mirror of
https://github.com/elastic/kibana.git
synced 2025-04-23 17:28:26 -04:00
* replace state for load more documents * simpler solution * simpler solution + functional test * fix test * disable flaky test
This commit is contained in:
parent
423d18cbd9
commit
b8a1c15e40
4 changed files with 66 additions and 2 deletions
|
@ -76,6 +76,7 @@ function ContextAppRouteController($routeParams, $scope, $route) {
|
|||
getFilters,
|
||||
setFilters,
|
||||
setAppState,
|
||||
flushToUrl,
|
||||
} = getState({
|
||||
defaultStepSize: getServices().uiSettings.get('context:defaultSize'),
|
||||
timeFieldName: indexPattern.timeFieldName,
|
||||
|
@ -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);
|
||||
}
|
||||
}
|
||||
);
|
||||
|
|
|
@ -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';
|
||||
|
@ -205,7 +205,7 @@ export function getState({
|
|||
}
|
||||
},
|
||||
// helper function just needed for testing
|
||||
flushToUrl: () => stateStorage.flush(),
|
||||
flushToUrl: (replace?: boolean) => stateStorage.flush({ replace }),
|
||||
};
|
||||
}
|
||||
|
||||
|
|
61
test/functional/apps/context/_context_navigation.js
Normal file
61
test/functional/apps/context/_context_navigation.js
Normal file
|
@ -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');
|
||||
});
|
||||
});
|
||||
}
|
|
@ -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'));
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue