Skip to content

Latest commit

 

History

History
132 lines (75 loc) · 4.34 KB

troubleshooting.md

File metadata and controls

132 lines (75 loc) · 4.34 KB

Troubleshooting

Each entry gives the symptom, the cause, and the fix. Errors are quoted exactly as the framework prints them.

Setup

Executable doesn't exist at ... chromium_headless_shell

Cause: Playwright's bundled browser is not installed on this machine.

Fix:

bunx playwright install chromium

bun install --frozen-lockfile fails

Cause: package.json and bun.lock disagree. Someone changed a dependency without updating the lockfile.

Fix: run bun install locally, review the lockfile change, and commit bun.lock with the dependency change.

Commands fail with npm errors

Cause: an old command or an npm install from before the Bun migration.

Fix: use bun install and bun run <script>. Delete any stray package-lock.json. The repo uses bun.lock.

Environment

Unknown TEST_ENV "..."

Cause: TEST_ENV is set to a name that does not exist.

Fix: use one of dev, qa, staging, production. Unset it to default to dev.

Missing environment file or config/environments/<name>.json is missing required key

Cause: the settings file is absent or incomplete.

Fix: copy the keys from an existing file in config/environments/. See environments.

Invalid base URL for "<env>"

Cause: the baseUrl (or the BASE_URL override) is not an absolute URL, for example it is missing https://.

Fix: correct the value.

Credentials

Set E2E_USERNAME and E2E_PASSWORD (see .env.example)

Cause: an authenticated test ran without credentials. Only the setup project and tests that use the credentials fixture need them.

Fix: add the values to .env locally, or set the GitHub Environment secrets in CI. Do not put them in a file that is committed.

The setup test fails at toHaveURL and stays on the login page

Cause: the account in E2E_USERNAME and E2E_PASSWORD was rejected. The login page shows an Invalid credentials alert, so the browser never reaches the dashboard.

Fix: check the values. On a shared demo, the account may have been reset. Re-enter the credentials, then re-run. Open the failing test's trace in reports/test-results/ to see the alert.

Running

Refusing to run "<title>" in production

Cause: the production guard blocked a test that is not tagged @prod. The config filter normally prevents this, so the guard runs only when that filter has been removed or changed.

Fix: restore the grep: /@prod/ filter in playwright.config.js, and run only @prod tests in production, for example bun run test:production. If the test should run in production, make it read-only and tag it @prod. See tagging.

Tests are skipped or fewer than expected run

Cause: the --grep filter or the environment selects a smaller set.

Fix: list the selection first:

bunx playwright test --list
bunx playwright test --list --grep "@smoke"

The browser window does not appear

Cause: the run is headless by default.

Fix: run bun run test:headed. Or set HEADED=true in .env and run any script.

Authenticated tests fail with a login page or a redirect

Cause: the saved session in playwright/.auth/user.json is stale or missing.

Fix: delete the file and run the setup project again:

rm -f playwright/.auth/user.json      # PowerShell: Remove-Item playwright/.auth/user.json
bunx playwright test --project=setup

Reports

An old report opens instead of the new one

Cause: reports/ still contains output from an earlier run.

Fix: bun run clean, then run the tests again.

No Monocart report found at ... from report:monocart

Cause: no run has written a report yet, or reports/ was cleaned.

Fix: run bun run test first.

Windows

Prettier reports every file as "code style issues"

Cause: the files were checked out with CRLF line endings. The repo stores LF and .gitattributes enforces LF on checkout. An older clone may predate that file.

Fix: re-clone the repo, or stash your changes and run git checkout -- .. Check with git ls-files --eol.

Still stuck?

Run the failing command with the full output, then check the README and the guardrails. Open an issue with the command, the environment name, and the error. Do not paste credentials.