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

[Feature] Allow skipping specific browser downloads #823

Closed
jperl opened this issue Feb 3, 2020 · 4 comments · Fixed by #834
Closed

[Feature] Allow skipping specific browser downloads #823

jperl opened this issue Feb 3, 2020 · 4 comments · Fixed by #834

Comments

@jperl
Copy link
Contributor

jperl commented Feb 3, 2020

My library depends on playwright, and supports all the browsers playwright supports. However not all of my users want to download each browser.

It would be nice if the end-user of my library could skip certain browser downloads by setting environment variables.

For example, if they only care about chromium they could do PLAYWRIGHT_SKIP_FIREFOX_DOWNLOAD=true PLAYWRIGHT_SKIP_WEBKIT_DOWNLOAD=true npm install

@pavelfeldman
Copy link
Member

Closing as a dupe of #812

@jperl
Copy link
Contributor Author

jperl commented Feb 4, 2020

@pavelfeldman This is not a dupe of #812, let me try to illustrate the problem better.

Problem

qawolf depends on playwright. To get around this, I would need to create qawolf-firefox, qawolf-webkit, qawolf-chromium variants which is a lot of maintenance burden. It's not just for me, anyone who wants to create a package that depends on playwright will have this same burden. It would be much easier to let end-users specify ENV variables to skip the download.

Solution

Add this to the top of downloadBrowser:

if (process.env[`PLAYWRIGHT_SKIP_${browser.toUpperCase()}_DOWNLOAD`]) {
  return;
}

@aslushnikov
Copy link
Collaborator

@jperl Yeah I agree, this is different.

I don't like using ENV variables as an API for libraries. We tried this in Puppeteer with PUPPETEER_SKIP_CHROMIUM_DOWNLOAD, and it bit us: if different dependencies used Puppeteer somewhere deep in their guts without users even knowing it, and users tried to use Puppeteer and disable browser downloads, then this env variable got propagated during npm install step, breaking dependencies in a weird ways.

So instead we switched to programmatic browser downloads: every library that wished to use Puppeteer internally had to use puppeteer-core instead, and have it's own simple install.js script that uses BrowserFetcher API to download browser, if necessary. This way dependencies stay hermetic. (more info: puppeteer vs puppeteer-core).


Now, qawolf wants to use playwright internally and is supposed to be an end-user product rather then a library. This means that qawolf should have it's own mechanism to specify which browsers to download, and use playwright-core internally to drive and download browsers.

It looks like we don't currently expose browser downloads - let me fix it.

@aslushnikov aslushnikov reopened this Feb 4, 2020
@jperl
Copy link
Contributor Author

jperl commented Feb 4, 2020

Ok, I like that solution of depending on playwright-core instead and calling the download code ourselves. Thank you for this, and for explaining your reasoning 🙏.

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 a pull request may close this issue.

3 participants