Skip to content

Commit

Permalink
[Lighthouse] Fix flaky start view tests
Browse files Browse the repository at this point in the history
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 <[email protected]>
Commit-Queue: Adam Raine <[email protected]>
  • Loading branch information
Adam Raine authored and Devtools-frontend LUCI CQ committed Jun 14, 2024
1 parent 4e2ef92 commit c6e33e6
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 32 deletions.
7 changes: 4 additions & 3 deletions test/e2e/helpers/lighthouse-helpers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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<HTMLElement>('.lighthouse-start-view devtools-button');
return button.evaluate(element => {
return element.hasAttribute('disabled');
});
}

export async function getHelpText() {
Expand Down
54 changes: 25 additions & 29 deletions test/e2e/lighthouse/start-view_test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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');

Expand All @@ -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();

Expand Down

0 comments on commit c6e33e6

Please sign in to comment.