Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

tests(devtools): sync e2e #14544

Merged
merged 1 commit into from
Nov 16, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 13 additions & 13 deletions third-party/devtools-tests/e2e/lighthouse/navigation_test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,21 +30,19 @@ describe('Navigation', async function() {
// The tests in this suite are particularly slow
this.timeout(60_000);

beforeEach(() => {
// https://bugs.chromium.org/p/chromium/issues/detail?id=1357791
expectError(/Protocol Error: the message with wrong session id/);
expectError(/Protocol Error: the message with wrong session id/);
expectError(/Protocol Error: the message with wrong session id/);
expectError(/Protocol Error: the message with wrong session id/);
expectError(/Protocol Error: the message with wrong session id/);
});

const modes = ['legacy', 'FR'];

for (const mode of modes) {
describe(`in ${mode} mode`, () => {
beforeEach(() => {
if (mode === 'FR') {
// https://bugs.chromium.org/p/chromium/issues/detail?id=1357791
expectError(/Protocol Error: the message with wrong session id/);
expectError(/Protocol Error: the message with wrong session id/);
expectError(/Protocol Error: the message with wrong session id/);
expectError(/Protocol Error: the message with wrong session id/);
expectError(/Protocol Error: the message with wrong session id/);
}
});

it('successfully returns a Lighthouse report', async () => {
await navigateToLighthouseTab('lighthouse/hello.html');
await registerServiceWorker();
Expand Down Expand Up @@ -139,7 +137,8 @@ describe('Navigation', async function() {
const waitForJson = await interceptNextFileSave();

// For some reason the CDP click command doesn't work here even if the tools menu is open.
await reportEl.$eval('a[data-action="save-json"]', saveJsonEl => (saveJsonEl as HTMLElement).click());
await reportEl.$eval(
'a[data-action="save-json"]:not(.hidden)', saveJsonEl => (saveJsonEl as HTMLElement).click());

const jsonContent = await waitForJson();
assert.strictEqual(jsonContent, JSON.stringify(lhr, null, 2));
Expand All @@ -150,7 +149,8 @@ describe('Navigation', async function() {
// TODO: Update the report generator usage once the changes land in DevTools.
//
// // For some reason the CDP click command doesn't work here even if the tools menu is open.
// await reportEl.$eval('a[data-action="save-html"]', saveHtmlEl => (saveHtmlEl as HTMLElement).click());
// await reportEl.$eval(
// 'a[data-action="save-html"]:not(.hidden)', saveHtmlEl => (saveHtmlEl as HTMLElement).click());

// const htmlContent = await waitForHtml();
// const iframeHandle = await renderHtmlInIframe(htmlContent);
Expand Down