-
Notifications
You must be signed in to change notification settings - Fork 4.3k
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
Scripts: Enable skipping Playwright browser installation #56594
Conversation
Size Change: +55 B (0%) Total Size: 1.7 MB
ℹ️ View Unchanged
|
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.
The changes test well for me locally ✅
The only possible issue is that this could be considered a breaking change. Any GitHub action relying on previous behavior will have to make a change before updating the package.
Good point. How should this be handled in such a case? |
I think @swissspidy was suggesting an opt-out flag for Maybe something like
|
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.
Makes sense to me 👍!
path.resolve( | ||
require.resolve( 'playwright-core' ), | ||
'..', | ||
'cli.js' | ||
), |
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.
Off-topic: This is probably an implementation detail, I wonder why we don't just use npx
here?
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 tried swapping it here but couldn't get it working locally - #54051 (comment).
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.
Yeah I recall seeing this earlier but couldn't remember where 😆.
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.
It seems to be working for me via:
const result = spawn( 'npx', [ 'playwright', 'install' ], {
stdio: 'inherit',
} );
Big +1 to this. There are other projects outside core & Gutenberg relying on However, a flag like I suggested will give us more flexibility here. So I would suggest doing that instead. |
We could also use a new env variable. Puppeteer has |
The issue with this approach is apparently that it would need to be passed like this:
...which makes it a part of the test runner args, which breaks it because it doesn't recognize that arg. We could probably filter it out from those args, but it feels like an anti-pattern since the only utils we have are getters around note: Just noticed your comment about |
It also supports it for Node, see https://github.com/microsoft/playwright/blob/1901a1a1555536e26beb74c77695a866b501f27f/docs/src/library-js.md#browser-downloads While it's only meant for |
31c881d
to
c9d6bae
Compare
Updated in c9d6bae! |
@swissspidy, it looks like these would need to be updated as well unless there's still some stuff running with Puppeteer: |
Unfortunately there still is 😞 QUnit tests in WP use Puppeteer |
stdio: 'inherit', | ||
} | ||
); | ||
if ( process.env.PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD !== '1' ) { |
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.
Should we also check for 'true'
?
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.
Good point. I figured I'd find a util for that (getting env vars as boolean values), but there doesn't seem to be one. Decided to add it and make it convert just like Playwright does it. Updated in c290701.
What?
Closes #56588
Dependencies in CI should be explicitly defined for the sake of saving time. For example, performance tests only run against Chromium, but all browsers are installed anyway because we're running
playwright install
before each test run. Adding aCI
check should be sufficient to address this.To make sure we're not breaking anything, I've checked the following workflows to ensure they install Playwright deps explicitly:
Testing Instructions
node packages/scripts/node_modules/playwright-core/cli.js uninstall
CI
var added:CI=true npm run test:e2e:playwright
npm run test:e2e:playwright