Bug 1812461 - Migrate TCP CFR Tests to compose
Two new tests have been added to check the TCP cfr and the review checker cfr has been made sticky as wellfenix/119.0
parent
b7db4a7875
commit
2807157d2c
@ -0,0 +1,77 @@
|
||||
/* 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.compose.ui.test.junit4.AndroidComposeTestRule
|
||||
import okhttp3.mockwebserver.MockWebServer
|
||||
import org.junit.After
|
||||
import org.junit.Before
|
||||
import org.junit.Rule
|
||||
import org.junit.Test
|
||||
import org.mozilla.fenix.ext.settings
|
||||
import org.mozilla.fenix.helpers.AndroidAssetDispatcher
|
||||
import org.mozilla.fenix.helpers.HomeActivityTestRule
|
||||
import org.mozilla.fenix.helpers.TestAssetHelper.getGenericAsset
|
||||
import org.mozilla.fenix.ui.robots.navigationToolbar
|
||||
|
||||
/**
|
||||
* Tests for verifying the new Cookie protection & homescreen feature hints.
|
||||
* Note: This involves setting the feature flags On for CFRs which are disabled elsewhere.
|
||||
*
|
||||
*/
|
||||
class TotalCookieProtectionTest {
|
||||
private lateinit var mockWebServer: MockWebServer
|
||||
|
||||
@get:Rule
|
||||
val composeTestRule = AndroidComposeTestRule(
|
||||
HomeActivityTestRule(
|
||||
isTCPCFREnabled = true,
|
||||
isCookieBannerReductionDialogEnabled = false,
|
||||
),
|
||||
) { it.activity }
|
||||
|
||||
@Before
|
||||
fun setUp() {
|
||||
mockWebServer = MockWebServer().apply {
|
||||
dispatcher = AndroidAssetDispatcher()
|
||||
start()
|
||||
}
|
||||
}
|
||||
|
||||
@After
|
||||
fun tearDown() {
|
||||
mockWebServer.shutdown()
|
||||
}
|
||||
|
||||
// TestRail link: https://testrail.stage.mozaws.net/index.php?/cases/view/2260552
|
||||
@Test
|
||||
fun openTotalCookieProtectionLearnMoreLinkTest() {
|
||||
val genericPage = getGenericAsset(mockWebServer, 1)
|
||||
|
||||
navigationToolbar {
|
||||
}.enterURLAndEnterToBrowserForTCPCFR(genericPage.url) {
|
||||
waitForPageToLoad()
|
||||
verifyCookiesProtectionHintIsDisplayed(composeTestRule, true)
|
||||
clickTCPCFRLearnMore(composeTestRule)
|
||||
verifyUrl("support.mozilla.org/en-US/kb/enhanced-tracking-protection-firefox-android")
|
||||
verifyShouldShowCFRTCP(false, composeTestRule.activity.settings())
|
||||
}
|
||||
}
|
||||
|
||||
// TestRail link: https://testrail.stage.mozaws.net/index.php?/cases/view/1913589
|
||||
@Test
|
||||
fun dismissTotalCookieProtectionHintTest() {
|
||||
val genericPage = getGenericAsset(mockWebServer, 1)
|
||||
|
||||
navigationToolbar {
|
||||
}.enterURLAndEnterToBrowserForTCPCFR(genericPage.url) {
|
||||
waitForPageToLoad()
|
||||
verifyCookiesProtectionHintIsDisplayed(composeTestRule, true)
|
||||
dismissTCPCFRPopup(composeTestRule)
|
||||
verifyCookiesProtectionHintIsDisplayed(composeTestRule, false)
|
||||
verifyShouldShowCFRTCP(false, composeTestRule.activity.settings())
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue