Skip to content

Commit

Permalink
Merge branch '7.7' into backport/7.7/pr-62493
Browse files Browse the repository at this point in the history
  • Loading branch information
elasticmachine authored Apr 6, 2020
2 parents 76cba73 + b8a1c15 commit b948cfb
Show file tree
Hide file tree
Showing 4 changed files with 66 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@ function ContextAppRouteController($routeParams, $scope, $route) {
getFilters,
setFilters,
setAppState,
flushToUrl,
} = getState({
defaultStepSize: getServices().uiSettings.get('context:defaultSize'),
timeFieldName: indexPattern.timeFieldName,
Expand All @@ -99,6 +100,7 @@ function ContextAppRouteController($routeParams, $scope, $route) {
const [columns, predecessorCount, successorCount] = newValues;
if (Array.isArray(columns) && predecessorCount >= 0 && successorCount >= 0) {
setAppState({ columns, predecessorCount, successorCount });
flushToUrl(true);
}
}
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ interface GetStateReturn {
/**
* sync state to URL, used for testing
*/
flushToUrl: () => void;
flushToUrl: (replace?: boolean) => void;
}
const GLOBAL_STATE_URL_KEY = '_g';
const APP_STATE_URL_KEY = '_a';
Expand Down Expand Up @@ -205,7 +205,7 @@ export function getState({
}
},
// helper function just needed for testing
flushToUrl: () => stateStorage.flush(),
flushToUrl: (replace?: boolean) => stateStorage.flush({ replace }),
};
}

Expand Down
61 changes: 61 additions & 0 deletions test/functional/apps/context/_context_navigation.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
/*
* Licensed to Elasticsearch B.V. under one or more contributor
* license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright
* ownership. Elasticsearch B.V. licenses this file to you under
* the Apache License, Version 2.0 (the "License"); you may
* not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/

import expect from '@kbn/expect';

const TEST_COLUMN_NAMES = ['@message'];
const TEST_FILTER_COLUMN_NAMES = [
['extension', 'jpg'],
['geo.src', 'IN'],
];

export default function({ getService, getPageObjects }) {
const browser = getService('browser');
const docTable = getService('docTable');
const PageObjects = getPageObjects(['common', 'context', 'discover', 'timePicker']);

describe('context link in discover', function contextSize() {
before(async function() {
await PageObjects.common.navigateToApp('discover');
await PageObjects.timePicker.setDefaultAbsoluteRange();
await Promise.all(
TEST_COLUMN_NAMES.map(columnName => PageObjects.discover.clickFieldListItemAdd(columnName))
);
for (const [columnName, value] of TEST_FILTER_COLUMN_NAMES) {
await PageObjects.discover.clickFieldListItem(columnName);
await PageObjects.discover.clickFieldListPlusFilter(columnName, value);
}
});

it('should go back after loading', async function() {
// navigate to the context view
await docTable.clickRowToggle({ rowIndex: 0 });
await (await docTable.getRowActions({ rowIndex: 0 }))[0].click();
await PageObjects.context.waitUntilContextLoadingHasFinished();
await PageObjects.context.clickSuccessorLoadMoreButton();
await PageObjects.context.clickSuccessorLoadMoreButton();
await PageObjects.context.clickSuccessorLoadMoreButton();
await PageObjects.context.waitUntilContextLoadingHasFinished();
await browser.goBack();
await PageObjects.discover.waitForDocTableLoadingComplete();
const hitCount = await PageObjects.discover.getHitCount();
expect(hitCount).to.be('1,556');
});
});
}
1 change: 1 addition & 0 deletions test/functional/apps/context/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ export default function({ getService, getPageObjects, loadTestFile }) {
return esArchiver.unload('logstash_functional');
});

loadTestFile(require.resolve('./_context_navigation'));
loadTestFile(require.resolve('./_discover_navigation'));
loadTestFile(require.resolve('./_filters'));
loadTestFile(require.resolve('./_size'));
Expand Down

0 comments on commit b948cfb

Please sign in to comment.