-
Notifications
You must be signed in to change notification settings - Fork 468
fix: Resolve E2E test deadlocks and API configuration issues #6648
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: chore/playwright
Are you sure you want to change the base?
Conversation
This commit fixes critical issues preventing E2E tests from running reliably locally: ## 1. Database Deadlock Fix (Backend) **File:** api/e2etests/e2e_seed_data.py **Problem:** Concurrent teardown operations caused PostgreSQL deadlocks. Two separate mechanisms were calling teardown simultaneously: - run-with-retry.ts calling manual teardown after test failure - globalSetup.playwright.ts calling automatic teardown before retry runs **Solution:** Added PostgreSQL advisory locks to serialise teardown/seed operations, preventing concurrent execution and database conflicts. ## 2. Edge API Configuration Fix (Frontend) **File:** frontend/env/project_e2e.js **Problem:** E2E environment was configured to call external production Edge API (https://edge.api.flagsmith.com/api/v1/), which is unreachable from Docker containers, causing network errors and 6 test failures. **Solution:** Changed API endpoints to local Docker API (http://flagsmith-api:8000/api/v1/). ## 3. Redundant Teardown Removal (Frontend) **File:** frontend/e2e/run-with-retry.ts **Problem:** Manual teardown call after test failure created race conditions with Playwright's automatic global setup teardown. **Solution:** Removed redundant manual teardown call, relying solely on Playwright's built-in lifecycle. ## 4. E2E Token Configuration (Infrastructure) **File:** frontend/docker-compose-e2e-tests.yml **Problem:** Missing E2E_TEST_TOKEN caused 401 errors from teardown endpoint. Backend expects E2E_TEST_TOKEN but only E2E_TEST_TOKEN_DEV was configured. **Solution:** Added E2E_TEST_TOKEN environment variable to frontend service. ## Test Results - **Before:** 4/10 tests passing (40%) - **After:** 10/10 tests passing (100%) - **Duration:** ~2.6 minutes - **Deadlock errors:** Zero See E2E-TEST-FIXES-COMPLETE.md for complete technical details. Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Docker builds report
|
Playwright Test Results (private-cloud)Details
🖥️ Runner: depot-ubuntu-latest-16 |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## chore/playwright #6648 +/- ##
====================================================
- Coverage 98.18% 98.15% -0.03%
====================================================
Files 1295 1293 -2
Lines 46968 46610 -358
====================================================
- Hits 46115 45751 -364
- Misses 853 859 +6 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
04bb854 to
8d936c7
Compare
The Makefile change was environment-specific for Colima and is not needed when using Docker Desktop (which has Compose V2 plugin built-in). Updated documentation to reflect 4 essential fixes instead of 5.
E2E_TEST_TOKEN_DEV is sufficient as the teardown logic uses fallback: - First tries E2E_TEST_TOKEN - Falls back to E2E_TEST_TOKEN_DEV when env is 'dev' This change reduces to 3 essential fixes only.
d39f930 to
20bfd43
Compare
for more information, see https://pre-commit.ci
| flagsmithClientAPI: 'http://flagsmith-api:8000/api/v1/', | ||
|
|
||
| flagsmithClientEdgeAPI: 'https://edge.api.flagsmith.com/api/v1/', | ||
| flagsmithClientEdgeAPI: 'http://flagsmith-api:8000/api/v1/', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this necessary ?
Summary
This PR fixes critical issues preventing E2E tests from running reliably locally. All 10 tests now pass consistently (100% pass rate).
Problems Fixed
1. Database Deadlock (Backend) 🔴 BLOCKER
File:
api/e2etests/e2e_seed_data.pyProblem: Concurrent teardown operations caused PostgreSQL deadlocks:
run-with-retry.tscalling manual teardown after test failureglobalSetup.playwright.tscalling automatic teardown before retry runsSolution: Added PostgreSQL advisory locks to serialise teardown/seed operations.
2. Edge API Configuration (Frontend) 🔴 BLOCKER
File:
frontend/env/project_e2e.jsProblem: E2E environment configured to call external production Edge API (
https://edge.api.flagsmith.com/api/v1/), unreachable from Docker, causing 6 test failures.Solution: Changed to local Docker API (
http://flagsmith-api:8000/api/v1/).3. Redundant Teardown (Frontend) 🟡 RACE CONDITION
File:
frontend/e2e/run-with-retry.tsProblem: Manual teardown call after test failure created race conditions with Playwright's automatic teardown.
Solution: Removed redundant manual teardown, relying on Playwright's lifecycle.
Test Results
Before Fixes
After Fixes
Passing Tests
Technical Details
See E2E-TEST-FIXES-COMPLETE.md for complete technical explanation.
Running Tests Locally
Context
This PR is based on #6562 (Playwright migration) and addresses issues discovered during local testing. These fixes are essential for the migration to be production-ready.
🤖 Generated with Claude Code