GitLab is used only for code review, issue tracking and project management. Canonical locations for source code are still https://gitweb.torproject.org/ https://git.torproject.org/ and git-rw.torproject.org.

Commit 4a00131f authored by Oana Horvath's avatar Oana Horvath

Closes #13218: adds IdlingResources for the Addons list

parent 1e7faa69
package org.mozilla.fenix.ui
import androidx.test.espresso.IdlingRegistry
import org.mozilla.fenix.helpers.TestAssetHelper
/* This Source Code Form is subject to the terms of the Mozilla Public
......@@ -11,8 +12,10 @@ import org.junit.Rule
import org.junit.Before
import org.junit.After
import org.junit.Test
import org.mozilla.fenix.R
import org.mozilla.fenix.helpers.AndroidAssetDispatcher
import org.mozilla.fenix.helpers.HomeActivityTestRule
import org.mozilla.fenix.helpers.RecyclerViewIdlingResource
import org.mozilla.fenix.ui.robots.homeScreen
import org.mozilla.fenix.ui.robots.navigationToolbar
......@@ -25,6 +28,7 @@ class SettingsAddonsTest {
/* ktlint-disable no-blank-line-before-rbrace */ // This imposes unreadable grouping.
private lateinit var mockWebServer: MockWebServer
private var addonsListIdlingResource: RecyclerViewIdlingResource? = null
@get:Rule
val activityTestRule = HomeActivityTestRule()
......@@ -40,6 +44,10 @@ class SettingsAddonsTest {
@After
fun tearDown() {
mockWebServer.shutdown()
if (addonsListIdlingResource != null) {
IdlingRegistry.getInstance().unregister(addonsListIdlingResource!!)
}
}
// Walks through settings add-ons menu to ensure all items are present
......@@ -51,6 +59,9 @@ class SettingsAddonsTest {
verifyAdvancedHeading()
verifyAddons()
}.openAddonsManagerMenu {
addonsListIdlingResource =
RecyclerViewIdlingResource(activityTestRule.activity.findViewById(R.id.add_ons_list), 1)
IdlingRegistry.getInstance().register(addonsListIdlingResource!!)
verifyAddonsItems()
}
}
......@@ -65,6 +76,9 @@ class SettingsAddonsTest {
}.openNewTabAndEnterToBrowser(defaultWebPage.url) {
}.openThreeDotMenu {
}.openAddonsManagerMenu {
addonsListIdlingResource =
RecyclerViewIdlingResource(activityTestRule.activity.findViewById(R.id.add_ons_list), 1)
IdlingRegistry.getInstance().register(addonsListIdlingResource!!)
clickInstallAddon(addonName)
verifyAddonPrompt(addonName)
cancelInstallAddon()
......@@ -85,6 +99,9 @@ class SettingsAddonsTest {
verifyAdvancedHeading()
verifyAddons()
}.openAddonsManagerMenu {
addonsListIdlingResource =
RecyclerViewIdlingResource(activityTestRule.activity.findViewById(R.id.add_ons_list), 1)
IdlingRegistry.getInstance().register(addonsListIdlingResource!!)
clickInstallAddon(addonName)
acceptInstallAddon()
verifyDownloadAddonPrompt(addonName, activityTestRule)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment