For #8485 Update UI tests after settings reorg

fennec/production
mcarare 4 years ago committed by Emily Kager
parent edabf9c865
commit 677a9da5ec

@ -0,0 +1,59 @@
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
package org.mozilla.fenix.ui
import androidx.test.platform.app.InstrumentationRegistry
import androidx.test.uiautomator.UiDevice
import okhttp3.mockwebserver.MockWebServer
import org.junit.Rule
import org.junit.Before
import org.junit.After
import org.junit.Test
import org.mozilla.fenix.helpers.AndroidAssetDispatcher
import org.mozilla.fenix.helpers.HomeActivityIntentTestRule
import org.mozilla.fenix.ui.robots.homeScreen
/**
* Tests for verifying the advanced section in Settings
*
*/
class SettingsAdvancedTest {
/* ktlint-disable no-blank-line-before-rbrace */ // This imposes unreadable grouping.
private val mDevice = UiDevice.getInstance(InstrumentationRegistry.getInstrumentation())
private lateinit var mockWebServer: MockWebServer
@get:Rule
val activityIntentTestRule = HomeActivityIntentTestRule()
@Before
fun setUp() {
mockWebServer = MockWebServer().apply {
setDispatcher(AndroidAssetDispatcher())
start()
}
}
@After
fun tearDown() {
mockWebServer.shutdown()
}
@Test
// Walks through settings menu and sub-menus to ensure all items are present
fun settingsAboutItemsTest() {
// ADVANCED
homeScreen {
}.openThreeDotMenu {
}.openSettings {
// ADVANCED
verifyAdvancedHeading()
verifyAddons()
verifyRemoteDebug()
verifyLeakCanaryButton()
}
}
}

@ -49,7 +49,6 @@ class SettingsDeveloperToolsTest {
homeScreen { homeScreen {
}.openThreeDotMenu { }.openThreeDotMenu {
}.openSettings { }.openSettings {
verifyDeveloperToolsHeading()
verifyRemoteDebug() verifyRemoteDebug()
} }
} }

@ -111,7 +111,6 @@ class SettingsPrivacyTest {
verifyDeleteBrowsingDataButton() verifyDeleteBrowsingDataButton()
verifyDeleteBrowsingDataOnQuitButton() verifyDeleteBrowsingDataOnQuitButton()
verifyDataCollectionButton() verifyDataCollectionButton()
verifyLeakCanaryButton()
} }
} }

@ -64,9 +64,9 @@ class SettingsRobot {
fun verifyLeakCanaryButton() = assertLeakCanaryButton() fun verifyLeakCanaryButton() = assertLeakCanaryButton()
fun verifySettingsView() = assertSettingsView() fun verifySettingsView() = assertSettingsView()
// DEVELOPER TOOLS SECTION // ADVANCED SECTION
fun verifyDeveloperToolsHeading() = assertDeveloperToolsHeading() fun verifyAdvancedHeading() = assertAdvancedHeading()
fun verifyAddons() = assertAddons()
fun verifyRemoteDebug() = assertRemoteDebug() fun verifyRemoteDebug() = assertRemoteDebug()
// ABOUT SECTION // ABOUT SECTION
@ -174,7 +174,7 @@ private fun assertSettingsView() {
// verify that we are in the correct library view // verify that we are in the correct library view
assertGeneralHeading() assertGeneralHeading()
assertPrivacyHeading() assertPrivacyHeading()
assertDeveloperToolsHeading() assertAdvancedHeading()
assertAboutHeading() assertAboutHeading()
} }
@ -255,13 +255,22 @@ private fun assertDeleteBrowsingDataOnQuitButton() {
private fun assertDataCollectionButton() = onView(withText("Data collection")) private fun assertDataCollectionButton() = onView(withText("Data collection"))
.check(matches(withEffectiveVisibility(Visibility.VISIBLE))) .check(matches(withEffectiveVisibility(Visibility.VISIBLE)))
private fun assertLeakCanaryButton() = onView(withText("LeakCanary")) private fun assertLeakCanaryButton() {
.check(matches(withEffectiveVisibility(Visibility.VISIBLE))) scrollToElementByText("LeakCanary")
onView(withText("LeakCanary"))
.check(matches(withEffectiveVisibility(Visibility.VISIBLE)))
}
// ADVANCED SECTION
private fun assertAdvancedHeading() {
scrollToElementByText("Advanced")
onView(withText("Advanced"))
.check(matches(withEffectiveVisibility(Visibility.VISIBLE)))
}
// DEVELOPER TOOLS SECTION private fun assertAddons() {
private fun assertDeveloperToolsHeading() { scrollToElementByText("Add-ons")
scrollToElementByText("Developer tools") onView(withText("Add-ons"))
onView(withText("Developer tools"))
.check(matches(withEffectiveVisibility(Visibility.VISIBLE))) .check(matches(withEffectiveVisibility(Visibility.VISIBLE)))
} }

Loading…
Cancel
Save