-
Notifications
You must be signed in to change notification settings - Fork 27.1k
build: several minor fixes related to using puppeteer
#35381
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -35,10 +35,10 @@ module.exports = function (config) { | |
| ChromeHeadlessNoSandbox: { | ||
| base: 'ChromeHeadless', | ||
| // See /integration/README.md#browser-tests for more info on these args | ||
| flags: ['--no-sandbox', '--headless', '--disable-gpu', '--disable-dev-shm-usage', '--hide-scrollbars', '--mute-audio'] | ||
| } | ||
| flags: ['--no-sandbox', '--headless', '--disable-gpu', '--disable-dev-shm-usage', '--hide-scrollbars', '--mute-audio'], | ||
| }, | ||
| }, | ||
| browsers: [process.env['CI'] ? 'ChromeHeadlessNoSandbox' : 'Chrome'], | ||
| browsers: ['ChromeHeadlessNoSandbox'], | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. For local testing I suppose you're no relying on the browser popping up and if you need it you can always change this temporarily?
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yeah, exactly. I still needed to pass some flags for the |
||
| browserNoActivityTimeout: 60000, | ||
| singleRun: false, | ||
| restartOnFileChange: true, | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -27,10 +27,10 @@ | |
| */ | ||
|
|
||
| // Imports | ||
| const puppeteer = require('puppeteer'); | ||
| const lighthouse = require('lighthouse'); | ||
| const printer = require('lighthouse/lighthouse-cli/printer'); | ||
| const logger = require('lighthouse-logger'); | ||
| const puppeteer = require('puppeteer'); | ||
|
|
||
| // Constants | ||
| const AUDIT_CATEGORIES = ['accessibility', 'best-practices', 'performance', 'pwa', 'seo']; | ||
|
|
@@ -83,10 +83,8 @@ function formatScore(score) { | |
| } | ||
|
|
||
| async function launchChromeAndRunLighthouse(url, flags, config) { | ||
| const browser = await puppeteer.launch({ | ||
| headless: true, | ||
| args: ['--remote-debugging-port=9222']}); | ||
| flags.port = browser.port; | ||
| const browser = await puppeteer.launch(); | ||
| flags.port = (new URL(browser.wsEndpoint())).port; | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 😎 |
||
|
|
||
| try { | ||
| return await lighthouse(url, flags, config); | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,19 @@ | ||
| // @ts-check | ||
| // A protractor config to use to run the tests using the Chrome version provided by `puppeteer`. | ||
| // This is useful to ensure deterministic runs on CI and locally. This file is ignored when creating | ||
| // StackBlitz examples and ZIP archives for each example. | ||
|
|
||
| const {config} = require('./protractor.conf.js'); | ||
|
|
||
| exports.config = { | ||
| ...config, | ||
| capabilities: { | ||
| ...config.capabilities, | ||
| chromeOptions: { | ||
| ...config.capabilities.chromeOptions, | ||
| binary: require('puppeteer').executablePath(), | ||
| // See /integration/README.md#browser-tests for more info on these args | ||
| args: ['--no-sandbox', '--headless', '--disable-gpu', '--disable-dev-shm-usage', '--hide-scrollbars', '--mute-audio'], | ||
| }, | ||
| }, | ||
| }; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we still need this for one last test which is the integration/bazel-schematics. Once that is updated to puppeteer we can finally kill it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ahh. I see you hard-coded it there instead 👍 👍