Prompt
How do I run end-to-end tests on every pull request?
Latest observation
Oct 19, 2026
OpenAI APIWeb search: off
To run end-to-end tests on every pull request, set up CI to trigger on pull request events and execute your E2E test suite automatically.
General approach
-
Define your E2E tests
Use a framework like Playwright, Cypress, Selenium, or TestCafe. -
Create a CI workflow/pipeline
Configure it to run when a PR is opened or updated. -
Install dependencies
-
Start your app and any required services
-
Run the E2E tests
-
Fail the PR if tests fail
Example: GitHub Actions
If your repo is on GitHub, add a workflow like this:
name: E2E Tests
on:
pull_request:
jobs:
e2e:
runs-on: ubuntu-latest
services:
postgres:
image: postgres:15
env:
POSTGRES_PASSWORD: password
POSTGRES_DB: app_test
ports:
- 5432:5432
options: >-
--health-cmd="pg_isready -U postgres"
--health-interval=10s
--health-timeout=5s
--health-retries=5
steps:
- uses: actions/checkout@v4
- name: Set up Node
uses: actions/setup-node@v4
with:
node-version: 20
- name: Install dependencies
run: npm ci
- name: Build app
run: npm run build
- name: Start app
run: npm start &
- name: Wait for app
run: npx wait-on http://localhost:3000
- name: Run E2E tests
run: npm run test:e2e
Notes
- Use
pull_requestso tests run on every PR update. - If your app needs a database, cache, or other service, define it in CI.
- Make sure your test environment is isolated and reproducible.
- Consider running tests in parallel if the suite is large.
- Optionally add required status checks so PRs can’t be merged unless E2E passes.
If you use another CI
- GitLab CI: use
rules: if: $CI_PIPELINE_SOURCE == "merge_request_event" - CircleCI: use workflows triggered on pull requests
- Azure DevOps / Jenkins: configure PR build triggers similarly
If you want, I can give you a ready-to-use config for GitHub Actions, GitLab CI, or Cypress/Playwright specifically.