mirror of
https://github.com/elastic/kibana.git
synced 2025-04-24 17:59:23 -04:00
Backports the following commits to 6.x: - [ftr/confirmModal] assert expected state rather than just reading (#20019)
This commit is contained in:
parent
3f2b5d5518
commit
20a932e03e
3 changed files with 18 additions and 9 deletions
|
@ -67,8 +67,7 @@ export default function ({ getService, getPageObjects }) {
|
|||
|
||||
await PageObjects.common.pressEnterKey();
|
||||
|
||||
const isConfirmOpen = await PageObjects.common.isConfirmModalOpen();
|
||||
expect(isConfirmOpen).to.be(false);
|
||||
await PageObjects.common.expectConfirmModalOpenState(false);
|
||||
|
||||
const countOfDashboards = await PageObjects.dashboard.getDashboardCountWithName(dashboardName);
|
||||
expect(countOfDashboards).to.equal(1);
|
||||
|
|
|
@ -209,8 +209,7 @@ export default function ({ getService, getPageObjects }) {
|
|||
await PageObjects.header.setAbsoluteRange('2014-10-19 06:31:44.000', '2014-12-19 06:31:44.000');
|
||||
await PageObjects.dashboard.clickCancelOutOfEditMode();
|
||||
|
||||
const isOpen = await PageObjects.common.isConfirmModalOpen();
|
||||
expect(isOpen).to.be(false);
|
||||
await PageObjects.common.expectConfirmModalOpenState(false);
|
||||
});
|
||||
|
||||
// See https://github.com/elastic/kibana/issues/10110 - this is intentional.
|
||||
|
@ -222,8 +221,7 @@ export default function ({ getService, getPageObjects }) {
|
|||
|
||||
await PageObjects.dashboard.clickCancelOutOfEditMode();
|
||||
|
||||
const isOpen = await PageObjects.common.isConfirmModalOpen();
|
||||
expect(isOpen).to.be(false);
|
||||
await PageObjects.common.expectConfirmModalOpenState(false);
|
||||
|
||||
await PageObjects.dashboard.loadSavedDashboard(dashboardName);
|
||||
const query = await queryBar.getQueryString();
|
||||
|
|
|
@ -18,6 +18,7 @@
|
|||
*/
|
||||
|
||||
import { delay } from 'bluebird';
|
||||
import expect from 'expect.js';
|
||||
|
||||
import getUrl from '../../../src/test_utils/get_url';
|
||||
|
||||
|
@ -260,9 +261,20 @@ export function CommonPageProvider({ getService, getPageObjects }) {
|
|||
}
|
||||
}
|
||||
|
||||
async isConfirmModalOpen() {
|
||||
log.debug('isConfirmModalOpen');
|
||||
return await testSubjects.exists('confirmModalCancelButton', 2000);
|
||||
async expectConfirmModalOpenState(state) {
|
||||
if (typeof state !== 'boolean') {
|
||||
throw new Error('pass true or false to expectConfirmModalOpenState()');
|
||||
}
|
||||
|
||||
log.debug(`expectConfirmModalOpenState(${state})`);
|
||||
|
||||
// we use retry here instead of a simple .exists() check because the modal
|
||||
// fades in/out, which takes time, and we really only care that at some point
|
||||
// the modal is either open or closed
|
||||
await retry.try(async () => {
|
||||
const actualState = await testSubjects.exists('confirmModalCancelButton');
|
||||
expect(actualState).to.be(state);
|
||||
});
|
||||
}
|
||||
|
||||
async getBreadcrumbPageTitle() {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue