Stub out Settings tests

nightly-build-test
Richard Pappalardo 5 years ago committed by Jeff Boek
parent 68f5d211d3
commit ca24dd6ea8

@ -8,7 +8,6 @@ import androidx.test.uiautomator.UiDevice
import org.junit.Rule import org.junit.Rule
import org.junit.Test import org.junit.Test
import org.mozilla.fenix.helpers.HomeActivityTestRule import org.mozilla.fenix.helpers.HomeActivityTestRule
import androidx.test.platform.app.InstrumentationRegistry import androidx.test.platform.app.InstrumentationRegistry
import androidx.test.uiautomator.By import androidx.test.uiautomator.By
import androidx.test.uiautomator.Until import androidx.test.uiautomator.Until

@ -0,0 +1,162 @@
/* 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.Ignore
import org.junit.Test
import org.mozilla.fenix.helpers.AndroidAssetDispatcher
import org.mozilla.fenix.helpers.HomeActivityTestRule
/**
* Tests for verifying the main three dot menu options
*
*/
class SettingsBasicsTest {
/* 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 activityTestRule = HomeActivityTestRule()
@Before
fun setUp() {
mockWebServer = MockWebServer().apply {
setDispatcher(AndroidAssetDispatcher())
start()
}
}
@After
fun tearDown() {
mockWebServer.shutdown()
}
@Ignore("This is a stub test, ignore for now")
@Test
fun settingsMenuBasicsItemsTests() {
// Open 3dot (main) menu
// Select settings
// Verify header: "Basics"
// Verify item: "Search Engine" and default value: "Google"
// Open 3dot (main) menu
// Select settings
// Verify default search engine (Google)
// Select "Search engine" to change
// Verify menu choices: Google, Amazon.com, Bing, DuckDuckGo, Twitter, Wikipedia
// Verify label: "Show search suggestions"
// Verify search suggestions toggle, set to 'on' by default
// Verify label: "Show visited sites and bookmarks"
// Verify visited sites and bookmarks toggle, set to 'on' by default
// Verify item: "Theme" and default value: "Light"
// Verify item: "Accessibility"
// Verify item: "Set as default browser" and default toggle value: "off"
// Verify item: "Search Engine" and default value: "Google"
}
@Ignore("This is a stub test, ignore for now")
@Test
fun selectNewDefaultSearchEngine() {
// Open 3dot (main) menu
// Select settings
// Select "Search engine"
// Choose: DuckDuckGo
// Back arrow to Home
// Verify DuckDuckGo icon in Navigation bar
}
@Ignore("This is a stub test, ignore for now")
@Test
fun toggleSearchSuggestions() {
// Enter: "mozilla" in navigation bar
// Verify more than one suggesion provided
// Open 3dot (main) menu
// Select settings
// Select "Search engine"
// Toggle 'Show search suggestions' to 'off'
// Back arrow twice to home screen
// Enter: "mozilla" in navigation bar
// Verify no suggestions provided
}
@Ignore("This is a stub test, ignore for now")
@Test
fun toggleShowVisitedSitesAndBookmarks() {
// Visit 3 static sites
// Bookmark 2 of them
// Open 3dot (main) menu
// Enter navigation bar and verify visited sites appear
// Verify bookmarks exist
// Open 3dot (main) menu
// Select settings
// Select "Search engine"
// Toggle off "Show visited sites and bookmarks"
// Back arrow twice to home screen
// Verify history and bookmarks are gone
}
@Ignore("This is a stub test, ignore for now")
@Test
fun changeThemeSetting() {
// Open 3dot (main) menu
// Select settings
// Verify default theme appears as "Light"
// Select theme to enter theme sub-menu
// Verify them sub-menu has 3 options: "Light", "Dark" and "Set by Battery Saver"
// Select "Dark" theme
// Verify them is changed to Dark
// Optional:
// Select "Set by battery saver"
// Verify theme changes based on battery saver
}
@Ignore("This is a stub test, ignore for now")
@Test
fun changeAccessibiltySettings() {
// Open 3dot (main) menu
// Select settings
// Select Accessibility
// Verify header: "Automatic Font Sizing"
// Verify description: "Font size will match your Android settings. Disable to manage font size here"
// Verify toggle is set to 'on' by default
// Toggle font size to off
// Verify that new sub-menu items appear....
// Verify header: "Font Size"
// Verify description: "Make text on websites larger or smaller"
// Verify slider bar exists
// Verify slider bar default value set to 100%
// Verify sample text "The quick brown fox..." appears 4 times
// Move slider bar to 180%
// Verify that text grows to 180%
// Back error twice to home screen
// Open static website in navigation bar
// Verify that text is now at 180%
// Select settings
// Select Accessibility
// Toggle font size back to 'off'
// Verify that "Font Size" header, description, slider bar and sample text all disappear
}
@Ignore("This is a stub test, ignore for now")
@Test
fun changeDefaultBrowserSetting() {
// Open 3dot (main) menu
// Select settings
// Verify that "Set as default browser toggle is set to 'off' (default)
// Turn default browser toggle 'on'
// Verify that Andrdoid "Default Apps" menu appears
}
}

@ -0,0 +1,253 @@
/* 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.Ignore
import org.junit.Test
import org.mozilla.fenix.helpers.AndroidAssetDispatcher
import org.mozilla.fenix.helpers.HomeActivityTestRule
/**
* Tests for verifying the main three dot menu options
*
*/
class SettingsPrivacyTest {
/* 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 activityTestRule = HomeActivityTestRule()
@Before
fun setUp() {
mockWebServer = MockWebServer().apply {
setDispatcher(AndroidAssetDispatcher())
start()
}
}
@After
fun tearDown() {
mockWebServer.shutdown()
}
@Ignore("This is a stub test, ignore for now")
@Test
fun settingsPrivacyItemsTest() {
// Open 3dot (main) menu
// Select settings
// Verify header: "Privacy"
// Verify item: "Tracking Protection" and default value: "On"
// Verify item: "Tracking Protection" and default value: "On"
// Verify item: "Site Permissions"
// Click on: "Site permissions"
// Verify sub-menu items...
// Verify item: Exceptions
// Verify item: header: "Permissions"
// Verify item: "Camera" and default value: "ask to allow"
// Verify item: "Location" and default value: "ask to allow"
// Verify item: "Microphone" and default value: "ask to allow"
// Verify item: "Notification" and default value: "ask to allow"
// Verify item: "Delete browsing data"
// Click on: "Delete browsing data"
// Verify sub-menu items...
// Verify item: "Open tabs"
// Verify item" <tab count> tabs
// Verify item: "Browsing history and site data"
// Verify item" <address count> addresses
// Verify item: "Collections
// Verify item" <collection count> collections
// Verify item button: "Delete browsing data"
// Verify item: "Data collection"
// Click on: "Data collection"
// Verify sub-menu items...
// Verify header: "Usage and technical data"
// Verify description: "Shares performance, usage, hardware and customization data about your browser with Mozilla to help us make Firefox Preview better"
// Verify item: toggle default value: 'on'
// Verify item: "Privacy notice"
// Verify item: "Leak Canary" and default toggle value: "Off"
}
@Ignore("This is a stub test, ignore for now")
@Test
fun toggleTrackingProtection() {
// Open static test website to verify TP is turned on (default): https://github.com/rpappalax/testapp
// (static content needs to be migrated to assets folder)
// Open 3dot (main) menu
// Select settings
// Toggle Tracking Protection to 'off'
// Back arrow to Home
// Open static test website to verify TP is now off: https://github.com/rpappalax/testapp
}
@Ignore("This is a stub test, ignore for now")
@Test
fun verifySitePermissions() {
// Open 3dot (main) menu
// Select settings
// Click on: "Site permissions"
// Verify sub-menu items...
// Click on: "Exceptions"
// Verify: "No site exceptions"
// TBD: create a site exception
// TBD: return to this UI and verify
//
// Open browser to static test website: https://github.com/rpappalax/testapp
// Click on "Test site permissions: geolocation"
// Verify that geolocation permissions dialogue is opened
// Verify text: "Allow <website URL> to use your geolocation?
// Verify toggle: 'Remember decision for this site?"
// Verify button: "Don't Allow"
// Verify button: "Allow" (default)
// Select "Remember decision for this site"
// Refresh page
// Click on "Test site permissions: geolocation"
// Verify that geolocation permissions dialogue is not opened
//
//
// Open browser to static test website: https://github.com/rpappalax/testapp
// Click on "Test site permissions: camera"
// Verify that camera permissions dialogue is opened
// Verify text: "Allow <website URL> to use your camera?
// Verify toggle: 'Remember decision for this site?"
// Verify button: "Don't Allow"
// Verify button: "Allow" (default)
// Select "Remember decision for this site"
// Refresh page
// Click on "Test site permissions: camera"
// Verify that camera permissions dialogue is not opened
//
//
// Open browser to static test website: https://github.com/rpappalax/testapp
// Click on "Test site permissions: microphone"
// Verify that microphone permissions dialogue is opened
// Verify text: "Allow <website URL> to use your microphone?
// Verify toggle: 'Remember decision for this site?"
// Verify button: "Don't Allow"
// Verify button: "Allow" (default)
// Select "Remember decision for this site"
// Refresh page
// Click on "Test site permissions: microphone"
// Verify that microphone permissions dialogue is not opened
//
//
// Open browser to static test website: https://github.com/rpappalax/testapp
// Click on "Test site permissions: notifications dialogue"
// Verify that notifications dialogue permissions dialogue is opened
// Verify text: "Allow <website URL> to send notifications?
// Verify toggle: 'Remember decision for this site?"
// Verify button: "Never"
// Verify button: "Always" (default)
// Select "Remember decision for this site"
// Refresh page
// Click on "Test site permissions: notifications dialogue"
// Verify that notifications dialogue permissions dialogue is not opened
//
// Open 3dot (main) menu
// Select settings
// Click on: "Site permissions"
// Select: Camera
// Switch from "ask to allow" (default) to "blocked"
// Click back arrow
//
// Select: Location
// Switch from "ask to allow" (default) to "blocked"
// Click back arrow
//
// Select: Microphone
// Switch from "ask to allow" (default) to "blocked"
// Click back arrow
//
// Select: Notification
// Switch from "ask to allow" (default) to "blocked"
// Click back arrow
//
// Open browser to static test website: https://github.com/rpappalax/testapp
// Click on "Test site permissions: camera dialogue"
// Verify that notifications dialogue permissions dialogue is not opened
//
// Open browser to static test website: https://github.com/rpappalax/testapp
// Click on "Test site permissions: geolocation dialogue"
// Verify that notifications dialogue permissions dialogue is not opened
//
// Open browser to static test website: https://github.com/rpappalax/testapp
// Click on "Test site permissions: microphone dialogue"
// Verify that notifications dialogue permissions dialogue is not opened
//
// Open browser to static test website: https://github.com/rpappalax/testapp
// Click on "Test site permissions: notifications dialogue"
// Verify that notifications dialogue permissions dialogue is not opened
}
@Ignore("This is a stub test, ignore for now")
@Test
fun deleteBrowsingData() {
// Setup:
// Open 2 websites as 2 tabs
// Save as 1 collection
// Open 2 more websites in 2 other tabs
// Save as a 2nd collection
// Open 3dot (main) menu
// Select settings
// Click on "Delete browsing data"
// Verify correct number of tabs, addresses and collections are indicated
// Select all 3 checkboxes
// Click on "Delete browsing data button"
// Return to home screen and verify that all tabs, history and collection are gone
//
// Verify xxx
}
@Ignore("This is a stub test, ignore for now")
@Test
fun verifyDataCollection() {
// Open 3dot (main) menu
// Select settings
// Click on "Data collection"
// Verify header: "Usage and technical data"
// Verify text: "Shares performance, usage, hardware and customization data about your browser with Mozilla"
// " to help us make Firefox preview better"
// Verify toggle is on by default
// TBD:
// see: telemetry testcases
}
@Ignore("This is a stub test, ignore for now")
@Test
fun openPrivacyNotice() {
// Open 3dot (main) menu
// Select settings
// Click on "Privacy notice"
// Verify redirect to: mozilla.org Privacy notice page"
}
@Ignore("This is a stub test, ignore for now")
@Test
fun checkLeakCanary() {
// Open 3dot (main) menu
// Select settings
// Click on Leak Canary toggle
// Verify 'dump' message
}
}

@ -0,0 +1,70 @@
/* 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.Ignore
import org.junit.Test
import org.mozilla.fenix.helpers.AndroidAssetDispatcher
import org.mozilla.fenix.helpers.HomeActivityTestRule
/**
* Tests for verifying the main three dot menu options
*
*/
class SettingsSyncTest {
/* 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 activityTestRule = HomeActivityTestRule()
@Before
fun setUp() {
mockWebServer = MockWebServer().apply {
setDispatcher(AndroidAssetDispatcher())
start()
}
}
@After
fun tearDown() {
mockWebServer.shutdown()
}
@Ignore("This is a stub test, ignore for now")
@Test
// Walks through settings menu and sub-menus to ensure all items are present
fun settingsSyncMenusItemsTest() {
// SYNC
// Open 3dot (main) menu
// Select settings
// Verify header: "Turn on Sync"
// Verify description: "Sync bookmarks, history, and more with your Firefox Account"
}
// SYNC
@Ignore("This is a stub test, ignore for now")
@Test
fun turnOnSync() {
// Note this requires a test Firefox Account and a desktop
// Open 3dot (main) menu
// Select settings
// Click on "Turn on Sync"
// Open Firefox on laptop and go to https://firefox.com/pair
// Pair with QR code and/or alternate method
// Verify pairing
}
}

@ -0,0 +1,129 @@
/* 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.Ignore
import org.junit.Test
import org.mozilla.fenix.helpers.AndroidAssetDispatcher
import org.mozilla.fenix.helpers.HomeActivityTestRule
/**
* Tests for verifying the main three dot menu options
*
*/
class SettingsTest {
/* 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 activityTestRule = HomeActivityTestRule()
@Before
fun setUp() {
mockWebServer = MockWebServer().apply {
setDispatcher(AndroidAssetDispatcher())
start()
}
}
@After
fun tearDown() {
mockWebServer.shutdown()
}
@Ignore("This is a stub test, ignore for now")
@Test
// Walks through settings menu and sub-menus to ensure all items are present
fun settingsMenusItemsTest() {
// SYNC
// see: SettingsSyncTest
// BASICS
// see: SettingsBasicsTest
// PRIVACY
// see: SettingsPrivacyTest
// DEVELOPER TOOLS
// Verify header: "Developer Tools"
// Verify item: "Remote debugging via USB" and default toggle value: "Off"
// ABOUT
// Verify header: "About"
// Verify item: "Help"
// Verify item: "Rate on Google Play"
// Verify item: "About Firefox Preview"
//
}
// SYNC
// see: SettingsSyncTest
// BASICS
// see: SettingsBasicsTest
//
// PRIVACY
// see: SettingsPrivacyTest
// DEVELOPER TOOLS
@Ignore("This is a stub test, ignore for now")
@Test
fun turnOnRemoteDebuggingViaUsb() {
// Open terminal
// Verify USB debugging is off
// Open 3dot (main) menu
// Select settings
// Toggle Remote debugging via USB to 'on'
// Open terminal
// Verify USB debugging is on
}
// ABOUT
@Ignore("This is a stub test, ignore for now")
@Test
fun verifyHelpRedirect() {
// Open 3dot (main) menu
// Select settings
// Click on "Help"
// Verify redirect to: https://support.mozilla.org/
}
@Ignore("This is a stub test, ignore for now")
@Test
fun verifyRateOnGooglePlayRedirect() {
// Open 3dot (main) menu
// Select settings
// Click on "Rate on Google Play"
// Verify Android "Open with Google Play Store" sub menu
}
@Ignore("This is a stub test, ignore for now")
@Test
fun verifyAboutFirefoxPreview() {
// Open 3dot (main) menu
// Select settings
// Click on "Verify About Firefox Preview"
// Verify about page contains....
// Build #
// Version #
// "Firefox Preview is produced by Mozilla"
// Day, Date, timestamp
// "Open source libraries we use"
}
}

@ -4,26 +4,44 @@
package org.mozilla.fenix.ui 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.Rule
import org.junit.Before
import org.junit.After
import org.junit.Test import org.junit.Test
import org.mozilla.fenix.helpers.AndroidAssetDispatcher
import org.mozilla.fenix.helpers.HomeActivityTestRule import org.mozilla.fenix.helpers.HomeActivityTestRule
import org.mozilla.fenix.ui.robots.homeScreen import org.mozilla.fenix.ui.robots.homeScreen
/** /**
* Tests for verifying the main three dot menu options * Tests for verifying the main three dot menu options
* *
* Including:
* - Verify all menu items present
* - Open library button opens library menu
* - Open settings button opens settings menu
* - Open Help button opens support page in browser
*
*/ */
class ThreeDotMenuTest { class ThreeDotMenuMainTest {
/* ktlint-disable no-blank-line-before-rbrace */ // This imposes unreadable grouping. /* 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 @get:Rule
val activityTestRule = HomeActivityTestRule() val activityTestRule = HomeActivityTestRule()
@Before
fun setUp() {
mockWebServer = MockWebServer().apply {
setDispatcher(AndroidAssetDispatcher())
start()
}
}
@After
fun tearDown() {
mockWebServer.shutdown()
}
@Test @Test
fun threeDotMenuItemsTest() { fun threeDotMenuItemsTest() {
homeScreen { homeScreen {
Loading…
Cancel
Save