Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 7fd9a75

Browse files
Emyrkaslilac
andauthored
chore: nix shell to support playwright e2e tests (coder#12917)
* chore: nix shell to support playwright e2e tests nix is running an older version of chromium, so had to reduce the playwright version. * Add to e2e readme * add enterprise test comment * add note about install to readme * make fmt * remove shellhook message Co-authored-by: Kayla Washburn-Love <[email protected]> * add link to nixos playwright package to get version * formatting --------- Co-authored-by: Kayla Washburn-Love <[email protected]>
1 parent 566f8f2 commit 7fd9a75

File tree

5 files changed

+51
-18
lines changed

5 files changed

+51
-18
lines changed

flake.lock

+6-6
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

flake.nix

+8-1
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,7 @@
5858
pango
5959
pixman
6060
pkg-config
61+
playwright-driver.browsers
6162
postgresql_13
6263
protobuf
6364
protoc-gen-go
@@ -86,7 +87,13 @@
8687
in
8788
{
8889
defaultPackage = formatter; # or replace it with your desired default package.
89-
devShell = pkgs.mkShell { buildInputs = devShellPackages; };
90+
devShell = pkgs.mkShell {
91+
buildInputs = devShellPackages;
92+
shellHook = ''
93+
export PLAYWRIGHT_BROWSERS_PATH=${pkgs.playwright-driver.browsers}
94+
export PLAYWRIGHT_SKIP_VALIDATE_HOST_REQUIREMENTS=true
95+
'';
96+
};
9097
packages.all = allPackages;
9198
}
9299
);

site/e2e/README.md

+26
Original file line numberDiff line numberDiff line change
@@ -20,3 +20,29 @@ pnpm playwright:test
2020
# Run a specific test (`-g` stands for grep. It accepts regex).
2121
pnpm playwright:test -g '<your test here>'
2222
```
23+
24+
# Using nix
25+
26+
If this breaks, it is likely because the flake chromium version and playwright
27+
are no longer compatible. To fix this, update the flake to get the latest
28+
chromium version, and adjust the playwright version in the package.json.
29+
30+
You can see the playwright version here:
31+
https://search.nixos.org/packages?channel=unstable&show=playwright-driver&from=0&size=50&sort=relevance&type=packages&query=playwright-driver
32+
33+
```shell
34+
# Optionally add '--command zsh' to choose your shell.
35+
nix develop
36+
cd site
37+
pnpm install
38+
pnpm build
39+
pnpm playwright:test
40+
```
41+
42+
# Enterprise tests
43+
44+
Enterprise tests require a license key to run.
45+
46+
```shell
47+
export CODER_E2E_ENTERPRISE_LICENSE=<license key>
48+
```

site/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@
9595
},
9696
"devDependencies": {
9797
"@octokit/types": "12.3.0",
98-
"@playwright/test": "1.42.1",
98+
"@playwright/test": "1.40.1",
9999
"@storybook/addon-actions": "8.0.5",
100100
"@storybook/addon-essentials": "8.0.5",
101101
"@storybook/addon-interactions": "8.0.5",

site/pnpm-lock.yaml

+10-10
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)