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): support dbw smoke #14616

Merged
merged 1 commit into from
Dec 15, 2022
Merged

tests(devtools): support dbw smoke #14616

merged 1 commit into from
Dec 15, 2022

Conversation

adamraine
Copy link
Member

Would be nice to have DT smoke coverage of #14465. Turns out it was pretty easy to get dbw working in the DT smoke runner.

@adamraine adamraine requested a review from a team as a code owner December 15, 2022 18:45
@adamraine adamraine requested review from brendankenny and removed request for a team December 15, 2022 18:45
// 22 requests made for a single navigation.
// 6 extra requests made because stylesheets are evicted from the cache by the time DT opens.
length: 28,
},
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Member

@brendankenny brendankenny left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice! Did not remember dbw was in the exclusion list. We should look into those "need further investigation" ones at some point too.

@@ -315,10 +322,14 @@ async function testUrlFromDevtools(url, options = {}) {
const logs = [];
await installConsoleListener(inspectorSession, logs);

page.on('dialog', dismissDialog);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the need for this means

/**
* Dismiss JavaScript dialogs (alert, confirm, prompt), providing a
* generic promptText in case the dialog is a prompt.
* @param {LH.Gatherer.FRProtocolSession} session
* @return {Promise<void>}
*/
async function dismissJavaScriptDialogs(session) {
session.on('Page.javascriptDialogOpening', data => {
log.warn('Driver', `${data.type} dialog opened by the page automatically suppressed.`);
session
.sendCommand('Page.handleJavaScriptDialog', {
accept: true,
promptText: 'Lighthouse prompt response',
})
.catch(err => log.warn('Driver', err));
});
await session.sendCommand('Page.enable');
}
isn't working in DevTools? :/

Lots of previous history

I guess we should open an issue?

Copy link
Member Author

@adamraine adamraine Dec 15, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is working in DevTools. In the setup for the test however, the dialog prevents pptr-run-devtools.js from starting the Lighthouse run. This PR just dismissed the dialog in the initial test setup so we can actually start the test. The dialog dismiss listener is then removed before the test starts.

During the test, the page is reloaded so the dialog appears again. This time the code you linked is responsible for dismissing the dialog.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, I missed that this was running only before the test. Probably could use a comment but at least blame will find this :)

@adamraine adamraine merged commit cf286d9 into main Dec 15, 2022
@adamraine adamraine deleted the dt-support-dbw branch December 15, 2022 19:07
@adamraine adamraine mentioned this pull request Dec 20, 2022
3 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants