Skip to content

Conversation

@uinstinct
Copy link
Contributor

@uinstinct uinstinct commented Dec 3, 2025

Description

There are some other tests which are causing the macos tests to fail because tui is not updated. This PR fixes that

This is a follow-up on #8909

AI Code Review

  • Team members only: AI review runs automatically when PR is opened or marked ready for review
  • Team members can also trigger a review by commenting @continue-review

Checklist

  • [] I've read the contributing guide
  • [] The relevant docs, if any, have been updated or created
  • [] The relevant tests, if any, have been updated or created

Screen recording or screenshot

[ When applicable, please include a short screen recording or screenshot - this makes it much easier for us as contributors to review and understand your changes. See this PR as a good example. ]

Tests

[ What tests were added or updated to ensure the changes work as expected? ]


Summary by cubic

Stabilizes CLI TUI tests by centralizing a waitForCondition helper and updating tests to use it, fixing macOS failures caused by UI timing.

  • Bug Fixes
    • Added waitForCondition to TUIChat.testHelper.ts and used in edit message, file search, and slash command tests.
    • Replaced ad-hoc timers and inconsistent waits to ensure UI updates are complete before assertions.
    • Reduces flakiness in macOS CI runs.

Written for commit 3db6091. Summary will update automatically on new commits.

@uinstinct uinstinct requested a review from a team as a code owner December 3, 2025 12:54
@uinstinct uinstinct requested review from RomneyDa and removed request for a team December 3, 2025 12:54
@continue
Copy link
Contributor

continue bot commented Dec 3, 2025

Keep this PR in a mergeable state →

Learn more

All Green is an AI agent that automatically:

✅ Addresses code review comments

✅ Fixes failing CI checks

✅ Resolves merge conflicts

@dosubot dosubot bot added the size:M This PR changes 30-99 lines, ignoring generated files. label Dec 3, 2025
@continue
Copy link
Contributor

continue bot commented Dec 3, 2025

Documentation Updates

Added documentation for test helper functions that were introduced or consolidated in this PR:

  • waitForCondition(): Documents the newly consolidated helper function that replaces duplicated code and provides a more reliable way to wait for UI conditions compared to fixed timeouts
  • waitForNextRender(): Added documentation for this existing helper that wasn't previously documented
  • Best Practices: Updated to recommend using waitForCondition() over fixed timeouts for more reliable, less flaky tests

These changes keep the test documentation in sync with the codebase improvements made in this PR.

Copy link
Contributor

@cubic-dev-ai cubic-dev-ai bot left a comment

Choose a reason for hiding this comment

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

4 issues found across 4 files

Prompt for AI agents (all 4 issues)

Check if these issues are valid — if so, understand the root cause of each and fix them.


<file name="extensions/cli/src/ui/__tests__/TUIChat.fileSearch.test.tsx">

<violation number="1" location="extensions/cli/src/ui/__tests__/TUIChat.fileSearch.test.tsx:39">
P2: `waitForCondition` is async but this call never awaits it, so the test continues to assert against the stale frame before the UI updates.</violation>

<violation number="2" location="extensions/cli/src/ui/__tests__/TUIChat.fileSearch.test.tsx:63">
P2: The wait for `@@test` happens after `const frame = lastFrame();`, so the assertions continue to use the pre-wait frame and never see the updated output.</violation>
</file>

<file name="extensions/cli/src/ui/__tests__/TUIChat.slashCommands.test.tsx">

<violation number="1" location="extensions/cli/src/ui/__tests__/TUIChat.slashCommands.test.tsx:34">
P2: `waitForCondition` is asynchronous but is invoked without `await`, so the test continues asserting before the UI updates and stays flaky.</violation>
</file>

<file name="extensions/cli/src/ui/__tests__/TUIChat.testHelper.ts">

<violation number="1" location="extensions/cli/src/ui/__tests__/TUIChat.testHelper.ts:474">
P2: waitForCondition never throws when the timeout elapses, so tests continue even if the condition is never met. Throw an error after the loop so unmet conditions actually fail the test.</violation>
</file>

Reply to cubic to teach it or ask questions. Re-run a review with @cubic-dev-ai review this PR

Copy link
Collaborator

@RomneyDa RomneyDa left a comment

Choose a reason for hiding this comment

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

lgtm

@dosubot dosubot bot added the lgtm This PR has been approved by a maintainer label Dec 3, 2025
@github-project-automation github-project-automation bot moved this from Todo to In Progress in Issues and PRs Dec 3, 2025
@RomneyDa RomneyDa merged commit bbb9d9c into continuedev:main Dec 3, 2025
56 of 57 checks passed
@github-project-automation github-project-automation bot moved this from In Progress to Done in Issues and PRs Dec 3, 2025
@github-actions github-actions bot locked and limited conversation to collaborators Dec 3, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

lgtm This PR has been approved by a maintainer size:M This PR changes 30-99 lines, ignoring generated files.

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

2 participants