-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Closes #6031 - Wrap waits with assert check; adjust timer check #6084
Closes #6031 - Wrap waits with assert check; adjust timer check #6084
Conversation
Codecov Report
@@ Coverage Diff @@
## master #6084 +/- ##
========================================
Coverage ? 14.3%
Complexity ? 326
========================================
Files ? 261
Lines ? 10756
Branches ? 1572
========================================
Hits ? 1539
Misses ? 9090
Partials ? 127 Continue to review full report at Codecov.
|
app/src/androidTest/java/org/mozilla/fenix/ui/robots/NavigationToolbarRobot.kt
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@AaronMT is there a reason why the mDevice.waits were removed? In general, I don't think any of these were added randomly. Each one of them was originally added afaik to address timing issues
I didn't think they were necessary (one in particular above was failing a test) (aside it doesn't make sense to have them in the test but rather should be in the robot) |
@AaronMT So let's work on fixing intermittents on this PR until we make a one clean pass. In this run, only the |
@@ -109,7 +110,7 @@ class SyncIntegrationTest { | |||
} | |||
|
|||
fun tapOnSignIn() { | |||
mDevice.wait(Until.findObjects(By.text("Sign in")), TestAssetHelper.waitingTime) | |||
assertNotNull(mDevice.wait(Until.findObjects(By.text("Sign in")), TestAssetHelper.waitingTime)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It occurs to me that we could make this easier to reuse with an extension function. Something like the following:
/**
* Blocks the test for [waitTime] miliseconds before continuing.
*
* Will cause the test to fail is the condition is not met before the timeout.
*/
fun UiDevice.waitNotNull(
searchCondition: SearchCondition<*>,
waitTime: Long = TestAssetHelper.waitingTimeShort
) = assertNotNull(wait(searchCondition, waitTime))
Which would update L113 to look like mDevice.waitNotNull(Until.findObjects(By.text("Sign in")))
, or (if we wanted to use a different timeout) mDevice.waitNotNull(Until.findObjects(By.text("Sign in")), TestAssetHelper.waitingTimeShort)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
^ @rpappalax fyi
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We can open a new issue.
18c9430
to
621282e
Compare
…er check See mozilla-mobile#6031 - Adjust waits with assert check - Adjusts timer to speed things up - Test fix and cleanup fix: review comments - fixed proper resource name selectors - re-added waits for slow devices fix: ktlint
621282e
to
1cbf1a4
Compare
🍏 green @npark-mozilla (quick re-review) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!
@AaronMT let's see how this one goes. :) and also let's create an issue based on Severin's suggestion and see how that goes as well, this might refactor our tests better. |
…er check (mozilla-mobile#6084) See mozilla-mobile#6031 - Adjust waits with assert check - Adjusts timer to speed things up - Test fix and cleanup fix: review comments - fixed proper resource name selectors - re-added waits for slow devices fix: ktlint
See #6031