[CI] Various lens test/combobox speedups (#130934) (#130989)

(cherry picked from commit 799ec1b2d4)

Co-authored-by: Brian Seeders <brian.seeders@elastic.co>
This commit is contained in:
Kibana Machine 2022-04-26 11:37:05 -05:00 committed by GitHub
parent 49feef2ea6
commit ae7f6f7188
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 26 additions and 15 deletions

View file

@ -157,7 +157,7 @@ export class ComboBoxService extends FtrService {
* @param comboBoxElement element that wraps up EuiComboBox
*/
private async waitForOptionsListLoading(comboBoxElement: WebElementWrapper): Promise<void> {
await comboBoxElement.waitForDeletedByCssSelector('.euiLoadingSpinner');
await comboBoxElement.waitForDeletedByCssSelector('.euiLoadingSpinner', 50);
}
/**
@ -255,7 +255,9 @@ export class ComboBoxService extends FtrService {
* @param comboBoxElement element that wraps up EuiComboBox
*/
public async closeOptionsList(comboBoxElement: WebElementWrapper): Promise<void> {
const isOptionsListOpen = await this.testSubjects.exists('~comboBoxOptionsList');
const isOptionsListOpen = await this.testSubjects.exists('~comboBoxOptionsList', {
timeout: 50,
});
if (isOptionsListOpen) {
const input = await comboBoxElement.findByTagName('input');
await input.pressKeys(this.browser.keys.ESCAPE);
@ -268,7 +270,10 @@ export class ComboBoxService extends FtrService {
* @param comboBoxElement element that wraps up EuiComboBox
*/
public async openOptionsList(comboBoxElement: WebElementWrapper): Promise<void> {
const isOptionsListOpen = await this.testSubjects.exists('~comboBoxOptionsList');
const isOptionsListOpen = await this.testSubjects.exists('~comboBoxOptionsList', {
timeout: 50,
});
if (!isOptionsListOpen) {
await this.retry.try(async () => {
const toggleBtn = await comboBoxElement.findByTestSubject('comboBoxInput');

View file

@ -686,17 +686,23 @@ export class WebElementWrapper {
* @param {string} className
* @return {Promise<void>}
*/
public async waitForDeletedByCssSelector(selector: string): Promise<void> {
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.timeout,
`The element with ${selector} selector was still present after ${this.timeout} sec.`
);
await this.driver.manage().setTimeouts({ implicit: this.timeout });
public async waitForDeletedByCssSelector(
selector: string,
implicitTimeout = 1000
): Promise<void> {
try {
await this.driver.manage().setTimeouts({ implicit: implicitTimeout });
await this.driver.wait(
async () => {
const found = await this._webElement.findElements(this.By.css(selector));
return found.length === 0;
},
this.timeout,
`The element with ${selector} selector was still present after ${this.timeout} sec.`
);
} finally {
await this.driver.manage().setTimeouts({ implicit: this.timeout });
}
}
/**

View file

@ -737,7 +737,7 @@ export function LensPageProvider({ getService, getPageObjects }: FtrProviderCont
},
async openChartSwitchPopover() {
if (await testSubjects.exists('lnsChartSwitchList')) {
if (await testSubjects.exists('lnsChartSwitchList', { timeout: 50 })) {
return;
}
await retry.try(async () => {