-
Notifications
You must be signed in to change notification settings - Fork 614
[ENHANCEMENT][TESTING][UI]: Improve Playwright test resilience and developer experience #2632
Copy link
Copy link
Closed
Task
Copy link
Labels
COULDP3: Nice-to-have features with minimal impact if left out; included if time permitsP3: Nice-to-have features with minimal impact if left out; included if time permitsplaywrightAutomated UI testing with playwrightAutomated UI testing with playwrightpythonPython / backend development (FastAPI)Python / backend development (FastAPI)test-automationAutomated testingAutomated testingtestingTesting (unit, e2e, manual, automated, etc)Testing (unit, e2e, manual, automated, etc)uiUser InterfaceUser Interface
Milestone
Description
Summary
Enhance the Playwright UI testing infrastructure to improve test resilience, developer experience, and alignment with the recommended docker-compose testing stack.
Problem
- Endpoint mismatch: Default test target (
localhost:8000) didn't match the recommended docker-compose nginx endpoint (localhost:8080) - Auth brittleness: Tests failed when admin credentials didn't match the running gateway, with no fallback mechanism
- Poor preflight guidance: No validation or guidance before running tests, leading to confusing failures
- Test data collisions: Hardcoded server names caused conflicts when tests ran multiple times
- Missing artifact capture: No always-on screenshot/video targets for debugging intermittent failures
Changes
Configuration & Defaults
- Default
TEST_BASE_URLchanged fromlocalhost:8000tolocalhost:8080(docker-compose nginx) - Added
playwright-preflighttarget that validates gateway availability and shows helpful guidance - Made
TEST_BASE_URLconfigurable via environment variable for all make targets
Authentication Resilience
- Added JWT cookie fallback (
_set_admin_jwt_cookie()) when UI login fails with unknown credentials - Fallback uses
_create_jwt_token()to seed a valid admin JWT, bypassing form login - Fallback can be disabled via
PLAYWRIGHT_DISABLE_JWT_FALLBACK=true - Auth tests now skip gracefully instead of failing when credentials are invalid
Test Stability
- Fixed admin page URL from
/adminto/admin/for consistent navigation - Added UUID suffix to test server names to prevent naming collisions
- Improved login flow handling with better status detection
Artifact Capture
- Added
make test-ui-screenshotsfor always-on screenshot capture - Enhanced
make test-ui-recordto capture both videos and screenshots - Updated
.gitignorefortest-results/,reports/,videos/,screenshots/
Documentation
- Updated
TESTING.mdwith preflight guidance and new targets - Updated
tests/playwright/README.mdwith docker-compose workflow - Clarified artifact storage locations
Technical Details
| File | Change |
|---|---|
playwright.config.py |
Default base URL → localhost:8080 |
tests/playwright/conftest.py |
JWT fallback, URL updates |
tests/playwright/pages/admin_page.py |
Trailing slash fix |
tests/playwright/test_admin_ui.py |
UUID server names |
tests/playwright/test_auth.py |
Graceful skip on invalid credentials |
Makefile |
playwright-preflight, test-ui-screenshots, preflight in all targets |
.gitignore |
Playwright artifact directories |
TESTING.md, README.md |
Documentation updates |
Testing
# Start the recommended stack
make testing-up
# Run tests with new defaults
make test-ui-headless
# Override endpoint if needed
TEST_BASE_URL=http://localhost:8000 make test-uiRelated Issues
- Parent Epic: [EPIC][TESTING][UI]: Comprehensive Playwright E2E Test Suite for MCP Gateway Admin UI #2519 ([EPIC][TESTING][UI]: Comprehensive Playwright E2E Test Suite)
- Related: [BUG][TESTING]: Playwright tests not updated to use admin email/password login credentials #2136 (Playwright tests not updated to use admin email/password login credentials)
- Related: [CHORE]: Implement comprehensive Playwright test automation for the entire MCP Gateway Admin UI with Makefile targets and GitHub Actions #255 (Implement comprehensive Playwright test automation)
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
COULDP3: Nice-to-have features with minimal impact if left out; included if time permitsP3: Nice-to-have features with minimal impact if left out; included if time permitsplaywrightAutomated UI testing with playwrightAutomated UI testing with playwrightpythonPython / backend development (FastAPI)Python / backend development (FastAPI)test-automationAutomated testingAutomated testingtestingTesting (unit, e2e, manual, automated, etc)Testing (unit, e2e, manual, automated, etc)uiUser InterfaceUser Interface