Skip to content
This repository has been archived by the owner on Feb 20, 2023. It is now read-only.

Closes #6172 - Convert waitNotNull into extension function for UI tests #6220

Merged
merged 1 commit into from
Oct 23, 2019

Conversation

AaronMT
Copy link
Contributor

@AaronMT AaronMT commented Oct 23, 2019

#6172

From previous re-factor

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)

@AaronMT AaronMT self-assigned this Oct 23, 2019
@codecov-io
Copy link

codecov-io commented Oct 23, 2019

Codecov Report

Merging #6220 into master will decrease coverage by 0.03%.
The diff coverage is n/a.

Impacted file tree graph

@@             Coverage Diff              @@
##             master    #6220      +/-   ##
============================================
- Coverage     14.73%   14.69%   -0.04%     
  Complexity      319      319              
============================================
  Files           262      262              
  Lines         10732    10723       -9     
  Branches       1560     1558       -2     
============================================
- Hits           1581     1576       -5     
+ Misses         9025     9021       -4     
  Partials        126      126
Impacted Files Coverage Δ Complexity Δ
...ava/org/mozilla/fenix/browser/UriOpenedObserver.kt 47.05% <0%> (-12.04%) 3% <0%> (ø)
...a/org/mozilla/fenix/browser/BaseBrowserFragment.kt 0% <0%> (ø) 0% <0%> (ø) ⬇️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update cc9ee5a...c405cf5. Read the comment docs.

Copy link
Contributor

@severinrudie severinrudie left a comment

Choose a reason for hiding this comment

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

LGTM! But I'm not on the test automation team, so I'll let someone else approve.

…ion for UI tests

fix: redundant parameters for waitingTimeShort
@AaronMT AaronMT merged commit 23c98f9 into mozilla-mobile:master Oct 23, 2019
@AaronMT AaronMT deleted the 6172-waitNotNull-ext branch October 28, 2019 16:04
mcarare pushed a commit to mcarare/fenix that referenced this pull request Oct 29, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants