Bug 1880087 - Create TestSetup helper: Test classes D-L

fenix/125.0
oana.horvath 4 months ago committed by mergify[bot]
parent 9582c71045
commit edc60d77fd

@ -5,16 +5,12 @@
package org.mozilla.fenix.ui package org.mozilla.fenix.ui
import androidx.test.platform.app.InstrumentationRegistry import androidx.test.platform.app.InstrumentationRegistry
import androidx.test.uiautomator.UiDevice
import okhttp3.mockwebserver.MockWebServer
import org.junit.After
import org.junit.Before
import org.junit.Ignore import org.junit.Ignore
import org.junit.Rule import org.junit.Rule
import org.junit.Test import org.junit.Test
import org.mozilla.fenix.helpers.AndroidAssetDispatcher
import org.mozilla.fenix.helpers.HomeActivityIntentTestRule import org.mozilla.fenix.helpers.HomeActivityIntentTestRule
import org.mozilla.fenix.helpers.TestAssetHelper import org.mozilla.fenix.helpers.TestAssetHelper
import org.mozilla.fenix.helpers.TestSetup
import org.mozilla.fenix.ui.robots.DeepLinkRobot import org.mozilla.fenix.ui.robots.DeepLinkRobot
/** /**
@ -31,29 +27,12 @@ import org.mozilla.fenix.ui.robots.DeepLinkRobot
**/ **/
@Ignore("All tests perma-failing, see: https://github.com/mozilla-mobile/fenix/issues/13491") @Ignore("All tests perma-failing, see: https://github.com/mozilla-mobile/fenix/issues/13491")
class DeepLinkTest { class DeepLinkTest : TestSetup() {
private lateinit var mDevice: UiDevice
private lateinit var mockWebServer: MockWebServer
private val robot = DeepLinkRobot() private val robot = DeepLinkRobot()
@get:Rule @get:Rule
val activityIntentTestRule = HomeActivityIntentTestRule() val activityIntentTestRule = HomeActivityIntentTestRule()
@Before
fun setUp() {
mDevice = UiDevice.getInstance(InstrumentationRegistry.getInstrumentation())
mockWebServer = MockWebServer().apply {
dispatcher = AndroidAssetDispatcher()
start()
}
}
@After
fun tearDown() {
mockWebServer.shutdown()
}
@Test @Test
fun openHomeScreen() { fun openHomeScreen() {
robot.openHomeScreen { robot.openHomeScreen {

@ -5,14 +5,13 @@
package org.mozilla.fenix.ui package org.mozilla.fenix.ui
import androidx.core.net.toUri import androidx.core.net.toUri
import org.junit.After
import org.junit.Rule import org.junit.Rule
import org.junit.Test import org.junit.Test
import org.junit.runner.RunWith import org.junit.runner.RunWith
import org.junit.runners.Parameterized import org.junit.runners.Parameterized
import org.mozilla.fenix.customannotations.SmokeTest import org.mozilla.fenix.customannotations.SmokeTest
import org.mozilla.fenix.helpers.AppAndSystemHelper.clearDownloadsFolder
import org.mozilla.fenix.helpers.HomeActivityIntentTestRule import org.mozilla.fenix.helpers.HomeActivityIntentTestRule
import org.mozilla.fenix.helpers.TestSetup
import org.mozilla.fenix.ui.robots.downloadRobot import org.mozilla.fenix.ui.robots.downloadRobot
/** /**
@ -22,7 +21,7 @@ import org.mozilla.fenix.ui.robots.downloadRobot
* - Verifies downloading of varying file types and the appearance inside the Downloads listing. * - Verifies downloading of varying file types and the appearance inside the Downloads listing.
**/ **/
@RunWith(Parameterized::class) @RunWith(Parameterized::class)
class DownloadFileTypesTest(fileName: String) { class DownloadFileTypesTest(fileName: String) : TestSetup() {
/* Remote test page managed by Mozilla Mobile QA team at https://github.com/mozilla-mobile/testapp */ /* Remote test page managed by Mozilla Mobile QA team at https://github.com/mozilla-mobile/testapp */
private val downloadTestPage = "https://storage.googleapis.com/mobile_test_assets/test_app/downloads.html" private val downloadTestPage = "https://storage.googleapis.com/mobile_test_assets/test_app/downloads.html"
private var downloadFile: String = fileName private var downloadFile: String = fileName
@ -30,12 +29,6 @@ class DownloadFileTypesTest(fileName: String) {
@get:Rule @get:Rule
val activityTestRule = HomeActivityIntentTestRule.withDefaultSettingsOverrides() val activityTestRule = HomeActivityIntentTestRule.withDefaultSettingsOverrides()
@After
fun tearDown() {
// Check and clear the downloads folder
clearDownloadsFolder()
}
companion object { companion object {
// Creating test data. The test will take each file name as a parameter and run it individually. // Creating test data. The test will take each file name as a parameter and run it individually.
@JvmStatic @JvmStatic

@ -5,16 +5,11 @@
package org.mozilla.fenix.ui package org.mozilla.fenix.ui
import androidx.core.net.toUri import androidx.core.net.toUri
import okhttp3.mockwebserver.MockWebServer
import org.junit.After
import org.junit.Before
import org.junit.Ignore import org.junit.Ignore
import org.junit.Rule import org.junit.Rule
import org.junit.Test import org.junit.Test
import org.mozilla.fenix.customannotations.SmokeTest import org.mozilla.fenix.customannotations.SmokeTest
import org.mozilla.fenix.helpers.AndroidAssetDispatcher
import org.mozilla.fenix.helpers.AppAndSystemHelper.assertExternalAppOpens import org.mozilla.fenix.helpers.AppAndSystemHelper.assertExternalAppOpens
import org.mozilla.fenix.helpers.AppAndSystemHelper.clearDownloadsFolder
import org.mozilla.fenix.helpers.AppAndSystemHelper.deleteDownloadedFileOnStorage import org.mozilla.fenix.helpers.AppAndSystemHelper.deleteDownloadedFileOnStorage
import org.mozilla.fenix.helpers.AppAndSystemHelper.setNetworkEnabled import org.mozilla.fenix.helpers.AppAndSystemHelper.setNetworkEnabled
import org.mozilla.fenix.helpers.Constants.PackageName.GOOGLE_APPS_PHOTOS import org.mozilla.fenix.helpers.Constants.PackageName.GOOGLE_APPS_PHOTOS
@ -25,6 +20,7 @@ import org.mozilla.fenix.helpers.TestAssetHelper
import org.mozilla.fenix.helpers.TestHelper.clickSnackbarButton import org.mozilla.fenix.helpers.TestHelper.clickSnackbarButton
import org.mozilla.fenix.helpers.TestHelper.exitMenu import org.mozilla.fenix.helpers.TestHelper.exitMenu
import org.mozilla.fenix.helpers.TestHelper.mDevice import org.mozilla.fenix.helpers.TestHelper.mDevice
import org.mozilla.fenix.helpers.TestSetup
import org.mozilla.fenix.ui.robots.browserScreen import org.mozilla.fenix.ui.robots.browserScreen
import org.mozilla.fenix.ui.robots.clickPageObject import org.mozilla.fenix.ui.robots.clickPageObject
import org.mozilla.fenix.ui.robots.downloadRobot import org.mozilla.fenix.ui.robots.downloadRobot
@ -40,9 +36,7 @@ import org.mozilla.fenix.ui.robots.notificationShade
* - Verifies download notification and actions * - Verifies download notification and actions
* - Verifies managing downloads inside the Downloads listing. * - Verifies managing downloads inside the Downloads listing.
**/ **/
class DownloadTest { class DownloadTest : TestSetup() {
private lateinit var mockWebServer: MockWebServer
/* Remote test page managed by Mozilla Mobile QA team at https://github.com/mozilla-mobile/testapp */ /* Remote test page managed by Mozilla Mobile QA team at https://github.com/mozilla-mobile/testapp */
private val downloadTestPage = "https://storage.googleapis.com/mobile_test_assets/test_app/downloads.html" private val downloadTestPage = "https://storage.googleapis.com/mobile_test_assets/test_app/downloads.html"
private var downloadFile: String = "" private var downloadFile: String = ""
@ -50,34 +44,6 @@ class DownloadTest {
@get:Rule @get:Rule
val activityTestRule = HomeActivityIntentTestRule.withDefaultSettingsOverrides() val activityTestRule = HomeActivityIntentTestRule.withDefaultSettingsOverrides()
@Before
fun setUp() {
mockWebServer = MockWebServer().apply {
dispatcher = AndroidAssetDispatcher()
start()
}
// clear all existing notifications
notificationShade {
mDevice.openNotification()
clearNotifications()
}
}
@After
fun tearDown() {
notificationShade {
cancelAllShownNotifications()
}
mockWebServer.shutdown()
setNetworkEnabled(enabled = true)
// Check and clear the downloads folder
clearDownloadsFolder()
}
// TestRail link: https://testrail.stage.mozaws.net/index.php?/cases/view/243844 // TestRail link: https://testrail.stage.mozaws.net/index.php?/cases/view/243844
@Test @Test
fun verifyTheDownloadPromptsTest() { fun verifyTheDownloadPromptsTest() {

@ -6,14 +6,10 @@ package org.mozilla.fenix.ui
import androidx.core.net.toUri import androidx.core.net.toUri
import androidx.test.espresso.Espresso.pressBack import androidx.test.espresso.Espresso.pressBack
import okhttp3.mockwebserver.MockWebServer
import org.junit.After
import org.junit.Before
import org.junit.Rule import org.junit.Rule
import org.junit.Test import org.junit.Test
import org.mozilla.fenix.customannotations.SmokeTest import org.mozilla.fenix.customannotations.SmokeTest
import org.mozilla.fenix.ext.settings import org.mozilla.fenix.ext.settings
import org.mozilla.fenix.helpers.AndroidAssetDispatcher
import org.mozilla.fenix.helpers.HomeActivityIntentTestRule import org.mozilla.fenix.helpers.HomeActivityIntentTestRule
import org.mozilla.fenix.helpers.TestAssetHelper.getEnhancedTrackingProtectionAsset import org.mozilla.fenix.helpers.TestAssetHelper.getEnhancedTrackingProtectionAsset
import org.mozilla.fenix.helpers.TestAssetHelper.getGenericAsset import org.mozilla.fenix.helpers.TestAssetHelper.getGenericAsset
@ -22,6 +18,7 @@ import org.mozilla.fenix.helpers.TestHelper.exitMenu
import org.mozilla.fenix.helpers.TestHelper.mDevice import org.mozilla.fenix.helpers.TestHelper.mDevice
import org.mozilla.fenix.helpers.TestHelper.restartApp import org.mozilla.fenix.helpers.TestHelper.restartApp
import org.mozilla.fenix.helpers.TestHelper.scrollToElementByText import org.mozilla.fenix.helpers.TestHelper.scrollToElementByText
import org.mozilla.fenix.helpers.TestSetup
import org.mozilla.fenix.ui.robots.browserScreen import org.mozilla.fenix.ui.robots.browserScreen
import org.mozilla.fenix.ui.robots.enhancedTrackingProtection import org.mozilla.fenix.ui.robots.enhancedTrackingProtection
import org.mozilla.fenix.ui.robots.homeScreen import org.mozilla.fenix.ui.robots.homeScreen
@ -40,9 +37,7 @@ import org.mozilla.fenix.ui.robots.navigationToolbar
* - Verifying Enhanced Tracking Protection site exceptions * - Verifying Enhanced Tracking Protection site exceptions
*/ */
class EnhancedTrackingProtectionTest { class EnhancedTrackingProtectionTest : TestSetup() {
private lateinit var mockWebServer: MockWebServer
@get:Rule @get:Rule
val activityTestRule = HomeActivityIntentTestRule( val activityTestRule = HomeActivityIntentTestRule(
isJumpBackInCFREnabled = false, isJumpBackInCFREnabled = false,
@ -50,19 +45,6 @@ class EnhancedTrackingProtectionTest {
isWallpaperOnboardingEnabled = false, isWallpaperOnboardingEnabled = false,
) )
@Before
fun setUp() {
mockWebServer = MockWebServer().apply {
dispatcher = AndroidAssetDispatcher()
start()
}
}
@After
fun tearDown() {
mockWebServer.shutdown()
}
// TestRail link: https://testrail.stage.mozaws.net/index.php?/cases/view/416046 // TestRail link: https://testrail.stage.mozaws.net/index.php?/cases/view/416046
@Test @Test
fun testETPSettingsItemsAndSubMenus() { fun testETPSettingsItemsAndSubMenus() {

@ -14,6 +14,7 @@ import org.mozilla.fenix.helpers.AppAndSystemHelper.runWithCondition
import org.mozilla.fenix.helpers.DataGenerationHelper.getSponsoredFxSuggestPlaceHolder import org.mozilla.fenix.helpers.DataGenerationHelper.getSponsoredFxSuggestPlaceHolder
import org.mozilla.fenix.helpers.HomeActivityTestRule import org.mozilla.fenix.helpers.HomeActivityTestRule
import org.mozilla.fenix.helpers.TestHelper import org.mozilla.fenix.helpers.TestHelper
import org.mozilla.fenix.helpers.TestSetup
import org.mozilla.fenix.ui.robots.navigationToolbar import org.mozilla.fenix.ui.robots.navigationToolbar
/** /**
@ -21,7 +22,7 @@ import org.mozilla.fenix.ui.robots.navigationToolbar
* *
*/ */
class FirefoxSuggestTest { class FirefoxSuggestTest : TestSetup() {
@get:Rule @get:Rule
val activityTestRule = AndroidComposeTestRule( val activityTestRule = AndroidComposeTestRule(

@ -4,15 +4,13 @@
package org.mozilla.fenix.ui package org.mozilla.fenix.ui
import okhttp3.mockwebserver.MockWebServer
import org.junit.After
import org.junit.Before import org.junit.Before
import org.junit.Rule import org.junit.Rule
import org.junit.Test import org.junit.Test
import org.mozilla.fenix.helpers.AndroidAssetDispatcher
import org.mozilla.fenix.helpers.HomeActivityIntentTestRule import org.mozilla.fenix.helpers.HomeActivityIntentTestRule
import org.mozilla.fenix.helpers.TestAssetHelper.TestAsset import org.mozilla.fenix.helpers.TestAssetHelper.TestAsset
import org.mozilla.fenix.helpers.TestAssetHelper.getGPCTestAsset import org.mozilla.fenix.helpers.TestAssetHelper.getGPCTestAsset
import org.mozilla.fenix.helpers.TestSetup
import org.mozilla.fenix.ui.robots.homeScreen import org.mozilla.fenix.ui.robots.homeScreen
import org.mozilla.fenix.ui.robots.navigationToolbar import org.mozilla.fenix.ui.robots.navigationToolbar
@ -20,8 +18,7 @@ import org.mozilla.fenix.ui.robots.navigationToolbar
* Tests for Global Privacy Control setting. * Tests for Global Privacy Control setting.
*/ */
class GlobalPrivacyControlTest { class GlobalPrivacyControlTest : TestSetup() {
private lateinit var mockWebServer: MockWebServer
private lateinit var gpcPage: TestAsset private lateinit var gpcPage: TestAsset
@get:Rule @get:Rule
@ -33,20 +30,11 @@ class GlobalPrivacyControlTest {
) )
@Before @Before
fun setUp() { override fun setUp() {
mockWebServer = MockWebServer().apply { super.setUp()
dispatcher = AndroidAssetDispatcher()
start()
}
gpcPage = getGPCTestAsset(mockWebServer) gpcPage = getGPCTestAsset(mockWebServer)
} }
@After
fun tearDown() {
mockWebServer.shutdown()
}
// TestRail link: https://testrail.stage.mozaws.net/index.php?/cases/view/2429327 // TestRail link: https://testrail.stage.mozaws.net/index.php?/cases/view/2429327
@Test @Test
fun testGPCinNormalBrowsing() { fun testGPCinNormalBrowsing() {

@ -4,24 +4,14 @@
package org.mozilla.fenix.ui package org.mozilla.fenix.ui
import android.content.Context
import androidx.compose.ui.test.junit4.AndroidComposeTestRule import androidx.compose.ui.test.junit4.AndroidComposeTestRule
import androidx.test.espresso.Espresso.openActionBarOverflowOrOptionsMenu import androidx.test.espresso.Espresso.openActionBarOverflowOrOptionsMenu
import androidx.test.espresso.Espresso.pressBack import androidx.test.espresso.Espresso.pressBack
import androidx.test.platform.app.InstrumentationRegistry
import androidx.test.uiautomator.UiDevice
import kotlinx.coroutines.runBlocking
import mozilla.components.browser.storage.sync.PlacesHistoryStorage
import okhttp3.mockwebserver.MockWebServer
import org.junit.After
import org.junit.Before
import org.junit.Ignore import org.junit.Ignore
import org.junit.Rule import org.junit.Rule
import org.junit.Test import org.junit.Test
import org.mozilla.fenix.R import org.mozilla.fenix.R
import org.mozilla.fenix.customannotations.SmokeTest import org.mozilla.fenix.customannotations.SmokeTest
import org.mozilla.fenix.ext.settings
import org.mozilla.fenix.helpers.AndroidAssetDispatcher
import org.mozilla.fenix.helpers.AppAndSystemHelper.registerAndCleanupIdlingResources import org.mozilla.fenix.helpers.AppAndSystemHelper.registerAndCleanupIdlingResources
import org.mozilla.fenix.helpers.HomeActivityIntentTestRule import org.mozilla.fenix.helpers.HomeActivityIntentTestRule
import org.mozilla.fenix.helpers.MockBrowserDataHelper import org.mozilla.fenix.helpers.MockBrowserDataHelper
@ -29,7 +19,9 @@ import org.mozilla.fenix.helpers.RecyclerViewIdlingResource
import org.mozilla.fenix.helpers.TestAssetHelper import org.mozilla.fenix.helpers.TestAssetHelper
import org.mozilla.fenix.helpers.TestHelper.exitMenu import org.mozilla.fenix.helpers.TestHelper.exitMenu
import org.mozilla.fenix.helpers.TestHelper.longTapSelectItem import org.mozilla.fenix.helpers.TestHelper.longTapSelectItem
import org.mozilla.fenix.helpers.TestHelper.mDevice
import org.mozilla.fenix.helpers.TestHelper.verifySnackBarText import org.mozilla.fenix.helpers.TestHelper.verifySnackBarText
import org.mozilla.fenix.helpers.TestSetup
import org.mozilla.fenix.ui.robots.browserScreen import org.mozilla.fenix.ui.robots.browserScreen
import org.mozilla.fenix.ui.robots.historyMenu import org.mozilla.fenix.ui.robots.historyMenu
import org.mozilla.fenix.ui.robots.homeScreen import org.mozilla.fenix.ui.robots.homeScreen
@ -40,40 +32,13 @@ import org.mozilla.fenix.ui.robots.navigationToolbar
* Tests for verifying basic functionality of history * Tests for verifying basic functionality of history
* *
*/ */
class HistoryTest { class HistoryTest : TestSetup() {
private lateinit var mockWebServer: MockWebServer
private lateinit var mDevice: UiDevice
@get:Rule @get:Rule
val activityTestRule = val activityTestRule =
AndroidComposeTestRule( AndroidComposeTestRule(
HomeActivityIntentTestRule.withDefaultSettingsOverrides(), HomeActivityIntentTestRule(isJumpBackInCFREnabled = false),
) { it.activity } ) { it.activity }
@Before
fun setUp() {
InstrumentationRegistry.getInstrumentation().targetContext.settings()
.shouldShowJumpBackInCFR = false
mDevice = UiDevice.getInstance(InstrumentationRegistry.getInstrumentation())
mockWebServer = MockWebServer().apply {
dispatcher = AndroidAssetDispatcher()
start()
}
}
@After
fun tearDown() {
mockWebServer.shutdown()
// Clearing all history data after each test to avoid overlapping data
val applicationContext: Context = activityTestRule.activity.applicationContext
val historyStorage = PlacesHistoryStorage(applicationContext)
runBlocking {
historyStorage.deleteEverything()
}
}
// TestRail link: https://testrail.stage.mozaws.net/index.php?/cases/view/243285 // TestRail link: https://testrail.stage.mozaws.net/index.php?/cases/view/243285
@Test @Test
fun verifyEmptyHistoryMenuTest() { fun verifyEmptyHistoryMenuTest() {

@ -5,19 +5,14 @@
package org.mozilla.fenix.ui package org.mozilla.fenix.ui
import androidx.compose.ui.test.junit4.AndroidComposeTestRule import androidx.compose.ui.test.junit4.AndroidComposeTestRule
import androidx.test.platform.app.InstrumentationRegistry
import androidx.test.uiautomator.UiDevice
import okhttp3.mockwebserver.MockWebServer
import org.junit.After
import org.junit.Before
import org.junit.Rule import org.junit.Rule
import org.junit.Test import org.junit.Test
import org.mozilla.fenix.customannotations.SmokeTest import org.mozilla.fenix.customannotations.SmokeTest
import org.mozilla.fenix.helpers.AndroidAssetDispatcher
import org.mozilla.fenix.helpers.HomeActivityTestRule import org.mozilla.fenix.helpers.HomeActivityTestRule
import org.mozilla.fenix.helpers.RetryTestRule import org.mozilla.fenix.helpers.RetryTestRule
import org.mozilla.fenix.helpers.TestAssetHelper import org.mozilla.fenix.helpers.TestAssetHelper
import org.mozilla.fenix.helpers.TestHelper import org.mozilla.fenix.helpers.TestHelper
import org.mozilla.fenix.helpers.TestSetup
import org.mozilla.fenix.ui.robots.homeScreen import org.mozilla.fenix.ui.robots.homeScreen
import org.mozilla.fenix.ui.robots.navigationToolbar import org.mozilla.fenix.ui.robots.navigationToolbar
import org.mozilla.fenix.ui.robots.searchScreen import org.mozilla.fenix.ui.robots.searchScreen
@ -29,10 +24,7 @@ import org.mozilla.fenix.ui.robots.searchScreen
* *
*/ */
class HomeScreenTest { class HomeScreenTest : TestSetup() {
private lateinit var mDevice: UiDevice
private lateinit var mockWebServer: MockWebServer
@get:Rule(order = 0) @get:Rule(order = 0)
val activityTestRule = val activityTestRule =
AndroidComposeTestRule(HomeActivityTestRule.withDefaultSettingsOverrides()) { it.activity } AndroidComposeTestRule(HomeActivityTestRule.withDefaultSettingsOverrides()) { it.activity }
@ -41,21 +33,6 @@ class HomeScreenTest {
@JvmField @JvmField
val retryTestRule = RetryTestRule(3) val retryTestRule = RetryTestRule(3)
@Before
fun setUp() {
mDevice = UiDevice.getInstance(InstrumentationRegistry.getInstrumentation())
mockWebServer = MockWebServer().apply {
dispatcher = AndroidAssetDispatcher()
start()
}
}
@After
fun tearDown() {
mockWebServer.shutdown()
}
// TestRail link: https://testrail.stage.mozaws.net/index.php?/cases/view/235396 // TestRail link: https://testrail.stage.mozaws.net/index.php?/cases/view/235396
@Test @Test
fun homeScreenItemsTest() { fun homeScreenItemsTest() {

@ -7,14 +7,11 @@ package org.mozilla.fenix.ui
import android.os.Build import android.os.Build
import android.view.autofill.AutofillManager import android.view.autofill.AutofillManager
import androidx.core.net.toUri import androidx.core.net.toUri
import okhttp3.mockwebserver.MockWebServer
import org.junit.After
import org.junit.Before import org.junit.Before
import org.junit.Ignore import org.junit.Ignore
import org.junit.Rule import org.junit.Rule
import org.junit.Test import org.junit.Test
import org.mozilla.fenix.customannotations.SmokeTest import org.mozilla.fenix.customannotations.SmokeTest
import org.mozilla.fenix.helpers.AndroidAssetDispatcher
import org.mozilla.fenix.helpers.HomeActivityIntentTestRule import org.mozilla.fenix.helpers.HomeActivityIntentTestRule
import org.mozilla.fenix.helpers.MatcherHelper import org.mozilla.fenix.helpers.MatcherHelper
import org.mozilla.fenix.helpers.MatcherHelper.itemWithResId import org.mozilla.fenix.helpers.MatcherHelper.itemWithResId
@ -29,6 +26,7 @@ import org.mozilla.fenix.helpers.TestHelper.restartApp
import org.mozilla.fenix.helpers.TestHelper.scrollToElementByText import org.mozilla.fenix.helpers.TestHelper.scrollToElementByText
import org.mozilla.fenix.helpers.TestHelper.verifySnackBarText import org.mozilla.fenix.helpers.TestHelper.verifySnackBarText
import org.mozilla.fenix.helpers.TestHelper.waitForAppWindowToBeUpdated import org.mozilla.fenix.helpers.TestHelper.waitForAppWindowToBeUpdated
import org.mozilla.fenix.helpers.TestSetup
import org.mozilla.fenix.ui.robots.browserScreen import org.mozilla.fenix.ui.robots.browserScreen
import org.mozilla.fenix.ui.robots.clearTextFieldItem import org.mozilla.fenix.ui.robots.clearTextFieldItem
import org.mozilla.fenix.ui.robots.clickPageObject import org.mozilla.fenix.ui.robots.clickPageObject
@ -42,20 +40,14 @@ import org.mozilla.fenix.ui.robots.setPageObjectText
* - save login prompts. * - save login prompts.
* - saving logins based on the user's preferences. * - saving logins based on the user's preferences.
*/ */
class LoginsTest { class LoginsTest : TestSetup() {
private lateinit var mockWebServer: MockWebServer
@get:Rule @get:Rule
val activityTestRule = val activityTestRule =
HomeActivityIntentTestRule.withDefaultSettingsOverrides(skipOnboarding = true) HomeActivityIntentTestRule.withDefaultSettingsOverrides(skipOnboarding = true)
@Before @Before
fun setUp() { override fun setUp() {
mockWebServer = MockWebServer().apply { super.setUp()
dispatcher = AndroidAssetDispatcher()
start()
}
if (Build.VERSION.SDK_INT == Build.VERSION_CODES.R) { if (Build.VERSION.SDK_INT == Build.VERSION_CODES.R) {
val autofillManager: AutofillManager = val autofillManager: AutofillManager =
TestHelper.appContext.getSystemService(AutofillManager::class.java) TestHelper.appContext.getSystemService(AutofillManager::class.java)
@ -63,11 +55,6 @@ class LoginsTest {
} }
} }
@After
fun tearDown() {
mockWebServer.shutdown()
}
// TestRail link: https://testrail.stage.mozaws.net/index.php?/cases/view/2092713 // TestRail link: https://testrail.stage.mozaws.net/index.php?/cases/view/2092713
// Tests the Logins and passwords menu items and default values // Tests the Logins and passwords menu items and default values
@Test @Test

Loading…
Cancel
Save