test(playwright): run MCP Chat AUT describe serially to avoid shared-app race#29169
test(playwright): run MCP Chat AUT describe serially to avoid shared-app race#29169pmbrull wants to merge 2 commits into
Conversation
…app race The MCP Chat sidebar-navigation tests share one globally-named installed app (McpChatApplication) created in beforeAll and hard-deleted in afterAll. The project runs `fullyParallel`, so the describe's tests are split across workers and beforeAll/afterAll execute per worker. The fast direct-navigation test finishes first and its afterAll hardDeletes the app while the slower sidebar-dependent tests are still polling for `app-bar-item-mcp-chat`, so the item never renders and they time out. Force serial execution so the shared app stays installed for the whole describe. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
❌ PR checklist incompleteThis PR cannot be merged until the following are addressed on its linked issue:
The fields live on the linked issue in the Shipping project (open the issue → right sidebar → Projects). After you set them, re-run this check (or push a commit) — issue/project changes do not re-trigger it automatically. Maintainers can bypass this check by adding the |
Code Review ✅ ApprovedForces Playwright MCP Chat tests to run serially to prevent worker-level race conditions from deleting the shared application prematurely. The spec now maintains the required app state throughout the test suite. OptionsDisplay: compact → Showing less information. Comment with these commands to change:
Was this helpful? React with 👍 / 👎 | Gitar |
|



Problem
The
MCP Chat - Sidebar NavigationPlaywright spec (McpChat.spec.ts, added in #26343) fails deterministically in the nightly AUT runs. Two of its three tests fail every night:MCP Chat nav item should appear in sidebar when app is installed→expect(getByTestId('app-bar-item-mcp-chat')).toBeVisible()→ element(s) not foundClicking MCP Chat sidebar nav should navigate to chat page→ 60s timeout waiting for the same sidebar itemThe third test,
Send button should enable when input has text, passes — it reaches the page via a directpage.goto('/mcp-chat')and does not depend on the sidebar item.Root cause
The describe shares one globally-named installed app (
McpChatApplication): installed inbeforeAll, hard-deleted inafterAll. The project runs withfullyParallel: true(workers: 3), so:beforeAll/afterAllrun once per worker.afterAllthenDELETE …?hardDelete=trueremoves the shared app.GET /api/v1/apps/installedno longer returns it, the UI'sApplicationsProviderbuilds noMcpChatPlugin, and theapp-bar-item-mcp-chatsidebar entry never renders.It is deterministic (not flaky) because the direct-navigation test is always the quickest to reach its
afterAll. The/mcp-chatroute is registered unconditionally, which is why that test still passes.Fix
Force the describe to run serially in a single worker:
beforeAll/afterAllthen run exactly once andafterAllonly fires after all three tests complete, so the shared app stays installed for the whole describe. No production code change — test isolation only.🤖 Generated with Claude Code
Greptile Summary
Fixes a deterministic nightly AUT failure in the
MCP Chat - Sidebar Navigationspec by configuring the describe block to run in serial mode, preventing worker-level race conditions around the sharedMcpChatApplicationinstall/teardown lifecycle.fullyParallel: true, each worker ran its ownbeforeAll/afterAll— the fastest test'safterAllhard-deleted the app while slower sibling tests were still asserting the sidebar item.test.describe.configure({ mode: 'serial' })— ensuresbeforeAll/afterAllfire exactly once andafterAllonly runs after all three tests finish. No production code is touched.Confidence Score: 5/5
Safe to merge — one-line test configuration change with no production code impact.
The change is a single test.describe.configure({ mode: 'serial' }) call that corrects a well-documented, deterministic race condition in the test suite. It does not touch any application code, only test isolation semantics. The comment accurately describes the problem, and the fix is the standard Playwright-recommended approach for describes that share global state through beforeAll/afterAll.
No files require special attention.
Important Files Changed
Sequence Diagram
%%{init: {'theme': 'neutral'}}%% sequenceDiagram participant W1 as Worker 1 participant W2 as Worker 2 participant W3 as Worker 3 participant API as OpenMetadata API Note over W1,W3: BEFORE (fullyParallel, no serial mode) W1->>API: beforeAll: POST /api/v1/apps (install McpChatApplication) W2->>API: beforeAll: POST /api/v1/apps (409 already installed) W3->>API: beforeAll: POST /api/v1/apps (409 already installed) W3->>W3: Test: Send button enables (page.goto, fast ~4.5s) W3->>API: "afterAll: DELETE McpChatApplication?hardDelete=true" Note over W1,W2: App deleted — sidebar item disappears W1--xW1: FAIL: app-bar-item-mcp-chat not found W2--xW2: FAIL: 60s timeout waiting for sidebar item Note over W1,W3: AFTER (test.describe.configure serial mode) W1->>API: beforeAll: POST /api/v1/apps (runs once) W1->>W1: Test 1: MCP Chat nav item appears in sidebar W1->>W1: Test 2: Clicking nav navigates to chat page W1->>W1: Test 3: Send button enables with text W1->>API: "afterAll: DELETE McpChatApplication?hardDelete=true"%%{init: {'theme': 'base', 'themeVariables': {"darkMode": true, "background": "#0d1117", "primaryColor": "#21262d", "primaryTextColor": "#e6edf3", "primaryBorderColor": "#8b949e", "lineColor": "#8b949e", "textColor": "#e6edf3", "edgeLabelBackground": "#161b22", "actorBkg": "#21262d", "actorBorder": "#8b949e", "actorTextColor": "#e6edf3", "actorLineColor": "#8b949e", "signalColor": "#8b949e", "signalTextColor": "#e6edf3", "noteBkgColor": "#373320", "noteBorderColor": "#d4a72c", "noteTextColor": "#f0e6c0", "labelBoxBkgColor": "#21262d", "labelBoxBorderColor": "#8b949e", "labelTextColor": "#e6edf3", "loopTextColor": "#e6edf3", "activationBkgColor": "#30363d", "activationBorderColor": "#8b949e"}}}%% sequenceDiagram participant W1 as Worker 1 participant W2 as Worker 2 participant W3 as Worker 3 participant API as OpenMetadata API Note over W1,W3: BEFORE (fullyParallel, no serial mode) W1->>API: beforeAll: POST /api/v1/apps (install McpChatApplication) W2->>API: beforeAll: POST /api/v1/apps (409 already installed) W3->>API: beforeAll: POST /api/v1/apps (409 already installed) W3->>W3: Test: Send button enables (page.goto, fast ~4.5s) W3->>API: "afterAll: DELETE McpChatApplication?hardDelete=true" Note over W1,W2: App deleted — sidebar item disappears W1--xW1: FAIL: app-bar-item-mcp-chat not found W2--xW2: FAIL: 60s timeout waiting for sidebar item Note over W1,W3: AFTER (test.describe.configure serial mode) W1->>API: beforeAll: POST /api/v1/apps (runs once) W1->>W1: Test 1: MCP Chat nav item appears in sidebar W1->>W1: Test 2: Clicking nav navigates to chat page W1->>W1: Test 3: Send button enables with text W1->>API: "afterAll: DELETE McpChatApplication?hardDelete=true"Reviews (2): Last reviewed commit: "Merge branch 'main' into pmbrull/fix-mcp..." | Re-trigger Greptile