From c6e33e6c8d53d3e1f26f6a26e0e558574c446f3c Mon Sep 17 00:00:00 2001 From: Adam Raine Date: Thu, 13 Jun 2024 18:27:45 -0700 Subject: [PATCH] [Lighthouse] Fix flaky start view tests Also disables another test that is failing locally for what appears to be an unrelated reason. Bug: 338885778, 40282411 Change-Id: I721916bc6401f6979074d630eb8e5d048d341a5b Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/5632177 Reviewed-by: Changhao Han Commit-Queue: Adam Raine --- test/e2e/helpers/lighthouse-helpers.ts | 7 ++-- test/e2e/lighthouse/start-view_test.ts | 54 ++++++++++++-------------- 2 files changed, 29 insertions(+), 32 deletions(-) diff --git a/test/e2e/helpers/lighthouse-helpers.ts b/test/e2e/helpers/lighthouse-helpers.ts index 7374406df0d..9f562dc0283 100644 --- a/test/e2e/helpers/lighthouse-helpers.ts +++ b/test/e2e/helpers/lighthouse-helpers.ts @@ -138,9 +138,10 @@ export async function clickStartButton() { } export async function isGenerateReportButtonDisabled() { - const buttonWrapper = await waitFor('.lighthouse-start-view devtools-button'); - const button = await buttonWrapper.waitForSelector('>>> button'); - return button!.evaluate(element => (element as HTMLButtonElement).disabled); + const button = await waitFor('.lighthouse-start-view devtools-button'); + return button.evaluate(element => { + return element.hasAttribute('disabled'); + }); } export async function getHelpText() { diff --git a/test/e2e/lighthouse/start-view_test.ts b/test/e2e/lighthouse/start-view_test.ts index d06eb0c7a95..fc73aaa0add 100644 --- a/test/e2e/lighthouse/start-view_test.ts +++ b/test/e2e/lighthouse/start-view_test.ts @@ -25,34 +25,29 @@ describe('The Lighthouse start view', () => { assert.strictEqual(helpText, ''); }); - // Flaky test. - it.skipOnPlatforms( - ['mac', 'linux'], '[crbug.com/338885778] disables the start button when no categories are selected', async () => { - await navigateToLighthouseTab('empty.html'); - - await selectCategories([]); - - const disabled = await isGenerateReportButtonDisabled(); - const helpText = await getHelpText(); - assert.isTrue(disabled, 'The Generate Report button should be disabled'); - assert.strictEqual(helpText, 'At least one category must be selected.'); - }); - - // Flaky test. - it.skipOnPlatforms( - ['mac', 'linux'], '[crbug.com/338885778] enables the start button if only one category is selected', async () => { - await navigateToLighthouseTab('empty.html'); - - await selectCategories(['performance']); - - const disabled = await isGenerateReportButtonDisabled(); - const helpText = await getHelpText(); - assert.isFalse(disabled, 'The Generate Report button should be enabled'); - assert.strictEqual(helpText, ''); - }); - - // Flaky test. - it.skipOnPlatforms(['mac'], '[crbug.com/1484942]: disables the start button for internal pages', async () => { + it('disables the start button when no categories are selected', async () => { + await navigateToLighthouseTab('empty.html'); + + await selectCategories([]); + + const disabled = await isGenerateReportButtonDisabled(); + const helpText = await getHelpText(); + assert.isTrue(disabled, 'The Generate Report button should be disabled'); + assert.strictEqual(helpText, 'At least one category must be selected.'); + }); + + it('enables the start button if only one category is selected', async () => { + await navigateToLighthouseTab('empty.html'); + + await selectCategories(['performance']); + + const disabled = await isGenerateReportButtonDisabled(); + const helpText = await getHelpText(); + assert.isFalse(disabled, 'The Generate Report button should be enabled'); + assert.strictEqual(helpText, ''); + }); + + it('disables the start button for internal pages', async () => { await navigateToLighthouseTab(); await goTo('about:blank'); @@ -71,7 +66,8 @@ describe('The Lighthouse start view', () => { assert.isTrue(disabled, 'The Generate Report button should be disabled'); }); - it('displays warning if important data may affect performance', async () => { + // Broken in local builds and stressor jobs + it.skip('[crbug.com/347114248] displays warning if important data may affect performance', async () => { // e2e tests in application/ create indexeddb items and don't clean up after themselves await clearSiteData();