Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FTR: fix 10 sec timeout in waitForDeleted #33313

Merged
4 changes: 2 additions & 2 deletions test/functional/page_objects/home_page.js
Original file line number Diff line number Diff line change
Expand Up @@ -60,9 +60,9 @@ export function HomePageProvider({ getService }) {
async _waitForSampleDataLoadingAction(id) {
const sampleDataCard = await testSubjects.find(`sampleDataSetCard${id}`);
await retry.try(async () => {
// waitForDeletedByClassName needs to be inside retry because it will timeout at least once
// waitForDeletedByCssSelector needs to be inside retry because it will timeout at least once
// before action is complete
await sampleDataCard.waitForDeletedByClassName('euiLoadingSpinner');
await sampleDataCard.waitForDeletedByCssSelector('.euiLoadingSpinner');
});
}

Expand Down
2 changes: 1 addition & 1 deletion test/functional/page_objects/share_page.js
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ export function SharePageProvider({ getService, getPageObjects }) {
async checkShortenUrl() {
const shareForm = await testSubjects.find('shareUrlForm');
await PageObjects.visualize.checkCheckbox('useShortUrl');
await shareForm.waitForDeletedByClassName('euiLoadingSpinner');
await shareForm.waitForDeletedByCssSelector('.euiLoadingSpinner');
}

async exportAsSavedObject() {
Expand Down
2 changes: 1 addition & 1 deletion test/functional/services/combo_box.js
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ export function ComboBoxProvider({ getService }) {
}

async _waitForOptionsListLoading(comboBoxElement) {
await comboBoxElement.waitForDeletedByClassName('euiLoadingSpinner');
await comboBoxElement.waitForDeletedByCssSelector('.euiLoadingSpinner');
}

async getOptionsList(comboBoxSelector) {
Expand Down
2 changes: 2 additions & 0 deletions test/functional/services/find.js
Original file line number Diff line number Diff line change
Expand Up @@ -309,12 +309,14 @@ export async function FindProvider({ getService }) {
}
async waitForDeletedByCssSelector(selector, timeout = defaultFindTimeout) {
log.debug(`Find.waitForDeletedByCssSelector('${selector}') with timeout=${timeout}`);
await this._withTimeout(1000);
await driver.wait(async () => {
const found = await driver.findElements(By.css(selector));
return found.length === 0;
},
timeout,
`The element ${selector} was still present when it should have disappeared.`);
await this._withTimeout(defaultFindTimeout);
}

async waitForAttributeToChange(selector, attribute, value) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -389,22 +389,20 @@ export class WebElementWrapper {
}

/**
* Waits for all elements inside this element matching the given CSS class name to be destroyed.
* Waits for all elements inside this element matching the given CSS selector to be destroyed.
*
* @param {string} className
* @return {Promise<void>}
*/
async waitForDeletedByClassName(className) {
await this._driver.wait(() => {
return this._webElement.findElements(this._By.className(className)).then((children) => {
if (children.length <= 0) {
return true;
}
return false;
});
async waitForDeletedByCssSelector(selector) {
await this._driver.manage().setTimeouts({ implicit: 1000 });
await this._driver.wait(async () => {
const found = await this._webElement.findElements(this._By.css(selector));
return found.length === 0;
},
this._defaultFindTimeout,
`The element with ${className} className was still present when it should have disappeared.`);
`The element with ${selector} selector was still present after ${this._defaultFindTimeout} sec.`);
await this._driver.manage().setTimeouts({ implicit: this._defaultFindTimeout });
}

/**
Expand Down
4 changes: 3 additions & 1 deletion x-pack/test/functional/page_objects/gis_page.js
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ export function GisPageProvider({ getService, getPageObjects }) {
log.debug('Wait for layers to load');
const tableOfContents = await testSubjects.find('mapLayerTOC');
await retry.try(async () => {
await tableOfContents.waitForDeletedByClassName('euiLoadingSpinner');
await tableOfContents.waitForDeletedByCssSelector('.euiLoadingSpinner');
});
}

Expand Down Expand Up @@ -170,6 +170,8 @@ export function GisPageProvider({ getService, getPageObjects }) {
await testSubjects.setValue('zoomInput', zoom.toString());
await testSubjects.click('submitViewButton');
await this.waitForLayersToLoad();
// there is no way to wait for canvas been reloaded
await PageObjects.common.sleep(5000);
}

async getView() {
Expand Down