Skip to content

Commit

Permalink
Fix "visualize app linked saved searched should allow adding filters …
Browse files Browse the repository at this point in the history
…while having a linked saved search" (#22380)

* Rebuild modulePath correctly if on Windows

* Adding 1 second sleep to fix flaky test

* Wait to find a gear in the visualization after clicking Edit

* Revert "Wait to find a gear in the visualization after clicking Edit"

This reverts commit 8dac3fb.

* use waitForRenderComplete and change that to 1s timeout

* Add retry.waitFor

* use waitFor and return === result

* Revert to files from another PR

* Remove a debug console.log
  • Loading branch information
Lee Drengenberg authored Aug 27, 2018
1 parent 4653c7f commit 336be32
Showing 1 changed file with 25 additions and 12 deletions.
37 changes: 25 additions & 12 deletions test/functional/apps/visualize/_linked_saved_searches.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ import expect from 'expect.js';

export default function ({ getService, getPageObjects }) {
const filterBar = getService('filterBar');
const retry = getService('retry');
const PageObjects = getPageObjects(['common', 'discover', 'visualize', 'header']);

describe('visualize app', function describeIndexTests() {
Expand All @@ -46,44 +47,56 @@ export default function ({ getService, getPageObjects }) {
await PageObjects.visualize.clickSavedSearch(savedSearchName);
await PageObjects.header.setAbsoluteRange(fromTime, toTime);
await PageObjects.header.waitUntilLoadingHasFinished();
const data = await PageObjects.visualize.getTableVisData();
expect(data.trim()).to.be('9,109');
await retry.waitFor('wait for count to equal 9,109', async () => {
const data = await PageObjects.visualize.getTableVisData();
return data.trim() === '9,109';
});
});

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.getTableVisData();
expect(data.trim()).to.be('3,950');
await retry.waitFor('wait for count to equal 3,950', async () => {
const data = await PageObjects.visualize.getTableVisData();
return data.trim() === '3,950';
});
});

it('should allow adding filters while having a linked saved search', async () => {
await filterBar.addFilter('bytes', 'is between', '100', '3000');
await PageObjects.header.waitUntilLoadingHasFinished();
const data = await PageObjects.visualize.getTableVisData();
expect(data.trim()).to.be('707');
await retry.waitFor('wait for count to equal 707', async () => {
const data = await PageObjects.visualize.getTableVisData();
return data.trim() === '707';
});
});

it('should allow unlinking from a linked search', async () => {
await PageObjects.visualize.clickUnlinkSavedSearch();
const data = await PageObjects.visualize.getTableVisData();
expect(data.trim()).to.be('707');
await retry.waitFor('wait for count to equal 707', async () => {
const data = await PageObjects.visualize.getTableVisData();
return data.trim() === '707';
});
// The filter on the saved search should now be in the editor
expect(await filterBar.hasFilter('extension.raw', 'jpg')).to.be(true);

// Disabling this filter should now result in different values, since
// the visualization should not be linked anymore with the saved search.
await filterBar.toggleFilterEnabled('extension.raw');
await PageObjects.header.waitUntilLoadingHasFinished();
const unfilteredData = await PageObjects.visualize.getTableVisData();
expect(unfilteredData.trim()).to.be('1,293');
await retry.waitFor('wait for count to equal 1,293', async () => {
const unfilteredData = await PageObjects.visualize.getTableVisData();
return unfilteredData.trim() === '1,293';
});
});

it('should not break when saving after unlinking', async () => {
await PageObjects.visualize.saveVisualization('Unlinked before saved');
await PageObjects.header.waitUntilLoadingHasFinished();
const data = await PageObjects.visualize.getTableVisData();
expect(data.trim()).to.be('1,293');
await retry.waitFor('wait for count to equal 1,293', async () => {
const data = await PageObjects.visualize.getTableVisData();
return data.trim() === '1,293';
});
});
});
});
Expand Down

0 comments on commit 336be32

Please sign in to comment.