fix: Resolve E2E test deadlocks and API configuration issues#6648
Closed
talissoncosta wants to merge 4 commits intochore/playwrightfrom
Closed
fix: Resolve E2E test deadlocks and API configuration issues#6648talissoncosta wants to merge 4 commits intochore/playwrightfrom
talissoncosta wants to merge 4 commits intochore/playwrightfrom
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.
|
Contributor
Docker builds report
|
Contributor
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
kyle-ssg
reviewed
Feb 3, 2026
| flagsmithClientAPI: 'http://flagsmith-api:8000/api/v1/', | ||
|
|
||
| flagsmithClientEdgeAPI: 'https://edge.api.flagsmith.com/api/v1/', | ||
| flagsmithClientEdgeAPI: 'http://flagsmith-api:8000/api/v1/', |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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