[Draft] Address flaky tests#3754
Conversation
📝 WalkthroughWalkthroughThis change modifies Estimated code review effort🎯 1 (Trivial) | ⏱️ ~5 minutes 🚥 Pre-merge checks | ✅ 2 | ❌ 3❌ Failed checks (2 warnings, 1 inconclusive)
✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@app/instrumentation-tests/src/org/commcare/androidTests/CaseClaimTest.java`:
- Around line 131-132: The current wait uses waitForView(withText(name)) via
onView(isRoot()) which can match the search EditText; change the matcher to
exclude EditText so it targets the result row (e.g., combine with
not(isAssignableFrom(EditText.class)) or equivalent) and use that same matcher
both in the waitForView(...) call and when performing the subsequent click so
you synchronize on and interact with the actual case result rather than the
search field.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Pro Plus
Run ID: 24419774-58eb-4cb6-8ff8-68fe080fdd5c
📒 Files selected for processing (1)
app/instrumentation-tests/src/org/commcare/androidTests/CaseClaimTest.java
| onView(isRoot()) | ||
| .perform(waitForView(withText(name), 10000, true)); |
There was a problem hiding this comment.
Wait condition is too broad and can pass before results load.
waitForView(withText(name), ...) can match the already-filled search EditText, so this may not actually wait for the result row. Use a matcher that excludes EditText (and reuse it for the click) so synchronization targets the case result itself.
Proposed fix
+import static org.hamcrest.Matchers.not;
@@
- onView(isRoot())
- .perform(waitForView(withText(name), 10000, true));
- onView(withText(name))
+ onView(isRoot())
+ .perform(waitForView(allOf(withText(name), not(withClassName(endsWith("EditText")))), 10000, true));
+ onView(allOf(withText(name), not(withClassName(endsWith("EditText")))))
.perform(click());🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In `@app/instrumentation-tests/src/org/commcare/androidTests/CaseClaimTest.java`
around lines 131 - 132, The current wait uses waitForView(withText(name)) via
onView(isRoot()) which can match the search EditText; change the matcher to
exclude EditText so it targets the result row (e.g., combine with
not(isAssignableFrom(EditText.class)) or equivalent) and use that same matcher
both in the waitForView(...) call and when performing the subsequent click so
you synchronize on and interact with the actual case result rather than the
search field.
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #3754 +/- ##
============================================
+ Coverage 24.71% 24.80% +0.08%
- Complexity 4224 4255 +31
============================================
Files 938 938
Lines 57220 57220
Branches 6847 6847
============================================
+ Hits 14144 14191 +47
+ Misses 41271 41224 -47
Partials 1805 1805 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
df088d8 to
d340d76
Compare
…esults
Product Description
Technical Summary
Safety Assurance
Safety story
Automated test coverage
Labels and Review