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

Commit

Permalink
try run #1
Browse files Browse the repository at this point in the history
  • Loading branch information
sv-ohorvath committed Jun 6, 2022
1 parent e977e02 commit f4bf04d
Show file tree
Hide file tree
Showing 4 changed files with 38 additions and 19 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,14 @@

package org.mozilla.fenix.helpers

import androidx.test.espresso.IdlingRegistry
import androidx.test.espresso.IdlingResourceTimeoutException
import androidx.test.espresso.NoMatchingViewException
import androidx.test.uiautomator.UiObjectNotFoundException
import junit.framework.AssertionFailedError
import org.junit.rules.TestRule
import org.junit.runner.Description
import org.junit.runners.model.Statement
import java.lang.AssertionError

class RetryTestRule(private val retryCount: Int = 5) : TestRule {

Expand All @@ -23,30 +23,51 @@ class RetryTestRule(private val retryCount: Int = 5) : TestRule {
base.evaluate()
break
} catch (t: AssertionError) {
for (resource in IdlingRegistry.getInstance().resources) {
IdlingRegistry.getInstance().unregister(resource)
}
if (i == retryCount) {
throw t
}
} catch (t: AssertionFailedError) {
for (resource in IdlingRegistry.getInstance().resources) {
IdlingRegistry.getInstance().unregister(resource)
}
if (i == retryCount) {
throw t
}
} catch (t: UiObjectNotFoundException) {
for (resource in IdlingRegistry.getInstance().resources) {
IdlingRegistry.getInstance().unregister(resource)
}
if (i == retryCount) {
throw t
}
} catch (t: NoMatchingViewException) {
for (resource in IdlingRegistry.getInstance().resources) {
IdlingRegistry.getInstance().unregister(resource)
}
if (i == retryCount) {
throw t
}
} catch (t: IdlingResourceTimeoutException) {
for (resource in IdlingRegistry.getInstance().resources) {
IdlingRegistry.getInstance().unregister(resource)
}
if (i == retryCount) {
throw t
}
} catch (t: RuntimeException) {
for (resource in IdlingRegistry.getInstance().resources) {
IdlingRegistry.getInstance().unregister(resource)
}
if (i == retryCount) {
throw t
}
} catch (t: NullPointerException) {
for (resource in IdlingRegistry.getInstance().resources) {
IdlingRegistry.getInstance().unregister(resource)
}
if (i == retryCount) {
throw t
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ import androidx.test.espresso.IdlingRegistry
import okhttp3.mockwebserver.MockWebServer
import org.junit.After
import org.junit.Before
import org.junit.Ignore
import org.junit.Rule
import org.junit.Test
import org.mozilla.fenix.R
Expand Down Expand Up @@ -104,7 +103,7 @@ class SettingsAddonsTest {
}

// Installs an addon, then uninstalls it
@Ignore("Intermittent failures, see: https://github.com/mozilla-mobile/fenix/issues/24843")
// @Ignore("Intermittent failures, see: https://github.com/mozilla-mobile/fenix/issues/24843")
@Test
fun verifyAddonsCanBeUninstalled() {
val addonName = "uBlock Origin"
Expand Down Expand Up @@ -146,7 +145,7 @@ class SettingsAddonsTest {
}
}

@Ignore("Failing, see: https://github.com/mozilla-mobile/fenix/issues/23749")
// @Ignore("Failing, see: https://github.com/mozilla-mobile/fenix/issues/23749")
@SmokeTest
@Test
fun useAddonsInPrivateModeTest() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,16 @@ import org.mozilla.fenix.helpers.ext.waitNotNull
class SettingsSubMenuAddonsManagerRobot {
fun verifyAddonPermissionPrompt(addonName: String) = assertAddonPermissionPrompt(addonName)

fun clickInstallAddon(addonName: String) = selectInstallAddon(addonName)
fun clickInstallAddon(addonName: String) {
mDevice.waitNotNull(
Until.findObject(By.textContains(addonName)),
waitingTime
)

installButtonForAddon(addonName)
.check(matches(isCompletelyDisplayed()))
.perform(click())
}

fun closeAddonInstallCompletePrompt(
addonName: String,
Expand Down Expand Up @@ -127,17 +136,6 @@ class SettingsSubMenuAddonsManagerRobot {
)
)

private fun selectInstallAddon(addonName: String) {
mDevice.waitNotNull(
Until.findObject(By.textContains(addonName)),
waitingTime
)

installButtonForAddon(addonName)
.check(matches(isCompletelyDisplayed()))
.perform(click())
}

private fun assertAddonIsEnabled(addonName: String) {
installButtonForAddon(addonName)
.check(matches(not(isCompletelyDisplayed())))
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.SettingsAddonsTest

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 f4bf04d

Please sign in to comment.