Skip to content

Flaky test: BrowserTab lists and switches page tabs for selected other sessions (waits for mock call, not render) #5624

Description

@ThomasK33

BrowserTab > lists and switches page tabs for selected other sessions (src/browser/features/RightSidebar/BrowserTab/BrowserTab.test.tsx) fails intermittently in CI.

Seen: merge-group run https://github.com/coder/xum/actions/runs/37213407246 (job Test / Unit (2/6), commit 295ef89c3b), which removed #5612 from the merge queue. The failure is a getByTestId "unable to find element" error at line 412. The rendered DOM still shows "Waiting for browser frames". #5612 does not touch BrowserTab.

Cause (from reading the test): the test waits only until listTabsMock has been called (waitFor(() => expect(listTabsMock).toHaveBeenCalledWith(...))). It then synchronously calls view.getByTestId("browser-page-tab-t2"). The tab renders only after the mocked promise resolves and React commits the update, so on a loaded runner the synchronous lookup can run first.

Local evidence (bun 1.3.12, same commit): the file alone passed 6/6. Paired with WorkspaceStore.test.ts (the first file in the same shard) it passed 3/3. The full shard 2 via scripts/test-unit-ci.sh passed. It needs CI load to show up.

Fix: replace the synchronous lookup with await view.findByTestId("browser-page-tab-t2") (or wait for the tab itself instead of the mock call). Check the neighboring tests in the file for the same "waited for the call, not the render" pattern.


Generated with xum • Model: anthropic:claude-opus-5-5 • Thinking: high

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions