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 {
|
||||
}.openThreeDotMenu {
|
||||
}.openSettings {
|
||||
verifyDeveloperToolsHeading()
|
||||
verifyRemoteDebug()
|
||||
}
|
||||
}
|
||||
|
|
|
@ -111,7 +111,6 @@ class SettingsPrivacyTest {
|
|||
verifyDeleteBrowsingDataButton()
|
||||
verifyDeleteBrowsingDataOnQuitButton()
|
||||
verifyDataCollectionButton()
|
||||
verifyLeakCanaryButton()
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -64,9 +64,9 @@ class SettingsRobot {
|
|||
fun verifyLeakCanaryButton() = assertLeakCanaryButton()
|
||||
fun verifySettingsView() = assertSettingsView()
|
||||
|
||||
// DEVELOPER TOOLS SECTION
|
||||
fun verifyDeveloperToolsHeading() = assertDeveloperToolsHeading()
|
||||
|
||||
// ADVANCED SECTION
|
||||
fun verifyAdvancedHeading() = assertAdvancedHeading()
|
||||
fun verifyAddons() = assertAddons()
|
||||
fun verifyRemoteDebug() = assertRemoteDebug()
|
||||
|
||||
// ABOUT SECTION
|
||||
|
@ -174,7 +174,7 @@ private fun assertSettingsView() {
|
|||
// verify that we are in the correct library view
|
||||
assertGeneralHeading()
|
||||
assertPrivacyHeading()
|
||||
assertDeveloperToolsHeading()
|
||||
assertAdvancedHeading()
|
||||
assertAboutHeading()
|
||||
}
|
||||
|
||||
|
@ -255,13 +255,22 @@ private fun assertDeleteBrowsingDataOnQuitButton() {
|
|||
private fun assertDataCollectionButton() = onView(withText("Data collection"))
|
||||
.check(matches(withEffectiveVisibility(Visibility.VISIBLE)))
|
||||
|
||||
private fun assertLeakCanaryButton() = onView(withText("LeakCanary"))
|
||||
.check(matches(withEffectiveVisibility(Visibility.VISIBLE)))
|
||||
private fun assertLeakCanaryButton() {
|
||||
scrollToElementByText("LeakCanary")
|
||||
onView(withText("LeakCanary"))
|
||||
.check(matches(withEffectiveVisibility(Visibility.VISIBLE)))
|
||||
}
|
||||
|
||||
// DEVELOPER TOOLS SECTION
|
||||
private fun assertDeveloperToolsHeading() {
|
||||
scrollToElementByText("Developer tools")
|
||||
onView(withText("Developer tools"))
|
||||
// ADVANCED SECTION
|
||||
private fun assertAdvancedHeading() {
|
||||
scrollToElementByText("Advanced")
|
||||
onView(withText("Advanced"))
|
||||
.check(matches(withEffectiveVisibility(Visibility.VISIBLE)))
|
||||
}
|
||||
|
||||
private fun assertAddons() {
|
||||
scrollToElementByText("Add-ons")
|
||||
onView(withText("Add-ons"))
|
||||
.check(matches(withEffectiveVisibility(Visibility.VISIBLE)))
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue