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] Option to not remove unused browsers #5797

Closed
kolodny opened this issue Mar 11, 2021 · 6 comments · Fixed by #5827
Closed

[Feature] Option to not remove unused browsers #5797

kolodny opened this issue Mar 11, 2021 · 6 comments · Fixed by #5827

Comments

@kolodny
Copy link

kolodny commented Mar 11, 2021

I have a global cache for all browsers that will run in different docker images and with different versions. Specifically, I have a /.cache directory that stores all the browsers I care about and I plan on pruning that as necessary.

Is it possible to introduce an ENV variable to opt out of the browser autocleanup?

TL;DR: ENV var to opt out of "Removing unused browser" install step

@yury-s
Copy link
Member

yury-s commented Mar 11, 2021

This is certainly possible but since it'd introduce another installation flow we need to better understand if it's justified. Can you share a bit more details about your use case, do you want to mount some shared volume at ~/.cache and have all the browsers preinstalled there? What's the benefit of it compared to preinstalling required browsers into corresponding docker images (I'm assuming they will anyway have different playwright versions)?

@kolodny
Copy link
Author

kolodny commented Mar 11, 2021

Sure! One of the steps we want to avoid is to have to build a docker image per CI build, right now we just mount the current directory as a volume (including node_modules) and run the tests there (on a docker-playwright image). Building a docker repo specific image would also require rerunning npm install in CI which is a pretty expensive step as well. The only reason we need a docker image is because we can't run open the browsers on the out of the box CI machines.

I also see this being useful if the user has something like PLAYWRIGHT_BROWSERS_PATH=$HOME/pw-browsers in their .bashrc like you have shown in https://playwright.dev/docs/1.7.0/installation. If someone were to do that then having two projects anywhere with two versions of playwright would break the other

@yury-s
Copy link
Member

yury-s commented Mar 11, 2021

Thanks for explaining! You can make Playwright skip the browser download step altogether by setting PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD=1, does it solve your problem?

I also see this being useful if the user has something like PLAYWRIGHT_BROWSERS_PATH=$HOME/pw-browsers

PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD should be compatible with that too. Please let us know if it works for you.

@kolodny
Copy link
Author

kolodny commented Mar 11, 2021

Not really since I do need to install the browser when necessary, I only don't want to to blast away other installations as well during that process.

In the case of someone using PLAYWRIGHT_BROWSERS_PATH as a global export variable, it would break competing installations. In our case we need it to install when we don't have the browser installed yet but there are many tests all using the same cache with different versions that we don't want to break or delete

@kolodny
Copy link
Author

kolodny commented Mar 16, 2021

Wow, thanks!

@nottrobin
Copy link

Is there no way for it to use the same downloaded browser between two different runs?

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.

4 participants