Playwright doesn't support Fedora distribution. Following is a description how to run the tests using Ubuntu 22.04 image using distrobox which is fairy supported on various Linux distributions.
sudo dnf install distrobox podmanCreate home directory for your distrobox environment. It is useful not to mess with your host system home directory.
mkdir ~/distroboxThis command creates container using podman in your host. For more information see the documentation.
distrobox create \
--name pw --image ubuntu:22.04 \
--home ~/distrobox \
--root \
--additional-packages "podman libgtk2.0-0 libgtk-3-0 libgbm-dev libnotify-dev libnss3 libxss1 libasound2 libxtst6 xauth xvfb" \
--unshare-all \
--absolutely-disable-root-password-i-am-really-positively-sureNote
The last option of the previous command is not necessary. If avoided one will be asked for password used in sudo command in the container.
One can enter the created distrobox environment using:
distrobox enter --root pwWe recommend to use Nodesource to help you with the nodejs setup in the container.
Enter the container using:
distrobox enter --root pwDownload and run the setup for nodejs on Ubuntu installation:
curl -fsSL https://deb.nodesource.com/setup_22.x -o nodesource_setup.sh
sudo bash nodesource_setup.sh
sudo apt-get install nodejs -yThis made nodejs environment setup complete.
Next is to install playwright and run the test.
npx playwright install
npm test
Hi! Thanks for the guide. This is the first time I'm using distrobox. I've played around with
createbased on this page (though using Ubuntu 24.04), and I have the following remarks:--additional-packages.npx playwright install-depsthen takes care of the rest, it works and it makes thecreatecommand more readable.--absolutely-disable-root-password-i-am-really-positively-sure, because using it is highly discouraged in the documentation, and also--root, simply because it is not needed.npx playwright testthe framework automatically hosts the test report atlocalhost:9323, inside the distrobox, of course. The--unshare-allflag disables network sharing, making the localhost of the box unavailable from the host. Since I didn't want to install a browser in this box to look at the report, I enabled network sharing by omitting this flag as well. I have no concerns about shared resources right now but it is possible to control those resources separately (so introducing some of the specificunshareoptions while removingunshare-all).This is how my
createcommand looks after all that:distrobox create \ --name ubuntu --image ubuntu:24.04 \ --home /home/me/distrobox-ubuntu \ --additional-packages "git vim nodejs npm"Once created, I navigate to my project, go
npx playwright install-depsas mentioned before, thennpx playwright test.This approach seems simpler to me, it's free of discouraged bad practices, and it's working, so I wanted to share it.