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

Commit

Permalink
run #1 10x
Browse files Browse the repository at this point in the history
  • Loading branch information
Oana Horvath committed May 5, 2022
1 parent 79e6de6 commit c2401c3
Show file tree
Hide file tree
Showing 3 changed files with 45 additions and 23 deletions.
18 changes: 9 additions & 9 deletions app/src/androidTest/java/org/mozilla/fenix/ui/DownloadTest.kt
Original file line number Diff line number Diff line change
Expand Up @@ -46,18 +46,18 @@ class DownloadTest {
// disabling the PWA CFR on 3rd visit
featureSettingsHelper.disablePwaCFR(true)
// clear all existing notifications
notificationShade {
mDevice.openNotification()
clearNotifications()
}
// notificationShade {
// mDevice.openNotification()
// clearNotifications()
// }
}

@After
fun tearDown() {
featureSettingsHelper.resetAllFeatureFlags()
notificationShade {
cancelAllShownNotifications()
}
// notificationShade {
// cancelAllShownNotifications()
// }
}

@Test
Expand Down Expand Up @@ -113,7 +113,7 @@ class DownloadTest {
}
}

@Ignore("Intermittent: https://github.com/mozilla-mobile/fenix/issues/23434")
// @Ignore("Intermittent: https://github.com/mozilla-mobile/fenix/issues/23434")
@SmokeTest
@Test
fun pauseResumeCancelDownloadTest() {
Expand All @@ -128,7 +128,7 @@ class DownloadTest {
mDevice.openNotification()
notificationShade {
verifySystemNotificationExists("Firefox Fenix")
expandNotificationMessage()
expandDownloadNotificationMessage()
clickDownloadNotificationControlButton("PAUSE")
clickDownloadNotificationControlButton("RESUME")
clickDownloadNotificationControlButton("CANCEL")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ import org.mozilla.fenix.helpers.TestAssetHelper.waitingTime
import org.mozilla.fenix.helpers.TestHelper
import org.mozilla.fenix.helpers.TestHelper.appName
import org.mozilla.fenix.helpers.ext.waitNotNull
import java.lang.AssertionError

class NotificationRobot {

Expand Down Expand Up @@ -73,7 +72,13 @@ class NotificationRobot {
}

fun clickDownloadNotificationControlButton(action: String) {
assertTrue(downloadSystemNotificationButton(action).waitForExists(waitingTime))
// double check if notification actions are viewable by checking for action existence; otherwise scroll again
while (!downloadSystemNotificationButton(action).exists()) {
scrollToEnd()
notificationTray().ensureFullyVisible(downloadSystemNotificationButton(action))
}

// assertTrue(downloadSystemNotificationButton(action).waitForExists(waitingTime))
downloadSystemNotificationButton(action).click()

// API 30 Bug? Sometimes a click doesn't register, try again
Expand All @@ -92,22 +97,38 @@ class NotificationRobot {
assertTrue(downloadSystemNotificationButton(action).waitForExists(waitingTime))
}

fun expandNotificationMessage() {
fun expandDownloadNotificationMessage() {
while (!notificationHeader.exists()) {
scrollToEnd()
notificationTray().ensureFullyVisible(notificationHeader)
}

if (notificationHeader.exists()) {
val notificationCollapsed =
notificationHeader
.getFromParent(UiSelector().description("Expand"))
.exists()

// val actionsButtons =
// mDevice.findObject(
// UiSelector()
// .className("android.widget.FrameLayout")
// .childSelector(
// UiSelector().text(appName)
// )
// ).getFromParent(
// UiSelector().resourceId("android:id/actions_container")
// )

if (notificationCollapsed) {
// expand the notification
notificationHeader.click()

// double check if notification actions are viewable by checking for action existence; otherwise scroll again
while (!mDevice.findObject(UiSelector().resourceId("android:id/action0")).exists() &&
!mDevice.findObject(UiSelector().resourceId("android:id/actions_container")).exists()
) {
scrollToEnd()
}
}

// // double check if notification actions are viewable by checking for action existence; otherwise scroll again
// while (!actionsButtons.exists()) {
// scrollToEnd()
// notificationTray().ensureFullyVisible(actionsButtons)
// }
}

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

test-targets:
- notPackage org.mozilla.fenix.screenshots
- notPackage org.mozilla.fenix.syncintegration
# - notPackage org.mozilla.fenix.screenshots
# - notPackage org.mozilla.fenix.syncintegration
- class org.mozilla.fenix.ui.DownloadTest#pauseResumeCancelDownloadTest

device:
- model: Pixel2
Expand All @@ -53,7 +54,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: 10
### 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 c2401c3

Please sign in to comment.