[6.x] Fix broken linked save searches (#19722) | Skip flaky navigational test (#19751) (#19753)

* Fix broken linked save searches (#19722)

* Fix bug

* Retry navigation

* Skip flaky navigational test (#19751)
This commit is contained in:
Tim Roes 2018-06-08 14:19:06 +02:00 committed by GitHub
parent 77608f79b3
commit ac19ac96fc
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 73 additions and 1 deletions

View file

@ -71,7 +71,7 @@ const CourierRequestHandlerProvider = function (Private, courier, timefilter) {
// Add the explicit passed timeRange as a filter to the requestSearchSource.
requestSearchSource.filter(() => {
return timefilter.get(searchSource.index(), timeRange);
return timefilter.get(searchSource.get('index'), timeRange);
});
removeSearchSourceParentTimefilter(requestSearchSource);

View file

@ -0,0 +1,66 @@
/*
* 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 'expect.js';
export default function ({ getPageObjects, getService }) {
const retry = getService('retry');
const PageObjects = getPageObjects(['common', 'discover', 'visualize', 'header']);
// Blocked by: https://github.com/elastic/kibana/issues/19750
describe.skip('visualize app', function describeIndexTests() {
const fromTime = '2015-09-19 06:31:44.000';
const toTime = '2015-09-23 18:31:44.000';
describe('linked saved searched', () => {
const savedSearchName = 'vis_saved_search';
before(async () => {
await PageObjects.common.navigateToUrl('discover', '');
await PageObjects.discover.saveSearch(savedSearchName);
});
it('should create a visualization from a saved search', async () => {
retry.try(async () => {
// Sometimes navigation to the page fails, so we have this in a retry
await PageObjects.common.navigateToUrl('visualize', 'new');
await PageObjects.visualize.waitForVisualizationSelectPage();
});
await PageObjects.visualize.clickDataTable();
await PageObjects.visualize.clickSavedSearch(savedSearchName);
await PageObjects.header.setAbsoluteRange(fromTime, toTime);
await PageObjects.header.waitUntilLoadingHasFinished();
const data = await PageObjects.visualize.getDataTableData();
expect(data.trim()).to.be('14,004');
});
it('should respect the time filter when linked to a saved search', async () => {
await PageObjects.header.setAbsoluteRange('2015-09-19 06:31:44.000', '2015-09-21 10:00:00.000');
await PageObjects.header.waitUntilLoadingHasFinished();
const data = await PageObjects.visualize.getDataTableData();
expect(data.trim()).to.be('6,086');
});
});
after(async () => {
await PageObjects.header.setAbsoluteRange(fromTime, toTime);
});
});
}

View file

@ -53,5 +53,6 @@ export default function ({ getService, loadTestFile }) {
loadTestFile(require.resolve('./_histogram_request_start'));
loadTestFile(require.resolve('./_vega_chart'));
loadTestFile(require.resolve('./_lab_mode'));
loadTestFile(require.resolve('./_linked_saved_searches.js'));
});
}

View file

@ -375,6 +375,11 @@ export function VisualizePageProvider({ getService, getPageObjects }) {
await PageObjects.header.waitUntilLoadingHasFinished();
}
async clickSavedSearch(savedSearchName) {
await find.clickByPartialLinkText(savedSearchName);
await PageObjects.header.waitUntilLoadingHasFinished();
}
async setValue(newValue) {
await find.clickByCssSelector('button[ng-click="numberListCntr.add()"]', defaultFindTimeout * 2);
const input = await find.byCssSelector('input[ng-model="numberListCntr.getList()[$index]"]');