However the playwright cli is missing the test command
Using playwright through npm/yarn also has problems:
yarn playwright install-deps expects apt, so it does not work
yarn playwright install
yarn playright test
produces errors like:
browserType.launch:
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β Host system is missing dependencies to run browsers.
β Missing libraries:
β libgobject-2.0.so.0
β libglib-2.0.so.0
export PLAYWRIGHT_BROWSERS_PATH=$(nix build --print-out-paths nixpkgs#playwright
.browsers)
yarn playwright test
produces errors like:
Executable doesnβt exist at /nix/store/21isr8iwrdkhdhdyjw4jfxmwv0cn5zja-playwright-browsers/chromium-1045/chrome-linux/chrome
Short of a fix, is there a common workaround for problems like this? I often run into these kinds of problems when using npm/yarn and beating my head against nix is hurting my productivity.
It would be incredibly cool to be able to run playwright tests as part of nix flake check. The testScript attribute in pkgs.nixosTest is python code and playwright has python driver so it should be somehow possible no ?
but there is no playwright test command in hte python package:
β result/bin/playwright
Usage: playwright [options] [command]
Options:
-V, --version output the version number
-h, --help display help for command
Commands:
open [options] [url] open page in browser specified via -b, --browser
codegen [options] [url] open page and generate code for user actions
install [options] [browser...] ensure browsers necessary for this version of Playwright are installed
install-deps [options] [browser...] install dependencies necessary to run browsers (will ask for sudo permissions)
cr [options] [url] open page in Chromium
ff [options] [url] open page in Firefox
wk [options] [url] open page in WebKit
screenshot [options] <url> <filename> capture a page screenshot
pdf [options] <url> <filename> save page as pdf
show-trace [options] [trace...] show trace viewer
help [command] display help for command
what do you use it for ? do you write tests in python ? how do you launch them then ?
I can then do a playwright open nixos.org, but I canβt run tests with npm or run a visual studio code instance for testing with the playwright extension. It always tells me to install the browsers with npx playwright install.