[fenix] No issue: Add more smoke tests coverage

pull/600/head
Oana Horvath 3 years ago
parent ddf02bbac2
commit 60b8cfa916

@ -26,7 +26,7 @@ import org.mozilla.fenix.R
import org.mozilla.fenix.ext.components import org.mozilla.fenix.ext.components
import org.mozilla.fenix.ext.settings import org.mozilla.fenix.ext.settings
import org.mozilla.fenix.helpers.AndroidAssetDispatcher import org.mozilla.fenix.helpers.AndroidAssetDispatcher
import org.mozilla.fenix.helpers.HomeActivityTestRule import org.mozilla.fenix.helpers.HomeActivityIntentTestRule
import org.mozilla.fenix.helpers.RecyclerViewIdlingResource import org.mozilla.fenix.helpers.RecyclerViewIdlingResource
import org.mozilla.fenix.helpers.TestAssetHelper import org.mozilla.fenix.helpers.TestAssetHelper
import org.mozilla.fenix.helpers.TestHelper import org.mozilla.fenix.helpers.TestHelper
@ -45,6 +45,7 @@ import org.mozilla.fenix.ui.robots.enhancedTrackingProtection
import org.mozilla.fenix.ui.robots.homeScreen import org.mozilla.fenix.ui.robots.homeScreen
import org.mozilla.fenix.ui.robots.navigationToolbar import org.mozilla.fenix.ui.robots.navigationToolbar
import org.mozilla.fenix.ui.robots.notificationShade import org.mozilla.fenix.ui.robots.notificationShade
import org.mozilla.fenix.ui.robots.searchScreen
import org.mozilla.fenix.ui.robots.tabDrawer import org.mozilla.fenix.ui.robots.tabDrawer
import org.mozilla.fenix.ui.util.STRING_ONBOARDING_TRACKING_PROTECTION_HEADER import org.mozilla.fenix.ui.util.STRING_ONBOARDING_TRACKING_PROTECTION_HEADER
@ -76,7 +77,7 @@ class SmokeTest {
} }
@get:Rule @get:Rule
val activityTestRule = HomeActivityTestRule() val activityTestRule = HomeActivityIntentTestRule()
private lateinit var browserStore: BrowserStore private lateinit var browserStore: BrowserStore
@get: Rule @get: Rule
@ -1134,6 +1135,11 @@ class SmokeTest {
clickAddPrivateBrowsingShortcutButton() clickAddPrivateBrowsingShortcutButton()
clickAddAutomaticallyButton() clickAddAutomaticallyButton()
}.openHomeScreenShortcut("Private $appName") {} }.openHomeScreenShortcut("Private $appName") {}
searchScreen {
verifySearchView()
}.dismissSearchBar {
verifyPrivateSessionMessage()
}
} }
@Test @Test
@ -1320,4 +1326,17 @@ class SmokeTest {
assertPlaybackState(browserStore, MediaSession.PlaybackState.PAUSED) assertPlaybackState(browserStore, MediaSession.PlaybackState.PAUSED)
} }
} }
@Test
// For API>23
// Verifies the default browser switch opens the system default apps menu.
fun changeDefaultBrowserSetting() {
homeScreen {
}.openThreeDotMenu {
}.openSettings {
verifyDefaultBrowserIsDisaled()
clickDefaultBrowserSwitch()
verifyAndroidDefaultAppsMenuAppears()
}
}
} }

@ -311,14 +311,8 @@ private fun assertDefaultBrowserIsDisabled() {
} }
private fun toggleDefaultBrowserSwitch() { private fun toggleDefaultBrowserSwitch() {
scrollToElementByText("Set as default browser") scrollToElementByText("Privacy and security")
onView( onView(withText("Set as default browser")).perform(ViewActions.click())
CoreMatchers.allOf(
ViewMatchers.withParent(CoreMatchers.not(withId(R.id.navigationToolbar))),
withText("Set as default browser")
)
)
.perform(ViewActions.click())
} }
private fun assertAndroidDefaultAppsMenuAppears() { private fun assertAndroidDefaultAppsMenuAppears() {

@ -15,14 +15,15 @@ import androidx.test.espresso.matcher.ViewMatchers.withEffectiveVisibility
import androidx.test.espresso.matcher.ViewMatchers.withId import androidx.test.espresso.matcher.ViewMatchers.withId
import androidx.test.espresso.matcher.ViewMatchers.withParent import androidx.test.espresso.matcher.ViewMatchers.withParent
import androidx.test.espresso.matcher.ViewMatchers.withText import androidx.test.espresso.matcher.ViewMatchers.withText
import androidx.test.rule.ActivityTestRule
import androidx.test.uiautomator.By import androidx.test.uiautomator.By
import androidx.test.uiautomator.Until import androidx.test.uiautomator.Until
import org.hamcrest.CoreMatchers.allOf import org.hamcrest.CoreMatchers.allOf
import org.hamcrest.CoreMatchers.containsString import org.hamcrest.CoreMatchers.containsString
import org.hamcrest.CoreMatchers.instanceOf import org.hamcrest.CoreMatchers.instanceOf
import org.hamcrest.CoreMatchers.not import org.hamcrest.CoreMatchers.not
import org.mozilla.fenix.HomeActivity
import org.mozilla.fenix.R import org.mozilla.fenix.R
import org.mozilla.fenix.helpers.HomeActivityTestRule
import org.mozilla.fenix.helpers.IdlingResourceHelper.registerAddonInstallingIdlingResource import org.mozilla.fenix.helpers.IdlingResourceHelper.registerAddonInstallingIdlingResource
import org.mozilla.fenix.helpers.IdlingResourceHelper.unregisterAddonInstallingIdlingResource import org.mozilla.fenix.helpers.IdlingResourceHelper.unregisterAddonInstallingIdlingResource
import org.mozilla.fenix.helpers.TestAssetHelper.waitingTime import org.mozilla.fenix.helpers.TestAssetHelper.waitingTime
@ -38,7 +39,7 @@ import org.mozilla.fenix.helpers.ext.waitNotNull
class SettingsSubMenuAddonsManagerRobot { class SettingsSubMenuAddonsManagerRobot {
fun verifyAddonPrompt(addonName: String) = assertAddonPrompt(addonName) fun verifyAddonPrompt(addonName: String) = assertAddonPrompt(addonName)
fun clickInstallAddon(addonName: String) = selectInstallAddon(addonName) fun clickInstallAddon(addonName: String) = selectInstallAddon(addonName)
fun verifyDownloadAddonPrompt(addonName: String, activityTestRule: HomeActivityTestRule) = fun verifyDownloadAddonPrompt(addonName: String, activityTestRule: ActivityTestRule<HomeActivity>) =
assertDownloadingAddonPrompt(addonName, activityTestRule) assertDownloadingAddonPrompt(addonName, activityTestRule)
fun cancelInstallAddon() = cancelInstall() fun cancelInstallAddon() = cancelInstall()
@ -125,7 +126,7 @@ class SettingsSubMenuAddonsManagerRobot {
private fun assertDownloadingAddonPrompt( private fun assertDownloadingAddonPrompt(
addonName: String, addonName: String,
activityTestRule: HomeActivityTestRule activityTestRule: ActivityTestRule<HomeActivity>
) { ) {
registerAddonInstallingIdlingResource(activityTestRule) registerAddonInstallingIdlingResource(activityTestRule)

Loading…
Cancel
Save