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

Closes #6031 - Wrap waits with assert check; adjust timer check #6084

Merged
merged 1 commit into from
Oct 23, 2019

Conversation

AaronMT
Copy link
Contributor

@AaronMT AaronMT commented Oct 17, 2019

See #6031

  • Adjust waits with assert check
  • Adjusts timer to speed things up
  • Test fix and cleanup

@codecov-io
Copy link

codecov-io commented Oct 17, 2019

Codecov Report

❗ No coverage uploaded for pull request base (master@40cda1d). Click here to learn what that means.
The diff coverage is n/a.

Impacted file tree graph

@@           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.

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

Copy link
Contributor

@rpappalax rpappalax left a 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

@AaronMT
Copy link
Contributor Author

AaronMT commented Oct 21, 2019

@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)

@nojunpark
Copy link

@AaronMT So let's work on fixing intermittents on this PR until we make a one clean pass. In this run, only the shortcutButtonTest failed, and when I looked at it, it has a good reason why it failed.
after clickDuckDuckGoResult(), we don't wait for anything before we call verifyDuckDuckGoURL(). The DOM tree at the time of the failure shows that it was still in the search view, it didn't even open the web view at the time. I think within verifyDuckDuckGoURL(), you have to put a wait.Until() to wait for the url text.

@@ -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))
Copy link
Contributor

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)

Choose a reason for hiding this comment

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

^ @rpappalax fyi

Copy link
Contributor Author

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.

…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
@AaronMT
Copy link
Contributor Author

AaronMT commented Oct 22, 2019

🍏 green @npark-mozilla (quick re-review)

@AaronMT AaronMT self-assigned this Oct 22, 2019
Copy link

@nojunpark nojunpark left a comment

Choose a reason for hiding this comment

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

LGTM!

@nojunpark
Copy link

@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.

@AaronMT AaronMT merged commit c677fc6 into mozilla-mobile:master Oct 23, 2019
@AaronMT AaronMT deleted the 6031-adjust-wait-conditions branch October 28, 2019 16:04
mcarare pushed a commit to mcarare/fenix that referenced this pull request Oct 29, 2019
…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
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

5 participants