puppeteer_test: Improve how we select the typeahead element.

Our typeahead system is very sensitive, a simple internal
focus can hide it. This leads to occasional failure on the
puppeteer test.

This commit tries to solve it by clicking via javascript
instead of manual puppeteer click.
This commit is contained in:
Riken Shah 2021-07-17 09:30:54 +00:00 committed by Tim Abbott
parent 6c6b6643ce
commit 49193231aa
1 changed files with 4 additions and 1 deletions

View File

@ -482,8 +482,11 @@ class CommonUtils {
await this.clear_and_type(page, field_selector, str);
const entry = await page.waitForXPath(
`//*[@class="typeahead dropdown-menu" and contains(@style, "display: block")]//li[contains(normalize-space(), "${item}")]//a`,
{visible: true},
);
await entry!.click();
await page.evaluate((entry) => {
entry.click();
}, entry);
}
async wait_for_modal_to_close(page: Page): Promise<void> {