# How to run browser tests in GitHub Actions

Run saved browser tests against a known environment, keep the result tied to the commit and make the merge policy explicit.

## Why it is hard

- CI needs reachable environments and credentials.
- A test result can become stale as a PR changes.
- A comment alone does not enforce a merge policy.

## Plan the test around an observable outcome

1. Prepare a stable staging app and test fixtures.
2. Choose the tests that should block a merge.
3. Preserve run output even when the test command fails.
4. Require the workflow in branch protection.

## Where Zerocheck fits

1. Start with reviewed tests and add their YAML to your repository.
2. Authenticate the CLI and run zerocheck init --github-actions.
3. Configure the project token and environment credentials in CI.
4. Use the generated run and report steps to upload results and update one PR comment.

## Understand the exit status

The CLI exits 1 for a blocking failed test, or for a blocking flaky test when --fail-on-flaky is enabled. Setup, configuration, policy and infrastructure errors use exit 2. A nonblocking test keeps its failure visible while leaving the merge decision to the configured policy.

## Where results appear

The web app receives results and artifacts from CLI runs. GitHub Actions reporting updates one PR comment when it has the necessary token and permissions; a read-only or fork job still retains the job summary. Browser recordings are available only when the environment has no configured credentials.

## Pitfalls

- Do not assume the workflow can reach a private app without network setup.
- Do not give a PR comment credit for enforcing branch protection.
- Do not hide nonblocking failures from reviewers.

## Frequently asked questions

### Does Zerocheck install a GitHub App?

The supported workflow uses the optional CLI and GitHub Actions. Generate the workflow and configure the required token and environment.

### Can CI tests use a local browser?

Yes. The local runner executes on your CI machine while still using Zerocheck’s AI service and uploading results.

Related: [Browser Tests in CI](https://tryzerocheck.com/use-cases/zero-to-ci/)

---
Canonical: https://tryzerocheck.com/guides/ci-cd-e2e-testing/
Updated: 2026-09-14
