71 lines
2.0 KiB
Kotlin
71 lines
2.0 KiB
Kotlin
/* 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 okhttp3.mockwebserver.MockWebServer
|
|
import org.junit.After
|
|
import org.junit.Before
|
|
import org.junit.Rule
|
|
import org.junit.Test
|
|
import org.mozilla.fenix.helpers.AndroidAssetDispatcher
|
|
import org.mozilla.fenix.helpers.HomeActivityTestRule
|
|
import org.mozilla.fenix.helpers.TestAssetHelper.getGenericAsset
|
|
import org.mozilla.fenix.helpers.TestHelper.mDevice
|
|
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 ContextualHintsTest {
|
|
private lateinit var mockWebServer: MockWebServer
|
|
|
|
@get:Rule
|
|
val activityTestRule = HomeActivityTestRule(
|
|
isJumpBackInCFREnabled = true,
|
|
isTCPCFREnabled = true,
|
|
isPocketEnabled = false,
|
|
isRecentlyVisitedFeatureEnabled = false,
|
|
)
|
|
|
|
@Before
|
|
fun setUp() {
|
|
mockWebServer = MockWebServer().apply {
|
|
dispatcher = AndroidAssetDispatcher()
|
|
start()
|
|
}
|
|
}
|
|
|
|
@After
|
|
fun tearDown() {
|
|
mockWebServer.shutdown()
|
|
}
|
|
|
|
@Test
|
|
fun jumpBackInCFRTest() {
|
|
val genericPage = getGenericAsset(mockWebServer, 1)
|
|
|
|
navigationToolbar {
|
|
}.enterURLAndEnterToBrowser(genericPage.url) {
|
|
verifyCookiesProtectionHint()
|
|
// One back press to dismiss the TCP hint
|
|
mDevice.pressBack()
|
|
}.goToHomescreen {
|
|
verifyJumpBackInMessage()
|
|
}
|
|
}
|
|
|
|
@Test
|
|
fun cookieProtectionHintTest() {
|
|
val genericPage = getGenericAsset(mockWebServer, 1)
|
|
|
|
navigationToolbar {
|
|
}.enterURLAndEnterToBrowser(genericPage.url) {
|
|
verifyCookiesProtectionHint()
|
|
}
|
|
}
|
|
}
|