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

Skip to content

chore: nix shell to support playwright e2e tests #12917

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 8 commits into from
Apr 10, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions flake.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 8 additions & 1 deletion flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@
pango
pixman
pkg-config
playwright-driver.browsers
postgresql_13
protobuf
protoc-gen-go
Expand Down Expand Up @@ -86,7 +87,13 @@
in
{
defaultPackage = formatter; # or replace it with your desired default package.
devShell = pkgs.mkShell { buildInputs = devShellPackages; };
devShell = pkgs.mkShell {
buildInputs = devShellPackages;
shellHook = ''
export PLAYWRIGHT_BROWSERS_PATH=${pkgs.playwright-driver.browsers}
export PLAYWRIGHT_SKIP_VALIDATE_HOST_REQUIREMENTS=true
'';
};
packages.all = allPackages;
}
);
Expand Down
26 changes: 26 additions & 0 deletions site/e2e/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,3 +20,29 @@ pnpm playwright:test
# Run a specific test (`-g` stands for grep. It accepts regex).
pnpm playwright:test -g '<your test here>'
```

# Using nix
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it's probably worth linking to https://search.nixos.org/packages?channel=unstable&type=packages&query=playwright-driver somewhere in this section as a quick way to figure out what the "right" Playwright version is

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍


If this breaks, it is likely because the flake chromium version and playwright
are no longer compatible. To fix this, update the flake to get the latest
chromium version, and adjust the playwright version in the package.json.

You can see the playwright version here:
https://search.nixos.org/packages?channel=unstable&show=playwright-driver&from=0&size=50&sort=relevance&type=packages&query=playwright-driver

```shell
# Optionally add '--command zsh' to choose your shell.
nix develop
cd site
pnpm install
pnpm build
pnpm playwright:test
```

# Enterprise tests

Enterprise tests require a license key to run.

```shell
export CODER_E2E_ENTERPRISE_LICENSE=<license key>
```
2 changes: 1 addition & 1 deletion site/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@
},
"devDependencies": {
"@octokit/types": "12.3.0",
"@playwright/test": "1.42.1",
"@playwright/test": "1.40.1",
"@storybook/addon-actions": "8.0.5",
"@storybook/addon-essentials": "8.0.5",
"@storybook/addon-interactions": "8.0.5",
Expand Down
20 changes: 10 additions & 10 deletions site/pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.