From 49193231aa186bce67aa6e773f1d36e9ef26eb4a Mon Sep 17 00:00:00 2001 From: Riken Shah Date: Sat, 17 Jul 2021 09:30:54 +0000 Subject: [PATCH] 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. --- frontend_tests/puppeteer_lib/common.ts | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/frontend_tests/puppeteer_lib/common.ts b/frontend_tests/puppeteer_lib/common.ts index 6f256aa0df..7a54406ba7 100644 --- a/frontend_tests/puppeteer_lib/common.ts +++ b/frontend_tests/puppeteer_lib/common.ts @@ -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 {