Skip to content

Frontend suite is flaky: a date-expiring fixture plus three tests racing the 5s default timeout #27

Closed

Description

@superman2003

Summary

The frontend suite is non-deterministic: which tests fail depends on parallel
scheduling, not on behaviour. Two separate causes.

1. A test that expires by wall-clock date

DevicePairingPanel.test.tsx hard-codes a pairing expiry:

const createDevicePairing = vi.fn(async () => ({
  ...
  expires_at: '2026-08-31T05:05:00Z',

pairingLiveStatus returns 'failed' once now >= expiresAt, so after
2026-08-31 the panel renders the failed state and the assertion under test —

expect(screen.getByText('等待连接')).toBeVisible();

— can never pass again. This test was green when written and is now
permanently red, with a failure message that points at a missing status label
rather than at the expired fixture.

2. Heavy suites sitting just under the 5s default timeout

These pass in isolation but fail under full-suite parallel load:

Test Isolated Under load
PluginsSettings > runs an official CLI import ... 2.5s timeout at 5s
AgentRegistryView > builds a Registry-compatible definition ... ~3.3s timeout at 5s
CodexModelCatalogEditor > loads on expansion and saves ... ~2.0s timeout at 5s

Observed directly: two consecutive full runs of the same tree failed on
different tests. The CLI-import case is the worst offender because it drives
~90 characters through user.type, one keystroke at a time.

vitest.config.ts sets no testTimeout, so all of these run against the 5s
default.

Impact

CI failures that do not reproduce locally, and that change identity between
runs. That trains people to re-run the job instead of reading it.

Reproduce

cd frontend
pnpm exec vitest run          # note which tests fail
pnpm exec vitest run          # note that the set differs

What #20 does

Derives expires_at from the current time, raises testTimeout, and replaces
the character-by-character command entry with a paste. Related: #21

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