Skip to content

Commit

Permalink
tests(devtools): sync e2e (#14995)
Browse files Browse the repository at this point in the history
  • Loading branch information
adamraine authored Apr 19, 2023
1 parent 326834a commit 4459f49
Show file tree
Hide file tree
Showing 2 changed files with 41 additions and 42 deletions.
79 changes: 40 additions & 39 deletions third-party/devtools-tests/e2e/lighthouse/navigation_test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -199,45 +199,46 @@ describe.skipOnParallel('Navigation', async function() {
assert.strictEqual(await getServiceWorkerCount(), 0);
});

// [crbug.com/1427407] Flaky in legacy mode
if (mode !== 'legacy') {
it('successfully returns a Lighthouse report with DevTools throttling', async () => {
await navigateToLighthouseTab('lighthouse/hello.html');

await setThrottlingMethod('devtools');
await setLegacyNavigation(mode === 'legacy');

await clickStartButton();

const {lhr, reportEl} = await waitForResult();

assert.strictEqual(lhr.configSettings.throttlingMethod, 'devtools');

// [crbug.com/1347220] DevTools throttling can force resources to load slow enough for these audits to fail sometimes.
const flakyAudits = [
'server-response-time',
'render-blocking-resources',
];

const {auditResults, erroredAudits, failedAudits} = getAuditsBreakdown(lhr, flakyAudits);
assert.strictEqual(auditResults.length, 150);
assert.deepStrictEqual(erroredAudits, []);
assert.deepStrictEqual(failedAudits.map(audit => audit.id), [
'service-worker',
'installable-manifest',
'splash-screen',
'themed-omnibox',
'maskable-icon',
'document-title',
'html-has-lang',
'meta-description',
'bf-cache',
]);

const viewTraceButton = await $textContent('View Trace', reportEl);
assert.ok(viewTraceButton);
});
}
it('successfully returns a Lighthouse report with DevTools throttling', async () => {
// [crbug.com/1427407] Flaky in legacy mode
if (mode === 'legacy') {
return;
}
await navigateToLighthouseTab('lighthouse/hello.html');

await setThrottlingMethod('devtools');
await setLegacyNavigation(mode === 'legacy');

await clickStartButton();

const {lhr, reportEl} = await waitForResult();

assert.strictEqual(lhr.configSettings.throttlingMethod, 'devtools');

// [crbug.com/1347220] DevTools throttling can force resources to load slow enough for these audits to fail sometimes.
const flakyAudits = [
'server-response-time',
'render-blocking-resources',
];

const {auditResults, erroredAudits, failedAudits} = getAuditsBreakdown(lhr, flakyAudits);
assert.strictEqual(auditResults.length, 150);
assert.deepStrictEqual(erroredAudits, []);
assert.deepStrictEqual(failedAudits.map(audit => audit.id), [
'service-worker',
'installable-manifest',
'splash-screen',
'themed-omnibox',
'maskable-icon',
'document-title',
'html-has-lang',
'meta-description',
'bf-cache',
]);

const viewTraceButton = await $textContent('View Trace', reportEl);
assert.ok(viewTraceButton);
});

it('successfully returns a Lighthouse report when settings changed', async () => {
await setDevToolsSettings({language: 'es'});
Expand Down
4 changes: 1 addition & 3 deletions third-party/devtools-tests/e2e/lighthouse/start-view_test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -54,9 +54,7 @@ describe.skipOnParallel('The Lighthouse start view', async () => {
const disabled = await isGenerateReportButtonDisabled();
const helpText = await getHelpText();
assert.isTrue(disabled, 'The Generate Report button should be disabled');
assert.strictEqual(
helpText,
'Can only audit HTTP/HTTPS pages and Chrome extensions. Navigate to a different page to start an audit.');
assert.strictEqual(helpText, 'Can only audit pages on HTTP or HTTPS. Navigate to a different page.');
});

// Broken on non-debug runs
Expand Down

0 comments on commit 4459f49

Please sign in to comment.