Skip to content

Commit f02c6b3

Browse files
authoredFeb 22, 2022
tests(devtools): update Lighthouse sniffer for smokes (#13693)
1 parent 1b4748a commit f02c6b3

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed
 

‎lighthouse-core/scripts/pptr-run-devtools.js

+9-2
Original file line numberDiff line numberDiff line change
@@ -104,9 +104,12 @@ const sniffLighthouseStarted = `
104104
new Promise(resolve => {
105105
const panel = UI.panels.lighthouse || UI.panels.audits;
106106
const protocolService = panel.protocolService || panel._protocolService;
107+
const functionName = protocolService.__proto__.startLighthouse ?
108+
'startLighthouse' :
109+
'collectLighthouseResults';
107110
(${addSniffer.toString()})(
108111
protocolService.__proto__,
109-
'startLighthouse',
112+
functionName,
110113
(inspectedURL) => resolve(inspectedURL)
111114
);
112115
});
@@ -237,9 +240,13 @@ async function testPage(page, browser, url, config) {
237240
returnByValue: true,
238241
}).catch(err => err);
239242
// Verify the first parameter to `startLighthouse`, which should be a url.
243+
// In M100 the LHR is returned on `collectLighthouseResults` which has just 1 options parameter containing `inspectedUrl`.
240244
// Don't try to check the exact value (because of redirects and such), just
241245
// make sure it exists.
242-
if (!isValidUrl(lhStartedResponse.result.value)) {
246+
if (
247+
!isValidUrl(lhStartedResponse.result.value) &&
248+
!isValidUrl(lhStartedResponse.result.value.inspectedURL)
249+
) {
243250
throw new Error(`Lighthouse did not start correctly. Got unexpected value for url: ${
244251
JSON.stringify(lhStartedResponse.result.value)}`);
245252
}

0 commit comments

Comments
 (0)
Please sign in to comment.