Skip to content

Improve instrumentation test reliability with Compose waitUntil#170

Merged
kirklandsign merged 16 commits into
mainfrom
itest-timing
Jan 22, 2026
Merged

Improve instrumentation test reliability with Compose waitUntil#170
kirklandsign merged 16 commits into
mainfrom
itest-timing

Conversation

@kirklandsign
Copy link
Copy Markdown
Contributor

@kirklandsign kirklandsign commented Jan 21, 2026

Replace Thread.sleep calls with Compose's waitUntil for proper test synchronization, eliminating race conditions
Remove "Please Select a Model" popup dialog in favor of a system message in chat
Remove "Delete Chat History" confirmation dialog for streamlined UX
Add clearChatHistory() helper to ensure clean test state between tests
Fix various test timing issues by using proper Compose testing APIs

…zation

Use Compose Test Rule's waitUntil() instead of Thread.sleep() throughout
UIWorkflowTest to improve test reliability and reduce flakiness. This
approach waits for actual UI state changes rather than arbitrary delays.

- Replace all Thread.sleep calls with composeTestRule.waitUntil()
- Wait for dialogs to appear/disappear using semantic node checks
- Wait for button enabled/disabled state changes
- Increase assertModelResponseNotEmpty timeout to 10 seconds
@meta-cla meta-cla Bot added the CLA Signed This label is managed by the Meta Open Source bot. label Jan 21, 2026
@kirklandsign kirklandsign marked this pull request as ready for review January 21, 2026 23:07
@kirklandsign kirklandsign changed the title Replace Thread.sleep with Compose waitUntil for proper test synchroni… Replace Thread.sleep with Compose waitUntil for proper test sync Jan 21, 2026
Tests that check for "t/s" metrics or "Successfully loaded" text
could get false positives from previous test runs' chat history.
This adds a clearChatHistory() helper that navigates to settings
and clicks Clear Chat History before tests that rely on detecting
new generation output.
@kirklandsign kirklandsign changed the title Replace Thread.sleep with Compose waitUntil for proper test sync Improve instrumentation test reliability with Compose waitUntil Jan 22, 2026
private const val RESPONSE_TAG = "LLAMA_RESPONSE"
private const val DEFAULT_MODEL_FILE = "stories110M.pte"
private const val DEFAULT_TOKENIZER_FILE = "tokenizer.model"
private const val DEFAULT_TOKENIZER_FILE = "stories.model"
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

is this correct? :0

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Not correct. Added more

@kirklandsign kirklandsign merged commit 895079c into main Jan 22, 2026
2 checks passed
@kirklandsign kirklandsign deleted the itest-timing branch January 22, 2026 02:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CLA Signed This label is managed by the Meta Open Source bot.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants