You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[Feature] Faster way to install Playwright Browsers and dependencies on GitHub Actions #23388
The default GitHub Actions workflow generated by Playwright takes quite a lot of time to install Playwright Browsers, and sometimes fail entirely.
Example 1: It takes 3.5m to run playwright install --with-deps
Example 2: Sometimes azure.archive.ubuntu.com is unstable. In most Node.js applications we never have a need to run apt-get install except when installing Playwright browsers. This has been one of the most common cause of our build failures.
Since we run our tests on many workers, this Playwright installation failure costed us 10 hours of GitHub Actions billable time.
Update the docs to avoid running playwright install directly and use a Docker image to run instead, so people who follow the docs get the best testing experience. (Maybe update the template in create-playwright?)
For people who face the same issue
I am also exploring solutions as I create this issue, which I will update here as I find more workarounds.
For others who face the same issue: I would like to know how other people work around this problem, so maybe we can find the best one faster. If you have worked around this in some way, please share how you do it.
It's unfortunately not possible to make the GitHub Action unaware of apt. What we recommend instead is using our Docker image, which has all the dependencies preinstalled already: https://playwright.dev/docs/ci#via-containers
I tried using the container: directive. The tests now runs fast, but now I can’t run aws CLI. (GitHub’s default image has aws CLI preinstalled.) To fix that I try to install AWS CLI using the steps documented in the docs, but the Playwright CLI doesn’t have the unzip command either. To install unzip the most standard way is to apt-get install but that brings us back to the first problem 😂. This is where I’m at right now.
The test becomes faster at the expense expense of 30s spent in “Initialize containers” phase:
- name: Run Playwright testsuses: docker://mcr.microsoft.com/playwright:v1.34.3-jammywith:
args: npx playwright test
At runtime, GitHub Actions translate the above step into this command. It is good that GitHub Actions passes all the environment variables and mounts the source code into the image, so that it runs quite seamlessly.
Also, the “pull” action has been hoisted to the beginning of the workflow run:
I think this approach strikes a pretty good balance between simplicity and performance.
Reacted by Chris Wilkinson, Amber Williams, Ryosuke Iwanaga, Avi Romanoff, Dennis Cornwell, Zed Wong, Greg Bergé, Abhijit Hota, Kristian Kähkönen, Vegard Wright and 19 more
I've tried to set $HOME in PREreview/prereview.org@8f7b96e, but it didn't apply inside the container (still seeing Running Nightly as root in a regular user's session is not supported. ($HOME is /github/home which is owned by uid 1001.)). Not sure what to do now so will have to revert...
Chris Wilkinson (@thewilkybarkid) One potential way to work around this may be to prefix the args with env, i.e. env HOME=/root npx playwright ... or use something like cross-env. Not sure if it works or not.
Looks like there is no action item on our side and you have listed a few workarounds. If you are interested in contributing to our ci docs and add there another caching strategy to make it on GitHub Actions faster, we would more than appreciate!
Regarding the HOME=/root issue, I closed the linked issue a while ago since I wasn't able to reproduce it. If you help us reproducing this one, we can definitely fix it.
I recently learned that Playwright supports exposing local network to the remote browser server using exposeNetwork option and that Playwright Test can be configured to use that setup with PW_TEST_CONNECT_WS_ENDPOINT + PW_TEST_CONNECT_EXPOSE_NETWORK.
With that, I created the dtinth/setup-playwright-test-docker action, which is a drop-in replacement for playwright install --with-deps but is around 2x faster. It does this by launching a Playwright remote server using Docker, and then configures environment variables ($GITHUB_ENV) so that Playwright Test automatically connects to it.
Reacted by Livan and michaelbmuller
Reacted by Alex Martossy, Carise F, Barret Schloerke, Ibrahim Saberi and michaelbmuller
Just on May 29th 2026 a cron job started failing for me on npx playwright install chromium --with-deps:
full log
npx playwright install chromium --with-deps
Installing dependencies...
Switching to root user to install dependencies...
Get:1 file:/etc/apt/apt-mirrors.txt Mirrorlist [144 B]
Hit:2 http://azure.archive.ubuntu.com/ubuntu noble InRelease
Get:3 http://azure.archive.ubuntu.com/ubuntu noble-updates InRelease [126 kB]
Get:4 http://azure.archive.ubuntu.com/ubuntu noble-backports InRelease [126 kB]
Get:5 http://azure.archive.ubuntu.com/ubuntu noble-security InRelease [126 kB]
Hit:6 https://packages.microsoft.com/repos/azure-cli noble InRelease
Get:7 https://packages.microsoft.com/ubuntu/24.04/prod noble InRelease [3600 B]
Get:8 http://azure.archive.ubuntu.com/ubuntu noble-updates/main amd64 Packages [2049 kB]
Get:18 https://dl.google.com/linux/chrome-stable/deb stable InRelease [1825 B]
Get:9 http://azure.archive.ubuntu.com/ubuntu noble-updates/main Translation-en [360 kB]
Get:10 http://azure.archive.ubuntu.com/ubuntu noble-updates/main amd64 Components [177 kB]
Get:11 http://azure.archive.ubuntu.com/ubuntu noble-updates/universe amd64 Packages [1694 kB]
Get:12 http://azure.archive.ubuntu.com/ubuntu noble-updates/universe Translation-en [330 kB]
Get:13 http://azure.archive.ubuntu.com/ubuntu noble-updates/universe amd64 Components [386 kB]
Get:14 http://azure.archive.ubuntu.com/ubuntu noble-updates/restricted amd64 Packages [3278 kB]
Get:15 http://azure.archive.ubuntu.com/ubuntu noble-updates/restricted Translation-en [760 kB]
Get:16 http://azure.archive.ubuntu.com/ubuntu noble-updates/multiverse Translation-en [11.3 kB]
Get:17 http://azure.archive.ubuntu.com/ubuntu noble-updates/multiverse amd64 Components [940 B]
Get:19 http://azure.archive.ubuntu.com/ubuntu noble-backports/main amd64 Components [5760 B]
Get:20 http://azure.archive.ubuntu.com/ubuntu noble-backports/universe amd64 Components [10.5 kB]
Get:21 http://azure.archive.ubuntu.com/ubuntu noble-security/main amd64 Packages [1704 kB]
Get:22 http://azure.archive.ubuntu.com/ubuntu noble-security/main Translation-en [268 kB]
Get:23 http://azure.archive.ubuntu.com/ubuntu noble-security/main amd64 Components [42.5 kB]
Get:24 http://azure.archive.ubuntu.com/ubuntu noble-security/universe amd64 Packages [1192 kB]
Get:25 http://azure.archive.ubuntu.com/ubuntu noble-security/universe Translation-en [230 kB]
Get:26 http://azure.archive.ubuntu.com/ubuntu noble-security/universe amd64 Components [74.2 kB]
Get:27 http://azure.archive.ubuntu.com/ubuntu noble-security/restricted amd64 Packages [3006 kB]
Get:28 http://azure.archive.ubuntu.com/ubuntu noble-security/restricted Translation-en [698 kB]
Get:30 https://packages.microsoft.com/ubuntu/24.04/prod noble/main amd64 Packages [162 kB]
Get:29 http://azure.archive.ubuntu.com/ubuntu noble-security/multiverse Translation-en [9000 B]
Get:31 https://packages.microsoft.com/ubuntu/24.04/prod noble/main arm64 Packages [133 kB]
Get:32 https://dl.google.com/linux/chrome-stable/deb stable/main amd64 Packages [1218 B]
Fetched 17.0 MB in 2s (8895 kB/s)
Reading package lists...
Reading package lists...
Building dependency tree...
Reading state information...
libasound2t64 is already the newest version (1.2.11-1ubuntu0.2).
libasound2t64 set to manually installed.
libatk-bridge2.0-0t64 is already the newest version (2.52.0-1build1).
libatk-bridge2.0-0t64 set to manually installed.
libatk1.0-0t64 is already the newest version (2.52.0-1build1).
libatk1.0-0t64 set to manually installed.
libatspi2.0-0t64 is already the newest version (2.52.0-1build1).
libatspi2.0-0t64 set to manually installed.
libcairo2 is already the newest version (1.18.0-3build1).
libcairo2 set to manually installed.
libcups2t64 is already the newest version (2.4.7-1.2ubuntu7.9).
libcups2t64 set to manually installed.
libdbus-1-3 is already the newest version (1.14.10-4ubuntu4.1).
libdbus-1-3 set to manually installed.
libdrm2 is already the newest version (2.4.125-1ubuntu0.1~24.04.1).
libdrm2 set to manually installed.
libgbm1 is already the newest version (25.2.8-0ubuntu0.24.04.1).
libgbm1 set to manually installed.
libglib2.0-0t64 is already the newest version (2.80.0-6ubuntu3.8).
libglib2.0-0t64 set to manually installed.
libnspr4 is already the newest version (2:4.35-1.1build1).
libnspr4 set to manually installed.
libnss3 is already the newest version (2:3.98-1ubuntu0.1).
libnss3 set to manually installed.
libpango-1.0-0 is already the newest version (1.52.1+ds-1build1).
libpango-1.0-0 set to manually installed.
libx11-6 is already the newest version (2:1.8.7-1build1).
libx11-6 set to manually installed.
libxcb1 is already the newest version (1.15-1ubuntu2).
libxcb1 set to manually installed.
libxcomposite1 is already the newest version (1:0.4.5-1build3).
libxcomposite1 set to manually installed.
libxdamage1 is already the newest version (1:1.1.6-1build1).
libxdamage1 set to manually installed.
libxext6 is already the newest version (2:1.3.4-1build2).
libxext6 set to manually installed.
libxfixes3 is already the newest version (1:6.0.0-2build1).
libxfixes3 set to manually installed.
libxkbcommon0 is already the newest version (1.6.0-1build1).
libxkbcommon0 set to manually installed.
libxrandr2 is already the newest version (2:1.5.2-2build1).
libxrandr2 set to manually installed.
xvfb is already the newest version (2:21.1.12-1ubuntu1.5).
fonts-noto-color-emoji is already the newest version (2.047-0ubuntu0.24.04.1).
libfontconfig1 is already the newest version (2.15.0-1.1ubuntu2).
libfontconfig1 set to manually installed.
libfreetype6 is already the newest version (2.13.2+dfsg-1ubuntu0.1).
libfreetype6 set to manually installed.
fonts-liberation is already the newest version (1:2.1.5-3).
fonts-liberation set to manually installed.
The following additional packages will be installed:
xfonts-encodings xfonts-utils
Recommended packages:
fonts-ipafont-mincho fonts-tlwg-loma
The following NEW packages will be installed:
fonts-freefont-ttf fonts-ipafont-gothic fonts-tlwg-loma-otf fonts-unifont
fonts-wqy-zenhei xfonts-cyrillic xfonts-encodings xfonts-scalable
xfonts-utils
0 upgraded, 9 newly installed, 0 to remove and 48 not upgraded.
Need to get 21.1 MB of archives.
After this operation, 79.5 MB of additional disk space will be used.
Get:1 file:/etc/apt/apt-mirrors.txt Mirrorlist [144 B]
Get:2 http://azure.archive.ubuntu.com/ubuntu noble/universe amd64 fonts-ipafont-gothic all 00303-21ubuntu1 [3513 kB]
Get:3 http://azure.archive.ubuntu.com/ubuntu noble/main amd64 fonts-freefont-ttf all 20211204+svn4273-2 [5641 kB]
Get:4 http://azure.archive.ubuntu.com/ubuntu noble/universe amd64 fonts-tlwg-loma-otf all 1:0.7.3-1 [107 kB]
Get:5 http://azure.archive.ubuntu.com/ubuntu noble/universe amd64 fonts-unifont all 1:15.1.01-1build1 [2993 kB]
Get:6 http://azure.archive.ubuntu.com/ubuntu noble/universe amd64 fonts-wqy-zenhei all 0.9.45-8 [7472 kB]
Get:7 http://azure.archive.ubuntu.com/ubuntu noble/main amd64 xfonts-encodings all 1:1.0.5-0ubuntu2 [578 kB]
Get:8 http://azure.archive.ubuntu.com/ubuntu noble/main amd64 xfonts-utils amd64 1:7.7+6build3 [94.4 kB]
Get:9 http://azure.archive.ubuntu.com/ubuntu noble/universe amd64 xfonts-cyrillic all 1:1.0.5+nmu1 [384 kB]
Get:10 http://azure.archive.ubuntu.com/ubuntu noble/main amd64 xfonts-scalable all 1:1.0.3-1.3 [304 kB]
Fetched 21.1 MB in 1s (22.9 MB/s)
Selecting previously unselected package fonts-ipafont-gothic.
(Reading database ...
(Reading database ... 5%
(Reading database ... 10%
(Reading database ... 15%
(Reading database ... 20%
(Reading database ... 25%
(Reading database ... 30%
(Reading database ... 35%
(Reading database ... 40%
(Reading database ... 45%
(Reading database ... 50%
(Reading database ... 55%
(Reading database ... 60%
(Reading database ... 65%
(Reading database ... 70%
(Reading database ... 75%
(Reading database ... 80%
(Reading database ... 85%
(Reading database ... 90%
(Reading database ... 95%
(Reading database ... 100%
(Reading database ... 202271 files and directories currently installed.)
Preparing to unpack .../0-fonts-ipafont-gothic_00303-21ubuntu1_all.deb ...
Unpacking fonts-ipafont-gothic (00303-21ubuntu1) ...
Selecting previously unselected package fonts-freefont-ttf.
Preparing to unpack .../1-fonts-freefont-ttf_20211204+svn4273-2_all.deb ...
Unpacking fonts-freefont-ttf (20211204+svn4273-2) ...
Selecting previously unselected package fonts-tlwg-loma-otf.
Preparing to unpack .../2-fonts-tlwg-loma-otf_1%3a0.7.3-1_all.deb ...
Unpacking fonts-tlwg-loma-otf (1:0.7.3-1) ...
Selecting previously unselected package fonts-unifont.
Preparing to unpack .../3-fonts-unifont_1%3a15.1.01-1build1_all.deb ...
Unpacking fonts-unifont (1:15.1.01-1build1) ...
Selecting previously unselected package fonts-wqy-zenhei.
Preparing to unpack .../4-fonts-wqy-zenhei_0.9.45-8_all.deb ...
Unpacking fonts-wqy-zenhei (0.9.45-8) ...
Selecting previously unselected package xfonts-encodings.
Preparing to unpack .../5-xfonts-encodings_1%3a1.0.5-0ubuntu2_all.deb ...
Unpacking xfonts-encodings (1:1.0.5-0ubuntu2) ...
Selecting previously unselected package xfonts-utils.
Preparing to unpack .../6-xfonts-utils_1%3a7.7+6build3_amd64.deb ...
Unpacking xfonts-utils (1:7.7+6build3) ...
Selecting previously unselected package xfonts-cyrillic.
Preparing to unpack .../7-xfonts-cyrillic_1%3a1.0.5+nmu1_all.deb ...
Unpacking xfonts-cyrillic (1:1.0.5+nmu1) ...
Selecting previously unselected package xfonts-scalable.
Preparing to unpack .../8-xfonts-scalable_1%3a1.0.3-1.3_all.deb ...
Unpacking xfonts-scalable (1:1.0.3-1.3) ...
Setting up fonts-wqy-zenhei (0.9.45-8) ...
Setting up fonts-freefont-ttf (20211204+svn4273-2) ...
Setting up fonts-tlwg-loma-otf (1:0.7.3-1) ...
Setting up xfonts-encodings (1:1.0.5-0ubuntu2) ...
Setting up fonts-ipafont-gothic (00303-21ubuntu1) ...
update-alternatives: using /usr/share/fonts/opentype/ipafont-gothic/ipag.ttf to provide /usr/share/fonts/truetype/fonts-japanese-gothic.ttf (fonts-japanese-gothic.ttf) in auto mode
Setting up fonts-unifont (1:15.1.01-1build1) ...
Setting up xfonts-utils (1:7.7+6build3) ...
Setting up xfonts-cyrillic (1:1.0.5+nmu1) ...
Setting up xfonts-scalable (1:1.0.3-1.3) ...
Processing triggers for man-db (2.12.0-4build2) ...
Not building database; man-db/auto-update is not 'true'.
Processing triggers for fontconfig (2.15.0-1.1ubuntu2) ...
Running kernel seems to be up-to-date.
No services need to be restarted.
No containers need to be restarted.
No user sessions are running outdated binaries.
No VM guests are running outdated hypervisor (qemu) binaries on this host.
Downloading Chromium 134.0.6998.35 (playwright build v1161) from https://cdn.playwright.dev/dbazure/download/playwright/builds/chromium/1161/chromium-linux.zip
|| 0% of 164.9 MiB
|■■■■■■■■ | 10% of 164.9 MiB
|■■■■■■■■■■■■■■■■ | 20% of 164.9 MiB
|■■■■■■■■■■■■■■■■■■■■■■■■ | 30% of 164.9 MiB
|■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■ | 40% of 164.9 MiB
|■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■ | 50% of 164.9 MiB
|■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■ | 60% of 164.9 MiB
|■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■ | 70% of 164.9 MiB
|■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■ | 80% of 164.9 MiB
|■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■ | 90% of 164.9 MiB
|■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■| 100% of 164.9 MiB
Error: The operation was canceled.
It seemingly hangs on 100%, in my case for 6 hours, consistently.
I wonder if there should be a built-in failure timeout for the process, if there isn't already? I'd imagine you want to account for people who have slow internets, but I feel like an hour could be a good default... if it doesn't finish by then, it's probably not going to. We could also set timeout-minutes: in the GitHub Actions workflow, but it seems logically to put it directly within Playwright too?
Still looking into whether I can pin the Ubuntu version or use the Playwright Docker container to solve the issue for my use case.
Activity
mxschmitt commentedon May 31, 2023
It's unfortunately not possible to make the GitHub Action unaware of apt. What we recommend instead is using our Docker image, which has all the dependencies preinstalled already: https://playwright.dev/docs/ci#via-containers
To use it, you just add:
and remove the:
npx playwright install --with-depsdtinth commentedon May 31, 2023
Max Schmitt (@mxschmitt) Thank you for a quick response and a pointer to that page.
I was trying to find that workflow example in the docs but couldn’t find it. I looked at these pages:
I tried using the
container:directive. The tests now runs fast, but now I can’t runawsCLI. (GitHub’s default image hasawsCLI preinstalled.) To fix that I try to install AWS CLI using the steps documented in the docs, but the Playwright CLI doesn’t have theunzipcommand either. To installunzipthe most standard way is toapt-get installbut that brings us back to the first problem 😂. This is where I’m at right now.The test becomes faster at the expense expense of 30s spent in “Initialize containers” phase:
dtinth commentedon May 31, 2023
Update: A solution that works for me and improved the build time by 2.5 minutes is to create a custom Docker container action.
First define an action:
Then run it:
dtinth commentedon May 31, 2023
Update: Turns out a custom action isn’t needed. A
docker://URL can be used withwith:directive already.At runtime, GitHub Actions translate the above step into this command. It is good that GitHub Actions passes all the environment variables and mounts the source code into the image, so that it runs quite seamlessly.
Also, the “pull” action has been hoisted to the beginning of the workflow run:
I think this approach strikes a pretty good balance between simplicity and performance.
Try and speed up the integration tests by just running the Playwright…
thewilkybarkid commentedon Jun 1, 2023
I've just tried Thai Pangsakulyanont (@dtinth)'s idea and it worked great... except for Firefox:
Edit: just found #6500.
thewilkybarkid commentedon Jun 1, 2023
I've tried to set
$HOMEin PREreview/prereview.org@8f7b96e, but it didn't apply inside the container (still seeingRunning Nightly as root in a regular user's session is not supported. ($HOME is /github/home which is owned by uid 1001.)). Not sure what to do now so will have to revert...Revert "Try and speed up the integration tests by just running the Pl…
dtinth commentedon Jun 1, 2023
Chris Wilkinson (@thewilkybarkid) One potential way to work around this may be to prefix the
argswith env, i.e.env HOME=/root npx playwright ...or use something likecross-env. Not sure if it works or not.Retry speeding up the integration tests by just running the Playwrigh…
mxschmitt commentedon Jun 2, 2023
Looks like there is no action item on our side and you have listed a few workarounds. If you are interested in contributing to our ci docs and add there another caching strategy to make it on GitHub Actions faster, we would more than appreciate!
Regarding the HOME=/root issue, I closed the linked issue a while ago since I wasn't able to reproduce it. If you help us reproducing this one, we can definitely fix it.
Thanks for your understanding!
thewilkybarkid commentedon Jun 2, 2023
That worked Thai Pangsakulyanont (@dtinth)! I'll comment on the other issue Max Schmitt (@mxschmitt).
DivyanshGothwal commentedon Sep 5, 2023
Thai Pangsakulyanont (@dtinth) Max Schmitt (@mxschmitt)
In the below SS I tried creating a custom github action and tried to use it in my workflow, I got error saying playwright is not installed.
8 remaining items
airtonix commentedon Dec 19, 2024
Came here to say that all I needed to do was two things:
channel: "chrome"in my playwright configAnd then I just do normal Github Action Things ™
Fix permissions when using the container
⚡️(ci) save time on CI by not downloading already present browser
⚡️(ci) save time on CI by not downloading already present browser
⚡️(ci) save time on CI by not downloading already present browser
⚡️(ci) save time on CI by not downloading already present browser
benjick commentedon Sep 9, 2025
Is there no good solution for this?
channel: "chrome"doesn't work at all for meci: use builtin chrome
ci: use builtin chrome (#1109)
dtinth commentedon Mar 21, 2026
I recently learned that Playwright supports exposing local network to the remote browser server using
exposeNetworkoption and that Playwright Test can be configured to use that setup withPW_TEST_CONNECT_WS_ENDPOINT+PW_TEST_CONNECT_EXPOSE_NETWORK.With that, I created the dtinth/setup-playwright-test-docker action, which is a drop-in replacement for
playwright install --with-depsbut is around 2x faster. It does this by launching a Playwright remote server using Docker, and then configures environment variables ($GITHUB_ENV) so that Playwright Test automatically connects to it.alonbardavid commentedon Jun 4, 2026
A bit of a late reply, but I have found that just caching the downloads make for a very fast turnaround.
vincerubinetti commentedon Jun 5, 2026
Just on May 29th 2026 a cron job started failing for me on
npx playwright install chromium --with-deps:full log
It seemingly hangs on 100%, in my case for 6 hours, consistently.
I wonder if there should be a built-in failure timeout for the process, if there isn't already? I'd imagine you want to account for people who have slow internets, but I feel like an hour could be a good default... if it doesn't finish by then, it's probably not going to. We could also set
timeout-minutes:in the GitHub Actions workflow, but it seems logically to put it directly within Playwright too?Still looking into whether I can pin the Ubuntu version or use the Playwright Docker container to solve the issue for my use case.
ci: drop --with-deps from Playwright install, cutting ~10min from E2E
ci: only install chromium for Playwright UI tests (#121)
⚡️(ci) save time on CI by not downloading already present browser