Skip to content

fix(tests): stabilize flaky command palette E2E test#273

Merged
d-oit merged 1 commit into
mainfrom
fix/flaky-command-palette-test
Jun 5, 2026
Merged

fix(tests): stabilize flaky command palette E2E test#273
d-oit merged 1 commit into
mainfrom
fix/flaky-command-palette-test

Conversation

@d-oit
Copy link
Copy Markdown
Owner

@d-oit d-oit commented Jun 5, 2026

Summary

Fixes the flaky Cmd+K command palette E2E test (~1/3 failure rate).

Root Cause

CommandPalette opens with setTimeout(() => inputRef.current?.focus(), 10). The test pressed Escape immediately after toBeVisible(), but the input may not have focus yet. Escape then goes to the body instead of the input handleKeyDown.

Fix

Added toBeFocused({ timeout: 3000 }) after each palette open to ensure focus before pressing Escape.

Validation

  • 5/5 consecutive runs pass ✅ (was ~1/3 failure)
  • Lint clean ✅
  • 310 unit tests ✅

Co-authored-by: d-oit 6849456+d-oit@users.noreply.github.com

Wait for input toBeFocused() after opening palette before pressing
Escape. CommandPalette uses setTimeout(10ms) to focus input, so
Escape was sometimes sent before focus arrived.

5/5 consecutive runs pass (was ~1/3 failure rate).

Co-authored-by: d-oit <6849456+d-oit@users.noreply.github.com>
@d-oit d-oit merged commit 44e5d11 into main Jun 5, 2026
3 of 5 checks passed
@d-oit d-oit deleted the fix/flaky-command-palette-test branch June 5, 2026 15:28
@github-actions github-actions Bot added config tests Related to automated/manual tests labels Jun 5, 2026
@deepsource-io
Copy link
Copy Markdown

deepsource-io Bot commented Jun 5, 2026

DeepSource Code Review

We reviewed changes in 9b44970...0bcec59 on this pull request. Below is the summary for the review, and you can see the individual issues we found as inline review comments.

See full review on DeepSource ↗

PR Report Card

Overall Grade   Security  

Reliability  

Complexity  

Hygiene  

Code Review Summary

Analyzer Status Updated (UTC) Details
JavaScript Jun 5, 2026 3:28p.m. Review ↗
Python Jun 5, 2026 3:28p.m. Review ↗
Shell Jun 5, 2026 3:28p.m. Review ↗
SQL Jun 5, 2026 3:28p.m. Review ↗

Important

AI Review is run only on demand for your team. We're only showing results of static analysis review right now. To trigger AI Review, comment @deepsourcebot review on this thread.

@codacy-production
Copy link
Copy Markdown
Contributor

Up to standards ✅

🟢 Issues 0 issues

Results:
0 new issues

View in Codacy

🟢 Metrics 0 complexity · 0 duplication

Metric Results
Complexity 0
Duplication 0

View in Codacy

NEW Get contextual insights on your PRs based on Codacy's metrics, along with PR and Jira context, without leaving GitHub. Enable AI reviewer
TIP This summary will be updated as you push new changes.

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

Labels

config tests Related to automated/manual tests

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants