From 972ab829b87413bffa19e1ee476ca380c7363f79 Mon Sep 17 00:00:00 2001 From: Adam Raine Date: Tue, 7 Jan 2025 11:16:01 -0500 Subject: [PATCH] [Lighthouse] Prevent flake when switching to Lighthouse tab in tests Bug: 388183157 Change-Id: I997a4c35821bbe003fffebee3774ad96909c7e6f Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/6147555 Commit-Queue: Connor Clark Reviewed-by: Connor Clark Auto-Submit: Adam Raine --- test/e2e/helpers/lighthouse-helpers.ts | 12 ++++++++++-- test/e2e/lighthouse/navigation_test.ts | 4 ++-- 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/test/e2e/helpers/lighthouse-helpers.ts b/test/e2e/helpers/lighthouse-helpers.ts index 80a5e0bc77d..9df182e5ba3 100644 --- a/test/e2e/helpers/lighthouse-helpers.ts +++ b/test/e2e/helpers/lighthouse-helpers.ts @@ -27,8 +27,16 @@ export async function navigateToLighthouseTab(path?: string): Promise .lighthouse'); + // TODO(b/388183157): Investigate why a single click doesn't open the tab properly sometimes + const interval = setInterval(() => { + void lighthouseTabButton.click(); + }, 500); + + try { + await waitFor('.view-container > .lighthouse'); + } finally { + clearInterval(interval); + } const {target, frontend} = getBrowserAndPages(); if (path) { diff --git a/test/e2e/lighthouse/navigation_test.ts b/test/e2e/lighthouse/navigation_test.ts index 1cd1c7fdb6f..c0fc91b6c4b 100644 --- a/test/e2e/lighthouse/navigation_test.ts +++ b/test/e2e/lighthouse/navigation_test.ts @@ -66,8 +66,8 @@ describe('Navigation', function() { console.error(consoleLog.join('\n')); } }); - // Flaky - it.skip('[crbug.com/388183157] successfully returns a Lighthouse report', async () => { + + it('successfully returns a Lighthouse report', async () => { await navigateToLighthouseTab('lighthouse/hello.html'); await registerServiceWorker();