|
|
|
@ -4,24 +4,14 @@
|
|
|
|
|
|
|
|
|
|
package org.mozilla.fenix.ui
|
|
|
|
|
|
|
|
|
|
import android.content.Context
|
|
|
|
|
import androidx.compose.ui.test.junit4.AndroidComposeTestRule
|
|
|
|
|
import androidx.test.espresso.Espresso.openActionBarOverflowOrOptionsMenu
|
|
|
|
|
import androidx.test.espresso.Espresso.pressBack
|
|
|
|
|
import androidx.test.platform.app.InstrumentationRegistry
|
|
|
|
|
import androidx.test.uiautomator.UiDevice
|
|
|
|
|
import kotlinx.coroutines.runBlocking
|
|
|
|
|
import mozilla.components.browser.storage.sync.PlacesHistoryStorage
|
|
|
|
|
import okhttp3.mockwebserver.MockWebServer
|
|
|
|
|
import org.junit.After
|
|
|
|
|
import org.junit.Before
|
|
|
|
|
import org.junit.Ignore
|
|
|
|
|
import org.junit.Rule
|
|
|
|
|
import org.junit.Test
|
|
|
|
|
import org.mozilla.fenix.R
|
|
|
|
|
import org.mozilla.fenix.customannotations.SmokeTest
|
|
|
|
|
import org.mozilla.fenix.ext.settings
|
|
|
|
|
import org.mozilla.fenix.helpers.AndroidAssetDispatcher
|
|
|
|
|
import org.mozilla.fenix.helpers.AppAndSystemHelper.registerAndCleanupIdlingResources
|
|
|
|
|
import org.mozilla.fenix.helpers.HomeActivityIntentTestRule
|
|
|
|
|
import org.mozilla.fenix.helpers.MockBrowserDataHelper
|
|
|
|
@ -29,7 +19,9 @@ import org.mozilla.fenix.helpers.RecyclerViewIdlingResource
|
|
|
|
|
import org.mozilla.fenix.helpers.TestAssetHelper
|
|
|
|
|
import org.mozilla.fenix.helpers.TestHelper.exitMenu
|
|
|
|
|
import org.mozilla.fenix.helpers.TestHelper.longTapSelectItem
|
|
|
|
|
import org.mozilla.fenix.helpers.TestHelper.mDevice
|
|
|
|
|
import org.mozilla.fenix.helpers.TestHelper.verifySnackBarText
|
|
|
|
|
import org.mozilla.fenix.helpers.TestSetup
|
|
|
|
|
import org.mozilla.fenix.ui.robots.browserScreen
|
|
|
|
|
import org.mozilla.fenix.ui.robots.historyMenu
|
|
|
|
|
import org.mozilla.fenix.ui.robots.homeScreen
|
|
|
|
@ -40,40 +32,13 @@ import org.mozilla.fenix.ui.robots.navigationToolbar
|
|
|
|
|
* Tests for verifying basic functionality of history
|
|
|
|
|
*
|
|
|
|
|
*/
|
|
|
|
|
class HistoryTest {
|
|
|
|
|
private lateinit var mockWebServer: MockWebServer
|
|
|
|
|
private lateinit var mDevice: UiDevice
|
|
|
|
|
|
|
|
|
|
class HistoryTest : TestSetup() {
|
|
|
|
|
@get:Rule
|
|
|
|
|
val activityTestRule =
|
|
|
|
|
AndroidComposeTestRule(
|
|
|
|
|
HomeActivityIntentTestRule.withDefaultSettingsOverrides(),
|
|
|
|
|
HomeActivityIntentTestRule(isJumpBackInCFREnabled = false),
|
|
|
|
|
) { it.activity }
|
|
|
|
|
|
|
|
|
|
@Before
|
|
|
|
|
fun setUp() {
|
|
|
|
|
InstrumentationRegistry.getInstrumentation().targetContext.settings()
|
|
|
|
|
.shouldShowJumpBackInCFR = false
|
|
|
|
|
|
|
|
|
|
mDevice = UiDevice.getInstance(InstrumentationRegistry.getInstrumentation())
|
|
|
|
|
mockWebServer = MockWebServer().apply {
|
|
|
|
|
dispatcher = AndroidAssetDispatcher()
|
|
|
|
|
start()
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@After
|
|
|
|
|
fun tearDown() {
|
|
|
|
|
mockWebServer.shutdown()
|
|
|
|
|
// Clearing all history data after each test to avoid overlapping data
|
|
|
|
|
val applicationContext: Context = activityTestRule.activity.applicationContext
|
|
|
|
|
val historyStorage = PlacesHistoryStorage(applicationContext)
|
|
|
|
|
|
|
|
|
|
runBlocking {
|
|
|
|
|
historyStorage.deleteEverything()
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// TestRail link: https://testrail.stage.mozaws.net/index.php?/cases/view/243285
|
|
|
|
|
@Test
|
|
|
|
|
fun verifyEmptyHistoryMenuTest() {
|
|
|
|
|