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

Commit

Permalink
run #3
Browse files Browse the repository at this point in the history
  • Loading branch information
Oana Horvath committed Jun 29, 2021
1 parent cb5468c commit d1c6042
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 17 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,10 @@ package org.mozilla.fenix.ui.robots

import androidx.test.espresso.Espresso.onView
import androidx.test.espresso.NoMatchingViewException
import androidx.test.espresso.action.ViewActions
import androidx.test.espresso.action.ViewActions.pressImeActionButton
import androidx.test.espresso.action.ViewActions.replaceText
import androidx.test.espresso.action.ViewActions.swipeLeft
import androidx.test.espresso.action.ViewActions.swipeRight
import androidx.test.espresso.assertion.ViewAssertions.doesNotExist
import androidx.test.espresso.assertion.ViewAssertions.matches
import androidx.test.espresso.matcher.ViewMatchers
Expand Down Expand Up @@ -71,14 +72,15 @@ class CollectionRobot {
}

fun verifyTabSavedInCollection(title: String, visible: Boolean = true) {
try {
if (visible) {
scrollToElementByText(title)
collectionItem(title)
.check(
if (visible) matches(isDisplayed()) else doesNotExist()
matches(isDisplayed())
)
} catch (e: NoMatchingViewException) {
scrollToElementByText(title)
}
} else
collectionItem(title)
.check(doesNotExist())
}

fun verifyCollectionTabUrl() {
Expand Down Expand Up @@ -161,18 +163,30 @@ class CollectionRobot {
fun removeTabFromCollection(title: String) = removeTabFromCollectionButton(title).click()

fun swipeCollectionItemRight(title: String) {
try {
collectionItem(title).perform(ViewActions.swipeRight())
} catch (e: NoMatchingViewException) {
scrollToElementByText(title)
scrollToElementByText(title)
var retries = 0 // number of retries before failing, will stop at 2
while (mDevice.findObject(
UiSelector()
.resourceId("$packageName:id/label")
.text(title)
).exists() && retries < 2
) {
collectionItem(title).perform(swipeRight())
retries++
}
}

fun swipeCollectionItemLeft(title: String) {
try {
collectionItem(title).perform(ViewActions.swipeLeft())
} catch (e: NoMatchingViewException) {
scrollToElementByText(title)
scrollToElementByText(title)
var retries = 0 // number of retries before failing, will stop at 2
while (mDevice.findObject(
UiSelector()
.resourceId("$packageName:id/label")
.text(title)
).exists() && retries < 2
) {
collectionItem(title).perform(swipeLeft())
retries++
}
}

Expand Down
6 changes: 3 additions & 3 deletions automation/taskcluster/androidTest/flank-x86.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,8 @@ gcloud:
performance-metrics: true

test-targets:
- package org.mozilla.fenix.ui
- package org.mozilla.fenix.glean
- package org.mozilla.fenix.ui.CollectionTest#swipeToRemoveTabFromCollectionTest
#- package org.mozilla.fenix.glean

device:
- model: Pixel2
Expand All @@ -52,7 +52,7 @@ flank:
max-test-shards: -1
# num-test-runs: the amount of times to run the tests.
# 1 runs the tests once. 10 runs all the tests 10x
num-test-runs: 1
num-test-runs: 50
### Output Style flag
## Output style of execution status. May be one of [verbose, multi, single, compact].
## For runs with only one test execution the default value is 'verbose', in other cases
Expand Down

0 comments on commit d1c6042

Please sign in to comment.