This doucument assumes you are using the devcontainer.
-
Run Precommit Suite
- Go Tests
- TypeScript Tests
- License Check
- License Fix
- Linting
- Attempt Automatic Lint Error Fixing
-
Run Playwright Tests
- Update Screenshots
- Download GitHub Playwright Test Results
- Analyze Playwright Test Results
- Show Playwright Test Report
- Show Playwright Test Trace
The precommit command is a wrapper command that includes many tools (tests minus Playwright tests, license check,
linting, etc).
Run the following command to run the precommit suite: make precommit.
Below describes some of the commands from the precommit command that a developer can run.
To run only the Go tests, run: make go-test.
To run only the TypeScript tests (excluding Playwright tests), run: make node-test.
Run the following command to check the license headers for all code: make license-check.
Run the following command to automatically fix the license errors: make license-fix.
Run the following command to lint all the code: make lint.
Some lint errors can be fixed automatically. This command will try to fix all the lint errors: make lint-fix.
Developers may still need to inspect and manually fix the error.
If you have a running local development environment
(established via make start-local) with the necessary port forwarding
(make port-forward-manual), fake users (make dev_fake_users) and
fake data (make dev_fake_data), you can expedite Playwright testing by
skipping the environment setup.
To do this, prefix your make command with SKIP_FRESH_ENV=1. This is
particularly useful for rapid iteration, as make start-local leverages
Skaffold to rebuild the application on file saves.
For example: make playwright-test becomes SKIP_FRESH_ENV=1 make playwright-test.
Important: Skipping the environment setup assumes your existing local
environment is in a known good state. If inconsistencies arise, ensure you run
the Playwright target without SKIP_FRESH_ENV=1 to create a clean environment.
This is the default behavior to guarantee a reliable testing environment.
Run the following command to run the Playwright tests: make playwright-test.
There are some tests that check screenshots. That means, your changes may impact the existing screenshots. Run the
following command to update the screenshots: make playwright-update-snapshots.
Sometimes the Playwright tests fail in GitHub and you will want to download the results and analyze them.
- Find the GitHub Action ID by running:
make print-gh-runs- Example output:
In this example, we will use IDSTATUS TITLE WORKFLOW BRANCH EVENT ID ELAPSED AGE ✓ PR title build jcscottiii/branch pull_request 9551121552 12m49s about 2 hours ago X PR title build jcscottiii/branch pull_request 9551110554 16m28s about 2 hours ago9551110554 - Download the report:
make download-playwright-report-from-run-$RUNID- In this example, you would run:
make download-playwright-report-from-run-9551110554
- In this example, you would run:
This section describes how to analyze the Playwright tests. The following sections expect there is a playwright-report
directory that is present by:
- running the Playwright tests locally, or
- downloading the report from GitHub.
Given the playwright-report directory exists, run the following command: make playwright-open-report to open the report.
- Given there are failures, there should be traces. You can list each failure trace by running:
make playwright-show-traces- Example:
playwright-report/data/9bd87f9fe48efeb348ad4c6f05d01743b15501b8.zip playwright-report/data/4dc5b7341597474f7fb1abedf1b2017e3b271eef.zip playwright-report/data/0baeb6be37c91cd90156df684dc28a7b51970df3.zip - Open the trace:
npx playwright show-trace path/to/trace.zip- Example:
npx playwright show-trace playwright-report/data/9bd87f9fe48efeb348ad4c6f05d01743b15501b8.zip
- Example:
For the best developer experience when iterating on E2E tests, use the Playwright Test extension for VS Code.
- Direct Execution: Run or debug individual tests using code lens "play" buttons directly in the editor.
- Show Browser: Control a live browser window while tests are running to inspect the UI state.
- Auto-Wait: Benefit from Playwright's auto-waiting features which are easier to observe during live runs.
- Open the Testing panel in the VS Code sidebar.
- Ensure the "Playwright" tests are discovered.
- Check the "Show Browser" box at the bottom of the testing panel.
- Run a test; a Chromium window will launch showing the automated actions.
- Set breakpoints in your
.spec.tsfiles to pause execution and use the browser's DevTools to inspect elements.