Skip to content

Commit

Permalink
[Lighthouse] Prevent flake when switching to Lighthouse tab in tests
Browse files Browse the repository at this point in the history
Bug: 388183157
Change-Id: I997a4c35821bbe003fffebee3774ad96909c7e6f
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/6147555
Commit-Queue: Connor Clark <[email protected]>
Reviewed-by: Connor Clark <[email protected]>
Auto-Submit: Adam Raine <[email protected]>
  • Loading branch information
Adam Raine authored and Devtools-frontend LUCI CQ committed Jan 7, 2025
1 parent 3f3b139 commit 972ab82
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 4 deletions.
12 changes: 10 additions & 2 deletions test/e2e/helpers/lighthouse-helpers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,16 @@ export async function navigateToLighthouseTab(path?: string): Promise<ElementHan
lighthouseTabButton = await waitForElementWithTextContent('Lighthouse');
}

await lighthouseTabButton.click();
await waitFor('.view-container > .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) {
Expand Down
4 changes: 2 additions & 2 deletions test/e2e/lighthouse/navigation_test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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();

Expand Down

0 comments on commit 972ab82

Please sign in to comment.