Bug 1807268 - Re-enable verifyShowClipboardSuggestionsToggleTest UI test r=jajohnson
[gecko.git] / mobile / android / fenix / app / src / androidTest / java / org / mozilla / fenix / ui / SettingsPrivacyTest.kt
blob93084fb3eaaec65118e934d29de48386878fb336
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
7 import org.junit.Rule
8 import org.junit.Test
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
17 /**
18  *  Tests for verifying the the privacy and security section of the Settings menu
19  *
20  */
22 class SettingsPrivacyTest : TestSetup() {
23     @get:Rule
24     val activityTestRule = HomeActivityTestRule.withDefaultSettingsOverrides(skipOnboarding = true)
26     // TestRail link: https://testrail.stage.mozaws.net/index.php?/cases/view/2092698
27     @Test
28     fun settingsPrivacyItemsTest() {
29         homeScreen {
30         }.openThreeDotMenu {
31         }.openSettings {
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()
47         }
48     }
50     // TestRail link: https://testrail.stage.mozaws.net/index.php?/cases/view/243362
51     @Test
52     fun verifyDataCollectionSettingsTest() {
53         homeScreen {
54         }.openThreeDotMenu {
55         }.openSettings {
56         }.openSettingsSubMenuDataCollection {
57             verifyDataCollectionView(
58                 true,
59                 true,
60                 "On",
61             )
62             clickUsageAndTechnicalDataToggle()
63             verifyUsageAndTechnicalDataToggle(false)
64             clickUsageAndTechnicalDataToggle()
65             verifyUsageAndTechnicalDataToggle(true)
66             clickMarketingDataToggle()
67             verifyMarketingDataToggle(false)
68             clickMarketingDataToggle()
69             verifyMarketingDataToggle(true)
70             clickStudiesOption()
71             verifyStudiesToggle(true)
72             clickStudiesToggle()
73             verifyStudiesDialog()
74             clickStudiesDialogCancelButton()
75             verifyStudiesToggle(true)
76         }
77     }
79     // TestRail link: https://testrail.stage.mozaws.net/index.php?/cases/view/1024594
80     @Test
81     fun verifyNotificationsSettingsTest() {
82         val defaultWebPage = TestAssetHelper.getGenericAsset(mockWebServer, 1)
84         // Clear all existing notifications
85         notificationShade {
86             mDevice.openNotification()
87             clearNotifications()
88         }
90         homeScreen {
91         }.togglePrivateBrowsingMode()
93         navigationToolbar {
94         }.enterURLAndEnterToBrowser(defaultWebPage.url) {
95         }.openNotificationShade {
96             verifySystemNotificationExists("Close private tabs")
97         }.closeNotificationTray {
98         }.openThreeDotMenu {
99         }.openSettings {
100             verifySettingsOptionSummary("Notifications", "Allowed")
101         }.openSettingsSubMenuNotifications {
102             verifyAllSystemNotificationsToggleState(true)
103             verifyPrivateBrowsingSystemNotificationsToggleState(true)
104             clickPrivateBrowsingSystemNotificationsToggle()
105             verifyPrivateBrowsingSystemNotificationsToggleState(false)
106             clickAllSystemNotificationsToggle()
107             verifyAllSystemNotificationsToggleState(false)
108         }.goBack {
109             verifySettingsOptionSummary("Notifications", "Not allowed")
110         }.goBackToBrowser {
111         }.openNotificationShade {
112             verifySystemNotificationDoesNotExist("Close private tabs")
113         }
114     }