Skip to content

[BUG][PLAYWRIGHT]: Test ordering contamination causes 6 Playwright tests to fail in full suite #2867

@crivetimihai

Description

@crivetimihai

Description

6 Playwright E2E tests pass when run individually but fail when run as part of the full test suite. This is caused by test ordering contamination — state from earlier tests leaks into subsequent tests.

Affected Tests

MCP Registry tests (5 tests)

  • test_registry_panel_loads
  • test_registry_server_cards_display
  • test_registry_search_functionality
  • test_registry_refresh_button
  • test_registry_server_card_details

All fail with #server-grid not being visible. The #server-grid element is loaded via HTMX partial from /admin/mcp-registry/partial and depends on the MCP Registry tab being properly initialized. When previous tests leave the page in an unexpected state, the HTMX partial load doesn't complete before the assertion timeout.

Server delete test (1 test)

  • test_delete_server_ui_button

Fails at page.reload() because the server creation JS handler triggers window.location.href = redirectUrl which races with the reload.

Team edit settings test (1 test)

  • test_edit_settings_button

Passes individually, fails when run with other TestTeams tests. Test ordering contamination from prior team CRUD operations.

Steps to Reproduce

# Full suite - tests fail
make test-ui-headless

# Individual test - passes
pytest tests/playwright/test_mcp_registry.py::TestMCPRegistry::test_registry_panel_loads -v
pytest tests/playwright/test_organization.py::TestTeams::test_edit_settings_button -v

Root Cause

Test isolation is insufficient — tests share browser state (page, cookies, DOM) and prior test execution leaves the application in a state that breaks subsequent test assumptions. Possible causes:

  • HTMX partials not fully loaded/settled before next test starts
  • Navigation state (active tab, sidebar) carried over between tests
  • Stale DOM elements from prior HTMX swaps

Expected Behavior

All tests should pass regardless of execution order.

Environment

  • Playwright with Chromium
  • HTMX + Alpine.js admin UI
  • FastAPI backend

Metadata

Metadata

Assignees

Labels

COULDP3: Nice-to-have features with minimal impact if left out; included if time permitsbugSomething isn't workingplaywrightAutomated UI testing with playwrighttest-automationAutomated testingtestingTesting (unit, e2e, manual, automated, etc)uiUser Interface

Type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions