FTR: fix 10 sec timeout in waitForDeleted (#33313)
* use css selector instead of className, set implicit wait to 0
* set implicitWait to 2 sec
* set default implicitWait to WAIT_FOR_EXISTS_TIME
* set timeout to 1 sec, retry for query bar test
* sleep 5 sec waiting zoom is finished
* sleep is the only way to wait
* run x-pack-ciGroup3 20x times
* Revert "run x-pack-ciGroup3 20x times"
This reverts commit 55482de330
.
This commit is contained in:
parent
20bdf7d4a9
commit
8b0d1206a8
6 changed files with 17 additions and 15 deletions
|
@ -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');
|
||||
});
|
||||
}
|
||||
|
||||
|
|
|
@ -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() {
|
||||
|
|
|
@ -56,7 +56,7 @@ export function ComboBoxProvider({ getService }) {
|
|||
}
|
||||
|
||||
async _waitForOptionsListLoading(comboBoxElement) {
|
||||
await comboBoxElement.waitForDeletedByClassName('euiLoadingSpinner');
|
||||
await comboBoxElement.waitForDeletedByCssSelector('.euiLoadingSpinner');
|
||||
}
|
||||
|
||||
async getOptionsList(comboBoxSelector) {
|
||||
|
|
|
@ -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) {
|
||||
|
|
|
@ -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 });
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -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');
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -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() {
|
||||
|
|
Loading…
Reference in a new issue