Skip to content

chore: playwright#6562

Open
kyle-ssg wants to merge 273 commits intomainfrom
chore/playwright
Open

chore: playwright#6562
kyle-ssg wants to merge 273 commits intomainfrom
chore/playwright

Conversation

@kyle-ssg
Copy link
Member

@kyle-ssg kyle-ssg commented Jan 20, 2026

  • I have read the Contributing Guide.
  • I have added information to docs/ if required so people know about the feature.
  • I have filled in the "Changes" section below.
  • I have filled in the "How did you test this code" section below.

Changes

Playwright Test Improvements

Faster Tests

  • Inputs are really fast compared to TestCafe
  • Tests are passing in CI around 2m30s vs ~4m

Better Local Development

  • Tests are re-runable via ui (you'll have to run npm run test:teardown before clicking play again)
  • Tests come with videos and clickable traces (these get uploaded from GitHub on failures too)
  • Tests can be ran very quickly and can be repeated (E2E_REPEAT=x) and exit on first failed test (E2E_RETRIES=0)
image

main_large

Added Claude Commands

  • /e2e - Run all tests (OSS + Enterprise)
  • /e2e-oss - Run OSS tests, auto-fix failures, re-run until passing
  • /e2e-ee - Run Enterprise tests, auto-fix failures, re-run until passing
  • /e2e-create - Create a new test following existing patterns

Note: You can have the tests repeat to guarantee no flakiness

  • /e2e 5 → Runs all tests with E2E_REPEAT=5 (runs once, then 5 more times if passing)
  • /e2e-oss 5 → Same for OSS tests only
  • /e2e-ee 5 → Same for enterprise tests only
image

HTML Reports

  • Interactive dashboard with search/filter
  • Test timeline and duration metrics
  • Detailed error messages with stack traces

e.g. this is a downloaded report, we can access reports of failures as well as videos / interactive traces.

image image image image

CI/CD Features

GitHub Integration

  • Sticky PR comments with failure summaries
  • Direct links to ZIP artifacts containing:
  • HTML report
  • Videos of failures
  • Interactive traces
  • Screenshots
  • Automatic artifact cleanup
image image

How did you test this code?

  • No code changes, all e2e refactoring
  • Run local image and keep track of any failures
image

@kyle-ssg kyle-ssg removed request for a team February 25, 2026 10:44
const CHANNEL_ID = 'C0102JZRG3G'; // infra_tests channel ID
const failedJsonPath = path.join(__dirname, 'test-results', 'failed.json');
const failedData = JSON.parse(fs.readFileSync(failedJsonPath, 'utf-8'));
const failedCount = failedData.failedTests?.length || 0;
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

File read crashes before existence check is reached

High Severity

fs.readFileSync(failedJsonPath, 'utf-8') on line 8 executes unconditionally at module load, before the fs.existsSync guard on line 82 is ever reached. If failed.json doesn't exist, the script crashes with an unhandled ENOENT error. Since this script only runs on CI test failures (if: failure()), the file may well be absent — for example, when global setup fails before any test executes. The existence check and early process.exit(0) are dead code in the missing-file scenario. Moving the file read after the existence check (or into main()) would fix this.

Additional Locations (1)

Fix in Cursor Fix in Web

API_IMAGE: ${{ inputs.api-image }}
E2E_IMAGE: ${{ inputs.e2e-image }}
E2E_CONCURRENCY: ${{ inputs.concurrency }}
E2E_RETRIES: 2
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

E2E_RETRIES not forwarded to Docker container in CI

Medium Severity

E2E_RETRIES: 2 is set in the CI workflow step env but never reaches the Docker container. The Makefile explicitly forwards E2E_CONCURRENCY to the container via cross-env in the sh -c command, but E2E_RETRIES is not included. The docker-compose-e2e-tests.yml frontend service environment section also doesn't list it. So run-with-retry.ts inside the container always uses the default value of 1, making the CI setting ineffective.

Additional Locations (1)

Fix in Cursor Fix in Web

Co-authored-by: Claude Sonnet 4.5 <noreply@anthropic.com>
Copy link

@cursor cursor bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes and found 2 potential issues.

Bugbot Autofix is OFF. To automatically fix reported issues with Cloud Agents, enable Autofix in the Cursor dashboard.

const CHANNEL_ID = 'C0102JZRG3G'; // infra_tests channel ID
const failedJsonPath = path.join(__dirname, 'test-results', 'failed.json');
const failedData = JSON.parse(fs.readFileSync(failedJsonPath, 'utf-8'));
const failedCount = failedData.failedTests?.length || 0;
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

File read crashes before existence check executes

Medium Severity

The top-level fs.readFileSync(failedJsonPath, 'utf-8') on line 8 executes at module load time, before the fs.existsSync(failedJsonPath) guard on line 82. If failed.json doesn't exist (e.g., global setup failure prevents any tests from running), the script crashes with an unhandled error instead of gracefully exiting. The existence check needs to be moved before the file read.

Additional Locations (1)

Fix in Cursor Fix in Web

|| (docker compose logs flagsmith-api; exit 1)
@echo "Running E2E tests..."
@docker compose run --name e2e-test-run frontend \
sh -c 'npx cross-env E2E_CONCURRENCY=${E2E_CONCURRENCY} npm run test -- $(opts)' \
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

E2E_RETRIES not forwarded to Docker container

Medium Severity

The Makefile test target passes E2E_CONCURRENCY via cross-env to the Docker container but omits E2E_RETRIES. The CI workflow sets E2E_RETRIES: 2 as a step-level env var, but since the Makefile doesn't include it in the cross-env command and it's not in docker-compose-e2e-tests.yml, the test runner inside the container defaults to 1 retry instead of the intended 2.

Additional Locations (1)

Fix in Cursor Fix in Web

@talissoncosta talissoncosta linked an issue Feb 25, 2026 that may be closed by this pull request
@talissoncosta
Copy link
Contributor

talissoncosta commented Feb 27, 2026

Great work on the Playwright migration @kyle-ssg ! The DX improvements (trace viewer, DOM snapshots, interactive UI mode) are huge.

I tested extensively using both /e2e and make test. Here are my findings:

Test Results

Using make test with --grep @oss:

10 passed ✅

Using make test with --grep @enterprise:

4 passed, 2 failed ❌ (change-request-test, roles-test)

Using /e2e (all tests):

14 passed, 2 failed ❌ (same tests)

Observations

1. Enterprise tests fail against OSS API

Two tests consistently fail locally:

  • change-request-test → POST /create-change-request/ returns 405
  • roles-test → POST /roles/ returns 405

Root cause: docker-compose-e2e-tests.yml uses target: oss-api, but these tests require enterprise-only endpoints.

2. Concurrency mismatch

  • .claude/commands/e2e.md uses E2E_CONCURRENCY=20 → causes browser crashes locally
  • Makefile uses E2E_CONCURRENCY=3 → stable

3. waitForTimeout() anti-patterns

Found instances in e2e-helpers.playwright.ts, though e2e.md states "NEVER use page.waitForTimeout()".

CI handles OSS/Enterprise correctly

Looking at platform-pull-request.yml:

Job API Image Tests
run-e2e-tests oss-api --grep @oss
run-e2e-tests-private-cloud private-cloud-unified --grep "@oss|@enterprise"

Can't build private-cloud locally

Tried changing to target: private-cloud-unified but build fails - requires github_private_cloud_token for private repos.

Questions

  1. Is --grep @oss the intended way to run tests locally?

  2. Should docs/commands default to OSS-only tests for local development?

  3. Should we align concurrency settings? (Makefile uses 3, /e2e command uses 20)


None of these are blockers. The PR is really good and ready to merge! I just wanted to raise these observations for awareness and to clarify the expected local development workflow.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

api Issue related to the REST API chore front-end Issue related to the React Front End Dashboard

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Migrate E2E tests to playwright

3 participants