For #8485 Update UI tests after settings reorg
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)))
|
||||||
|
}
|
||||||
|
|
||||||
// DEVELOPER TOOLS SECTION
|
// ADVANCED SECTION
|
||||||
private fun assertDeveloperToolsHeading() {
|
private fun assertAdvancedHeading() {
|
||||||
scrollToElementByText("Developer tools")
|
scrollToElementByText("Advanced")
|
||||||
onView(withText("Developer tools"))
|
onView(withText("Advanced"))
|
||||||
|
.check(matches(withEffectiveVisibility(Visibility.VISIBLE)))
|
||||||
|
}
|
||||||
|
|
||||||
|
private fun assertAddons() {
|
||||||
|
scrollToElementByText("Add-ons")
|
||||||
|
onView(withText("Add-ons"))
|
||||||
.check(matches(withEffectiveVisibility(Visibility.VISIBLE)))
|
.check(matches(withEffectiveVisibility(Visibility.VISIBLE)))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue