Conversation
Adds "playwright test" command.
|
This pull request has been mentioned on NixOS Discourse. There might be relevant details there: https://discourse.nixos.org/t/running-playwright-tests/25655/9 |
|
I built the PR and run the resulting binary in a (unfortunately private) repository with Playwright tests written in Javascript: /nix/store/8ck7islaxlgffm584kf91rq05ygigima-_at_playwright_slash_test-1.31.1/bin/playwright testgave me errors like Do I need to do something to my test project first? |
Ha I have seen that error at some point. I was told that javascript has a peculiar singleton system based on path that even symlinks could throw off. This package is a port of a package we use internally with success and that shouldn't suffer from the problem. So maybe it's a plawyright error. Have you tried clearning up NODE_PATH in case it does load an alternative playwright ? |
|
My NODE_PATH is Only when I was manually removing But not in Firefox, there I got: I don't know where it gets the path from, My shell.nix is: { pkgs ? import <nixpkgs> {} }:
pkgs.mkShell {
buildInputs = [
pkgs.nodejs-18_x
pkgs.playwright
];
PLAYWRIGHT_BROWSERS_PATH="${pkgs.playwright-driver.browsers}";
}env said: And is there a chance to make it work inside VS-Code with the Playwright extension (where you are supposed to do the actual development of the tests)? |
Add this to your vscode settings "playwright.env": {
"PLAYWRIGHT_BROWSERS_PATH": "/nix/store/mlyamflq8icq0lwfircr03aiba0dbzg3-chromium-playwright",
"PLAYWRIGHT_SKIP_VALIDATE_HOST_REQUIREMENTS": 1
},Unfortunately u have to hard code the nix store path, maybe there's a way to read it from env var in vscode |
|
Hm, I tried to do that, but vs-code doesn't even seem to detect my JS tests any more. It want to show python tests. 😅 |
|
I created https://github.com/pbek/playwright-example with an example playwright test to test this PR as follow-up from #215450 (comment). https://github.com/pbek/playwright-example/blob/main/shell.nix uses this PR. |
|
awesome, maybe we can integrate your repository as part of the testsuite ? Seems like it works for the only supported browser aka chrome: I am tempted to merge as is and discuss the test afterwards. There might even be a native testsuite that could be run |
fine with me! 🚀 |
|
Let's go ! |
|
@teto, do you maybe know why there is no |
|
nope sry no idea, documentation is not clear to me either. |
|
Ah, I see, thank you :) |
|
@teto We're also keen on a newer version at work. What would be the process of updating? Do we need to think about the driver/browsers as well? |
|
I am sure you could sell @toto for a shitton of money, if only to https://en.wikipedia.org/wiki/Toto_Ltd. @samhh Absolutely, the playwright-driver version must match the package version ! we could add a warning to check that I have spent my plawyright FOSS credits but I am happy to review PRs if you wanna update the package. pkgs/development/web/playwright-test/wrapped.nix was written manually but depends on the driver version. Updating the driver and running |
Adds "playwright test" command.
Description of changes
Raw dump of a package working in an out of tree project, still needs some polish
Fixes #217693
I've tried buildNpmPackage but doesn't seem ready yet to handle this kind of package.
Things done
sandbox = trueset innix.conf? (See Nix manual)nix-shell -p nixpkgs-review --run "nixpkgs-review rev HEAD". Note: all changes have to be committed, also see nixpkgs-review usage./result/bin/)