1 /* This Source Code Form is subject to the terms of the Mozilla Public
2 * License, v. 2.0. If a copy of the MPL was not distributed with this
3 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
5 package org.mozilla.fenix.ui
9 import org.mozilla.fenix.helpers.HomeActivityTestRule
10 import org.mozilla.fenix.helpers.TestAssetHelper
11 import org.mozilla.fenix.helpers.TestHelper.mDevice
12 import org.mozilla.fenix.helpers.TestSetup
13 import org.mozilla.fenix.ui.robots.homeScreen
14 import org.mozilla.fenix.ui.robots.navigationToolbar
15 import org.mozilla.fenix.ui.robots.notificationShade
18 * Tests for verifying the the privacy and security section of the Settings menu
22 class SettingsPrivacyTest : TestSetup() {
24 val activityTestRule = HomeActivityTestRule.withDefaultSettingsOverrides(skipOnboarding = true)
26 // TestRail link: https://testrail.stage.mozaws.net/index.php?/cases/view/2092698
28 fun settingsPrivacyItemsTest() {
32 verifySettingsToolbar()
33 verifyPrivacyHeading()
34 verifyPrivateBrowsingButton()
35 verifyHTTPSOnlyModeButton()
36 verifySettingsOptionSummary("HTTPS-Only Mode", "Off")
37 verifySettingsOptionSummary("Cookie Banner Blocker in private browsing", "")
38 verifyEnhancedTrackingProtectionButton()
39 verifySettingsOptionSummary("Enhanced Tracking Protection", "Standard")
40 verifySitePermissionsButton()
41 verifyDeleteBrowsingDataButton()
42 verifyDeleteBrowsingDataOnQuitButton()
43 verifySettingsOptionSummary("Delete browsing data on quit", "Off")
44 verifyNotificationsButton()
45 verifySettingsOptionSummary("Notifications", "Allowed")
46 verifyDataCollectionButton()
50 // TestRail link: https://testrail.stage.mozaws.net/index.php?/cases/view/243362
52 fun verifyDataCollectionSettingsTest() {
56 }.openSettingsSubMenuDataCollection {
57 verifyDataCollectionView(
62 clickUsageAndTechnicalDataToggle()
63 verifyUsageAndTechnicalDataToggle(false)
64 clickUsageAndTechnicalDataToggle()
65 verifyUsageAndTechnicalDataToggle(true)
66 clickMarketingDataToggle()
67 verifyMarketingDataToggle(false)
68 clickMarketingDataToggle()
69 verifyMarketingDataToggle(true)
71 verifyStudiesToggle(true)
74 clickStudiesDialogCancelButton()
75 verifyStudiesToggle(true)
79 // TestRail link: https://testrail.stage.mozaws.net/index.php?/cases/view/1024594
81 fun verifyNotificationsSettingsTest() {
82 val defaultWebPage = TestAssetHelper.getGenericAsset(mockWebServer, 1)
84 // Clear all existing notifications
86 mDevice.openNotification()
91 }.togglePrivateBrowsingMode()
94 }.enterURLAndEnterToBrowser(defaultWebPage.url) {
95 }.openNotificationShade {
96 verifySystemNotificationExists("Close private tabs")
97 }.closeNotificationTray {
100 verifySettingsOptionSummary("Notifications", "Allowed")
101 }.openSettingsSubMenuNotifications {
102 verifyAllSystemNotificationsToggleState(true)
103 verifyPrivateBrowsingSystemNotificationsToggleState(true)
104 clickPrivateBrowsingSystemNotificationsToggle()
105 verifyPrivateBrowsingSystemNotificationsToggleState(false)
106 clickAllSystemNotificationsToggle()
107 verifyAllSystemNotificationsToggleState(false)
109 verifySettingsOptionSummary("Notifications", "Not allowed")
111 }.openNotificationShade {
112 verifySystemNotificationDoesNotExist("Close private tabs")