mirror of
https://github.com/elastic/kibana.git
synced 2025-04-24 01:38:56 -04:00
This PR fixes timeout handling in `find.existsByDisplayedByCssSelector` for elements that are found but (not yet) displayed.
This commit is contained in:
parent
ac66b9024f
commit
d3347774ca
3 changed files with 21 additions and 7 deletions
|
@ -47,7 +47,6 @@ export default function ({ getService, getPageObjects, updateBaselines }) {
|
|||
await PageObjects.common.closeToast();
|
||||
|
||||
await PageObjects.dashboard.saveDashboard('tsvb');
|
||||
await PageObjects.common.closeToast();
|
||||
await PageObjects.dashboard.clickFullScreenMode();
|
||||
await dashboardPanelActions.openContextMenu();
|
||||
await dashboardPanelActions.clickExpandPanelToggle();
|
||||
|
@ -68,7 +67,6 @@ export default function ({ getService, getPageObjects, updateBaselines }) {
|
|||
await PageObjects.common.closeToast();
|
||||
|
||||
await PageObjects.dashboard.saveDashboard('area');
|
||||
await PageObjects.common.closeToast();
|
||||
await PageObjects.dashboard.clickFullScreenMode();
|
||||
await dashboardPanelActions.openContextMenu();
|
||||
await dashboardPanelActions.clickExpandPanelToggle();
|
||||
|
|
|
@ -309,7 +309,8 @@ export function DashboardPageProvider({ getService, getPageObjects }) {
|
|||
|
||||
/**
|
||||
* Save the current dashboard with the specified name and options and
|
||||
* verify that the save was successful
|
||||
* verify that the save was successful, close the toast and return the
|
||||
* toast message
|
||||
*
|
||||
* @param dashName {String}
|
||||
* @param saveOptions {{storeTimeWithDashboard: boolean, saveAsNew: boolean, needsConfirm: false, waitDialogIsClosed: boolean }}
|
||||
|
@ -323,8 +324,11 @@ export function DashboardPageProvider({ getService, getPageObjects }) {
|
|||
|
||||
// Confirm that the Dashboard has actually been saved
|
||||
await testSubjects.existOrFail('saveDashboardSuccess');
|
||||
const message = await PageObjects.common.closeToast();
|
||||
await PageObjects.header.waitUntilLoadingHasFinished();
|
||||
await this.waitForSaveModalToClose();
|
||||
|
||||
return message;
|
||||
}
|
||||
|
||||
async waitForSaveModalToClose() {
|
||||
|
|
|
@ -303,10 +303,22 @@ export async function FindProvider({ getService }: FtrProviderContext) {
|
|||
timeout: number = WAIT_FOR_EXISTS_TIME
|
||||
): Promise<boolean> {
|
||||
log.debug(`Find.existsByDisplayedByCssSelector('${selector}') with timeout=${timeout}`);
|
||||
return await this.exists(async drive => {
|
||||
const elements = wrapAll(await drive.findElements(By.css(selector)));
|
||||
return await this.filterElementIsDisplayed(elements);
|
||||
}, timeout);
|
||||
try {
|
||||
await retry.tryForTime(timeout, async () => {
|
||||
// make sure that the find timeout is not longer than the retry timeout
|
||||
await this._withTimeout(Math.min(timeout, WAIT_FOR_EXISTS_TIME));
|
||||
const elements = await driver.findElements(By.css(selector));
|
||||
await this._withTimeout(defaultFindTimeout);
|
||||
const displayed = await this.filterElementIsDisplayed(wrapAll(elements));
|
||||
if (displayed.length === 0) {
|
||||
throw new Error(`${selector} is not displayed`);
|
||||
}
|
||||
});
|
||||
} catch (err) {
|
||||
await this._withTimeout(defaultFindTimeout);
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
public async existsByCssSelector(
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue