Skip to content

Commit

Permalink
Replace jest-puppeteer with Playwright
Browse files Browse the repository at this point in the history
Advantages of the new Playwright setup:

1. It auto-detects whether a server is already running (no need for two
   separate npm scripts)
2. Browser installation is done in a separate command. Previously, it
   was done on installation of puppeteer which became difficult to debug
   when it timed out on remote build environments.
3. It requires much fewer dependencies (see diff of package-lock.json)
  • Loading branch information
victorlin committed Nov 6, 2024
1 parent af7b31a commit fddd0cf
Show file tree
Hide file tree
Showing 10 changed files with 197 additions and 3,077 deletions.
3 changes: 2 additions & 1 deletion .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,8 @@ jobs:
node-version: ${{ matrix.node }}
- run: npm ci --loglevel verbose
- run: npm run get-data
- run: npm run smoke-test:ci
- run: npx playwright install chromium
- run: npm run smoke-test

lint:
runs-on: ubuntu-latest
Expand Down
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -16,5 +16,8 @@ node_modules/
npm-debug.log
*tgz

### playwright ###
.playwright/

### IDE ###
.vscode/*
7 changes: 4 additions & 3 deletions DEV_DOCS.md
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,7 @@ From a fork: `git pull --rebase upstream master`
We use the following libraries for all kinds of testing, so it'd help to read the docs to get familiar with their APIs and features:

1. [`Jest`](https://github.com/facebook/jest)
2. [`Puppeteer`](https://github.com/puppeteer/puppeteer/)
3. [`Jest-Puppeteer`](https://github.com/smooth-code/jest-puppeteer)
2. [`Playwright`](https://playwright.dev)

When you submit a pull request to the auspice repository, certain tests will need to pass before it can be merged.

Expand All @@ -74,11 +73,13 @@ Run `npm run lint`. If there are issues run `npm run lint:fix`.

Auspice used to have integration testing using jest + puppeteer, however this was removed in [PR 1672](https://github.com/nextstrain/auspice/pull/1672).
Ideally this functionality will be brought back, and that PR would be a good place to start.
If embarking on this journey, consider using Playwright since it is already used for smoke tests.

#### For smoke tests

1. Fetch the datasets with `npm run get-data`.
2. Ensure you are **not** currently running the site locally, then run `npm run smoke-test:ci`.
2. Install the testing browser with `npx playwright install chromium`.
3. Run `npm run smoke-test`.


#### Test Tips
Expand Down
9 changes: 0 additions & 9 deletions jest-puppeteer.config.js

This file was deleted.

Loading

0 comments on commit fddd0cf

Please sign in to comment.