Skip to content

Fix flaky VerificationCodeScreenTest overflow menu test#6139

Closed
SaintPatrck wants to merge 2 commits intomainfrom
fix-flaky-test
Closed

Fix flaky VerificationCodeScreenTest overflow menu test#6139
SaintPatrck wants to merge 2 commits intomainfrom
fix-flaky-test

Conversation

@SaintPatrck
Copy link
Contributor

🎟️ Tracking

N/A

📔 Objective

Fix flaky VerificationCodeScreenTest > on overflow item click should display menu test that intermittently fails with FutureGarbageCollectedException in CI.

Root Cause: The test used .isDisplayed() matcher which returns immediately without waiting for Compose recomposition, creating a race condition with asynchronous popup rendering.

Solution: Replace .isDisplayed() with .assertIsDisplayed() to properly wait for the Compose UI to settle before verification. This aligns with the established pattern used in other menu interaction tests within the same file (lines 426-455).

⏰ Reminders before review

  • Contributor guidelines followed
  • All formatters and local linters executed and passed
  • Written new unit and / or integration tests where applicable
  • Protected functional changes with optionality (feature flags)
  • Used internationalization (i18n) for all UI strings
  • CI builds passed
  • Communicated to DevOps any deployment requirements
  • Updated any necessary documentation (Confluence, contributing docs) or informed the documentation team

🦮 Reviewer guidelines

  • 👍 (:+1:) or similar for great changes
  • 📝 (:memo:) or ℹ️ (:information_source:) for notes or general info
  • ❓ (:question:) for questions
  • 🤔 (:thinking:) or 💭 (:thought_balloon:) for more open inquiry that's not quite a confirmed issue and could potentially benefit from discussion
  • 🎨 (:art:) for suggestions / improvements
  • ❌ (:x:) or ⚠️ (:warning:) for more significant problems or concerns needing attention
  • 🌱 (:seedling:) or ♻️ (:recycle:) for future improvements or indications of technical debt
  • ⛏ (:pick:) for minor or nitpick changes

Replace .isDisplayed() with .assertIsDisplayed() in the overflow menu
verification test to properly wait for Compose recomposition before
asserting. The previous matcher returned immediately without waiting,
causing FutureGarbageCollectedException when popup rendering was slow.

This aligns with the established pattern used in other menu interaction
tests in the same file.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
@claude
Copy link
Contributor

claude bot commented Nov 7, 2025

Claude finished @SaintPatrck's task —— View job


Review Complete

Overall Assessment: APPROVE

Correctly replaces .isDisplayed() with .assertIsDisplayed() to eliminate race conditions in flaky tests, ensuring proper wait for Compose UI state.


@github-actions
Copy link
Contributor

github-actions bot commented Nov 7, 2025

Logo
Checkmarx One – Scan Summary & Detailsba33b78d-ee87-4741-93de-aa8870f492d9

Great job! No new security vulnerabilities introduced in this pull request

@codecov
Copy link

codecov bot commented Nov 7, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 84.97%. Comparing base (9baec6e) to head (5e61c1e).
⚠️ Report is 2 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #6139      +/-   ##
==========================================
- Coverage   84.97%   84.97%   -0.01%     
==========================================
  Files         723      723              
  Lines       52746    52744       -2     
  Branches     7649     7649              
==========================================
- Hits        44822    44820       -2     
  Misses       5250     5250              
  Partials     2674     2674              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

.onAllNodesWithText(text = "Lock")
.filterToOne(hasAnyAncestor(isPopup()))
.isDisplayed()
.assertIsDisplayed()
Copy link
Collaborator

Choose a reason for hiding this comment

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

We definitely do this in other tests too.

Add `assertIsDisplayed()` before performing an accessibility action in the landscape orientation test. This ensures the Compose UI has fully settled before interaction.

The test was failing intermittently due to the UI not being ready before the test attempted to perform the action, leading to flaky behavior. This explicit assertion provides the necessary synchronization to create a more robust test.
auto-merge was automatically disabled November 11, 2025 14:20

Pull request was closed

@SaintPatrck SaintPatrck deleted the fix-flaky-test branch November 11, 2025 14:20
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