Fix, or debug, flaky nested visualization filter test (#18957)
* Debug flaky test, or at least retry the spot that seems to be failing * Fix missing await, use queryBar service, use more detailed error message * update remaining references to dashboard.getQuery * getQueryString not getQuery
This commit is contained in:
parent
f579d2299f
commit
897f5f3f1a
|
@ -5,6 +5,7 @@ export default function ({ getService, getPageObjects }) {
|
||||||
const dashboardExpect = getService('dashboardExpect');
|
const dashboardExpect = getService('dashboardExpect');
|
||||||
const remote = getService('remote');
|
const remote = getService('remote');
|
||||||
const log = getService('log');
|
const log = getService('log');
|
||||||
|
const queryBar = getService('queryBar');
|
||||||
|
|
||||||
let kibanaBaseUrl;
|
let kibanaBaseUrl;
|
||||||
|
|
||||||
|
@ -44,7 +45,7 @@ export default function ({ getService, getPageObjects }) {
|
||||||
await remote.get(url, true);
|
await remote.get(url, true);
|
||||||
await PageObjects.header.waitUntilLoadingHasFinished();
|
await PageObjects.header.waitUntilLoadingHasFinished();
|
||||||
|
|
||||||
const query = await PageObjects.dashboard.getQuery();
|
const query = await queryBar.getQueryString();
|
||||||
expect(query).to.equal('memory:>220000');
|
expect(query).to.equal('memory:>220000');
|
||||||
|
|
||||||
await dashboardExpect.pieSliceCount(5);
|
await dashboardExpect.pieSliceCount(5);
|
||||||
|
@ -60,7 +61,7 @@ export default function ({ getService, getPageObjects }) {
|
||||||
await remote.get(url, true);
|
await remote.get(url, true);
|
||||||
await PageObjects.header.waitUntilLoadingHasFinished();
|
await PageObjects.header.waitUntilLoadingHasFinished();
|
||||||
|
|
||||||
const query = await PageObjects.dashboard.getQuery();
|
const query = await queryBar.getQueryString();
|
||||||
expect(query).to.equal('memory:>220000');
|
expect(query).to.equal('memory:>220000');
|
||||||
|
|
||||||
await dashboardExpect.pieSliceCount(5);
|
await dashboardExpect.pieSliceCount(5);
|
||||||
|
|
|
@ -6,6 +6,7 @@ import expect from 'expect.js';
|
||||||
*/
|
*/
|
||||||
export default function ({ getService, getPageObjects }) {
|
export default function ({ getService, getPageObjects }) {
|
||||||
const dashboardExpect = getService('dashboardExpect');
|
const dashboardExpect = getService('dashboardExpect');
|
||||||
|
const queryBar = getService('queryBar');
|
||||||
const dashboardAddPanel = getService('dashboardAddPanel');
|
const dashboardAddPanel = getService('dashboardAddPanel');
|
||||||
const testSubjects = getService('testSubjects');
|
const testSubjects = getService('testSubjects');
|
||||||
const filterBar = getService('filterBar');
|
const filterBar = getService('filterBar');
|
||||||
|
@ -153,8 +154,8 @@ export default function ({ getService, getPageObjects }) {
|
||||||
await dashboardExpect.pieSliceCount(5);
|
await dashboardExpect.pieSliceCount(5);
|
||||||
|
|
||||||
await PageObjects.dashboard.clickEditVisualization();
|
await PageObjects.dashboard.clickEditVisualization();
|
||||||
await PageObjects.dashboard.setQuery('weightLbs:>50');
|
await queryBar.setQuery('weightLbs:>50');
|
||||||
await PageObjects.dashboard.clickFilterButton();
|
await queryBar.submitQuery();
|
||||||
await PageObjects.header.waitUntilLoadingHasFinished();
|
await PageObjects.header.waitUntilLoadingHasFinished();
|
||||||
await PageObjects.dashboard.waitForRenderComplete();
|
await PageObjects.dashboard.waitForRenderComplete();
|
||||||
await dashboardExpect.pieSliceCount(3);
|
await dashboardExpect.pieSliceCount(3);
|
||||||
|
@ -186,9 +187,8 @@ export default function ({ getService, getPageObjects }) {
|
||||||
});
|
});
|
||||||
|
|
||||||
it('Pie chart linked to saved search filters shows no data with conflicting dashboard query', async () => {
|
it('Pie chart linked to saved search filters shows no data with conflicting dashboard query', async () => {
|
||||||
await PageObjects.dashboard.setQuery('weightLbs:<40');
|
await queryBar.setQuery('weightLbs:<40');
|
||||||
await PageObjects.dashboard.clickFilterButton();
|
await queryBar.submitQuery();
|
||||||
await PageObjects.header.waitUntilLoadingHasFinished();
|
|
||||||
await PageObjects.dashboard.waitForRenderComplete();
|
await PageObjects.dashboard.waitForRenderComplete();
|
||||||
|
|
||||||
await dashboardExpect.pieSliceCount(0);
|
await dashboardExpect.pieSliceCount(0);
|
||||||
|
|
|
@ -9,6 +9,7 @@ export default function ({ getService, getPageObjects }) {
|
||||||
const PageObjects = getPageObjects(['dashboard', 'visualize', 'header', 'discover']);
|
const PageObjects = getPageObjects(['dashboard', 'visualize', 'header', 'discover']);
|
||||||
const testSubjects = getService('testSubjects');
|
const testSubjects = getService('testSubjects');
|
||||||
const remote = getService('remote');
|
const remote = getService('remote');
|
||||||
|
const queryBar = getService('queryBar');
|
||||||
const retry = getService('retry');
|
const retry = getService('retry');
|
||||||
const dashboardAddPanel = getService('dashboardAddPanel');
|
const dashboardAddPanel = getService('dashboardAddPanel');
|
||||||
|
|
||||||
|
@ -146,14 +147,14 @@ export default function ({ getService, getPageObjects }) {
|
||||||
await PageObjects.dashboard.gotoDashboardLandingPage();
|
await PageObjects.dashboard.gotoDashboardLandingPage();
|
||||||
await PageObjects.dashboard.clickNewDashboard();
|
await PageObjects.dashboard.clickNewDashboard();
|
||||||
|
|
||||||
const currentQuery = await PageObjects.dashboard.getQuery();
|
const currentQuery = await queryBar.getQueryString();
|
||||||
expect(currentQuery).to.equal('');
|
expect(currentQuery).to.equal('');
|
||||||
const currentUrl = await remote.getCurrentUrl();
|
const currentUrl = await remote.getCurrentUrl();
|
||||||
const newUrl = currentUrl.replace('query:%27%27', 'query:%27hi%27');
|
const newUrl = currentUrl.replace('query:%27%27', 'query:%27hi%27');
|
||||||
// Don't add the timestamp to the url or it will cause a hard refresh and we want to test a
|
// Don't add the timestamp to the url or it will cause a hard refresh and we want to test a
|
||||||
// soft refresh.
|
// soft refresh.
|
||||||
await remote.get(newUrl.toString(), false);
|
await remote.get(newUrl.toString(), false);
|
||||||
const newQuery = await PageObjects.dashboard.getQuery();
|
const newQuery = await queryBar.getQueryString();
|
||||||
expect(newQuery).to.equal('hi');
|
expect(newQuery).to.equal('hi');
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
@ -5,6 +5,7 @@ export default function ({ getService, getPageObjects }) {
|
||||||
const kibanaServer = getService('kibanaServer');
|
const kibanaServer = getService('kibanaServer');
|
||||||
const retry = getService('retry');
|
const retry = getService('retry');
|
||||||
const remote = getService('remote');
|
const remote = getService('remote');
|
||||||
|
const queryBar = getService('queryBar');
|
||||||
const dashboardAddPanel = getService('dashboardAddPanel');
|
const dashboardAddPanel = getService('dashboardAddPanel');
|
||||||
const PageObjects = getPageObjects(['dashboard', 'header', 'common', 'visualize']);
|
const PageObjects = getPageObjects(['dashboard', 'header', 'common', 'visualize']);
|
||||||
const dashboardName = 'Dashboard View Edit Test';
|
const dashboardName = 'Dashboard View Edit Test';
|
||||||
|
@ -79,16 +80,16 @@ export default function ({ getService, getPageObjects }) {
|
||||||
});
|
});
|
||||||
|
|
||||||
it('when the query is edited and applied', async function () {
|
it('when the query is edited and applied', async function () {
|
||||||
const originalQuery = await PageObjects.dashboard.getQuery();
|
const originalQuery = await queryBar.getQueryString();
|
||||||
await PageObjects.dashboard.setQuery(`${originalQuery} and extra stuff`);
|
await queryBar.setQuery(`${originalQuery} and extra stuff`);
|
||||||
await PageObjects.dashboard.clickFilterButton();
|
await queryBar.submitQuery();
|
||||||
|
|
||||||
await PageObjects.dashboard.clickCancelOutOfEditMode();
|
await PageObjects.dashboard.clickCancelOutOfEditMode();
|
||||||
|
|
||||||
// confirm lose changes
|
// confirm lose changes
|
||||||
await PageObjects.common.clickConfirmOnModal();
|
await PageObjects.common.clickConfirmOnModal();
|
||||||
|
|
||||||
const query = await PageObjects.dashboard.getQuery();
|
const query = await queryBar.getQueryString();
|
||||||
expect(query).to.equal(originalQuery);
|
expect(query).to.equal(originalQuery);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -232,8 +233,8 @@ export default function ({ getService, getPageObjects }) {
|
||||||
it('when the query is edited but not applied', async function () {
|
it('when the query is edited but not applied', async function () {
|
||||||
await PageObjects.dashboard.gotoDashboardEditMode(dashboardName);
|
await PageObjects.dashboard.gotoDashboardEditMode(dashboardName);
|
||||||
|
|
||||||
const originalQuery = await PageObjects.dashboard.getQuery();
|
const originalQuery = await queryBar.getQueryString();
|
||||||
await PageObjects.dashboard.setQuery(`${originalQuery} extra stuff`);
|
await queryBar.setQuery(`${originalQuery} extra stuff`);
|
||||||
|
|
||||||
await PageObjects.dashboard.clickCancelOutOfEditMode();
|
await PageObjects.dashboard.clickCancelOutOfEditMode();
|
||||||
|
|
||||||
|
@ -241,7 +242,7 @@ export default function ({ getService, getPageObjects }) {
|
||||||
expect(isOpen).to.be(false);
|
expect(isOpen).to.be(false);
|
||||||
|
|
||||||
await PageObjects.dashboard.loadSavedDashboard(dashboardName);
|
await PageObjects.dashboard.loadSavedDashboard(dashboardName);
|
||||||
const query = await PageObjects.dashboard.getQuery();
|
const query = await queryBar.getQueryString();
|
||||||
expect(query).to.equal(originalQuery);
|
expect(query).to.equal(originalQuery);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
|
@ -139,27 +139,6 @@ export function DashboardPageProvider({ getService, getPageObjects }) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
async getQueryInputElement() {
|
|
||||||
return await testSubjects.find('queryInput');
|
|
||||||
}
|
|
||||||
|
|
||||||
async getQuery() {
|
|
||||||
log.debug(`getQuery`);
|
|
||||||
const queryInputElement = await this.getQueryInputElement();
|
|
||||||
return await queryInputElement.getProperty('value');
|
|
||||||
}
|
|
||||||
|
|
||||||
async setQuery(query) {
|
|
||||||
log.debug(`setQuery(${query})`);
|
|
||||||
return await testSubjects.setValue('queryInput', query);
|
|
||||||
}
|
|
||||||
|
|
||||||
async clickFilterButton() {
|
|
||||||
log.debug('Clicking filter button');
|
|
||||||
await testSubjects.click('querySubmitButton');
|
|
||||||
await PageObjects.header.waitUntilLoadingHasFinished();
|
|
||||||
}
|
|
||||||
|
|
||||||
async clickClone() {
|
async clickClone() {
|
||||||
log.debug('Clicking clone');
|
log.debug('Clicking clone');
|
||||||
await testSubjects.click('dashboardClone');
|
await testSubjects.click('dashboardClone');
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
|
|
||||||
export function DashboardVisualizationProvider({ getService, getPageObjects }) {
|
export function DashboardVisualizationProvider({ getService, getPageObjects }) {
|
||||||
const log = getService('log');
|
const log = getService('log');
|
||||||
|
const queryBar = getService('queryBar');
|
||||||
const testSubjects = getService('testSubjects');
|
const testSubjects = getService('testSubjects');
|
||||||
const dashboardAddPanel = getService('dashboardAddPanel');
|
const dashboardAddPanel = getService('dashboardAddPanel');
|
||||||
const PageObjects = getPageObjects(['dashboard', 'visualize', 'header', 'discover']);
|
const PageObjects = getPageObjects(['dashboard', 'visualize', 'header', 'discover']);
|
||||||
|
@ -25,8 +26,8 @@ export function DashboardVisualizationProvider({ getService, getPageObjects }) {
|
||||||
await PageObjects.dashboard.setTimepickerInDataRange();
|
await PageObjects.dashboard.setTimepickerInDataRange();
|
||||||
|
|
||||||
if (query) {
|
if (query) {
|
||||||
await PageObjects.dashboard.setQuery(query);
|
await queryBar.setQuery(query);
|
||||||
await PageObjects.dashboard.clickFilterButton();
|
await queryBar.submitQuery();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (fields) {
|
if (fields) {
|
||||||
|
|
|
@ -1,11 +1,32 @@
|
||||||
export function QueryBarProvider({ getService }) {
|
export function QueryBarProvider({ getService, getPageObjects }) {
|
||||||
const testSubjects = getService('testSubjects');
|
const testSubjects = getService('testSubjects');
|
||||||
|
const retry = getService('retry');
|
||||||
|
const log = getService('log');
|
||||||
|
const PageObjects = getPageObjects(['header']);
|
||||||
|
|
||||||
class QueryBar {
|
class QueryBar {
|
||||||
|
|
||||||
async getQueryString() {
|
async getQueryString() {
|
||||||
const queryInput = await testSubjects.find('queryInput');
|
return await testSubjects.getProperty('queryInput', 'value');
|
||||||
return await queryInput.getProperty('value');
|
}
|
||||||
|
|
||||||
|
async setQuery(query) {
|
||||||
|
log.debug(`QueryBar.setQuery(${query})`);
|
||||||
|
// Extra caution used because of flaky test here: https://github.com/elastic/kibana/issues/16978 doesn't seem
|
||||||
|
// to be actually setting the query in the query input based off
|
||||||
|
await retry.try(async () => {
|
||||||
|
await testSubjects.setValue('queryInput', query);
|
||||||
|
const currentQuery = await this.getQueryString();
|
||||||
|
if (currentQuery !== query) {
|
||||||
|
throw new Error(`Failed to set query input to ${query}, instead query is ${currentQuery}`);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
async submitQuery() {
|
||||||
|
log.debug('QueryBar.submitQuery');
|
||||||
|
await testSubjects.click('querySubmitButton');
|
||||||
|
await PageObjects.header.waitUntilLoadingHasFinished();
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue