Skip to content

deflake a few tests#21605

Draft
Hona wants to merge 21 commits intoanomalyco:devfrom
Hona:deflake-a-few-windows-tests-yessssirrrrrrrrrrrrrrrrrrrrrrrrrrr
Draft

deflake a few tests#21605
Hona wants to merge 21 commits intoanomalyco:devfrom
Hona:deflake-a-few-windows-tests-yessssirrrrrrrrrrrrrrrrrrrrrrrrrrr

Conversation

@Hona
Copy link
Copy Markdown
Member

@Hona Hona commented Apr 9, 2026

No description provided.

@Hona Hona requested a review from adamdotdevin as a code owner April 9, 2026 02:48
Copilot AI review requested due to automatic review settings April 9, 2026 02:48
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR aims to reduce E2E flakiness in packages/app by replacing timing-based waits and force clicks with more deterministic polling/assertions and more resilient UI interaction helpers.

Changes:

  • Refactors multiple E2E specs to use expect.poll(...), stronger visibility/selection assertions, and more stable locators.
  • Updates shared E2E helpers (actions.ts) to improve menu/popover opening behavior and session waiting.
  • Aligns E2E selectors with current UI attributes (e.g., model variant control data-action).

Reviewed changes

Copilot reviewed 15 out of 15 changed files in this pull request and generated no comments.

Show a summary per file
File Description
packages/app/e2e/thinking-level.spec.ts Makes model-variant cycling deterministic by selecting an explicit next option instead of “text changed”.
packages/app/e2e/terminal/terminal-tabs.spec.ts Adds state-based polling and stronger selection assertions to reduce terminal tab flake.
packages/app/e2e/terminal/terminal-init.spec.ts Ensures focus is restored to the prompt before keybind-driven terminal creation.
packages/app/e2e/status/status-popover.spec.ts Adds a polling-based tab picker to avoid races when switching status popover tabs.
packages/app/e2e/settings/settings.spec.ts Introduces helpers for localStorage/CSS reads and replaces fixed delays with polling/assertions.
packages/app/e2e/settings/settings-keybinds.spec.ts Refactors repeated keybind-setting logic into helpers and replaces fixed delays with polling/assertions.
packages/app/e2e/session/session-model-persistence.spec.ts Increases timeout and adds a poll to ensure model changes are observed before assertions.
packages/app/e2e/session/session-composer-dock.spec.ts Refactors permission-flow tests to rely on reloads and removes a prior “pending resolved” sync hook.
packages/app/e2e/selectors.ts Updates the model variant selector to match current UI data-action.
packages/app/e2e/projects/workspaces.spec.ts Removes forced menu clicks in favor of improved menu interaction helper behavior.
packages/app/e2e/projects/workspace-new-session.spec.ts Removes forced click and adds readiness waits to stabilize post-session creation interactions.
packages/app/e2e/projects/projects-switch.spec.ts Removes forced clicks for switching projects/sessions.
packages/app/e2e/projects/projects-close.spec.ts Removes forced click when closing a project from its menu.
packages/app/e2e/files/file-open.spec.ts Uses an explicit tab role/name assertion for opened file verification.
packages/app/e2e/actions.ts Strengthens settings/menu/popover helpers, improves click fallbacks, and extends waitSession timeout/logic.
Comments suppressed due to low confidence (1)

packages/app/e2e/session/session-composer-dock.spec.ts:263

  • withMockPermission no longer provides a synchronization point to ensure the mocked permission reply request has actually been observed/handled (i.e., pending drained) before the callback returns and routes are unregistered. This can race with the immediate page.reload() in callers: the reload can cancel the reply request, leaving pending unchanged and causing the next reload to still show the permission dock, or causing subsequent requests to hit the real backend after unroute. Consider restoring an explicit “wait until pending is empty / reply request completed” step (either inside withMockPermission or exposed to callers) before reloading and before unroute cleanup runs.
  try {
    return await fn()
  } finally {
    await page.unroute(listUrl, list)
    for (const item of replyUrls) {
      await page.unroute(item, reply)
    }
    if (sessionList) await page.unroute("**/session?*", sessionList)
  }

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@Hona Hona marked this pull request as draft April 9, 2026 10:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants