For #26844: Fix ktlint issues and remove them from baseline.
This commit is contained in:
parent
ba611e848e
commit
ffcef5ff2e
|
@ -39,9 +39,8 @@ class AppRequestInterceptor(private val context: Context) : RequestInterceptor {
|
|||
isSameDomain: Boolean,
|
||||
isRedirect: Boolean,
|
||||
isDirectNavigation: Boolean,
|
||||
isSubframeRequest: Boolean
|
||||
isSubframeRequest: Boolean,
|
||||
): RequestInterceptor.InterceptionResponse? {
|
||||
|
||||
interceptFxaRequest(
|
||||
engineSession,
|
||||
uri,
|
||||
|
@ -50,7 +49,7 @@ class AppRequestInterceptor(private val context: Context) : RequestInterceptor {
|
|||
isSameDomain,
|
||||
isRedirect,
|
||||
isDirectNavigation,
|
||||
isSubframeRequest
|
||||
isSubframeRequest,
|
||||
)?.let { response ->
|
||||
return response
|
||||
}
|
||||
|
@ -68,14 +67,14 @@ class AppRequestInterceptor(private val context: Context) : RequestInterceptor {
|
|||
isSameDomain,
|
||||
isRedirect,
|
||||
isDirectNavigation,
|
||||
isSubframeRequest
|
||||
isSubframeRequest,
|
||||
)
|
||||
}
|
||||
|
||||
override fun onErrorRequest(
|
||||
session: EngineSession,
|
||||
errorType: ErrorType,
|
||||
uri: String?
|
||||
uri: String?,
|
||||
): RequestInterceptor.ErrorResponse? {
|
||||
val improvedErrorType = improveErrorType(errorType)
|
||||
val riskLevel = getRiskLevel(improvedErrorType)
|
||||
|
@ -86,7 +85,7 @@ class AppRequestInterceptor(private val context: Context) : RequestInterceptor {
|
|||
context = context,
|
||||
errorType = improvedErrorType,
|
||||
uri = uri,
|
||||
htmlResource = riskLevel.htmlRes
|
||||
htmlResource = riskLevel.htmlRes,
|
||||
)
|
||||
|
||||
return RequestInterceptor.ErrorResponse(errorPageUri)
|
||||
|
@ -102,20 +101,18 @@ class AppRequestInterceptor(private val context: Context) : RequestInterceptor {
|
|||
private fun interceptAmoRequest(
|
||||
uri: String,
|
||||
isSameDomain: Boolean,
|
||||
hasUserGesture: Boolean
|
||||
hasUserGesture: Boolean,
|
||||
): RequestInterceptor.InterceptionResponse? {
|
||||
// First we execute a quick check to see if this is a request we're interested in i.e. a
|
||||
// request triggered by the user and coming from AMO.
|
||||
if (hasUserGesture && isSameDomain && uri.startsWith(AMO_BASE_URL)) {
|
||||
|
||||
// Check if this is a request to install an add-on.
|
||||
val matchResult = AMO_INSTALL_URL_REGEX.toRegex().matchEntire(uri)
|
||||
if (matchResult != null) {
|
||||
|
||||
// Navigate and trigger add-on installation.
|
||||
matchResult.groupValues.getOrNull(1)?.let { addonId ->
|
||||
navController?.get()?.navigate(
|
||||
NavGraphDirections.actionGlobalAddonsManagementFragment(addonId)
|
||||
NavGraphDirections.actionGlobalAddonsManagementFragment(addonId),
|
||||
)
|
||||
|
||||
// We've redirected to the add-ons management fragment, skip original request.
|
||||
|
@ -137,7 +134,7 @@ class AppRequestInterceptor(private val context: Context) : RequestInterceptor {
|
|||
isSameDomain: Boolean,
|
||||
isRedirect: Boolean,
|
||||
isDirectNavigation: Boolean,
|
||||
isSubframeRequest: Boolean
|
||||
isSubframeRequest: Boolean,
|
||||
): RequestInterceptor.InterceptionResponse? {
|
||||
return appContext.components.services.accountsAuthFeature.interceptor.onLoadRequest(
|
||||
engineSession,
|
||||
|
@ -147,7 +144,7 @@ class AppRequestInterceptor(private val context: Context) : RequestInterceptor {
|
|||
isSameDomain,
|
||||
isRedirect,
|
||||
isDirectNavigation,
|
||||
isSubframeRequest
|
||||
isSubframeRequest,
|
||||
)
|
||||
}
|
||||
|
||||
|
@ -189,16 +186,19 @@ class AppRequestInterceptor(private val context: Context) : RequestInterceptor {
|
|||
ErrorType.ERROR_NO_INTERNET,
|
||||
ErrorType.ERROR_HTTPS_ONLY,
|
||||
ErrorType.ERROR_BAD_HSTS_CERT,
|
||||
ErrorType.ERROR_UNKNOWN_PROTOCOL -> RiskLevel.Low
|
||||
ErrorType.ERROR_UNKNOWN_PROTOCOL,
|
||||
-> RiskLevel.Low
|
||||
|
||||
ErrorType.ERROR_SECURITY_BAD_CERT,
|
||||
ErrorType.ERROR_SECURITY_SSL,
|
||||
ErrorType.ERROR_PORT_BLOCKED -> RiskLevel.Medium
|
||||
ErrorType.ERROR_PORT_BLOCKED,
|
||||
-> RiskLevel.Medium
|
||||
|
||||
ErrorType.ERROR_SAFEBROWSING_HARMFUL_URI,
|
||||
ErrorType.ERROR_SAFEBROWSING_MALWARE_URI,
|
||||
ErrorType.ERROR_SAFEBROWSING_PHISHING_URI,
|
||||
ErrorType.ERROR_SAFEBROWSING_UNWANTED_URI -> RiskLevel.High
|
||||
ErrorType.ERROR_SAFEBROWSING_UNWANTED_URI,
|
||||
-> RiskLevel.High
|
||||
}
|
||||
|
||||
internal enum class RiskLevel(val htmlRes: String) {
|
||||
|
|
|
@ -91,7 +91,7 @@ class BaselinePingTest {
|
|||
val httpClient = ConceptFetchHttpUploader(
|
||||
lazy {
|
||||
GeckoViewFetchClient(ApplicationProvider.getApplicationContext())
|
||||
}
|
||||
},
|
||||
)
|
||||
|
||||
// Fenix does not initialize the Glean SDK in tests/debug builds, but this test
|
||||
|
@ -102,7 +102,7 @@ class BaselinePingTest {
|
|||
applicationContext = ApplicationProvider.getApplicationContext(),
|
||||
uploadEnabled = true,
|
||||
configuration = Configuration(httpClient = httpClient),
|
||||
buildInfo = GleanBuildInfo.buildInfo
|
||||
buildInfo = GleanBuildInfo.buildInfo,
|
||||
)
|
||||
}
|
||||
}
|
||||
|
@ -119,7 +119,7 @@ class BaselinePingTest {
|
|||
private fun waitForPingContent(
|
||||
pingName: String,
|
||||
pingReason: String?,
|
||||
maxAttempts: Int = 3
|
||||
maxAttempts: Int = 3,
|
||||
): JSONObject? {
|
||||
var attempts = 0
|
||||
do {
|
||||
|
@ -163,8 +163,8 @@ class BaselinePingTest {
|
|||
mDevice.pressRecentApps()
|
||||
mDevice.findObject(
|
||||
UiSelector().descriptionContains(
|
||||
ApplicationProvider.getApplicationContext<Context>().getString(R.string.app_name)
|
||||
)
|
||||
ApplicationProvider.getApplicationContext<Context>().getString(R.string.app_name),
|
||||
),
|
||||
)
|
||||
.click()
|
||||
|
||||
|
|
|
@ -25,7 +25,7 @@ import org.mozilla.fenix.onboarding.FenixOnboarding
|
|||
class HomeActivityTestRule(
|
||||
initialTouchMode: Boolean = false,
|
||||
launchActivity: Boolean = true,
|
||||
private val skipOnboarding: Boolean = false
|
||||
private val skipOnboarding: Boolean = false,
|
||||
) :
|
||||
ActivityTestRule<HomeActivity>(HomeActivity::class.java, initialTouchMode, launchActivity) {
|
||||
private val longTapUserPreference = getLongPressTimeout()
|
||||
|
@ -54,7 +54,7 @@ class HomeActivityTestRule(
|
|||
class HomeActivityIntentTestRule(
|
||||
initialTouchMode: Boolean = false,
|
||||
launchActivity: Boolean = true,
|
||||
private val skipOnboarding: Boolean = false
|
||||
private val skipOnboarding: Boolean = false,
|
||||
) :
|
||||
IntentsTestRule<HomeActivity>(HomeActivity::class.java, initialTouchMode, launchActivity) {
|
||||
private val longTapUserPreference = getLongPressTimeout()
|
||||
|
@ -94,7 +94,7 @@ private fun skipOnboardingBeforeLaunch() {
|
|||
|
||||
private fun closeNotificationShade() {
|
||||
if (mDevice.findObject(
|
||||
UiSelector().resourceId("com.android.systemui:id/notification_stack_scroller")
|
||||
UiSelector().resourceId("com.android.systemui:id/notification_stack_scroller"),
|
||||
).exists()
|
||||
) {
|
||||
mDevice.pressHome()
|
||||
|
|
|
@ -17,16 +17,16 @@ object IdlingResourceHelper {
|
|||
fun registerAddonInstallingIdlingResource(activityTestRule: ActivityTestRule<HomeActivity>) {
|
||||
IdlingRegistry.getInstance().register(
|
||||
AddonsInstallingIdlingResource(
|
||||
activityTestRule.activity.supportFragmentManager
|
||||
)
|
||||
activityTestRule.activity.supportFragmentManager,
|
||||
),
|
||||
)
|
||||
}
|
||||
|
||||
fun unregisterAddonInstallingIdlingResource(activityTestRule: ActivityTestRule<HomeActivity>) {
|
||||
IdlingRegistry.getInstance().unregister(
|
||||
AddonsInstallingIdlingResource(
|
||||
activityTestRule.activity.supportFragmentManager
|
||||
)
|
||||
activityTestRule.activity.supportFragmentManager,
|
||||
),
|
||||
)
|
||||
}
|
||||
|
||||
|
|
|
@ -44,7 +44,7 @@ fun withBitmapDrawable(bitmap: Bitmap, name: String): Matcher<View>? = BitmapDra
|
|||
|
||||
fun nthChildOf(
|
||||
parentMatcher: Matcher<View>,
|
||||
childPosition: Int
|
||||
childPosition: Int,
|
||||
): Matcher<View> {
|
||||
return object : TypeSafeMatcher<View>() {
|
||||
override fun describeTo(description: Description) {
|
||||
|
|
|
@ -42,7 +42,7 @@ class MockLocationUpdatesRule : ExternalResource() {
|
|||
mDevice.executeShellCommand(
|
||||
"appops set " +
|
||||
appContext.packageName +
|
||||
" android:mock_location allow"
|
||||
" android:mock_location allow",
|
||||
)
|
||||
|
||||
// To mock locations we need a location provider, so we generate and set it here.
|
||||
|
@ -57,7 +57,7 @@ class MockLocationUpdatesRule : ExternalResource() {
|
|||
true,
|
||||
true,
|
||||
3,
|
||||
2
|
||||
2,
|
||||
)
|
||||
} catch (ex: Exception) {
|
||||
// unstable
|
||||
|
|
|
@ -34,7 +34,7 @@ object TestAssetHelper {
|
|||
TestAsset(
|
||||
server.url("pages/generic$it.html").toString().toUri()!!,
|
||||
"Page content: $it",
|
||||
""
|
||||
"",
|
||||
)
|
||||
}
|
||||
}
|
||||
|
|
|
@ -82,13 +82,13 @@ object TestHelper {
|
|||
fun longTapSelectItem(url: Uri) {
|
||||
mDevice.waitNotNull(
|
||||
Until.findObject(By.text(url.toString())),
|
||||
waitingTime
|
||||
waitingTime,
|
||||
)
|
||||
onView(
|
||||
allOf(
|
||||
withId(R.id.url),
|
||||
withText(url.toString())
|
||||
)
|
||||
withText(url.toString()),
|
||||
),
|
||||
).perform(longClick())
|
||||
}
|
||||
|
||||
|
@ -111,7 +111,7 @@ object TestHelper {
|
|||
fun waitUntilObjectIsFound(resourceName: String) {
|
||||
mDevice.waitNotNull(
|
||||
Until.findObjects(By.res(resourceName)),
|
||||
waitingTime
|
||||
waitingTime,
|
||||
)
|
||||
}
|
||||
|
||||
|
@ -189,7 +189,7 @@ object TestHelper {
|
|||
fun createCustomTabIntent(
|
||||
pageUrl: String,
|
||||
customMenuItemLabel: String = "",
|
||||
customActionButtonDescription: String = ""
|
||||
customActionButtonDescription: String = "",
|
||||
): Intent {
|
||||
val appContext = InstrumentationRegistry.getInstrumentation()
|
||||
.targetContext
|
||||
|
@ -200,7 +200,9 @@ object TestHelper {
|
|||
.setShareState(CustomTabsIntent.SHARE_STATE_ON)
|
||||
.setActionButton(
|
||||
createTestBitmap(),
|
||||
customActionButtonDescription, pendingIntent, true
|
||||
customActionButtonDescription,
|
||||
pendingIntent,
|
||||
true,
|
||||
)
|
||||
.build()
|
||||
customTabsIntent.intent.data = Uri.parse(pageUrl)
|
||||
|
@ -233,7 +235,7 @@ object TestHelper {
|
|||
} else {
|
||||
mDevice.waitNotNull(
|
||||
Until.findObject(By.text("Could not open file")),
|
||||
waitingTime
|
||||
waitingTime,
|
||||
)
|
||||
}
|
||||
}
|
||||
|
@ -243,7 +245,7 @@ object TestHelper {
|
|||
mDevice.waitForIdle(waitingTimeShort)
|
||||
assertTrue(
|
||||
mDevice.findObject(UiSelector().packageName(appPackageName))
|
||||
.waitForExists(waitingTime)
|
||||
.waitForExists(waitingTime),
|
||||
)
|
||||
} else {
|
||||
BrowserRobot().verifyUrl(url)
|
||||
|
@ -281,9 +283,9 @@ object TestHelper {
|
|||
return withParent(
|
||||
hasSibling(
|
||||
withChild(
|
||||
matcher
|
||||
)
|
||||
)
|
||||
matcher,
|
||||
),
|
||||
),
|
||||
)
|
||||
}
|
||||
|
||||
|
@ -302,11 +304,12 @@ object TestHelper {
|
|||
By.text(
|
||||
when (Build.VERSION.SDK_INT) {
|
||||
Build.VERSION_CODES.R -> Pattern.compile(
|
||||
"WHILE USING THE APP", Pattern.CASE_INSENSITIVE
|
||||
"WHILE USING THE APP",
|
||||
Pattern.CASE_INSENSITIVE,
|
||||
)
|
||||
else -> Pattern.compile("Allow", Pattern.CASE_INSENSITIVE)
|
||||
}
|
||||
)
|
||||
},
|
||||
),
|
||||
).click()
|
||||
}
|
||||
}
|
||||
|
@ -317,11 +320,12 @@ object TestHelper {
|
|||
By.text(
|
||||
when (Build.VERSION.SDK_INT) {
|
||||
Build.VERSION_CODES.R -> Pattern.compile(
|
||||
"DENY", Pattern.CASE_INSENSITIVE
|
||||
"DENY",
|
||||
Pattern.CASE_INSENSITIVE,
|
||||
)
|
||||
else -> Pattern.compile("Deny", Pattern.CASE_INSENSITIVE)
|
||||
}
|
||||
)
|
||||
},
|
||||
),
|
||||
).click()
|
||||
}
|
||||
}
|
||||
|
@ -368,7 +372,7 @@ object TestHelper {
|
|||
config.javaClass.getDeclaredField("userSetLocale").setBoolean(config, true)
|
||||
am.javaClass.getMethod(
|
||||
"updateConfiguration",
|
||||
Configuration::class.java
|
||||
Configuration::class.java,
|
||||
).invoke(am, config)
|
||||
}
|
||||
}
|
||||
|
|
|
@ -9,7 +9,7 @@ import androidx.test.espresso.IdlingResource
|
|||
|
||||
class ViewVisibilityIdlingResource(
|
||||
private val view: View,
|
||||
private val expectedVisibility: Int
|
||||
private val expectedVisibility: Int,
|
||||
) : IdlingResource {
|
||||
private var resourceCallback: IdlingResource.ResourceCallback? = null
|
||||
private var isIdle: Boolean = false
|
||||
|
|
|
@ -43,6 +43,6 @@ fun ViewInteraction.clickAtLocationInView(locationInView: GeneralLocation): View
|
|||
locationInView,
|
||||
Press.FINGER,
|
||||
InputDevice.SOURCE_UNKNOWN,
|
||||
MotionEvent.BUTTON_PRIMARY
|
||||
)
|
||||
MotionEvent.BUTTON_PRIMARY,
|
||||
),
|
||||
)
|
||||
|
|
|
@ -16,5 +16,5 @@ import org.mozilla.fenix.helpers.TestAssetHelper
|
|||
*/
|
||||
fun UiDevice.waitNotNull(
|
||||
searchCondition: SearchCondition<*>,
|
||||
waitTime: Long = TestAssetHelper.waitingTime
|
||||
waitTime: Long = TestAssetHelper.waitingTime,
|
||||
) = assertNotNull(wait(searchCondition, waitTime))
|
||||
|
|
|
@ -10,7 +10,7 @@ import androidx.test.espresso.IdlingResource
|
|||
import mozilla.components.feature.addons.ui.AddonInstallationDialogFragment
|
||||
|
||||
class AddonsInstallingIdlingResource(
|
||||
private val fragmentManager: FragmentManager
|
||||
private val fragmentManager: FragmentManager,
|
||||
) :
|
||||
IdlingResource {
|
||||
private var resourceCallback: IdlingResource.ResourceCallback? = null
|
||||
|
@ -25,8 +25,9 @@ class AddonsInstallingIdlingResource(
|
|||
}
|
||||
|
||||
override fun registerIdleTransitionCallback(callback: IdlingResource.ResourceCallback?) {
|
||||
if (callback != null)
|
||||
if (callback != null) {
|
||||
resourceCallback = callback
|
||||
}
|
||||
}
|
||||
|
||||
private fun isInstalledAddonDialogShown(): Boolean {
|
||||
|
|
|
@ -20,14 +20,16 @@ class AddonsLoadingIdlingResource(val fragmentManager: FragmentManager) : Idling
|
|||
|
||||
override fun isIdleNow(): Boolean {
|
||||
val idle = addonsFinishedLoading()
|
||||
if (idle)
|
||||
if (idle) {
|
||||
resourceCallback?.onTransitionToIdle()
|
||||
}
|
||||
return idle
|
||||
}
|
||||
|
||||
override fun registerIdleTransitionCallback(callback: IdlingResource.ResourceCallback?) {
|
||||
if (callback != null)
|
||||
if (callback != null) {
|
||||
resourceCallback = callback
|
||||
}
|
||||
}
|
||||
|
||||
private fun addonsFinishedLoading(): Boolean {
|
||||
|
@ -37,8 +39,9 @@ class AddonsLoadingIdlingResource(val fragmentManager: FragmentManager) : Idling
|
|||
addonsManagementFragment.view?.findViewById<View>(R.id.add_ons_progress_bar)
|
||||
} ?: return true
|
||||
|
||||
if (progressbar.visibility == VISIBLE)
|
||||
if (progressbar.visibility == VISIBLE) {
|
||||
return false
|
||||
}
|
||||
|
||||
return true
|
||||
}
|
||||
|
|
|
@ -32,14 +32,16 @@ class NetworkConnectionIdlingResource(private val networkConnected: Boolean) : I
|
|||
} else {
|
||||
!isOnline()
|
||||
}
|
||||
if (idle)
|
||||
if (idle) {
|
||||
resourceCallback?.onTransitionToIdle()
|
||||
}
|
||||
return idle
|
||||
}
|
||||
|
||||
override fun registerIdleTransitionCallback(callback: IdlingResource.ResourceCallback?) {
|
||||
if (callback != null)
|
||||
if (callback != null) {
|
||||
resourceCallback = callback
|
||||
}
|
||||
}
|
||||
|
||||
private fun isOnline(): Boolean {
|
||||
|
|
|
@ -28,7 +28,7 @@ class BottomSheetBehaviorHalfExpandedMaxRatioMatcher(private val maxHalfExpanded
|
|||
override fun describeTo(description: Description?) {
|
||||
description?.appendText(
|
||||
"BottomSheetBehavior with an at max halfExpandedRation: " +
|
||||
"$maxHalfExpandedRatio"
|
||||
"$maxHalfExpandedRatio",
|
||||
)
|
||||
}
|
||||
|
||||
|
|
|
@ -79,7 +79,7 @@ private val EXPECTED_NUMBER_OF_INFLATION =
|
|||
private val failureMsgStrictMode = getErrorMessage("StrictMode suppression")
|
||||
private val failureMsgRunBlocking = getErrorMessage("runBlockingIncrement")
|
||||
private val failureMsgRecyclerViewConstraintLayoutChildren = getErrorMessage(
|
||||
"ConstraintLayout being a common direct descendant of a RecyclerView"
|
||||
"ConstraintLayout being a common direct descendant of a RecyclerView",
|
||||
)
|
||||
private val failureMsgNumberOfInflation = getErrorMessage("start up inflation")
|
||||
|
||||
|
|
|
@ -26,6 +26,7 @@ class DefaultHomeScreenTest : ScreenshotTest() {
|
|||
|
||||
@Rule @JvmField
|
||||
val localeTestRule = LocaleTestRule()
|
||||
|
||||
@get:Rule
|
||||
var mActivityTestRule: ActivityTestRule<HomeActivity> = HomeActivityTestRule()
|
||||
|
||||
|
|
|
@ -177,7 +177,7 @@ class SyncIntegrationTest {
|
|||
val emailInput = mDevice.findObject(
|
||||
UiSelector()
|
||||
.instance(0)
|
||||
.className(EditText::class.java)
|
||||
.className(EditText::class.java),
|
||||
)
|
||||
emailInput.waitForExists(TestAssetHelper.waitingTime)
|
||||
|
||||
|
@ -194,7 +194,7 @@ class SyncIntegrationTest {
|
|||
val passwordInput = mDevice.findObject(
|
||||
UiSelector()
|
||||
.instance(0)
|
||||
.className(EditText::class.java)
|
||||
.className(EditText::class.java),
|
||||
)
|
||||
|
||||
val passwordValue = javaClass.classLoader!!.getResource("password.txt").readText()
|
||||
|
|
|
@ -89,7 +89,7 @@ class BookmarksTest {
|
|||
bookmarksListIdlingResource =
|
||||
RecyclerViewIdlingResource(
|
||||
activityTestRule.activity.findViewById(R.id.bookmark_list),
|
||||
1
|
||||
1,
|
||||
)
|
||||
IdlingRegistry.getInstance().register(bookmarksListIdlingResource!!)
|
||||
|
||||
|
@ -642,7 +642,6 @@ class BookmarksTest {
|
|||
@SmokeTest
|
||||
@Test
|
||||
fun undoDeleteBookmarkFolderTest() {
|
||||
|
||||
browserScreen {
|
||||
}.openThreeDotMenu {
|
||||
}.openBookmarks {
|
||||
|
|
|
@ -40,7 +40,7 @@ class CollectionTest {
|
|||
@get:Rule
|
||||
val composeTestRule = AndroidComposeTestRule(
|
||||
HomeActivityIntentTestRule(),
|
||||
{ it.activity }
|
||||
{ it.activity },
|
||||
)
|
||||
|
||||
@Before
|
||||
|
@ -168,7 +168,7 @@ class CollectionTest {
|
|||
createCollection(
|
||||
firstTestPage.title,
|
||||
secondTestPage.title,
|
||||
collectionName = collectionName
|
||||
collectionName = collectionName,
|
||||
)
|
||||
closeTab()
|
||||
}
|
||||
|
@ -324,8 +324,9 @@ class CollectionTest {
|
|||
createCollection(webPage.title, collectionName = firstCollectionName)
|
||||
verifySnackBarText("Collection saved!")
|
||||
createCollection(
|
||||
webPage.title, collectionName = secondCollectionName,
|
||||
firstCollection = false
|
||||
webPage.title,
|
||||
collectionName = secondCollectionName,
|
||||
firstCollection = false,
|
||||
)
|
||||
verifySnackBarText("Collection saved!")
|
||||
}.closeTabDrawer {
|
||||
|
@ -369,7 +370,7 @@ class CollectionTest {
|
|||
}.openTabDrawer {
|
||||
createCollection(
|
||||
testPage.title,
|
||||
collectionName = collectionName
|
||||
collectionName = collectionName,
|
||||
)
|
||||
closeTab()
|
||||
}
|
||||
|
@ -396,7 +397,7 @@ class CollectionTest {
|
|||
}.openTabDrawer {
|
||||
createCollection(
|
||||
testPage.title,
|
||||
collectionName = collectionName
|
||||
collectionName = collectionName,
|
||||
)
|
||||
closeTab()
|
||||
}
|
||||
|
|
|
@ -28,7 +28,7 @@ class CrashReportingTest {
|
|||
@get:Rule
|
||||
val activityTestRule = AndroidComposeTestRule(
|
||||
HomeActivityIntentTestRule(),
|
||||
{ it.activity }
|
||||
{ it.activity },
|
||||
)
|
||||
|
||||
@Before
|
||||
|
|
|
@ -30,6 +30,7 @@ class CustomTabsTest {
|
|||
private lateinit var mDevice: UiDevice
|
||||
private lateinit var mockWebServer: MockWebServer
|
||||
private val customMenuItem = "TestMenuItem"
|
||||
|
||||
/* Updated externalLinks.html to v2.0,
|
||||
changed the hypertext reference to mozilla-mobile.github.io/testapp/downloads for "External link"
|
||||
*/
|
||||
|
@ -41,7 +42,9 @@ class CustomTabsTest {
|
|||
|
||||
@get: Rule
|
||||
val intentReceiverActivityTestRule = ActivityTestRule(
|
||||
IntentReceiverActivity::class.java, true, false
|
||||
IntentReceiverActivity::class.java,
|
||||
true,
|
||||
false,
|
||||
)
|
||||
|
||||
private val featureSettingsHelper = FeatureSettingsHelper()
|
||||
|
@ -71,8 +74,8 @@ class CustomTabsTest {
|
|||
intentReceiverActivityTestRule.launchActivity(
|
||||
createCustomTabIntent(
|
||||
externalLinksPWAPage.toUri().toString(),
|
||||
customMenuItem
|
||||
)
|
||||
customMenuItem,
|
||||
),
|
||||
)
|
||||
|
||||
customTabScreen {
|
||||
|
@ -86,12 +89,11 @@ class CustomTabsTest {
|
|||
@SmokeTest
|
||||
@Test
|
||||
fun customTabsSaveLoginTest() {
|
||||
|
||||
intentReceiverActivityTestRule.launchActivity(
|
||||
createCustomTabIntent(
|
||||
loginPage.toUri().toString(),
|
||||
customMenuItem
|
||||
)
|
||||
customMenuItem,
|
||||
),
|
||||
)
|
||||
|
||||
customTabScreen {
|
||||
|
@ -125,8 +127,8 @@ class CustomTabsTest {
|
|||
intentReceiverActivityTestRule.launchActivity(
|
||||
createCustomTabIntent(
|
||||
customTabPage.url.toString(),
|
||||
customMenuItem
|
||||
)
|
||||
customMenuItem,
|
||||
),
|
||||
)
|
||||
|
||||
customTabScreen {
|
||||
|
@ -155,8 +157,8 @@ class CustomTabsTest {
|
|||
intentReceiverActivityTestRule.launchActivity(
|
||||
createCustomTabIntent(
|
||||
customTabPage.url.toString(),
|
||||
customMenuItem
|
||||
)
|
||||
customMenuItem,
|
||||
),
|
||||
)
|
||||
|
||||
customTabScreen {
|
||||
|
@ -179,8 +181,8 @@ class CustomTabsTest {
|
|||
intentReceiverActivityTestRule.launchActivity(
|
||||
createCustomTabIntent(
|
||||
customTabPage.toUri().toString(),
|
||||
customMenuItem
|
||||
)
|
||||
customMenuItem,
|
||||
),
|
||||
)
|
||||
|
||||
customTabScreen {
|
||||
|
|
|
@ -44,7 +44,7 @@ class DownloadFileTypesTest(fileName: String) {
|
|||
"web_icon.png",
|
||||
"videoSample.webm",
|
||||
"CSVfile.csv",
|
||||
"XMLfile.xml"
|
||||
"XMLfile.xml",
|
||||
)
|
||||
}
|
||||
|
||||
|
|
|
@ -38,6 +38,7 @@ import org.mozilla.fenix.ui.robots.notificationShade
|
|||
class DownloadTest {
|
||||
private lateinit var mDevice: UiDevice
|
||||
private val featureSettingsHelper = FeatureSettingsHelper()
|
||||
|
||||
/* Remote test page managed by Mozilla Mobile QA team at https://github.com/mozilla-mobile/testapp */
|
||||
private val downloadTestPage = "https://storage.googleapis.com/mobile_test_assets/test_app/downloads.html"
|
||||
private var downloadFile: String = ""
|
||||
|
@ -45,15 +46,15 @@ class DownloadTest {
|
|||
@get:Rule
|
||||
val activityTestRule = HomeActivityIntentTestRule()
|
||||
|
||||
@get: Rule
|
||||
// Making sure to grant storage access for this test running on API 28
|
||||
@get: Rule
|
||||
var watcher: TestRule = object : TestWatcher() {
|
||||
override fun starting(description: Description) {
|
||||
if (description.methodName == "pauseResumeCancelDownloadTest") {
|
||||
PermissionRequester().apply {
|
||||
addPermissions(
|
||||
android.Manifest.permission.WRITE_EXTERNAL_STORAGE,
|
||||
android.Manifest.permission.READ_EXTERNAL_STORAGE
|
||||
android.Manifest.permission.READ_EXTERNAL_STORAGE,
|
||||
)
|
||||
requestPermissions()
|
||||
}
|
||||
|
@ -166,12 +167,12 @@ class DownloadTest {
|
|||
}
|
||||
}
|
||||
|
||||
@SmokeTest
|
||||
@Test
|
||||
/* Verifies downloads in the Downloads Menu:
|
||||
/* Verifies downloads in the Downloads Menu:
|
||||
- downloads appear in the list
|
||||
- deleting a download from device storage, removes it from the Downloads Menu too
|
||||
*/
|
||||
@SmokeTest
|
||||
@Test
|
||||
fun manageDownloadsInDownloadsMenuTest() {
|
||||
// a long filename to verify it's correctly displayed on the prompt and in the Downloads menu
|
||||
downloadFile = "tAJwqaWjJsXS8AhzSninBMCfIZbHBGgcc001lx5DIdDwIcfEgQ6vE5Gb5VgAled17DFZ2A7ZDOHA0NpQPHXXFt.svg"
|
||||
|
|
|
@ -92,9 +92,9 @@ class HistoryTest {
|
|||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
// Test running on beta/release builds in CI:
|
||||
// caution when making changes to it, so they don't block the builds
|
||||
@Test
|
||||
fun visitedUrlHistoryTest() {
|
||||
val firstWebPage = TestAssetHelper.getGenericAsset(mockWebServer, 1)
|
||||
|
||||
|
|
|
@ -98,9 +98,9 @@ class NavigationToolbarTest {
|
|||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
// Test running on beta/release builds in CI:
|
||||
// caution when making changes to it, so they don't block the builds
|
||||
@Test
|
||||
fun visitURLTest() {
|
||||
val defaultWebPage = TestAssetHelper.getGenericAsset(mockWebServer, 1)
|
||||
|
||||
|
|
|
@ -46,10 +46,10 @@ class NoNetworkAccessStartupTests {
|
|||
featureSettingsHelper.resetAllFeatureFlags()
|
||||
}
|
||||
|
||||
@Test
|
||||
// Test running on beta/release builds in CI:
|
||||
// caution when making changes to it, so they don't block the builds
|
||||
// Based on STR from https://github.com/mozilla-mobile/fenix/issues/16886
|
||||
@Test
|
||||
fun noNetworkConnectionStartupTest() {
|
||||
setNetworkEnabled(false)
|
||||
|
||||
|
@ -62,8 +62,8 @@ class NoNetworkAccessStartupTests {
|
|||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
// Based on STR from https://github.com/mozilla-mobile/fenix/issues/16886
|
||||
@Test
|
||||
fun networkInterruptedFromBrowserToHomeTest() {
|
||||
val url = "example.com"
|
||||
val settings = InstrumentationRegistry.getInstrumentation().targetContext.settings()
|
||||
|
@ -113,7 +113,7 @@ class NoNetworkAccessStartupTests {
|
|||
verifyUrl(
|
||||
"firefox.com",
|
||||
"$packageName:id/mozac_browser_toolbar_url_view",
|
||||
R.id.mozac_browser_toolbar_url_view
|
||||
R.id.mozac_browser_toolbar_url_view,
|
||||
)
|
||||
}
|
||||
}
|
||||
|
|
|
@ -17,6 +17,7 @@ import org.mozilla.fenix.ui.robots.pwaScreen
|
|||
|
||||
class PwaTest {
|
||||
private val featureSettingsHelper = FeatureSettingsHelper()
|
||||
|
||||
/* Updated externalLinks.html to v2.0,
|
||||
changed the hypertext reference to mozilla-mobile.github.io/testapp/downloads for "External link"
|
||||
*/
|
||||
|
@ -63,7 +64,6 @@ class PwaTest {
|
|||
@SmokeTest
|
||||
@Test
|
||||
fun emailLinkPWATest() {
|
||||
|
||||
navigationToolbar {
|
||||
}.enterURLAndEnterToBrowser(externalLinksPWAPage.toUri()) {
|
||||
waitForPageToLoad()
|
||||
|
@ -80,7 +80,6 @@ class PwaTest {
|
|||
@SmokeTest
|
||||
@Test
|
||||
fun telephoneLinkPWATest() {
|
||||
|
||||
navigationToolbar {
|
||||
}.enterURLAndEnterToBrowser(externalLinksPWAPage.toUri()) {
|
||||
waitForPageToLoad()
|
||||
|
@ -97,7 +96,6 @@ class PwaTest {
|
|||
@SmokeTest
|
||||
@Test
|
||||
fun appLikeExperiencePWATest() {
|
||||
|
||||
navigationToolbar {
|
||||
}.enterURLAndEnterToBrowser(externalLinksPWAPage.toUri()) {
|
||||
waitForPageToLoad()
|
||||
|
|
|
@ -77,7 +77,7 @@ class ReaderViewTest {
|
|||
|
||||
readerViewNotification = ViewVisibilityIdlingResource(
|
||||
activityIntentTestRule.activity.findViewById(R.id.mozac_browser_toolbar_page_actions),
|
||||
View.VISIBLE
|
||||
View.VISIBLE,
|
||||
)
|
||||
|
||||
IdlingRegistry.getInstance().register(readerViewNotification)
|
||||
|
@ -120,7 +120,7 @@ class ReaderViewTest {
|
|||
|
||||
readerViewNotification = ViewVisibilityIdlingResource(
|
||||
activityIntentTestRule.activity.findViewById(R.id.mozac_browser_toolbar_page_actions),
|
||||
View.VISIBLE
|
||||
View.VISIBLE,
|
||||
)
|
||||
|
||||
IdlingRegistry.getInstance().register(readerViewNotification)
|
||||
|
@ -158,7 +158,7 @@ class ReaderViewTest {
|
|||
|
||||
readerViewNotification = ViewVisibilityIdlingResource(
|
||||
activityIntentTestRule.activity.findViewById(R.id.mozac_browser_toolbar_page_actions),
|
||||
View.VISIBLE
|
||||
View.VISIBLE,
|
||||
)
|
||||
|
||||
IdlingRegistry.getInstance().register(readerViewNotification)
|
||||
|
@ -198,7 +198,7 @@ class ReaderViewTest {
|
|||
|
||||
readerViewNotification = ViewVisibilityIdlingResource(
|
||||
activityIntentTestRule.activity.findViewById(R.id.mozac_browser_toolbar_page_actions),
|
||||
View.VISIBLE
|
||||
View.VISIBLE,
|
||||
)
|
||||
|
||||
IdlingRegistry.getInstance().register(readerViewNotification)
|
||||
|
@ -244,7 +244,7 @@ class ReaderViewTest {
|
|||
|
||||
readerViewNotification = ViewVisibilityIdlingResource(
|
||||
activityIntentTestRule.activity.findViewById(R.id.mozac_browser_toolbar_page_actions),
|
||||
View.VISIBLE
|
||||
View.VISIBLE,
|
||||
)
|
||||
|
||||
IdlingRegistry.getInstance().register(readerViewNotification)
|
||||
|
|
|
@ -54,7 +54,7 @@ class SearchTest {
|
|||
@get:Rule
|
||||
val activityTestRule = AndroidComposeTestRule(
|
||||
HomeActivityTestRule(),
|
||||
{ it.activity }
|
||||
{ it.activity },
|
||||
)
|
||||
|
||||
@Before
|
||||
|
@ -184,7 +184,7 @@ class SearchTest {
|
|||
val customSearchEngine = createSearchEngine(
|
||||
name = "TestSearchEngine",
|
||||
url = searchString,
|
||||
icon = DefaultIconGenerator().generate(appContext, IconRequest(searchString)).bitmap
|
||||
icon = DefaultIconGenerator().generate(appContext, IconRequest(searchString)).bitmap,
|
||||
)
|
||||
setCustomSearchEngine(customSearchEngine)
|
||||
|
||||
|
@ -219,7 +219,7 @@ class SearchTest {
|
|||
val customSearchEngine = createSearchEngine(
|
||||
name = "TestSearchEngine",
|
||||
url = searchString,
|
||||
icon = DefaultIconGenerator().generate(appContext, IconRequest(searchString)).bitmap
|
||||
icon = DefaultIconGenerator().generate(appContext, IconRequest(searchString)).bitmap,
|
||||
)
|
||||
setCustomSearchEngine(customSearchEngine)
|
||||
|
||||
|
@ -250,7 +250,7 @@ class SearchTest {
|
|||
val customSearchEngine = createSearchEngine(
|
||||
name = "TestSearchEngine",
|
||||
url = searchString,
|
||||
icon = DefaultIconGenerator().generate(appContext, IconRequest(searchString)).bitmap
|
||||
icon = DefaultIconGenerator().generate(appContext, IconRequest(searchString)).bitmap,
|
||||
)
|
||||
setCustomSearchEngine(customSearchEngine)
|
||||
|
||||
|
@ -288,7 +288,7 @@ class SearchTest {
|
|||
val customSearchEngine = createSearchEngine(
|
||||
name = "TestSearchEngine",
|
||||
url = searchString,
|
||||
icon = DefaultIconGenerator().generate(appContext, IconRequest(searchString)).bitmap
|
||||
icon = DefaultIconGenerator().generate(appContext, IconRequest(searchString)).bitmap,
|
||||
)
|
||||
setCustomSearchEngine(customSearchEngine)
|
||||
|
||||
|
|
|
@ -53,8 +53,8 @@ class SettingsAboutTest {
|
|||
mockWebServer.shutdown()
|
||||
}
|
||||
|
||||
@Test
|
||||
// Walks through settings menu and sub-menus to ensure all items are present
|
||||
@Test
|
||||
fun settingsAboutItemsTest() {
|
||||
// ABOUT
|
||||
homeScreen {
|
||||
|
|
|
@ -90,7 +90,7 @@ class SettingsAddonsTest {
|
|||
addonsListIdlingResource =
|
||||
RecyclerViewIdlingResource(
|
||||
activityTestRule.activity.findViewById(R.id.add_ons_list),
|
||||
1
|
||||
1,
|
||||
)
|
||||
IdlingRegistry.getInstance().register(addonsListIdlingResource!!)
|
||||
clickInstallAddon(addonName)
|
||||
|
@ -119,7 +119,7 @@ class SettingsAddonsTest {
|
|||
}.openDetailedMenuForAddon(addonName) {
|
||||
addonContainerIdlingResource = ViewVisibilityIdlingResource(
|
||||
activityTestRule.activity.findViewById(R.id.addon_container),
|
||||
View.VISIBLE
|
||||
View.VISIBLE,
|
||||
)
|
||||
IdlingRegistry.getInstance().register(addonContainerIdlingResource!!)
|
||||
}.removeAddon {
|
||||
|
@ -128,9 +128,9 @@ class SettingsAddonsTest {
|
|||
}
|
||||
}
|
||||
|
||||
// Installs uBlock add-on and checks that the app doesn't crash while loading pages with trackers
|
||||
@SmokeTest
|
||||
@Test
|
||||
// Installs uBlock add-on and checks that the app doesn't crash while loading pages with trackers
|
||||
fun noCrashWithAddonInstalledTest() {
|
||||
// setting ETP to Strict mode to test it works with add-ons
|
||||
activityTestRule.activity.settings().setStrictETP()
|
||||
|
|
|
@ -54,8 +54,8 @@ class SettingsAdvancedTest {
|
|||
featureSettingsHelper.resetAllFeatureFlags()
|
||||
}
|
||||
|
||||
@Test
|
||||
// Walks through settings menu and sub-menus to ensure all items are present
|
||||
@Test
|
||||
fun settingsAboutItemsTest() {
|
||||
// ADVANCED
|
||||
homeScreen {
|
||||
|
@ -71,9 +71,9 @@ class SettingsAdvancedTest {
|
|||
}
|
||||
}
|
||||
|
||||
// Assumes Play Store is installed and enabled
|
||||
@SmokeTest
|
||||
@Test
|
||||
// Assumes Play Store is installed and enabled
|
||||
fun openLinkInAppTest() {
|
||||
val defaultWebPage = TestAssetHelper.getGenericAsset(mockWebServer, 3)
|
||||
val playStoreUrl = "play.google.com/store/apps/details?id=org.mozilla.fenix"
|
||||
|
|
|
@ -180,7 +180,7 @@ class SettingsBasicsTest {
|
|||
"94105",
|
||||
"United States",
|
||||
"555-5555",
|
||||
"foo@bar.com"
|
||||
"foo@bar.com",
|
||||
)
|
||||
}.goBack {
|
||||
}.goBack {
|
||||
|
@ -212,7 +212,7 @@ class SettingsBasicsTest {
|
|||
"94105",
|
||||
"United States",
|
||||
"555-5555",
|
||||
"foo@bar.com"
|
||||
"foo@bar.com",
|
||||
)
|
||||
clickManageAddressesButton()
|
||||
clickSavedAddress("Mozilla")
|
||||
|
@ -281,7 +281,7 @@ class SettingsBasicsTest {
|
|||
localeListIdlingResource =
|
||||
RecyclerViewIdlingResource(
|
||||
activityIntentTestRule.activity.findViewById(R.id.locale_list),
|
||||
2
|
||||
2,
|
||||
)
|
||||
IdlingRegistry.getInstance().register(localeListIdlingResource)
|
||||
selectLanguage("Romanian")
|
||||
|
|
|
@ -44,8 +44,8 @@ class SettingsDeveloperToolsTest {
|
|||
mockWebServer.shutdown()
|
||||
}
|
||||
|
||||
@Test
|
||||
// Walks through settings developer tools menu and sub-menus to ensure all items are present
|
||||
@Test
|
||||
fun settingsDeveloperToolsItemsTest() {
|
||||
homeScreen {
|
||||
}.openThreeDotMenu {
|
||||
|
|
|
@ -150,7 +150,7 @@ class SettingsHomepageTest {
|
|||
val wallpapers = listOf(
|
||||
"Wallpaper Item: amethyst",
|
||||
"Wallpaper Item: cerulean",
|
||||
"Wallpaper Item: sunrise"
|
||||
"Wallpaper Item: sunrise",
|
||||
)
|
||||
|
||||
for (wallpaper in wallpapers) {
|
||||
|
|
|
@ -79,8 +79,8 @@ class SettingsPrivacyTest {
|
|||
featureSettingsHelper.resetAllFeatureFlags()
|
||||
}
|
||||
|
||||
@Test
|
||||
// Walks through settings privacy menu and sub-menus to ensure all items are present
|
||||
@Test
|
||||
fun settingsPrivacyItemsTest() {
|
||||
homeScreen {
|
||||
}.openThreeDotMenu {
|
||||
|
@ -110,7 +110,6 @@ class SettingsPrivacyTest {
|
|||
verifyEnhancedTrackingProtectionProtectionExceptionsSubMenuItems()
|
||||
}.goBack {
|
||||
}.goBack {
|
||||
|
||||
// SITE PERMISSIONS
|
||||
verifySitePermissionsButton()
|
||||
}.openSettingsSubMenuSitePermissions {
|
||||
|
@ -122,54 +121,46 @@ class SettingsPrivacyTest {
|
|||
verifyNavigationToolBarHeader("Autoplay")
|
||||
verifySitePermissionsAutoPlaySubMenuItems()
|
||||
}.goBack {
|
||||
|
||||
// SITE PERMISSIONS CAMERA
|
||||
}.openCamera {
|
||||
verifyNavigationToolBarHeader("Camera")
|
||||
verifySitePermissionsCommonSubMenuItems()
|
||||
verifyToggleNameToON("3. Toggle Camera to ON")
|
||||
}.goBack {
|
||||
|
||||
// SITE PERMISSIONS LOCATION
|
||||
}.openLocation {
|
||||
verifyNavigationToolBarHeader("Location")
|
||||
verifySitePermissionsCommonSubMenuItems()
|
||||
verifyToggleNameToON("3. Toggle Location to ON")
|
||||
}.goBack {
|
||||
|
||||
// SITE PERMISSIONS MICROPHONE
|
||||
}.openMicrophone {
|
||||
verifyNavigationToolBarHeader("Microphone")
|
||||
verifySitePermissionsCommonSubMenuItems()
|
||||
verifyToggleNameToON("3. Toggle Microphone to ON")
|
||||
}.goBack {
|
||||
|
||||
// SITE PERMISSIONS NOTIFICATION
|
||||
}.openNotification {
|
||||
verifyNavigationToolBarHeader("Notification")
|
||||
verifySitePermissionsNotificationSubMenuItems()
|
||||
}.goBack {
|
||||
|
||||
// SITE PERMISSIONS PERSISTENT STORAGE
|
||||
}.openPersistentStorage {
|
||||
verifyNavigationToolBarHeader("Persistent Storage")
|
||||
verifySitePermissionsPersistentStorageSubMenuItems()
|
||||
}.goBack {
|
||||
|
||||
// SITE PERMISSIONS EXCEPTIONS
|
||||
}.openExceptions {
|
||||
verifyNavigationToolBarHeader()
|
||||
verifySitePermissionsExceptionSubMenuItems()
|
||||
}.goBack {
|
||||
}.goBack {
|
||||
|
||||
// DELETE BROWSING DATA
|
||||
verifyDeleteBrowsingDataButton()
|
||||
}.openSettingsSubMenuDeleteBrowsingData {
|
||||
verifyNavigationToolBarHeader()
|
||||
verifyDeleteBrowsingDataSubMenuItems()
|
||||
}.goBack {
|
||||
|
||||
// DELETE BROWSING DATA ON QUIT
|
||||
verifyDeleteBrowsingDataOnQuitButton()
|
||||
verifyDeleteBrowsingDataOnQuitState("Off")
|
||||
|
@ -177,13 +168,11 @@ class SettingsPrivacyTest {
|
|||
verifyNavigationToolBarHeader()
|
||||
verifyDeleteBrowsingDataOnQuitSubMenuItems()
|
||||
}.goBack {
|
||||
|
||||
// NOTIFICATIONS
|
||||
verifyNotificationsButton()
|
||||
}.openSettingsSubMenuNotifications {
|
||||
verifySystemNotificationsView()
|
||||
}.goBack {
|
||||
|
||||
// DATA COLLECTION
|
||||
verifyDataCollectionButton()
|
||||
}.openSettingsSubMenuDataCollection {
|
||||
|
@ -455,10 +444,10 @@ class SettingsPrivacyTest {
|
|||
}
|
||||
}
|
||||
|
||||
// Verifies that you can go to System settings and change app's permissions from inside the app
|
||||
@SmokeTest
|
||||
@Test
|
||||
@SdkSuppress(minSdkVersion = 29)
|
||||
// Verifies that you can go to System settings and change app's permissions from inside the app
|
||||
fun redirectToAppPermissionsSystemSettingsTest() {
|
||||
homeScreen {
|
||||
}.openThreeDotMenu {
|
||||
|
|
|
@ -24,7 +24,7 @@ class SettingsSearchTest {
|
|||
|
||||
@get:Rule
|
||||
val activityTestRule = AndroidComposeTestRule(
|
||||
HomeActivityIntentTestRule()
|
||||
HomeActivityIntentTestRule(),
|
||||
) { it.activity }
|
||||
|
||||
@Before
|
||||
|
@ -121,9 +121,9 @@ class SettingsSearchTest {
|
|||
}
|
||||
}
|
||||
|
||||
// Ads a new search engine from the list of custom engines
|
||||
@SmokeTest
|
||||
@Test
|
||||
// Ads a new search engine from the list of custom engines
|
||||
fun addPredefinedSearchEngineTest() {
|
||||
val searchEngine = "Reddit"
|
||||
|
||||
|
@ -147,9 +147,9 @@ class SettingsSearchTest {
|
|||
}
|
||||
}
|
||||
|
||||
// Verifies setting as default a customized search engine name and URL
|
||||
@SmokeTest
|
||||
@Test
|
||||
// Verifies setting as default a customized search engine name and URL
|
||||
fun editCustomSearchEngineTest() {
|
||||
searchMockServer = MockWebServer().apply {
|
||||
dispatcher = SearchDispatcher()
|
||||
|
@ -183,14 +183,13 @@ class SettingsSearchTest {
|
|||
}
|
||||
}
|
||||
|
||||
@Ignore("Failing, see: https://github.com/mozilla-mobile/fenix/issues/23817")
|
||||
@SmokeTest
|
||||
@Test
|
||||
// Test running on beta/release builds in CI:
|
||||
// caution when making changes to it, so they don't block the builds
|
||||
// Goes through the settings and changes the search suggestion toggle, then verifies it changes.
|
||||
@Ignore("Failing, see: https://github.com/mozilla-mobile/fenix/issues/23817")
|
||||
@SmokeTest
|
||||
@Test
|
||||
fun toggleSearchSuggestionsTest() {
|
||||
|
||||
homeScreen {
|
||||
}.openSearch {
|
||||
typeSearch("mozilla")
|
||||
|
|
|
@ -43,9 +43,9 @@ class SettingsSyncTest {
|
|||
mockWebServer.shutdown()
|
||||
}
|
||||
|
||||
// Walks through settings sync menu and sub-menus to ensure all items are present
|
||||
@Ignore("This is a stub test, ignore for now")
|
||||
@Test
|
||||
// Walks through settings sync menu and sub-menus to ensure all items are present
|
||||
fun settingsSyncItemsTest() {
|
||||
// SYNC
|
||||
|
||||
|
|
|
@ -43,9 +43,9 @@ class SettingsTest {
|
|||
mockWebServer.shutdown()
|
||||
}
|
||||
|
||||
// Walks through settings menu and sub-menus to ensure all items are present
|
||||
@Ignore("This is a stub test, ignore for now")
|
||||
@Test
|
||||
// Walks through settings menu and sub-menus to ensure all items are present
|
||||
fun settingsMenusItemsTest() {
|
||||
// SYNC
|
||||
|
||||
|
|
|
@ -45,7 +45,7 @@ class SitePermissionsTest {
|
|||
val grantPermissionRule: GrantPermissionRule = GrantPermissionRule.grant(
|
||||
Manifest.permission.RECORD_AUDIO,
|
||||
Manifest.permission.CAMERA,
|
||||
Manifest.permission.ACCESS_COARSE_LOCATION
|
||||
Manifest.permission.ACCESS_COARSE_LOCATION,
|
||||
)
|
||||
|
||||
@get: Rule
|
||||
|
|
|
@ -72,12 +72,14 @@ class SmokeTest {
|
|||
@get:Rule
|
||||
val activityTestRule = AndroidComposeTestRule(
|
||||
HomeActivityIntentTestRule(),
|
||||
{ it.activity }
|
||||
{ it.activity },
|
||||
)
|
||||
|
||||
@get: Rule
|
||||
val intentReceiverActivityTestRule = ActivityTestRule(
|
||||
IntentReceiverActivity::class.java, true, false
|
||||
IntentReceiverActivity::class.java,
|
||||
true,
|
||||
false,
|
||||
)
|
||||
|
||||
@Rule
|
||||
|
@ -171,8 +173,8 @@ class SmokeTest {
|
|||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
// Verifies the functionality of the onboarding Start Browsing button
|
||||
@Test
|
||||
fun startBrowsingButtonTest() {
|
||||
homeScreen {
|
||||
verifyStartBrowsingButton()
|
||||
|
@ -209,9 +211,9 @@ class SmokeTest {
|
|||
}
|
||||
}
|
||||
|
||||
// Verifies the list of items in a tab's 3 dot menu
|
||||
@Ignore("Failing, see: https://github.com/mozilla-mobile/fenix/issues/26711")
|
||||
@Test
|
||||
// Verifies the list of items in a tab's 3 dot menu
|
||||
fun verifyPageMainMenuItemsTest() {
|
||||
val defaultWebPage = TestAssetHelper.getGenericAsset(mockWebServer, 1)
|
||||
|
||||
|
@ -223,8 +225,8 @@ class SmokeTest {
|
|||
}
|
||||
|
||||
// Could be removed when more smoke tests from the History category are added
|
||||
@Test
|
||||
// Verifies the History menu opens from a tab's 3 dot menu
|
||||
@Test
|
||||
fun openMainMenuHistoryItemTest() {
|
||||
val defaultWebPage = TestAssetHelper.getGenericAsset(mockWebServer, 1)
|
||||
|
||||
|
@ -237,8 +239,8 @@ class SmokeTest {
|
|||
}
|
||||
|
||||
// Could be removed when more smoke tests from the Bookmarks category are added
|
||||
@Test
|
||||
// Verifies the Bookmarks menu opens from a tab's 3 dot menu
|
||||
@Test
|
||||
fun openMainMenuBookmarksItemTest() {
|
||||
val defaultWebPage = TestAssetHelper.getGenericAsset(mockWebServer, 1)
|
||||
|
||||
|
@ -250,8 +252,8 @@ class SmokeTest {
|
|||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
// Verifies the Add-ons menu opens from a tab's 3 dot menu
|
||||
@Test
|
||||
fun openMainMenuAddonsTest() {
|
||||
val defaultWebPage = TestAssetHelper.getGenericAsset(mockWebServer, 1)
|
||||
|
||||
|
@ -262,7 +264,7 @@ class SmokeTest {
|
|||
addonsListIdlingResource =
|
||||
RecyclerViewIdlingResource(
|
||||
activityTestRule.activity.findViewById(R.id.add_ons_list),
|
||||
1
|
||||
1,
|
||||
)
|
||||
IdlingRegistry.getInstance().register(addonsListIdlingResource!!)
|
||||
verifyAddonsItems()
|
||||
|
@ -270,9 +272,9 @@ class SmokeTest {
|
|||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
// Verifies the Synced tabs menu or Sync Sign In menu opens from a tab's 3 dot menu.
|
||||
// The test is assuming we are NOT signed in.
|
||||
@Test
|
||||
fun openMainMenuSyncItemTest() {
|
||||
val defaultWebPage = TestAssetHelper.getGenericAsset(mockWebServer, 1)
|
||||
|
||||
|
@ -285,10 +287,10 @@ class SmokeTest {
|
|||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
// Test running on beta/release builds in CI:
|
||||
// caution when making changes to it, so they don't block the builds
|
||||
// Verifies the Settings menu opens from a tab's 3 dot menu
|
||||
@Test
|
||||
fun openMainMenuSettingsItemTest() {
|
||||
val defaultWebPage = TestAssetHelper.getGenericAsset(mockWebServer, 1)
|
||||
|
||||
|
@ -300,8 +302,8 @@ class SmokeTest {
|
|||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
// Verifies the Find in page option in a tab's 3 dot menu
|
||||
@Test
|
||||
fun openMainMenuFindInPageTest() {
|
||||
val defaultWebPage = TestAssetHelper.getGenericAsset(mockWebServer, 1)
|
||||
|
||||
|
@ -313,8 +315,8 @@ class SmokeTest {
|
|||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
// Verifies the Add to home screen option in a tab's 3 dot menu
|
||||
@Test
|
||||
fun mainMenuAddToHomeScreenTest() {
|
||||
val website = TestAssetHelper.getGenericAsset(mockWebServer, 1)
|
||||
val shortcutTitle = generateRandomString(5)
|
||||
|
@ -342,8 +344,8 @@ class SmokeTest {
|
|||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
// Verifies the Add to collection option in a tab's 3 dot menu
|
||||
@Test
|
||||
fun openMainMenuAddToCollectionTest() {
|
||||
val defaultWebPage = TestAssetHelper.getGenericAsset(mockWebServer, 1)
|
||||
|
||||
|
@ -355,8 +357,8 @@ class SmokeTest {
|
|||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
// Verifies the Bookmark button in a tab's 3 dot menu
|
||||
@Test
|
||||
fun mainMenuBookmarkButtonTest() {
|
||||
val defaultWebPage = TestAssetHelper.getGenericAsset(mockWebServer, 1)
|
||||
|
||||
|
@ -368,10 +370,10 @@ class SmokeTest {
|
|||
}
|
||||
}
|
||||
|
||||
@Ignore("Failing with frequent ANR: https://github.com/mozilla-mobile/fenix/issues/25926")
|
||||
@Test
|
||||
// Device or AVD requires a Google Services Android OS installation with Play Store installed
|
||||
// Verifies the Open in app button when an app is installed
|
||||
@Ignore("Failing with frequent ANR: https://github.com/mozilla-mobile/fenix/issues/25926")
|
||||
@Test
|
||||
fun mainMenuOpenInAppTest() {
|
||||
val playStoreUrl = "play.google.com/store/apps/details?id=org.mozilla.fenix"
|
||||
|
||||
|
@ -384,8 +386,8 @@ class SmokeTest {
|
|||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
// Verifies the Desktop site toggle in a tab's 3 dot menu
|
||||
@Test
|
||||
fun mainMenuDesktopSiteTest() {
|
||||
val defaultWebPage = TestAssetHelper.getGenericAsset(mockWebServer, 1)
|
||||
|
||||
|
@ -398,8 +400,8 @@ class SmokeTest {
|
|||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
// Verifies the Share button in a tab's 3 dot menu
|
||||
@Test
|
||||
fun mainMenuShareButtonTest() {
|
||||
val defaultWebPage = TestAssetHelper.getGenericAsset(mockWebServer, 1)
|
||||
|
||||
|
@ -413,8 +415,8 @@ class SmokeTest {
|
|||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
// Verifies the refresh button in a tab's 3 dot menu
|
||||
@Test
|
||||
fun mainMenuRefreshButtonTest() {
|
||||
val refreshWebPage = TestAssetHelper.getRefreshAsset(mockWebServer)
|
||||
|
||||
|
@ -460,8 +462,8 @@ class SmokeTest {
|
|||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
// Verifies changing the default engine from the Search Shortcut menu
|
||||
@Test
|
||||
fun selectSearchEnginesShortcutTest() {
|
||||
val enginesList = listOf("DuckDuckGo", "Google", "Amazon.com", "Wikipedia", "Bing", "eBay")
|
||||
|
||||
|
@ -479,8 +481,8 @@ class SmokeTest {
|
|||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
// Swipes the nav bar left/right to switch between tabs
|
||||
@Test
|
||||
fun swipeToSwitchTabTest() {
|
||||
val firstWebPage = TestAssetHelper.getGenericAsset(mockWebServer, 1)
|
||||
val secondWebPage = TestAssetHelper.getGenericAsset(mockWebServer, 2)
|
||||
|
@ -497,8 +499,8 @@ class SmokeTest {
|
|||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
// Saves a login, then changes it and verifies the update
|
||||
@Test
|
||||
fun updateSavedLoginTest() {
|
||||
val saveLoginTest =
|
||||
TestAssetHelper.getSaveLoginAsset(mockWebServer)
|
||||
|
@ -579,8 +581,8 @@ class SmokeTest {
|
|||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
// Verifies that deleting a Bookmarks folder also removes the item from inside it.
|
||||
@Test
|
||||
fun deleteNonEmptyBookmarkFolderTest() {
|
||||
val website = TestAssetHelper.getGenericAsset(mockWebServer, 1)
|
||||
|
||||
|
@ -651,8 +653,9 @@ class SmokeTest {
|
|||
}.clickShareAllTabsButton {
|
||||
verifyShareTabsOverlay(firstWebsiteTitle, secondWebsiteTitle)
|
||||
verifySharingWithSelectedApp(
|
||||
sharingApp, sharedUrlsString,
|
||||
"$firstWebsiteTitle, $secondWebsiteTitle"
|
||||
sharingApp,
|
||||
sharedUrlsString,
|
||||
"$firstWebsiteTitle, $secondWebsiteTitle",
|
||||
)
|
||||
}
|
||||
}
|
||||
|
@ -698,9 +701,9 @@ class SmokeTest {
|
|||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
// Test running on beta/release builds in CI:
|
||||
// caution when making changes to it, so they don't block the builds
|
||||
@Test
|
||||
fun noHistoryInPrivateBrowsingTest() {
|
||||
FeatureSettingsHelper().setTCPCFREnabled(false)
|
||||
val website = TestAssetHelper.getGenericAsset(mockWebServer, 1)
|
||||
|
@ -753,8 +756,8 @@ class SmokeTest {
|
|||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
// Verifies that reader mode is detected and the custom appearance controls are displayed
|
||||
@Test
|
||||
fun verifyReaderViewAppearanceUI() {
|
||||
val readerViewPage =
|
||||
TestAssetHelper.getLoremIpsumAsset(mockWebServer)
|
||||
|
@ -767,7 +770,7 @@ class SmokeTest {
|
|||
|
||||
readerViewNotification = ViewVisibilityIdlingResource(
|
||||
activityTestRule.activity.findViewById(R.id.mozac_browser_toolbar_page_actions),
|
||||
View.VISIBLE
|
||||
View.VISIBLE,
|
||||
)
|
||||
|
||||
IdlingRegistry.getInstance().register(readerViewNotification)
|
||||
|
@ -795,16 +798,16 @@ class SmokeTest {
|
|||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
// Verifies the main menu of a custom tab with a custom menu item
|
||||
@Test
|
||||
fun customTabMenuItemsTest() {
|
||||
val customTabPage = TestAssetHelper.getGenericAsset(mockWebServer, 1)
|
||||
|
||||
intentReceiverActivityTestRule.launchActivity(
|
||||
createCustomTabIntent(
|
||||
customTabPage.url.toString(),
|
||||
customMenuItem
|
||||
)
|
||||
customMenuItem,
|
||||
),
|
||||
)
|
||||
|
||||
customTabScreen {
|
||||
|
@ -821,15 +824,15 @@ class SmokeTest {
|
|||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
// The test opens a link in a custom tab then sends it to the browser
|
||||
@Test
|
||||
fun openCustomTabInBrowserTest() {
|
||||
val customTabPage = TestAssetHelper.getGenericAsset(mockWebServer, 1)
|
||||
|
||||
intentReceiverActivityTestRule.launchActivity(
|
||||
createCustomTabIntent(
|
||||
customTabPage.url.toString()
|
||||
)
|
||||
customTabPage.url.toString(),
|
||||
),
|
||||
)
|
||||
|
||||
customTabScreen {
|
||||
|
@ -893,9 +896,9 @@ class SmokeTest {
|
|||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
// For API>23
|
||||
// Verifies the default browser switch opens the system default apps menu.
|
||||
@Test
|
||||
fun changeDefaultBrowserSetting() {
|
||||
homeScreen {
|
||||
}.openThreeDotMenu {
|
||||
|
|
|
@ -287,7 +287,6 @@ class TabbedBrowsingTest {
|
|||
|
||||
@Test
|
||||
fun verifyTabTrayNotShowingStateHalfExpanded() {
|
||||
|
||||
navigationToolbar {
|
||||
}.openTabTray {
|
||||
verifyNoOpenTabsInNormalBrowsing()
|
||||
|
|
|
@ -203,7 +203,7 @@ class TopSitesTest {
|
|||
val defaultTopSites = arrayOf(
|
||||
"Top Articles",
|
||||
"Wikipedia",
|
||||
"Google"
|
||||
"Google",
|
||||
)
|
||||
|
||||
homeScreen { }.dismissOnboarding()
|
||||
|
@ -245,7 +245,6 @@ class TopSitesTest {
|
|||
@SmokeTest
|
||||
@Test
|
||||
fun verifySponsoredShortcutsListTest() {
|
||||
|
||||
homeScreen {
|
||||
}.openThreeDotMenu {
|
||||
}.openCustomizeHome {
|
||||
|
|
|
@ -50,17 +50,17 @@ private fun disconnectButton() = Espresso.onView(CoreMatchers.allOf(ViewMatchers
|
|||
private fun assertBookmarksCheckbox() = bookmarksCheckbox().check(
|
||||
ViewAssertions.matches(
|
||||
ViewMatchers.withEffectiveVisibility(
|
||||
ViewMatchers.Visibility.VISIBLE
|
||||
)
|
||||
)
|
||||
ViewMatchers.Visibility.VISIBLE,
|
||||
),
|
||||
),
|
||||
)
|
||||
|
||||
private fun assertHistoryCheckbox() = historyCheckbox().check(
|
||||
ViewAssertions.matches(
|
||||
ViewMatchers.withEffectiveVisibility(
|
||||
ViewMatchers.Visibility.VISIBLE
|
||||
)
|
||||
)
|
||||
ViewMatchers.Visibility.VISIBLE,
|
||||
),
|
||||
),
|
||||
)
|
||||
|
||||
private fun assertSignOutButton() = signOutButton().check(ViewAssertions.matches(ViewMatchers.withEffectiveVisibility(ViewMatchers.Visibility.VISIBLE)))
|
||||
|
|
|
@ -55,10 +55,10 @@ class AddToHomeScreenRobot {
|
|||
mDevice.wait(
|
||||
Until.findObject(
|
||||
By.text(
|
||||
Pattern.compile("Add Automatically", Pattern.CASE_INSENSITIVE)
|
||||
)
|
||||
Pattern.compile("Add Automatically", Pattern.CASE_INSENSITIVE),
|
||||
),
|
||||
),
|
||||
waitingTime
|
||||
waitingTime,
|
||||
)
|
||||
addAutomaticallyButton().click()
|
||||
}
|
||||
|
@ -67,7 +67,7 @@ class AddToHomeScreenRobot {
|
|||
fun verifyShortcutAdded(shortcutTitle: String) {
|
||||
assertTrue(
|
||||
mDevice.findObject(UiSelector().text(shortcutTitle))
|
||||
.waitForExists(waitingTime)
|
||||
.waitForExists(waitingTime),
|
||||
)
|
||||
}
|
||||
|
||||
|
@ -75,7 +75,7 @@ class AddToHomeScreenRobot {
|
|||
fun openHomeScreenShortcut(title: String, interact: BrowserRobot.() -> Unit): BrowserRobot.Transition {
|
||||
mDevice.wait(
|
||||
Until.findObject(By.text(title)),
|
||||
waitingTime
|
||||
waitingTime,
|
||||
)
|
||||
mDevice.findObject((UiSelector().text(title))).clickAndWaitForNewWindow(waitingTime)
|
||||
|
||||
|
@ -112,8 +112,8 @@ private fun assertShortcutNameField(expectedText: String) {
|
|||
onView(
|
||||
allOf(
|
||||
withId(R.id.shortcut_text),
|
||||
withText(expectedText)
|
||||
)
|
||||
withText(expectedText),
|
||||
),
|
||||
)
|
||||
.check(matches(isCompletelyDisplayed()))
|
||||
}
|
||||
|
|
|
@ -46,7 +46,7 @@ class BookmarksRobot {
|
|||
|
||||
fun verifyBookmarksMenuView() {
|
||||
mDevice.findObject(
|
||||
UiSelector().text("Bookmarks")
|
||||
UiSelector().text("Bookmarks"),
|
||||
).waitForExists(waitingTime)
|
||||
|
||||
assertBookmarksView()
|
||||
|
@ -83,7 +83,7 @@ class BookmarksRobot {
|
|||
fun verifySnackBarHidden() {
|
||||
mDevice.waitNotNull(
|
||||
Until.gone(By.text("UNDO")),
|
||||
TestAssetHelper.waitingTime
|
||||
TestAssetHelper.waitingTime,
|
||||
)
|
||||
onView(withId(R.id.snackbar_layout)).check(doesNotExist())
|
||||
}
|
||||
|
@ -115,15 +115,15 @@ class BookmarksRobot {
|
|||
fun verifyCurrentFolderTitle(title: String) {
|
||||
mDevice.findObject(
|
||||
UiSelector().resourceId("$packageName:id/navigationToolbar")
|
||||
.textContains(title)
|
||||
.textContains(title),
|
||||
)
|
||||
.waitForExists(waitingTime)
|
||||
|
||||
onView(
|
||||
allOf(
|
||||
withText(title),
|
||||
withParent(withId(R.id.navigationToolbar))
|
||||
)
|
||||
withParent(withId(R.id.navigationToolbar)),
|
||||
),
|
||||
)
|
||||
.check(matches(isDisplayed()))
|
||||
}
|
||||
|
@ -131,7 +131,7 @@ class BookmarksRobot {
|
|||
fun waitForBookmarksFolderContentToExist(parentFolderName: String, childFolderName: String) {
|
||||
mDevice.findObject(
|
||||
UiSelector().resourceId("$packageName:id/navigationToolbar")
|
||||
.textContains(parentFolderName)
|
||||
.textContains(parentFolderName),
|
||||
)
|
||||
.waitForExists(waitingTime)
|
||||
|
||||
|
@ -159,7 +159,7 @@ class BookmarksRobot {
|
|||
fun clickAddFolderButton() {
|
||||
mDevice.waitNotNull(
|
||||
Until.findObject(By.desc("Add folder")),
|
||||
TestAssetHelper.waitingTime
|
||||
TestAssetHelper.waitingTime,
|
||||
)
|
||||
addFolderButton().click()
|
||||
}
|
||||
|
@ -266,10 +266,10 @@ private fun bookmarkFavicon(url: String) = onView(
|
|||
withId(R.id.favicon),
|
||||
withParent(
|
||||
withParent(
|
||||
withChild(allOf(withId(R.id.url), withText(url)))
|
||||
)
|
||||
)
|
||||
)
|
||||
withChild(allOf(withId(R.id.url), withText(url))),
|
||||
),
|
||||
),
|
||||
),
|
||||
)
|
||||
|
||||
private fun bookmarkURL(url: String) = onView(allOf(withId(R.id.url), withText(containsString(url))))
|
||||
|
@ -283,15 +283,15 @@ private fun saveFolderButton() = onView(withId(R.id.confirm_add_folder_button))
|
|||
private fun threeDotMenu(bookmarkUrl: Uri) = onView(
|
||||
allOf(
|
||||
withId(R.id.overflow_menu),
|
||||
withParent(withChild(allOf(withId(R.id.url), withText(bookmarkUrl.toString()))))
|
||||
)
|
||||
withParent(withChild(allOf(withId(R.id.url), withText(bookmarkUrl.toString())))),
|
||||
),
|
||||
)
|
||||
|
||||
private fun threeDotMenu(bookmarkTitle: String) = onView(
|
||||
allOf(
|
||||
withId(R.id.overflow_menu),
|
||||
withParent(withChild(allOf(withId(R.id.title), withText(bookmarkTitle))))
|
||||
)
|
||||
withParent(withChild(allOf(withId(R.id.title), withText(bookmarkTitle)))),
|
||||
),
|
||||
)
|
||||
|
||||
private fun snackBarText() = onView(withId(R.id.snackbar_text))
|
||||
|
@ -314,8 +314,8 @@ private fun assertBookmarksView() {
|
|||
onView(
|
||||
allOf(
|
||||
withText("Bookmarks"),
|
||||
withParent(withId(R.id.navigationToolbar))
|
||||
)
|
||||
withParent(withId(R.id.navigationToolbar)),
|
||||
),
|
||||
)
|
||||
.check(matches(isDisplayed()))
|
||||
}
|
||||
|
@ -331,23 +331,23 @@ private fun assertEmptyBookmarksList() =
|
|||
private fun assertBookmarkFolderIsNotCreated(title: String) {
|
||||
mDevice.findObject(
|
||||
UiSelector()
|
||||
.resourceId("$packageName:id/bookmarks_wrapper")
|
||||
.resourceId("$packageName:id/bookmarks_wrapper"),
|
||||
).waitForExists(waitingTime)
|
||||
|
||||
assertFalse(
|
||||
mDevice.findObject(
|
||||
UiSelector()
|
||||
.textContains(title)
|
||||
).waitForExists(waitingTime)
|
||||
.textContains(title),
|
||||
).waitForExists(waitingTime),
|
||||
)
|
||||
}
|
||||
|
||||
private fun assertBookmarkFavicon(forUrl: Uri) = bookmarkFavicon(forUrl.toString()).check(
|
||||
matches(
|
||||
withEffectiveVisibility(
|
||||
ViewMatchers.Visibility.VISIBLE
|
||||
)
|
||||
)
|
||||
ViewMatchers.Visibility.VISIBLE,
|
||||
),
|
||||
),
|
||||
)
|
||||
|
||||
private fun assertBookmarkURL(expectedURL: String) =
|
||||
|
@ -362,15 +362,15 @@ private fun assertBookmarkTitle(expectedTitle: String) =
|
|||
private fun assertBookmarkIsDeleted(expectedTitle: String) {
|
||||
mDevice.findObject(
|
||||
UiSelector()
|
||||
.resourceId("$packageName:id/bookmarks_wrapper")
|
||||
.resourceId("$packageName:id/bookmarks_wrapper"),
|
||||
).waitForExists(waitingTime)
|
||||
|
||||
assertFalse(
|
||||
mDevice.findObject(
|
||||
UiSelector()
|
||||
.resourceId("$packageName:id/title")
|
||||
.textContains(expectedTitle)
|
||||
).waitForExists(waitingTime)
|
||||
.textContains(expectedTitle),
|
||||
).waitForExists(waitingTime),
|
||||
)
|
||||
}
|
||||
private fun assertUndoDeleteSnackBarButton() =
|
||||
|
@ -399,7 +399,7 @@ private fun assertKeyboardVisibility(isExpectedToBeVisible: Boolean) =
|
|||
isExpectedToBeVisible,
|
||||
mDevice
|
||||
.executeShellCommand("dumpsys input_method | grep mInputShown")
|
||||
.contains("mInputShown=true")
|
||||
.contains("mInputShown=true"),
|
||||
)
|
||||
|
||||
private fun assertShareOverlay() =
|
||||
|
|
|
@ -67,8 +67,8 @@ class BrowserRobot {
|
|||
mDevice.findObject(
|
||||
UiSelector()
|
||||
.resourceId("$packageName:id/mozac_browser_toolbar_url_view")
|
||||
.textContains(url.replace("http://", ""))
|
||||
).waitForExists(waitingTime)
|
||||
.textContains(url.replace("http://", "")),
|
||||
).waitForExists(waitingTime),
|
||||
)
|
||||
}
|
||||
}
|
||||
|
@ -95,13 +95,13 @@ class BrowserRobot {
|
|||
|
||||
mDevice.waitNotNull(
|
||||
Until.findObject(By.res("$packageName:id/engineView")),
|
||||
waitingTime
|
||||
waitingTime,
|
||||
)
|
||||
|
||||
runWithIdleRes(sessionLoadedIdlingResource) {
|
||||
assertTrue(
|
||||
"Page didn't load or doesn't contain the expected text",
|
||||
mDevice.findObject(UiSelector().textContains(expectedText)).waitForExists(waitingTime)
|
||||
mDevice.findObject(UiSelector().textContains(expectedText)).waitForExists(waitingTime),
|
||||
)
|
||||
}
|
||||
}
|
||||
|
@ -115,21 +115,21 @@ class BrowserRobot {
|
|||
memorySection.getFromParent(
|
||||
UiSelector()
|
||||
.className("android.widget.GridView")
|
||||
.index(2)
|
||||
.index(2),
|
||||
)
|
||||
} else {
|
||||
memorySection.getFromParent(
|
||||
UiSelector()
|
||||
.className("android.widget.GridView")
|
||||
.index(4)
|
||||
.index(4),
|
||||
)
|
||||
}
|
||||
|
||||
val cacheSizeInfo =
|
||||
gridView.getChild(
|
||||
UiSelector().text("Number of entries:")
|
||||
UiSelector().text("Number of entries:"),
|
||||
).getFromParent(
|
||||
UiSelector().text("0")
|
||||
UiSelector().text("0"),
|
||||
)
|
||||
|
||||
for (i in 1..RETRY_COUNT) {
|
||||
|
@ -149,7 +149,7 @@ class BrowserRobot {
|
|||
mDevice.findObject(
|
||||
UiSelector()
|
||||
.resourceId("$packageName:id/counter_text")
|
||||
.text(expectedText)
|
||||
.text(expectedText),
|
||||
)
|
||||
assertTrue(counter.waitForExists(waitingTime))
|
||||
}
|
||||
|
@ -160,23 +160,23 @@ class BrowserRobot {
|
|||
assertTrue(
|
||||
mDevice.findObject(
|
||||
UiSelector()
|
||||
.textContains(expectedText)
|
||||
).waitForExists(waitingTime)
|
||||
.textContains(expectedText),
|
||||
).waitForExists(waitingTime),
|
||||
)
|
||||
}
|
||||
|
||||
fun verifyLinkContextMenuItems(containsURL: Uri) {
|
||||
mDevice.waitNotNull(
|
||||
Until.findObject(By.textContains(containsURL.toString())),
|
||||
waitingTime
|
||||
waitingTime,
|
||||
)
|
||||
mDevice.waitNotNull(
|
||||
Until.findObject(text("Open link in new tab")),
|
||||
waitingTime
|
||||
waitingTime,
|
||||
)
|
||||
mDevice.waitNotNull(
|
||||
Until.findObject(text("Open link in private tab")),
|
||||
waitingTime
|
||||
waitingTime,
|
||||
)
|
||||
mDevice.waitNotNull(Until.findObject(text("Copy link")), waitingTime)
|
||||
mDevice.waitNotNull(Until.findObject(text("Share link")), waitingTime)
|
||||
|
@ -185,19 +185,23 @@ class BrowserRobot {
|
|||
fun verifyLinkImageContextMenuItems(containsURL: Uri) {
|
||||
mDevice.waitNotNull(Until.findObject(By.textContains(containsURL.toString())))
|
||||
mDevice.waitNotNull(
|
||||
Until.findObject(text("Open link in new tab")), waitingTime
|
||||
Until.findObject(text("Open link in new tab")),
|
||||
waitingTime,
|
||||
)
|
||||
mDevice.waitNotNull(
|
||||
Until.findObject(text("Open link in private tab")), waitingTime
|
||||
Until.findObject(text("Open link in private tab")),
|
||||
waitingTime,
|
||||
)
|
||||
mDevice.waitNotNull(Until.findObject(text("Copy link")), waitingTime)
|
||||
mDevice.waitNotNull(Until.findObject(text("Share link")), waitingTime)
|
||||
mDevice.waitNotNull(
|
||||
Until.findObject(text("Open image in new tab")), waitingTime
|
||||
Until.findObject(text("Open image in new tab")),
|
||||
waitingTime,
|
||||
)
|
||||
mDevice.waitNotNull(Until.findObject(text("Save image")), waitingTime)
|
||||
mDevice.waitNotNull(
|
||||
Until.findObject(text("Copy image location")), waitingTime
|
||||
Until.findObject(text("Copy image location")),
|
||||
waitingTime,
|
||||
)
|
||||
}
|
||||
|
||||
|
@ -220,18 +224,19 @@ class BrowserRobot {
|
|||
mDevice.waitNotNull(Until.findObject(By.textContains(containsURL.toString())))
|
||||
mDevice.waitNotNull(
|
||||
Until.findObject(text("Open image in new tab")),
|
||||
waitingTime
|
||||
waitingTime,
|
||||
)
|
||||
mDevice.waitNotNull(Until.findObject(text("Save image")), waitingTime)
|
||||
mDevice.waitNotNull(
|
||||
Until.findObject(text("Copy image location")), waitingTime
|
||||
Until.findObject(text("Copy image location")),
|
||||
waitingTime,
|
||||
)
|
||||
}
|
||||
|
||||
fun verifyNotificationDotOnMainMenu() {
|
||||
assertTrue(
|
||||
mDevice.findObject(UiSelector().resourceId("$packageName:id/notification_dot"))
|
||||
.waitForExists(waitingTime)
|
||||
.waitForExists(waitingTime),
|
||||
)
|
||||
}
|
||||
|
||||
|
@ -249,7 +254,7 @@ class BrowserRobot {
|
|||
fun clickContextOpenLinkInNewTab() {
|
||||
mDevice.waitNotNull(
|
||||
Until.findObject(text("Open link in new tab")),
|
||||
waitingTime
|
||||
waitingTime,
|
||||
)
|
||||
|
||||
val menuOpenInNewTab = mDevice.findObject(text("Open link in new tab"))
|
||||
|
@ -259,7 +264,7 @@ class BrowserRobot {
|
|||
fun clickContextOpenLinkInPrivateTab() {
|
||||
mDevice.waitNotNull(
|
||||
Until.findObject(text("Open link in private tab")),
|
||||
waitingTime
|
||||
waitingTime,
|
||||
)
|
||||
|
||||
val menuOpenInPrivateTab = mDevice.findObject(text("Open link in private tab"))
|
||||
|
@ -292,20 +297,20 @@ class BrowserRobot {
|
|||
IntentMatchers.hasType("text/plain"),
|
||||
IntentMatchers.hasExtra(
|
||||
Intent.EXTRA_TEXT,
|
||||
url.toString()
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
url.toString(),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
)
|
||||
}
|
||||
|
||||
fun clickContextCopyImageLocation() {
|
||||
mDevice.waitNotNull(
|
||||
Until.findObject(text("Copy image location")),
|
||||
waitingTime
|
||||
waitingTime,
|
||||
)
|
||||
|
||||
val menuCopyImageLocation = mDevice.findObject(text("Copy image location"))
|
||||
|
@ -315,7 +320,7 @@ class BrowserRobot {
|
|||
fun clickContextOpenImageNewTab() {
|
||||
mDevice.waitNotNull(
|
||||
Until.findObject(text("Open image in new tab")),
|
||||
waitingTime
|
||||
waitingTime,
|
||||
)
|
||||
|
||||
val menuOpenImageNewTab = mDevice.findObject(text("Open image in new tab"))
|
||||
|
@ -463,7 +468,7 @@ class BrowserRobot {
|
|||
val switchButton =
|
||||
mDevice.findObject(
|
||||
UiSelector()
|
||||
.resourceId("$packageName:id/snackbar_btn")
|
||||
.resourceId("$packageName:id/snackbar_btn"),
|
||||
)
|
||||
switchButton.waitForExists(waitingTime)
|
||||
switchButton.clickAndWaitForNewWindow(waitingTime)
|
||||
|
@ -487,8 +492,8 @@ class BrowserRobot {
|
|||
fun saveLoginFromPrompt(optionToSaveLogin: String) {
|
||||
mDevice.waitForObjects(
|
||||
mDevice.findObject(
|
||||
UiSelector().resourceId("$packageName:id/feature_prompt_login_fragment")
|
||||
)
|
||||
UiSelector().resourceId("$packageName:id/feature_prompt_login_fragment"),
|
||||
),
|
||||
)
|
||||
mDevice.findObject(text(optionToSaveLogin)).click()
|
||||
}
|
||||
|
@ -497,14 +502,14 @@ class BrowserRobot {
|
|||
val passwordField = mDevice.findObject(
|
||||
UiSelector()
|
||||
.resourceId("password")
|
||||
.className(EditText::class.java)
|
||||
.className(EditText::class.java),
|
||||
)
|
||||
try {
|
||||
passwordField.waitForExists(waitingTime)
|
||||
mDevice.findObject(
|
||||
By
|
||||
.res("password")
|
||||
.clazz(EditText::class.java)
|
||||
.clazz(EditText::class.java),
|
||||
).click()
|
||||
passwordField.clearTextField()
|
||||
passwordField.text = password
|
||||
|
@ -524,7 +529,7 @@ class BrowserRobot {
|
|||
mDevice.findObject(
|
||||
By
|
||||
.res("password")
|
||||
.clazz(EditText::class.java)
|
||||
.clazz(EditText::class.java),
|
||||
).click()
|
||||
passwordField.clearTextField()
|
||||
passwordField.text = password
|
||||
|
@ -592,7 +597,7 @@ class BrowserRobot {
|
|||
fun clickTabCrashedRestoreButton() {
|
||||
assertTrue(
|
||||
mDevice.findObject(UiSelector().resourceId("$packageName:id/restoreTabButton"))
|
||||
.waitForExists(waitingTime)
|
||||
.waitForExists(waitingTime),
|
||||
)
|
||||
|
||||
val tabCrashRestoreButton = mDevice.findObject(UiSelector().resourceIdMatches("$packageName:id/restoreTabButton"))
|
||||
|
@ -662,7 +667,7 @@ class BrowserRobot {
|
|||
mDevice.findObject(
|
||||
UiSelector()
|
||||
.textContains(userName)
|
||||
.resourceId("$packageName:id/username")
|
||||
.resourceId("$packageName:id/username"),
|
||||
)
|
||||
|
||||
loginSuggestion.click()
|
||||
|
@ -681,11 +686,11 @@ class BrowserRobot {
|
|||
fun verifySuggestedUserName(userName: String) {
|
||||
mDevice.findObject(
|
||||
UiSelector()
|
||||
.resourceId("$packageName:id/mozac_feature_login_multiselect_expand")
|
||||
.resourceId("$packageName:id/mozac_feature_login_multiselect_expand"),
|
||||
).waitForExists(waitingTime)
|
||||
|
||||
assertTrue(
|
||||
mDevice.findObject(UiSelector().textContains(userName)).waitForExists(waitingTime)
|
||||
mDevice.findObject(UiSelector().textContains(userName)).waitForExists(waitingTime),
|
||||
)
|
||||
}
|
||||
|
||||
|
@ -744,8 +749,8 @@ class BrowserRobot {
|
|||
assertTrue(
|
||||
mDevice.findObject(
|
||||
UiSelector()
|
||||
.resourceId("$packageName:id/feature_prompt_login_fragment")
|
||||
).waitForExists(waitingTime)
|
||||
.resourceId("$packageName:id/feature_prompt_login_fragment"),
|
||||
).waitForExists(waitingTime),
|
||||
)
|
||||
}
|
||||
|
||||
|
@ -754,8 +759,8 @@ class BrowserRobot {
|
|||
try {
|
||||
assertTrue(
|
||||
mDevice.findObject(
|
||||
UiSelector().textContains(state)
|
||||
).waitForExists(waitingTimeLong)
|
||||
UiSelector().textContains(state),
|
||||
).waitForExists(waitingTimeLong),
|
||||
)
|
||||
|
||||
break
|
||||
|
@ -784,9 +789,9 @@ class BrowserRobot {
|
|||
private fun threeDotButton() = onView(
|
||||
allOf(
|
||||
ViewMatchers.withContentDescription(
|
||||
"Menu"
|
||||
)
|
||||
)
|
||||
"Menu",
|
||||
),
|
||||
),
|
||||
)
|
||||
|
||||
fun openThreeDotMenu(interact: ThreeDotMenuMainRobot.() -> Unit): ThreeDotMenuMainRobot.Transition {
|
||||
|
@ -808,7 +813,7 @@ class BrowserRobot {
|
|||
|
||||
fun openTabDrawer(interact: TabDrawerRobot.() -> Unit): TabDrawerRobot.Transition {
|
||||
mDevice.findObject(
|
||||
UiSelector().descriptionContains("Tap to switch tabs.")
|
||||
UiSelector().descriptionContains("Tap to switch tabs."),
|
||||
).waitForExists(waitingTime)
|
||||
|
||||
tabsCounter().click()
|
||||
|
@ -836,7 +841,7 @@ class BrowserRobot {
|
|||
fun goToHomescreen(interact: HomeScreenRobot.() -> Unit): HomeScreenRobot.Transition {
|
||||
assertTrue(
|
||||
mDevice.findObject(UiSelector().description("Home screen"))
|
||||
.waitForExists(waitingTime)
|
||||
.waitForExists(waitingTime),
|
||||
)
|
||||
|
||||
onView(withContentDescription("Home screen"))
|
||||
|
@ -845,7 +850,7 @@ class BrowserRobot {
|
|||
|
||||
assertTrue(
|
||||
mDevice.findObject(UiSelector().resourceId("$packageName:id/homeLayout"))
|
||||
.waitForExists(waitingTime)
|
||||
.waitForExists(waitingTime),
|
||||
)
|
||||
|
||||
HomeScreenRobot().interact()
|
||||
|
@ -862,7 +867,7 @@ class BrowserRobot {
|
|||
fun clickTabCrashedCloseButton(interact: HomeScreenRobot.() -> Unit): HomeScreenRobot.Transition {
|
||||
assertTrue(
|
||||
mDevice.findObject(UiSelector().resourceId("$packageName:id/closeTabButton"))
|
||||
.waitForExists(waitingTime)
|
||||
.waitForExists(waitingTime),
|
||||
)
|
||||
|
||||
val tabCrashedCloseButton = mDevice.findObject(text("Close tab"))
|
||||
|
@ -887,7 +892,7 @@ class BrowserRobot {
|
|||
|
||||
assertTrue(
|
||||
"$title download link not found",
|
||||
downloadLink.waitForExists(waitingTime)
|
||||
downloadLink.waitForExists(waitingTime),
|
||||
)
|
||||
downloadLink.click()
|
||||
|
||||
|
@ -981,12 +986,12 @@ private fun mediaPlayerPlayButton() =
|
|||
mDevice.findObject(
|
||||
UiSelector()
|
||||
.className("android.widget.Button")
|
||||
.text("Play")
|
||||
.text("Play"),
|
||||
)
|
||||
|
||||
private var progressBar =
|
||||
mDevice.findObject(
|
||||
UiSelector().resourceId("$packageName:id/mozac_browser_toolbar_progress")
|
||||
UiSelector().resourceId("$packageName:id/mozac_browser_toolbar_progress"),
|
||||
)
|
||||
|
||||
private val suggestedLogins = mDevice.findObject(UiSelector().resourceId("$packageName:id/loginSelectBar"))
|
||||
|
@ -997,7 +1002,7 @@ private fun addressSuggestion(streetName: String) =
|
|||
mDevice.findObject(
|
||||
UiSelector()
|
||||
.resourceId("$packageName:id/address_name")
|
||||
.textContains(streetName)
|
||||
.textContains(streetName),
|
||||
)
|
||||
|
||||
private fun streetAddressTextBox(streetAddress: String = "") =
|
||||
|
@ -1006,7 +1011,7 @@ private fun streetAddressTextBox(streetAddress: String = "") =
|
|||
.resourceId("streetAddress")
|
||||
.textContains(streetAddress)
|
||||
.className("android.widget.EditText")
|
||||
.packageName("$packageName")
|
||||
.packageName("$packageName"),
|
||||
)
|
||||
|
||||
private fun creditCardNumberTextBox(creditCardNumber: String = "") =
|
||||
|
@ -1015,14 +1020,14 @@ private fun creditCardNumberTextBox(creditCardNumber: String = "") =
|
|||
.resourceId("cardNumber")
|
||||
.textContains(creditCardNumber)
|
||||
.className("android.widget.EditText")
|
||||
.packageName("$packageName")
|
||||
.packageName("$packageName"),
|
||||
)
|
||||
|
||||
private fun creditCardSuggestion(creditCardNumber: String) =
|
||||
mDevice.findObject(
|
||||
UiSelector()
|
||||
.resourceId("$packageName:id/credit_card_number")
|
||||
.textContains(creditCardNumber)
|
||||
.textContains(creditCardNumber),
|
||||
)
|
||||
|
||||
// Permissions test page elements & prompts
|
||||
|
@ -1044,7 +1049,7 @@ val userNameTextBox =
|
|||
UiSelector()
|
||||
.resourceId("username")
|
||||
.className("android.widget.EditText")
|
||||
.packageName("$packageName")
|
||||
.packageName("$packageName"),
|
||||
)
|
||||
|
||||
private val submitLoginButton =
|
||||
|
@ -1053,7 +1058,7 @@ private val submitLoginButton =
|
|||
.resourceId("submit")
|
||||
.textContains("Submit Query")
|
||||
.className("android.widget.Button")
|
||||
.packageName("$packageName")
|
||||
.packageName("$packageName"),
|
||||
)
|
||||
|
||||
val passwordTextBox =
|
||||
|
@ -1061,5 +1066,5 @@ val passwordTextBox =
|
|||
UiSelector()
|
||||
.resourceId("password")
|
||||
.className("android.widget.EditText")
|
||||
.packageName("$packageName")
|
||||
.packageName("$packageName"),
|
||||
)
|
||||
|
|
|
@ -34,15 +34,15 @@ class CollectionRobot {
|
|||
fun verifySelectCollectionScreen() {
|
||||
assertTrue(
|
||||
mDevice.findObject(UiSelector().text("Select collection"))
|
||||
.exists()
|
||||
.exists(),
|
||||
)
|
||||
assertTrue(
|
||||
mDevice.findObject(UiSelector().resourceId("$packageName:id/collections_list"))
|
||||
.exists()
|
||||
.exists(),
|
||||
)
|
||||
assertTrue(
|
||||
mDevice.findObject(UiSelector().text("Add new collection"))
|
||||
.exists()
|
||||
.exists(),
|
||||
)
|
||||
}
|
||||
|
||||
|
@ -50,7 +50,7 @@ class CollectionRobot {
|
|||
|
||||
fun verifyCollectionNameTextField() {
|
||||
assertTrue(
|
||||
mainMenuEditCollectionNameField().waitForExists(waitingTime)
|
||||
mainMenuEditCollectionNameField().waitForExists(waitingTime),
|
||||
)
|
||||
}
|
||||
|
||||
|
@ -79,12 +79,13 @@ class CollectionRobot {
|
|||
if (visible) {
|
||||
scrollToElementByText(title)
|
||||
assertTrue(
|
||||
collectionListItem(title).waitForExists(waitingTime)
|
||||
collectionListItem(title).waitForExists(waitingTime),
|
||||
)
|
||||
} else
|
||||
} else {
|
||||
assertTrue(
|
||||
collectionListItem(title).waitUntilGone(waitingTime)
|
||||
collectionListItem(title).waitUntilGone(waitingTime),
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
fun verifyCollectionTabUrl(visible: Boolean, url: String) {
|
||||
|
@ -152,11 +153,11 @@ class CollectionRobot {
|
|||
fun verifyCollectionItemRemoveButtonIsVisible(title: String, visible: Boolean) {
|
||||
if (visible) {
|
||||
assertTrue(
|
||||
removeTabFromCollectionButton(title).exists()
|
||||
removeTabFromCollectionButton(title).exists(),
|
||||
)
|
||||
} else {
|
||||
assertFalse(
|
||||
removeTabFromCollectionButton(title).exists()
|
||||
removeTabFromCollectionButton(title).exists(),
|
||||
)
|
||||
}
|
||||
}
|
||||
|
@ -183,13 +184,13 @@ class CollectionRobot {
|
|||
|
||||
fun swipeToBottom() =
|
||||
UiScrollable(
|
||||
UiSelector().resourceId("$packageName:id/sessionControlRecyclerView")
|
||||
UiSelector().resourceId("$packageName:id/sessionControlRecyclerView"),
|
||||
).scrollToEnd(3)
|
||||
|
||||
class Transition {
|
||||
fun collapseCollection(
|
||||
title: String,
|
||||
interact: HomeScreenRobot.() -> Unit
|
||||
interact: HomeScreenRobot.() -> Unit,
|
||||
): HomeScreenRobot.Transition {
|
||||
try {
|
||||
collectionTitle(title).waitForExists(waitingTime)
|
||||
|
@ -206,7 +207,7 @@ class CollectionRobot {
|
|||
// names a collection saved from the 3dot menu
|
||||
fun typeCollectionNameAndSave(
|
||||
name: String,
|
||||
interact: BrowserRobot.() -> Unit
|
||||
interact: BrowserRobot.() -> Unit,
|
||||
): BrowserRobot.Transition {
|
||||
mainMenuEditCollectionNameField().waitForExists(waitingTime)
|
||||
mainMenuEditCollectionNameField().text = name
|
||||
|
@ -221,7 +222,7 @@ class CollectionRobot {
|
|||
|
||||
fun selectExistingCollection(
|
||||
title: String,
|
||||
interact: BrowserRobot.() -> Unit
|
||||
interact: BrowserRobot.() -> Unit,
|
||||
): BrowserRobot.Transition {
|
||||
collectionTitle(title).waitForExists(waitingTime)
|
||||
collectionTitle(title).click()
|
||||
|
@ -248,7 +249,7 @@ fun collectionRobot(interact: CollectionRobot.() -> Unit): CollectionRobot.Trans
|
|||
private fun collectionTitle(title: String) =
|
||||
mDevice.findObject(
|
||||
UiSelector()
|
||||
.text(title)
|
||||
.text(title),
|
||||
)
|
||||
|
||||
private fun collectionThreeDotButton(rule: ComposeTestRule) =
|
||||
|
@ -258,27 +259,27 @@ private fun collectionListItem(title: String) = mDevice.findObject(UiSelector().
|
|||
|
||||
private fun shareCollectionButton() =
|
||||
mDevice.findObject(
|
||||
UiSelector().description("Share")
|
||||
UiSelector().description("Share"),
|
||||
)
|
||||
|
||||
private fun removeTabFromCollectionButton(title: String) =
|
||||
mDevice.findObject(
|
||||
UiSelector().text(title)
|
||||
UiSelector().text(title),
|
||||
).getFromParent(
|
||||
UiSelector()
|
||||
.description("Remove tab from collection")
|
||||
.description("Remove tab from collection"),
|
||||
)
|
||||
|
||||
// collection name text field, opened from tab drawer
|
||||
private fun collectionNameTextField() =
|
||||
mDevice.findObject(
|
||||
UiSelector().resourceId("$packageName:id/collection_name")
|
||||
UiSelector().resourceId("$packageName:id/collection_name"),
|
||||
)
|
||||
|
||||
// collection name text field, when saving from the main menu option
|
||||
private fun mainMenuEditCollectionNameField() =
|
||||
mDevice.findObject(
|
||||
UiSelector().resourceId("$packageName:id/name_collection_edittext")
|
||||
UiSelector().resourceId("$packageName:id/name_collection_edittext"),
|
||||
)
|
||||
|
||||
private fun addNewCollectionButton() =
|
||||
|
@ -286,5 +287,5 @@ private fun addNewCollectionButton() =
|
|||
|
||||
private fun backButton() =
|
||||
mDevice.findObject(
|
||||
UiSelector().resourceId("$packageName:id/back_button")
|
||||
UiSelector().resourceId("$packageName:id/back_button"),
|
||||
)
|
||||
|
|
|
@ -38,7 +38,7 @@ class CustomTabRobot {
|
|||
fun verifyPoweredByTextIsDisplayed() {
|
||||
assertTrue(
|
||||
mDevice.findObject(UiSelector().textContains("POWERED BY $appName"))
|
||||
.waitForExists(waitingTime)
|
||||
.waitForExists(waitingTime),
|
||||
)
|
||||
}
|
||||
|
||||
|
@ -67,19 +67,19 @@ class CustomTabRobot {
|
|||
mDevice.findObject(
|
||||
UiSelector()
|
||||
.resourceId("$packageName:id/mozac_browser_toolbar_title_view")
|
||||
.textContains(title)
|
||||
.textContains(title),
|
||||
)
|
||||
.getFromParent(
|
||||
UiSelector().resourceId("$packageName:id/mozac_browser_toolbar_origin_view")
|
||||
)
|
||||
UiSelector().resourceId("$packageName:id/mozac_browser_toolbar_origin_view"),
|
||||
),
|
||||
)
|
||||
|
||||
assertTrue(
|
||||
mDevice.findObject(
|
||||
UiSelector()
|
||||
.resourceId("$packageName:id/mozac_browser_toolbar_title_view")
|
||||
.textContains(title)
|
||||
).waitForExists(waitingTime)
|
||||
.textContains(title),
|
||||
).waitForExists(waitingTime),
|
||||
)
|
||||
}
|
||||
|
||||
|
@ -178,7 +178,7 @@ private fun customTabToolbar() = mDevice.findObject(By.res("$packageName:id/tool
|
|||
|
||||
private val progressBar =
|
||||
mDevice.findObject(
|
||||
UiSelector().resourceId("$packageName:id/mozac_browser_toolbar_progress")
|
||||
UiSelector().resourceId("$packageName:id/mozac_browser_toolbar_progress"),
|
||||
)
|
||||
|
||||
private val submitLoginButton =
|
||||
|
@ -187,5 +187,5 @@ private val submitLoginButton =
|
|||
.resourceId("submit")
|
||||
.textContains("Submit Query")
|
||||
.className("android.widget.Button")
|
||||
.packageName("$packageName")
|
||||
.packageName("$packageName"),
|
||||
)
|
||||
|
|
|
@ -49,7 +49,7 @@ class DownloadRobot {
|
|||
assertTrue(
|
||||
"$fileName not found in Downloads list",
|
||||
mDevice.findObject(UiSelector().text(fileName))
|
||||
.waitForExists(waitingTime)
|
||||
.waitForExists(waitingTime),
|
||||
)
|
||||
}
|
||||
|
||||
|
@ -65,7 +65,7 @@ class DownloadRobot {
|
|||
assertTrue(
|
||||
"Downloads list either empty or not displayed",
|
||||
mDevice.findObject(UiSelector().resourceId("$packageName:id/download_list"))
|
||||
.waitForExists(waitingTime)
|
||||
.waitForExists(waitingTime),
|
||||
)
|
||||
|
||||
fun openDownloadedFile(fileName: String) {
|
||||
|
@ -96,8 +96,8 @@ class DownloadRobot {
|
|||
Intents.intended(
|
||||
CoreMatchers.allOf(
|
||||
IntentMatchers.hasAction(Intent.ACTION_VIEW),
|
||||
IntentMatchers.hasType(type)
|
||||
)
|
||||
IntentMatchers.hasType(type),
|
||||
),
|
||||
)
|
||||
|
||||
BrowserRobot().interact()
|
||||
|
@ -107,7 +107,7 @@ class DownloadRobot {
|
|||
fun clickAllowPermission(interact: DownloadRobot.() -> Unit): Transition {
|
||||
mDevice.waitNotNull(
|
||||
Until.findObject(By.res(TestHelper.getPermissionAllowID() + ":id/permission_allow_button")),
|
||||
waitingTime
|
||||
waitingTime,
|
||||
)
|
||||
|
||||
val allowPermissionButton = mDevice.findObject(By.res(TestHelper.getPermissionAllowID() + ":id/permission_allow_button"))
|
||||
|
@ -138,12 +138,12 @@ private fun assertDownloadPrompt(fileName: String) {
|
|||
assertTrue(
|
||||
"Download prompt button not visible",
|
||||
mDevice.findObject(UiSelector().resourceId("$packageName:id/download_button"))
|
||||
.waitForExists(waitingTimeLong)
|
||||
.waitForExists(waitingTimeLong),
|
||||
)
|
||||
assertTrue(
|
||||
"$fileName title doesn't match",
|
||||
mDevice.findObject(UiSelector().text(fileName))
|
||||
.waitForExists(waitingTimeLong)
|
||||
.waitForExists(waitingTimeLong),
|
||||
)
|
||||
|
||||
break
|
||||
|
@ -161,17 +161,17 @@ private fun assertDownloadNotificationPopup() {
|
|||
assertTrue(
|
||||
"Download notification Open button not found",
|
||||
mDevice.findObject(UiSelector().text("Open"))
|
||||
.waitForExists(waitingTime)
|
||||
.waitForExists(waitingTime),
|
||||
)
|
||||
assertTrue(
|
||||
"Download completed notification text doesn't match",
|
||||
mDevice.findObject(UiSelector().textContains("Download completed"))
|
||||
.waitForExists(waitingTime)
|
||||
.waitForExists(waitingTime),
|
||||
)
|
||||
assertTrue(
|
||||
"Downloaded file name not visible",
|
||||
mDevice.findObject(UiSelector().resourceId("$packageName:id/download_dialog_filename"))
|
||||
.waitForExists(waitingTime)
|
||||
.waitForExists(waitingTime),
|
||||
)
|
||||
}
|
||||
|
||||
|
@ -193,5 +193,5 @@ private fun assertDownloadedFileIcon() =
|
|||
assertTrue(
|
||||
"Downloaded file icon not found",
|
||||
mDevice.findObject(UiSelector().resourceId("$packageName:id/favicon"))
|
||||
.exists()
|
||||
.exists(),
|
||||
)
|
||||
|
|
|
@ -59,10 +59,10 @@ class EnhancedTrackingProtectionRobot {
|
|||
containsString(
|
||||
"social-track-digest256.dummytracker.org\n" +
|
||||
"ads-track-digest256.dummytracker.org\n" +
|
||||
"analytics-track-digest256.dummytracker.org"
|
||||
)
|
||||
)
|
||||
)
|
||||
"analytics-track-digest256.dummytracker.org",
|
||||
),
|
||||
),
|
||||
),
|
||||
)
|
||||
}
|
||||
|
||||
|
@ -130,9 +130,9 @@ private fun assertEnhancedTrackingProtectionSheetStatus(status: String, state: B
|
|||
onView(ViewMatchers.withResourceName("switch_widget")).check(
|
||||
matches(
|
||||
isChecked(
|
||||
state
|
||||
)
|
||||
)
|
||||
state,
|
||||
),
|
||||
),
|
||||
)
|
||||
}
|
||||
|
||||
|
@ -149,8 +149,8 @@ private fun enhancedTrackingProtectionSwitch() =
|
|||
private fun trackingProtectionSettingsButton() =
|
||||
onView(withId(R.id.protection_settings)).inRoot(RootMatchers.isDialog()).check(
|
||||
matches(
|
||||
isDisplayed()
|
||||
)
|
||||
isDisplayed(),
|
||||
),
|
||||
)
|
||||
|
||||
private fun openEnhancedTrackingProtectionDetails() =
|
||||
|
@ -180,7 +180,7 @@ private fun assertCryptominersBlocked() {
|
|||
private fun assertTrackingContentBlocked() {
|
||||
assertTrue(
|
||||
mDevice.findObject(UiSelector().resourceId("$packageName:id/tracking_content"))
|
||||
.waitForExists(waitingTime)
|
||||
.waitForExists(waitingTime),
|
||||
)
|
||||
}
|
||||
|
||||
|
@ -191,7 +191,7 @@ private fun assertSecuritySheetIsCompletelyDisplayed() {
|
|||
.waitForExists(waitingTime)
|
||||
assertTrue(
|
||||
mDevice.findObject(
|
||||
UiSelector().resourceId("$packageName:id/quick_action_sheet")
|
||||
).waitForExists(waitingTime)
|
||||
UiSelector().resourceId("$packageName:id/quick_action_sheet"),
|
||||
).waitForExists(waitingTime),
|
||||
)
|
||||
}
|
||||
|
|
|
@ -39,7 +39,7 @@ class HistoryRobot {
|
|||
|
||||
fun verifyEmptyHistoryView() {
|
||||
mDevice.findObject(
|
||||
UiSelector().text("No history here")
|
||||
UiSelector().text("No history here"),
|
||||
).waitForExists(waitingTime)
|
||||
|
||||
assertEmptyHistoryView()
|
||||
|
@ -50,9 +50,9 @@ class HistoryRobot {
|
|||
fun verifyVisitedTimeTitle() {
|
||||
mDevice.waitNotNull(
|
||||
Until.findObject(
|
||||
By.text("Today")
|
||||
By.text("Today"),
|
||||
),
|
||||
waitingTime
|
||||
waitingTime,
|
||||
)
|
||||
assertVisitedTimeTitle()
|
||||
}
|
||||
|
@ -88,7 +88,7 @@ class HistoryRobot {
|
|||
mDevice
|
||||
.findObject(
|
||||
UiSelector()
|
||||
.textContains(getStringResource(R.string.delete_browsing_data_prompt_cancel))
|
||||
.textContains(getStringResource(R.string.delete_browsing_data_prompt_cancel)),
|
||||
).click()
|
||||
|
||||
fun verifyDeleteSnackbarText(text: String) = assertSnackBarText(text)
|
||||
|
@ -127,7 +127,7 @@ private fun snackBarText() = onView(withId(R.id.snackbar_text))
|
|||
|
||||
private fun assertHistoryMenuView() {
|
||||
onView(
|
||||
allOf(withText("History"), withParent(withId(R.id.navigationToolbar)))
|
||||
allOf(withText("History"), withParent(withId(R.id.navigationToolbar))),
|
||||
)
|
||||
.check(matches(withEffectiveVisibility(ViewMatchers.Visibility.VISIBLE)))
|
||||
}
|
||||
|
@ -136,8 +136,8 @@ private fun assertEmptyHistoryView() =
|
|||
onView(
|
||||
allOf(
|
||||
withId(R.id.history_empty_view),
|
||||
withEffectiveVisibility(ViewMatchers.Visibility.VISIBLE)
|
||||
)
|
||||
withEffectiveVisibility(ViewMatchers.Visibility.VISIBLE),
|
||||
),
|
||||
)
|
||||
.check(matches(withText("No history here")))
|
||||
|
||||
|
@ -183,7 +183,7 @@ private fun deleteHistoryPromptTitle() =
|
|||
.findObject(
|
||||
UiSelector()
|
||||
.textContains(getStringResource(R.string.delete_history_prompt_title))
|
||||
.resourceId("$packageName:id/title")
|
||||
.resourceId("$packageName:id/title"),
|
||||
)
|
||||
|
||||
private fun deleteHistoryPromptSummary() =
|
||||
|
@ -191,7 +191,7 @@ private fun deleteHistoryPromptSummary() =
|
|||
.findObject(
|
||||
UiSelector()
|
||||
.textContains(getStringResource(R.string.delete_history_prompt_body))
|
||||
.resourceId("$packageName:id/body")
|
||||
.resourceId("$packageName:id/body"),
|
||||
)
|
||||
|
||||
private fun deleteHistoryEverythingOption() =
|
||||
|
@ -199,5 +199,5 @@ private fun deleteHistoryEverythingOption() =
|
|||
.findObject(
|
||||
UiSelector()
|
||||
.textContains(getStringResource(R.string.delete_history_prompt_button_everything))
|
||||
.resourceId("$packageName:id/everything_button")
|
||||
.resourceId("$packageName:id/everything_button"),
|
||||
)
|
||||
|
|
|
@ -92,14 +92,14 @@ class HomeScreenRobot {
|
|||
if (isEnabled) {
|
||||
assertTrue(
|
||||
mDevice.findObject(
|
||||
UiSelector().resourceId("$packageName:id/wallpaperImageView")
|
||||
).waitForExists(waitingTimeShort)
|
||||
UiSelector().resourceId("$packageName:id/wallpaperImageView"),
|
||||
).waitForExists(waitingTimeShort),
|
||||
)
|
||||
} else {
|
||||
assertFalse(
|
||||
mDevice.findObject(
|
||||
UiSelector().resourceId("$packageName:id/wallpaperImageView")
|
||||
).waitForExists(waitingTimeShort)
|
||||
UiSelector().resourceId("$packageName:id/wallpaperImageView"),
|
||||
).waitForExists(waitingTimeShort),
|
||||
)
|
||||
}
|
||||
|
||||
|
@ -159,13 +159,13 @@ class HomeScreenRobot {
|
|||
assertTrue(
|
||||
mDevice.findObject(UiSelector().text(searchTerm))
|
||||
.getFromParent(UiSelector().text("$groupSize sites"))
|
||||
.waitForExists(waitingTimeShort)
|
||||
.waitForExists(waitingTimeShort),
|
||||
)
|
||||
} else {
|
||||
assertFalse(
|
||||
mDevice.findObject(UiSelector().text(searchTerm))
|
||||
.getFromParent(UiSelector().text("$groupSize sites"))
|
||||
.waitForExists(waitingTimeShort)
|
||||
.waitForExists(waitingTimeShort),
|
||||
)
|
||||
}
|
||||
}
|
||||
|
@ -176,12 +176,12 @@ class HomeScreenRobot {
|
|||
assertTrue(
|
||||
mDevice.findObject(UiSelector().text("""Your search for "$searchTerm""""))
|
||||
.getFromParent(UiSelector().textContains("$groupSize sites"))
|
||||
.waitForExists(waitingTimeShort)
|
||||
.waitForExists(waitingTimeShort),
|
||||
)
|
||||
} else {
|
||||
assertFalse(
|
||||
mDevice.findObject(UiSelector().text("""Your search for "$searchTerm""""))
|
||||
.waitForExists(waitingTimeShort)
|
||||
.waitForExists(waitingTimeShort),
|
||||
)
|
||||
}
|
||||
}
|
||||
|
@ -215,8 +215,8 @@ class HomeScreenRobot {
|
|||
onView(
|
||||
allOf(
|
||||
withId(R.id.snackbar_btn),
|
||||
withText(expectedText)
|
||||
)
|
||||
withText(expectedText),
|
||||
),
|
||||
).click()
|
||||
}
|
||||
|
||||
|
@ -229,9 +229,9 @@ class HomeScreenRobot {
|
|||
mDevice.findObject(
|
||||
UiSelector()
|
||||
.textContains(
|
||||
getStringResource(R.string.pocket_stories_header_1)
|
||||
)
|
||||
).waitForExists(waitingTime)
|
||||
getStringResource(R.string.pocket_stories_header_1),
|
||||
),
|
||||
).waitForExists(waitingTime),
|
||||
)
|
||||
} else {
|
||||
homeScreenList().scrollToEnd(LISTS_MAXSWIPES)
|
||||
|
@ -239,9 +239,9 @@ class HomeScreenRobot {
|
|||
mDevice.findObject(
|
||||
UiSelector()
|
||||
.textContains(
|
||||
getStringResource(R.string.pocket_stories_header_1)
|
||||
)
|
||||
).waitForExists(waitingTime)
|
||||
getStringResource(R.string.pocket_stories_header_1),
|
||||
),
|
||||
).waitForExists(waitingTime),
|
||||
)
|
||||
}
|
||||
}
|
||||
|
@ -253,9 +253,9 @@ class HomeScreenRobot {
|
|||
mDevice.findObject(
|
||||
UiSelector()
|
||||
.textContains(
|
||||
getStringResource(R.string.pocket_stories_categories_header)
|
||||
)
|
||||
).waitForExists(waitingTime)
|
||||
getStringResource(R.string.pocket_stories_categories_header),
|
||||
),
|
||||
).waitForExists(waitingTime),
|
||||
)
|
||||
} else {
|
||||
homeScreenList().scrollToEnd(LISTS_MAXSWIPES)
|
||||
|
@ -263,9 +263,9 @@ class HomeScreenRobot {
|
|||
mDevice.findObject(
|
||||
UiSelector()
|
||||
.textContains(
|
||||
getStringResource(R.string.pocket_stories_categories_header)
|
||||
)
|
||||
).waitForExists(waitingTime)
|
||||
getStringResource(R.string.pocket_stories_categories_header),
|
||||
),
|
||||
).waitForExists(waitingTime),
|
||||
)
|
||||
}
|
||||
}
|
||||
|
@ -276,16 +276,16 @@ class HomeScreenRobot {
|
|||
assertTrue(
|
||||
mDevice.findObject(
|
||||
UiSelector()
|
||||
.textContains("Customize homepage")
|
||||
).waitForExists(waitingTime)
|
||||
.textContains("Customize homepage"),
|
||||
).waitForExists(waitingTime),
|
||||
)
|
||||
} else {
|
||||
homeScreenList().scrollToEnd(LISTS_MAXSWIPES)
|
||||
assertFalse(
|
||||
mDevice.findObject(
|
||||
UiSelector()
|
||||
.textContains("Customize homepage")
|
||||
).waitForExists(waitingTime)
|
||||
.textContains("Customize homepage"),
|
||||
).waitForExists(waitingTime),
|
||||
)
|
||||
}
|
||||
}
|
||||
|
@ -294,7 +294,7 @@ class HomeScreenRobot {
|
|||
|
||||
fun openTabDrawer(interact: TabDrawerRobot.() -> Unit): TabDrawerRobot.Transition {
|
||||
mDevice.findObject(
|
||||
UiSelector().descriptionContains("open tab. Tap to switch tabs.")
|
||||
UiSelector().descriptionContains("open tab. Tap to switch tabs."),
|
||||
).waitForExists(waitingTime)
|
||||
|
||||
tabsCounter().click()
|
||||
|
@ -309,7 +309,7 @@ class HomeScreenRobot {
|
|||
try {
|
||||
mDevice.waitNotNull(
|
||||
Until.findObject(By.res("$packageName:id/menuButton")),
|
||||
waitingTime
|
||||
waitingTime,
|
||||
)
|
||||
} catch (e: AssertionError) {
|
||||
mDevice.pressBack()
|
||||
|
@ -343,7 +343,7 @@ class HomeScreenRobot {
|
|||
fun togglePrivateBrowsingMode() {
|
||||
mDevice.findObject(UiSelector().resourceId("$packageName:id/privateBrowsingButton"))
|
||||
.waitForExists(
|
||||
waitingTime
|
||||
waitingTime,
|
||||
)
|
||||
privateBrowsingButton()
|
||||
.perform(click())
|
||||
|
@ -354,7 +354,7 @@ class HomeScreenRobot {
|
|||
for (i in 1..5) {
|
||||
mDevice.findObject(UiSelector().resourceId("$packageName:id/privateBrowsingButton"))
|
||||
.waitForExists(
|
||||
waitingTime
|
||||
waitingTime,
|
||||
)
|
||||
|
||||
privateBrowsingButton()
|
||||
|
@ -380,13 +380,13 @@ class HomeScreenRobot {
|
|||
|
||||
fun openContextMenuOnTopSitesWithTitle(
|
||||
title: String,
|
||||
interact: HomeScreenRobot.() -> Unit
|
||||
interact: HomeScreenRobot.() -> Unit,
|
||||
): Transition {
|
||||
onView(withId(R.id.top_sites_list)).perform(
|
||||
actionOnItem<RecyclerView.ViewHolder>(
|
||||
hasDescendant(withText(title)),
|
||||
ViewActions.longClick()
|
||||
)
|
||||
ViewActions.longClick(),
|
||||
),
|
||||
)
|
||||
|
||||
HomeScreenRobot().interact()
|
||||
|
@ -395,10 +395,10 @@ class HomeScreenRobot {
|
|||
|
||||
fun openTopSiteTabWithTitle(
|
||||
title: String,
|
||||
interact: BrowserRobot.() -> Unit
|
||||
interact: BrowserRobot.() -> Unit,
|
||||
): BrowserRobot.Transition {
|
||||
onView(withId(R.id.top_sites_list)).perform(
|
||||
actionOnItem<RecyclerView.ViewHolder>(hasDescendant(withText(title)), click())
|
||||
actionOnItem<RecyclerView.ViewHolder>(hasDescendant(withText(title)), click()),
|
||||
)
|
||||
|
||||
BrowserRobot().interact()
|
||||
|
@ -428,7 +428,7 @@ class HomeScreenRobot {
|
|||
|
||||
fun deleteTopSiteFromHistory(interact: HomeScreenRobot.() -> Unit): Transition {
|
||||
mDevice.findObject(
|
||||
UiSelector().resourceId("$packageName:id/simple_text")
|
||||
UiSelector().resourceId("$packageName:id/simple_text"),
|
||||
).waitForExists(waitingTime)
|
||||
deleteFromHistory.click()
|
||||
|
||||
|
@ -449,8 +449,8 @@ class HomeScreenRobot {
|
|||
mDevice.findObject(
|
||||
UiSelector()
|
||||
.textContains(
|
||||
getStringResource(R.string.private_browsing_common_myths)
|
||||
)
|
||||
getStringResource(R.string.private_browsing_common_myths),
|
||||
),
|
||||
).also { it.click() }
|
||||
|
||||
BrowserRobot().interact()
|
||||
|
@ -490,8 +490,8 @@ class HomeScreenRobot {
|
|||
mDevice.findObject(
|
||||
UiSelector()
|
||||
.textContains(
|
||||
"Customize homepage"
|
||||
)
|
||||
"Customize homepage",
|
||||
),
|
||||
).clickAndWaitForNewWindow(waitingTime)
|
||||
|
||||
SettingsSubMenuHomepageRobot().interact()
|
||||
|
@ -509,7 +509,7 @@ private fun homeScreenList() =
|
|||
UiScrollable(
|
||||
UiSelector()
|
||||
.resourceId("$packageName:id/sessionControlRecyclerView")
|
||||
.scrollable(true)
|
||||
.scrollable(true),
|
||||
).setAsVerticalList()
|
||||
|
||||
private fun assertKeyboardVisibility(isExpectedToBeVisible: Boolean) =
|
||||
|
@ -517,7 +517,7 @@ private fun assertKeyboardVisibility(isExpectedToBeVisible: Boolean) =
|
|||
isExpectedToBeVisible,
|
||||
mDevice
|
||||
.executeShellCommand("dumpsys input_method | grep mInputShown")
|
||||
.contains("mInputShown=true")
|
||||
.contains("mInputShown=true"),
|
||||
)
|
||||
|
||||
private fun navigationToolbar() = mDevice.findObject(UiSelector().resourceId("$packageName:id/toolbar"))
|
||||
|
@ -561,9 +561,9 @@ private fun assertNoCollectionsText() =
|
|||
withText(
|
||||
containsString(
|
||||
"Collect the things that matter to you.\n" +
|
||||
"Group together similar searches, sites, and tabs for quick access later."
|
||||
)
|
||||
)
|
||||
"Group together similar searches, sites, and tabs for quick access later.",
|
||||
),
|
||||
),
|
||||
).check(matches(isDisplayed()))
|
||||
|
||||
private fun assertHomeComponent() =
|
||||
|
@ -593,9 +593,9 @@ private fun assertWelcomeHeader() =
|
|||
assertTrue(
|
||||
mDevice.findObject(
|
||||
UiSelector().textContains(
|
||||
getStringResource(R.string.onboarding_header_2)
|
||||
)
|
||||
).waitForExists(waitingTime)
|
||||
getStringResource(R.string.onboarding_header_2),
|
||||
),
|
||||
).waitForExists(waitingTime),
|
||||
)
|
||||
|
||||
private fun assertStartSyncHeader() {
|
||||
|
@ -664,9 +664,9 @@ private fun assertAlwaysPrivacyText() {
|
|||
onView(
|
||||
allOf(
|
||||
withText(
|
||||
"Featuring Total Cookie Protection to stop trackers from using cookies to stalk you across sites."
|
||||
)
|
||||
)
|
||||
"Featuring Total Cookie Protection to stop trackers from using cookies to stalk you across sites.",
|
||||
),
|
||||
),
|
||||
)
|
||||
.check(matches(withEffectiveVisibility(Visibility.VISIBLE)))
|
||||
}
|
||||
|
@ -682,9 +682,9 @@ private fun assertYourPrivacyText() {
|
|||
onView(
|
||||
allOf(
|
||||
withText(
|
||||
"Firefox gives you control over what you share online and what you share with us."
|
||||
)
|
||||
)
|
||||
"Firefox gives you control over what you share online and what you share with us.",
|
||||
),
|
||||
),
|
||||
)
|
||||
.check(matches(withEffectiveVisibility(Visibility.VISIBLE)))
|
||||
}
|
||||
|
@ -723,9 +723,9 @@ private fun assertPrivateSessionMessage() =
|
|||
mDevice.findObject(
|
||||
UiSelector()
|
||||
.textContains(
|
||||
getStringResource(R.string.private_browsing_common_myths)
|
||||
)
|
||||
).waitForExists(waitingTime)
|
||||
getStringResource(R.string.private_browsing_common_myths),
|
||||
),
|
||||
).waitForExists(waitingTime),
|
||||
)
|
||||
|
||||
private fun collectionTitle(title: String, rule: ComposeTestRule) =
|
||||
|
@ -739,7 +739,7 @@ private fun assertExistingTopSitesTabs(title: String) {
|
|||
mDevice.findObject(
|
||||
UiSelector()
|
||||
.resourceId("$packageName:id/top_site_title")
|
||||
.textContains(title)
|
||||
.textContains(title),
|
||||
).waitForExists(waitingTime)
|
||||
|
||||
onView(allOf(withId(R.id.top_sites_list)))
|
||||
|
@ -751,14 +751,14 @@ private fun assertSponsoredTopSiteIsDisplayed(position: Int) {
|
|||
mDevice.findObject(
|
||||
UiSelector()
|
||||
.resourceId("$packageName:id/top_site_subtitle")
|
||||
.textContains(getStringResource(R.string.top_sites_sponsored_label))
|
||||
.textContains(getStringResource(R.string.top_sites_sponsored_label)),
|
||||
).waitForExists(waitingTime)
|
||||
|
||||
onView(
|
||||
allOf(
|
||||
withText(R.string.top_sites_sponsored_label),
|
||||
withParent(withParentIndex(position - 1))
|
||||
)
|
||||
withParent(withParentIndex(position - 1)),
|
||||
),
|
||||
).check(matches(withEffectiveVisibility(Visibility.VISIBLE)))
|
||||
}
|
||||
|
||||
|
@ -775,19 +775,19 @@ private fun assertSponsoredTopSitesNotDisplayed() {
|
|||
mDevice.findObject(
|
||||
UiSelector()
|
||||
.resourceId("$packageName:id/top_site_subtitle")
|
||||
.textContains(getStringResource(R.string.top_sites_sponsored_label))
|
||||
).waitForExists(waitingTime)
|
||||
.textContains(getStringResource(R.string.top_sites_sponsored_label)),
|
||||
).waitForExists(waitingTime),
|
||||
)
|
||||
}
|
||||
|
||||
private fun assertTopSiteContextMenuItems() {
|
||||
mDevice.waitNotNull(
|
||||
findObject(By.text("Open in private tab")),
|
||||
waitingTime
|
||||
waitingTime,
|
||||
)
|
||||
mDevice.waitNotNull(
|
||||
findObject(By.text("Remove")),
|
||||
waitingTime
|
||||
waitingTime,
|
||||
)
|
||||
}
|
||||
|
||||
|
@ -826,12 +826,12 @@ val deleteFromHistory =
|
|||
onView(
|
||||
allOf(
|
||||
withId(R.id.simple_text),
|
||||
withText(R.string.delete_from_history)
|
||||
)
|
||||
withText(R.string.delete_from_history),
|
||||
),
|
||||
).inRoot(RootMatchers.isPlatformPopup())
|
||||
|
||||
private val recentlyVisitedList =
|
||||
UiScrollable(
|
||||
UiSelector()
|
||||
.className("android.widget.HorizontalScrollView")
|
||||
.className("android.widget.HorizontalScrollView"),
|
||||
).setAsHorizontalList()
|
||||
|
|
|
@ -58,9 +58,9 @@ class LibrarySubMenusMultipleSelectionToolbarRobot {
|
|||
|
||||
mDevice.waitNotNull(
|
||||
Until.findObject(
|
||||
By.text("ALL ACTIONS")
|
||||
By.text("ALL ACTIONS"),
|
||||
),
|
||||
waitingTime
|
||||
waitingTime,
|
||||
)
|
||||
}
|
||||
|
||||
|
@ -69,9 +69,9 @@ class LibrarySubMenusMultipleSelectionToolbarRobot {
|
|||
|
||||
mDevice.waitNotNull(
|
||||
Until.findObject(
|
||||
By.text("ALL ACTIONS")
|
||||
By.text("ALL ACTIONS"),
|
||||
),
|
||||
waitingTime
|
||||
waitingTime,
|
||||
)
|
||||
}
|
||||
|
||||
|
@ -81,7 +81,6 @@ class LibrarySubMenusMultipleSelectionToolbarRobot {
|
|||
|
||||
class Transition {
|
||||
fun closeShareDialogReturnToPage(interact: BrowserRobot.() -> Unit): BrowserRobot.Transition {
|
||||
|
||||
BrowserRobot().interact()
|
||||
return BrowserRobot.Transition()
|
||||
}
|
||||
|
@ -104,7 +103,7 @@ class LibrarySubMenusMultipleSelectionToolbarRobot {
|
|||
openInNewTabButton().click()
|
||||
mDevice.waitNotNull(
|
||||
Until.findObject(By.res("$packageName:id/tab_layout")),
|
||||
waitingTime
|
||||
waitingTime,
|
||||
)
|
||||
|
||||
TabDrawerRobot().interact()
|
||||
|
@ -115,7 +114,7 @@ class LibrarySubMenusMultipleSelectionToolbarRobot {
|
|||
openInPrivateTabButton().click()
|
||||
mDevice.waitNotNull(
|
||||
Until.findObject(By.res("$packageName:id/tab_layout")),
|
||||
waitingTime
|
||||
waitingTime,
|
||||
)
|
||||
|
||||
TabDrawerRobot().interact()
|
||||
|
@ -125,7 +124,6 @@ class LibrarySubMenusMultipleSelectionToolbarRobot {
|
|||
}
|
||||
|
||||
fun multipleSelectionToolbar(interact: LibrarySubMenusMultipleSelectionToolbarRobot.() -> Unit): LibrarySubMenusMultipleSelectionToolbarRobot.Transition {
|
||||
|
||||
LibrarySubMenusMultipleSelectionToolbarRobot().interact()
|
||||
return LibrarySubMenusMultipleSelectionToolbarRobot.Transition()
|
||||
}
|
||||
|
@ -156,8 +154,8 @@ private fun assertMultiSelectionCheckmark(url: Uri) =
|
|||
// the match above is finding two checkmark views - one visible, one hidden, which is throwing off
|
||||
// the matcher. This 'isDisplayed' check is a hacky workaround for this, we're explicitly ignoring
|
||||
// the hidden one. Why are there two to begin with, though?
|
||||
isDisplayed()
|
||||
)
|
||||
isDisplayed(),
|
||||
),
|
||||
)
|
||||
.check(matches(isDisplayed()))
|
||||
|
||||
|
@ -177,7 +175,7 @@ private fun assertShareAppsLayout() = {
|
|||
val sendToDeviceTitle = mDevice.findObject(
|
||||
UiSelector()
|
||||
.instance(0)
|
||||
.className(TextView::class.java)
|
||||
.className(TextView::class.java),
|
||||
)
|
||||
sendToDeviceTitle.waitForExists(TestAssetHelper.waitingTime)
|
||||
}
|
||||
|
|
|
@ -59,7 +59,7 @@ class NavigationToolbarRobot {
|
|||
fun toggleReaderView() {
|
||||
mDevice.findObject(
|
||||
UiSelector()
|
||||
.resourceId("$packageName:id/mozac_browser_toolbar_page_actions")
|
||||
.resourceId("$packageName:id/mozac_browser_toolbar_page_actions"),
|
||||
)
|
||||
.waitForExists(waitingTime)
|
||||
|
||||
|
@ -76,8 +76,8 @@ class NavigationToolbarRobot {
|
|||
mDevice.findObject(
|
||||
UiSelector()
|
||||
.resourceId("$packageName:id/mozac_browser_toolbar_edit_url_view")
|
||||
.textContains("")
|
||||
).waitForExists(waitingTime)
|
||||
.textContains(""),
|
||||
).waitForExists(waitingTime),
|
||||
)
|
||||
|
||||
goBackButton()
|
||||
|
@ -88,7 +88,7 @@ class NavigationToolbarRobot {
|
|||
|
||||
fun enterURLAndEnterToBrowser(
|
||||
url: Uri,
|
||||
interact: BrowserRobot.() -> Unit
|
||||
interact: BrowserRobot.() -> Unit,
|
||||
): BrowserRobot.Transition {
|
||||
sessionLoadedIdlingResource = SessionLoadedIdlingResource()
|
||||
|
||||
|
@ -101,8 +101,8 @@ class NavigationToolbarRobot {
|
|||
onView(
|
||||
anyOf(
|
||||
withResourceName("browserLayout"),
|
||||
withResourceName("download_button")
|
||||
)
|
||||
withResourceName("download_button"),
|
||||
),
|
||||
).check(matches(withEffectiveVisibility(ViewMatchers.Visibility.VISIBLE)))
|
||||
}
|
||||
|
||||
|
@ -141,7 +141,7 @@ class NavigationToolbarRobot {
|
|||
tabTrayButton().click()
|
||||
mDevice.waitNotNull(
|
||||
Until.findObject(By.res("$packageName:id/tab_layout")),
|
||||
waitingTime
|
||||
waitingTime,
|
||||
)
|
||||
|
||||
TabDrawerRobot().interact()
|
||||
|
@ -151,13 +151,13 @@ class NavigationToolbarRobot {
|
|||
fun visitLinkFromClipboard(interact: BrowserRobot.() -> Unit): BrowserRobot.Transition {
|
||||
mDevice.waitNotNull(
|
||||
Until.findObject(By.res("org.mozilla.fenix.debug:id/mozac_browser_toolbar_clear_view")),
|
||||
waitingTime
|
||||
waitingTime,
|
||||
)
|
||||
clearAddressBar().click()
|
||||
|
||||
mDevice.waitNotNull(
|
||||
Until.findObject(By.res("org.mozilla.fenix.debug:id/clipboard_title")),
|
||||
waitingTime
|
||||
waitingTime,
|
||||
)
|
||||
|
||||
// On Android 12 or above we don't SHOW the URL unless the user requests to do so.
|
||||
|
@ -165,7 +165,7 @@ class NavigationToolbarRobot {
|
|||
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.S) {
|
||||
mDevice.waitNotNull(
|
||||
Until.findObject(By.res("org.mozilla.fenix.debug:id/clipboard_url")),
|
||||
waitingTime
|
||||
waitingTime,
|
||||
)
|
||||
}
|
||||
|
||||
|
@ -189,10 +189,10 @@ class NavigationToolbarRobot {
|
|||
.perform(
|
||||
RecyclerViewActions.actionOnItem<RecyclerView.ViewHolder>(
|
||||
hasDescendant(
|
||||
withText("Close tab")
|
||||
withText("Close tab"),
|
||||
),
|
||||
ViewActions.click()
|
||||
)
|
||||
ViewActions.click(),
|
||||
),
|
||||
)
|
||||
|
||||
NavigationToolbarRobot().interact()
|
||||
|
@ -206,10 +206,10 @@ class NavigationToolbarRobot {
|
|||
.perform(
|
||||
RecyclerViewActions.actionOnItem<RecyclerView.ViewHolder>(
|
||||
hasDescendant(
|
||||
withText("New tab")
|
||||
withText("New tab"),
|
||||
),
|
||||
ViewActions.click()
|
||||
)
|
||||
ViewActions.click(),
|
||||
),
|
||||
)
|
||||
|
||||
HomeScreenRobot().interact()
|
||||
|
@ -223,10 +223,10 @@ class NavigationToolbarRobot {
|
|||
.perform(
|
||||
RecyclerViewActions.actionOnItem<RecyclerView.ViewHolder>(
|
||||
hasDescendant(
|
||||
withText("New private tab")
|
||||
withText("New private tab"),
|
||||
),
|
||||
ViewActions.click()
|
||||
)
|
||||
ViewActions.click(),
|
||||
),
|
||||
)
|
||||
|
||||
HomeScreenRobot().interact()
|
||||
|
@ -237,7 +237,7 @@ class NavigationToolbarRobot {
|
|||
urlBar().click()
|
||||
|
||||
mDevice.findObject(
|
||||
UiSelector().resourceId("$packageName:id/mozac_browser_toolbar_edit_url_view")
|
||||
UiSelector().resourceId("$packageName:id/mozac_browser_toolbar_edit_url_view"),
|
||||
).waitForExists(waitingTime)
|
||||
|
||||
SearchRobot().interact()
|
||||
|
@ -254,12 +254,12 @@ fun navigationToolbar(interact: NavigationToolbarRobot.() -> Unit): NavigationTo
|
|||
fun openEditURLView() {
|
||||
mDevice.waitNotNull(
|
||||
Until.findObject(By.res("$packageName:id/toolbar")),
|
||||
waitingTime
|
||||
waitingTime,
|
||||
)
|
||||
urlBar().click()
|
||||
mDevice.waitNotNull(
|
||||
Until.findObject(By.res("$packageName:id/mozac_browser_toolbar_edit_url_view")),
|
||||
waitingTime
|
||||
waitingTime,
|
||||
)
|
||||
}
|
||||
|
||||
|
@ -292,36 +292,42 @@ private fun readerViewToggle() =
|
|||
private fun assertReaderViewDetected(visible: Boolean) {
|
||||
mDevice.findObject(
|
||||
UiSelector()
|
||||
.description("Reader view")
|
||||
.description("Reader view"),
|
||||
)
|
||||
.waitForExists(waitingTime)
|
||||
|
||||
onView(
|
||||
allOf(
|
||||
withParent(withId(R.id.mozac_browser_toolbar_page_actions)),
|
||||
withContentDescription("Reader view")
|
||||
)
|
||||
withContentDescription("Reader view"),
|
||||
),
|
||||
).check(
|
||||
if (visible) matches(withEffectiveVisibility(ViewMatchers.Visibility.VISIBLE))
|
||||
else ViewAssertions.doesNotExist()
|
||||
if (visible) {
|
||||
matches(withEffectiveVisibility(ViewMatchers.Visibility.VISIBLE))
|
||||
} else {
|
||||
ViewAssertions.doesNotExist()
|
||||
},
|
||||
)
|
||||
}
|
||||
|
||||
private fun assertCloseReaderViewDetected(visible: Boolean) {
|
||||
mDevice.findObject(
|
||||
UiSelector()
|
||||
.description("Close reader view")
|
||||
.description("Close reader view"),
|
||||
)
|
||||
.waitForExists(waitingTime)
|
||||
|
||||
onView(
|
||||
allOf(
|
||||
withParent(withId(R.id.mozac_browser_toolbar_page_actions)),
|
||||
withContentDescription("Close reader view")
|
||||
)
|
||||
withContentDescription("Close reader view"),
|
||||
),
|
||||
).check(
|
||||
if (visible) matches(withEffectiveVisibility(ViewMatchers.Visibility.VISIBLE))
|
||||
else ViewAssertions.doesNotExist()
|
||||
if (visible) {
|
||||
matches(withEffectiveVisibility(ViewMatchers.Visibility.VISIBLE))
|
||||
} else {
|
||||
ViewAssertions.doesNotExist()
|
||||
},
|
||||
)
|
||||
}
|
||||
|
||||
|
|
|
@ -54,13 +54,13 @@ class NotificationRobot {
|
|||
fun verifySystemNotificationGone(notificationMessage: String) {
|
||||
mDevice.waitNotNull(
|
||||
Until.gone(text(notificationMessage)),
|
||||
waitingTime
|
||||
waitingTime,
|
||||
)
|
||||
|
||||
assertFalse(
|
||||
mDevice.findObject(
|
||||
UiSelector().text(notificationMessage)
|
||||
).exists()
|
||||
UiSelector().text(notificationMessage),
|
||||
).exists(),
|
||||
)
|
||||
}
|
||||
|
||||
|
@ -117,7 +117,7 @@ class NotificationRobot {
|
|||
fun clickClosePrivateTabsNotification(interact: HomeScreenRobot.() -> Unit): HomeScreenRobot.Transition {
|
||||
try {
|
||||
assertTrue(
|
||||
closePrivateTabsNotification().exists()
|
||||
closePrivateTabsNotification().exists(),
|
||||
)
|
||||
} catch (e: AssertionError) {
|
||||
notificationTray().flingToEnd(1)
|
||||
|
@ -143,25 +143,25 @@ private fun downloadSystemNotificationButton(action: String) =
|
|||
mDevice.findObject(
|
||||
UiSelector()
|
||||
.resourceId("android:id/action0")
|
||||
.textContains(action)
|
||||
.textContains(action),
|
||||
)
|
||||
|
||||
private fun mediaSystemNotificationButton(action: String) =
|
||||
mDevice.findObject(
|
||||
UiSelector()
|
||||
.resourceId("com.android.systemui:id/action0")
|
||||
.descriptionContains(action)
|
||||
.descriptionContains(action),
|
||||
)
|
||||
|
||||
private fun notificationTray() = UiScrollable(
|
||||
UiSelector().resourceId("com.android.systemui:id/notification_stack_scroller")
|
||||
UiSelector().resourceId("com.android.systemui:id/notification_stack_scroller"),
|
||||
).setAsVerticalList()
|
||||
|
||||
private val notificationHeader =
|
||||
mDevice.findObject(
|
||||
UiSelector()
|
||||
.resourceId("android:id/app_name_text")
|
||||
.text(appName)
|
||||
.text(appName),
|
||||
)
|
||||
|
||||
private fun scrollToEnd() {
|
||||
|
|
|
@ -56,7 +56,7 @@ class ReaderViewRobot {
|
|||
val prefs = InstrumentationRegistry.getInstrumentation()
|
||||
.targetContext.getSharedPreferences(
|
||||
"mozac_feature_reader_view",
|
||||
Context.MODE_PRIVATE
|
||||
Context.MODE_PRIVATE,
|
||||
)
|
||||
|
||||
assertEquals(fontType, prefs.getString(fontTypeKey, ""))
|
||||
|
@ -68,7 +68,7 @@ class ReaderViewRobot {
|
|||
val prefs = InstrumentationRegistry.getInstrumentation()
|
||||
.targetContext.getSharedPreferences(
|
||||
"mozac_feature_reader_view",
|
||||
Context.MODE_PRIVATE
|
||||
Context.MODE_PRIVATE,
|
||||
)
|
||||
|
||||
val fontSizeKeyValue = prefs.getInt(fontSizeKey, 3)
|
||||
|
@ -82,7 +82,7 @@ class ReaderViewRobot {
|
|||
val prefs = InstrumentationRegistry.getInstrumentation()
|
||||
.targetContext.getSharedPreferences(
|
||||
"mozac_feature_reader_view",
|
||||
Context.MODE_PRIVATE
|
||||
Context.MODE_PRIVATE,
|
||||
)
|
||||
|
||||
assertEquals(expectedColorScheme, prefs.getString(colorSchemeKey, ""))
|
||||
|
@ -92,7 +92,7 @@ class ReaderViewRobot {
|
|||
fun toggleSansSerif(interact: ReaderViewRobot.() -> Unit): Transition {
|
||||
fun sansSerifButton() =
|
||||
onView(
|
||||
withId(R.id.mozac_feature_readerview_font_sans_serif)
|
||||
withId(R.id.mozac_feature_readerview_font_sans_serif),
|
||||
)
|
||||
|
||||
sansSerifButton().click()
|
||||
|
@ -104,7 +104,7 @@ class ReaderViewRobot {
|
|||
fun toggleSerif(interact: ReaderViewRobot.() -> Unit): Transition {
|
||||
fun serifButton() =
|
||||
onView(
|
||||
withId(R.id.mozac_feature_readerview_font_serif)
|
||||
withId(R.id.mozac_feature_readerview_font_serif),
|
||||
)
|
||||
|
||||
serifButton().click()
|
||||
|
@ -116,7 +116,7 @@ class ReaderViewRobot {
|
|||
fun toggleFontSizeDecrease(interact: ReaderViewRobot.() -> Unit): Transition {
|
||||
fun fontSizeDecrease() =
|
||||
onView(
|
||||
withId(R.id.mozac_feature_readerview_font_size_decrease)
|
||||
withId(R.id.mozac_feature_readerview_font_size_decrease),
|
||||
)
|
||||
|
||||
fontSizeDecrease().click()
|
||||
|
@ -128,7 +128,7 @@ class ReaderViewRobot {
|
|||
fun toggleFontSizeIncrease(interact: ReaderViewRobot.() -> Unit): Transition {
|
||||
fun fontSizeIncrease() =
|
||||
onView(
|
||||
withId(R.id.mozac_feature_readerview_font_size_increase)
|
||||
withId(R.id.mozac_feature_readerview_font_size_increase),
|
||||
)
|
||||
|
||||
fontSizeIncrease().click()
|
||||
|
@ -140,7 +140,7 @@ class ReaderViewRobot {
|
|||
fun toggleColorSchemeChangeLight(interact: ReaderViewRobot.() -> Unit): Transition {
|
||||
fun toggleLightColorSchemeButton() =
|
||||
onView(
|
||||
withId(R.id.mozac_feature_readerview_color_light)
|
||||
withId(R.id.mozac_feature_readerview_color_light),
|
||||
)
|
||||
|
||||
toggleLightColorSchemeButton().click()
|
||||
|
@ -152,7 +152,7 @@ class ReaderViewRobot {
|
|||
fun toggleColorSchemeChangeDark(interact: ReaderViewRobot.() -> Unit): Transition {
|
||||
fun toggleDarkColorSchemeButton() =
|
||||
onView(
|
||||
withId(R.id.mozac_feature_readerview_color_dark)
|
||||
withId(R.id.mozac_feature_readerview_color_dark),
|
||||
)
|
||||
|
||||
toggleDarkColorSchemeButton().click()
|
||||
|
@ -164,7 +164,7 @@ class ReaderViewRobot {
|
|||
fun toggleColorSchemeChangeSepia(interact: ReaderViewRobot.() -> Unit): Transition {
|
||||
fun toggleSepiaColorSchemeButton() =
|
||||
onView(
|
||||
withId(R.id.mozac_feature_readerview_color_sepia)
|
||||
withId(R.id.mozac_feature_readerview_color_sepia),
|
||||
)
|
||||
|
||||
toggleSepiaColorSchemeButton().click()
|
||||
|
@ -182,65 +182,65 @@ fun readerViewRobot(interact: ReaderViewRobot.() -> Unit): ReaderViewRobot.Trans
|
|||
|
||||
private fun assertAppearanceFontGroup(visible: Boolean) =
|
||||
onView(
|
||||
withId(R.id.mozac_feature_readerview_font_group)
|
||||
withId(R.id.mozac_feature_readerview_font_group),
|
||||
).check(
|
||||
matches(withEffectiveVisibility(visibleOrGone(visible)))
|
||||
matches(withEffectiveVisibility(visibleOrGone(visible))),
|
||||
)
|
||||
|
||||
private fun assertAppearanceFontSansSerif(visible: Boolean) =
|
||||
onView(
|
||||
withId(R.id.mozac_feature_readerview_font_sans_serif)
|
||||
withId(R.id.mozac_feature_readerview_font_sans_serif),
|
||||
).check(
|
||||
matches(withEffectiveVisibility(visibleOrGone(visible)))
|
||||
matches(withEffectiveVisibility(visibleOrGone(visible))),
|
||||
)
|
||||
|
||||
private fun assertAppearanceFontSerif(visible: Boolean) =
|
||||
onView(
|
||||
withId(R.id.mozac_feature_readerview_font_serif)
|
||||
withId(R.id.mozac_feature_readerview_font_serif),
|
||||
).check(
|
||||
matches(withEffectiveVisibility(visibleOrGone(visible)))
|
||||
matches(withEffectiveVisibility(visibleOrGone(visible))),
|
||||
)
|
||||
|
||||
private fun assertAppearanceFontDecrease(visible: Boolean) =
|
||||
onView(
|
||||
withId(R.id.mozac_feature_readerview_font_size_decrease)
|
||||
withId(R.id.mozac_feature_readerview_font_size_decrease),
|
||||
).check(
|
||||
matches(withEffectiveVisibility(visibleOrGone(visible)))
|
||||
matches(withEffectiveVisibility(visibleOrGone(visible))),
|
||||
)
|
||||
|
||||
private fun assertAppearanceFontIncrease(visible: Boolean) =
|
||||
onView(
|
||||
withId(R.id.mozac_feature_readerview_font_size_increase)
|
||||
withId(R.id.mozac_feature_readerview_font_size_increase),
|
||||
).check(
|
||||
matches(withEffectiveVisibility(visibleOrGone(visible)))
|
||||
matches(withEffectiveVisibility(visibleOrGone(visible))),
|
||||
)
|
||||
|
||||
private fun assertAppearanceColorDark(visible: Boolean) =
|
||||
onView(
|
||||
withId(R.id.mozac_feature_readerview_color_dark)
|
||||
withId(R.id.mozac_feature_readerview_color_dark),
|
||||
).check(
|
||||
matches(withEffectiveVisibility(visibleOrGone(visible)))
|
||||
matches(withEffectiveVisibility(visibleOrGone(visible))),
|
||||
)
|
||||
|
||||
private fun assertAppearanceColorLight(visible: Boolean) =
|
||||
onView(
|
||||
withId(R.id.mozac_feature_readerview_color_light)
|
||||
withId(R.id.mozac_feature_readerview_color_light),
|
||||
).check(
|
||||
matches(withEffectiveVisibility(visibleOrGone(visible)))
|
||||
matches(withEffectiveVisibility(visibleOrGone(visible))),
|
||||
)
|
||||
|
||||
private fun assertAppearanceColorSepia(visible: Boolean) =
|
||||
onView(
|
||||
withId(R.id.mozac_feature_readerview_color_sepia)
|
||||
withId(R.id.mozac_feature_readerview_color_sepia),
|
||||
).check(
|
||||
matches(withEffectiveVisibility(visibleOrGone(visible)))
|
||||
matches(withEffectiveVisibility(visibleOrGone(visible))),
|
||||
)
|
||||
|
||||
private fun assertAppearanceColorGroup(visible: Boolean) =
|
||||
onView(
|
||||
withId(R.id.mozac_feature_readerview_color_scheme_group)
|
||||
withId(R.id.mozac_feature_readerview_color_scheme_group),
|
||||
).check(
|
||||
matches(withEffectiveVisibility(visibleOrGone(visible)))
|
||||
matches(withEffectiveVisibility(visibleOrGone(visible))),
|
||||
)
|
||||
|
||||
private fun visibleOrGone(visibility: Boolean) =
|
||||
|
|
|
@ -30,7 +30,7 @@ class RecentlyClosedTabsRobot {
|
|||
fun waitForListToExist() =
|
||||
mDevice.findObject(UiSelector().resourceId("$packageName:id/recently_closed_list"))
|
||||
.waitForExists(
|
||||
TestAssetHelper.waitingTime
|
||||
TestAssetHelper.waitingTime,
|
||||
)
|
||||
|
||||
fun verifyRecentlyClosedTabsMenuView() = assertRecentlyClosedTabsMenuView()
|
||||
|
@ -58,11 +58,11 @@ private fun assertRecentlyClosedTabsMenuView() {
|
|||
onView(
|
||||
allOf(
|
||||
withText("Recently closed tabs"),
|
||||
withParent(withId(R.id.navigationToolbar))
|
||||
)
|
||||
withParent(withId(R.id.navigationToolbar)),
|
||||
),
|
||||
)
|
||||
.check(
|
||||
matches(withEffectiveVisibility(Visibility.VISIBLE))
|
||||
matches(withEffectiveVisibility(Visibility.VISIBLE)),
|
||||
)
|
||||
}
|
||||
|
||||
|
@ -72,8 +72,8 @@ private fun assertEmptyRecentlyClosedTabsList() {
|
|||
onView(
|
||||
allOf(
|
||||
withId(R.id.recently_closed_empty_view),
|
||||
withText(R.string.recently_closed_empty_message)
|
||||
)
|
||||
withText(R.string.recently_closed_empty_message),
|
||||
),
|
||||
).check(matches(withEffectiveVisibility(Visibility.VISIBLE)))
|
||||
}
|
||||
|
||||
|
@ -81,19 +81,19 @@ private fun assertPageUrl(expectedUrl: Uri) = onView(
|
|||
allOf(
|
||||
withId(R.id.url),
|
||||
withEffectiveVisibility(
|
||||
Visibility.VISIBLE
|
||||
)
|
||||
)
|
||||
Visibility.VISIBLE,
|
||||
),
|
||||
),
|
||||
)
|
||||
.check(
|
||||
matches(withText(Matchers.containsString(expectedUrl.toString())))
|
||||
matches(withText(Matchers.containsString(expectedUrl.toString()))),
|
||||
)
|
||||
|
||||
private fun recentlyClosedTabsPageTitle(title: String) = onView(
|
||||
allOf(
|
||||
withId(R.id.title),
|
||||
withText(title)
|
||||
)
|
||||
withText(title),
|
||||
),
|
||||
)
|
||||
|
||||
private fun assertRecentlyClosedTabsPageTitle(title: String) {
|
||||
|
@ -106,7 +106,7 @@ private fun recentlyClosedTabsDeleteButton() =
|
|||
allOf(
|
||||
withId(R.id.overflow_menu),
|
||||
withEffectiveVisibility(
|
||||
Visibility.VISIBLE
|
||||
)
|
||||
)
|
||||
Visibility.VISIBLE,
|
||||
),
|
||||
),
|
||||
)
|
||||
|
|
|
@ -79,8 +79,8 @@ class SearchRobot {
|
|||
when {
|
||||
Build.VERSION.SDK_INT == Build.VERSION_CODES.R -> "Allow all the time"
|
||||
else -> "While using the app"
|
||||
}
|
||||
)
|
||||
},
|
||||
),
|
||||
)
|
||||
|
||||
if (allowPermission.exists()) {
|
||||
|
@ -119,7 +119,7 @@ class SearchRobot {
|
|||
fun clickSearchEngineShortcutButton() {
|
||||
val searchEnginesShortcutButton = mDevice.findObject(
|
||||
UiSelector()
|
||||
.resourceId("$packageName:id/search_engines_shortcut_button")
|
||||
.resourceId("$packageName:id/search_engines_shortcut_button"),
|
||||
)
|
||||
searchEnginesShortcutButton.waitForExists(waitingTime)
|
||||
searchEnginesShortcutButton.click()
|
||||
|
@ -143,13 +143,13 @@ class SearchRobot {
|
|||
fun verifyScannerOpen() {
|
||||
assertTrue(
|
||||
mDevice.findObject(UiSelector().resourceId("$packageName:id/view_finder"))
|
||||
.waitForExists(waitingTime)
|
||||
.waitForExists(waitingTime),
|
||||
)
|
||||
}
|
||||
|
||||
fun typeSearch(searchTerm: String) {
|
||||
mDevice.findObject(
|
||||
UiSelector().resourceId("$packageName:id/mozac_browser_toolbar_edit_url_view")
|
||||
UiSelector().resourceId("$packageName:id/mozac_browser_toolbar_edit_url_view"),
|
||||
).waitForExists(waitingTime)
|
||||
|
||||
browserToolbarEditView().setText(searchTerm)
|
||||
|
@ -162,8 +162,8 @@ class SearchRobot {
|
|||
|
||||
mDevice.waitForObjects(
|
||||
mDevice.findObject(
|
||||
UiSelector().textContains(searchEngineName)
|
||||
)
|
||||
UiSelector().textContains(searchEngineName),
|
||||
),
|
||||
)
|
||||
|
||||
rule.onNodeWithText(searchEngineName)
|
||||
|
@ -175,7 +175,7 @@ class SearchRobot {
|
|||
fun clickSearchEngineResult(rule: ComposeTestRule, searchSuggestion: String) {
|
||||
mDevice.waitNotNull(
|
||||
Until.findObjects(By.text(searchSuggestion)),
|
||||
waitingTime
|
||||
waitingTime,
|
||||
)
|
||||
|
||||
rule.onNodeWithText(searchSuggestion)
|
||||
|
@ -188,7 +188,7 @@ class SearchRobot {
|
|||
fun scrollToSearchEngineSettings(rule: ComposeTestRule) {
|
||||
// Soft keyboard is visible on screen on view access; hide it
|
||||
onView(allOf(withId(R.id.search_wrapper))).perform(
|
||||
closeSoftKeyboard()
|
||||
closeSoftKeyboard(),
|
||||
)
|
||||
|
||||
mDevice.findObject(UiSelector().text("Google"))
|
||||
|
@ -267,8 +267,8 @@ class SearchRobot {
|
|||
runWithIdleRes(sessionLoadedIdlingResource) {
|
||||
assertTrue(
|
||||
mDevice.findObject(
|
||||
UiSelector().resourceId("$packageName:id/browserLayout")
|
||||
).waitForExists(waitingTime)
|
||||
UiSelector().resourceId("$packageName:id/browserLayout"),
|
||||
).waitForExists(waitingTime),
|
||||
)
|
||||
}
|
||||
|
||||
|
@ -318,7 +318,7 @@ private fun assertSearchEngineSuggestionResults(rule: ComposeTestRule, searchRes
|
|||
|
||||
assertTrue(
|
||||
mDevice.findObject(UiSelector().textContains(searchResult))
|
||||
.waitForExists(waitingTime)
|
||||
.waitForExists(waitingTime),
|
||||
)
|
||||
}
|
||||
|
||||
|
@ -327,34 +327,34 @@ private fun assertNoSuggestionsAreDisplayed(rule: ComposeTestRule, searchTerm: S
|
|||
|
||||
assertFalse(
|
||||
mDevice.findObject(UiSelector().textContains(searchTerm))
|
||||
.waitForExists(waitingTime)
|
||||
.waitForExists(waitingTime),
|
||||
)
|
||||
}
|
||||
|
||||
private fun assertSearchView() =
|
||||
assertTrue(
|
||||
mDevice.findObject(
|
||||
UiSelector().resourceId("$packageName:id/search_wrapper")
|
||||
).waitForExists(waitingTime)
|
||||
UiSelector().resourceId("$packageName:id/search_wrapper"),
|
||||
).waitForExists(waitingTime),
|
||||
)
|
||||
|
||||
private fun assertBrowserToolbarEditView() =
|
||||
assertTrue(
|
||||
mDevice.findObject(
|
||||
UiSelector().resourceId("$packageName:id/mozac_browser_toolbar_edit_url_view")
|
||||
).waitForExists(waitingTime)
|
||||
UiSelector().resourceId("$packageName:id/mozac_browser_toolbar_edit_url_view"),
|
||||
).waitForExists(waitingTime),
|
||||
)
|
||||
|
||||
private fun assertScanButton() =
|
||||
assertTrue(
|
||||
scanButton.waitForExists(waitingTime)
|
||||
scanButton.waitForExists(waitingTime),
|
||||
)
|
||||
|
||||
private fun assertSearchButton() =
|
||||
assertTrue(
|
||||
mDevice.findObject(
|
||||
UiSelector().resourceId("$packageName:id/search_engines_shortcut_button")
|
||||
).waitForExists(waitingTime)
|
||||
UiSelector().resourceId("$packageName:id/search_engines_shortcut_button"),
|
||||
).waitForExists(waitingTime),
|
||||
)
|
||||
|
||||
private fun assertSearchWithText() =
|
||||
|
@ -370,8 +370,8 @@ private fun assertSearchBarEmpty() =
|
|||
mDevice.findObject(
|
||||
UiSelector()
|
||||
.resourceId("$packageName:id/mozac_browser_toolbar_edit_url_view")
|
||||
.textContains("")
|
||||
).waitForExists(waitingTime)
|
||||
.textContains(""),
|
||||
).waitForExists(waitingTime),
|
||||
)
|
||||
|
||||
fun searchScreen(interact: SearchRobot.() -> Unit): SearchRobot.Transition {
|
||||
|
@ -387,7 +387,7 @@ private fun assertKeyboardVisibility(isExpectedToBeVisible: Boolean): () -> Unit
|
|||
isExpectedToBeVisible,
|
||||
mDevice
|
||||
.executeShellCommand("dumpsys input_method | grep mInputShown")
|
||||
.contains("mInputShown=true")
|
||||
.contains("mInputShown=true"),
|
||||
)
|
||||
}
|
||||
|
||||
|
@ -431,7 +431,7 @@ private fun assertEngineListShortcutContains(rule: ComposeTestRule, searchEngine
|
|||
}
|
||||
} finally {
|
||||
mDevice.findObject(
|
||||
UiSelector().textContains("Google")
|
||||
UiSelector().textContains("Google"),
|
||||
).waitForExists(waitingTime)
|
||||
|
||||
rule.onNodeWithTag("mozac.awesomebar.suggestions")
|
||||
|
@ -458,8 +458,8 @@ private fun assertDefaultSearchEngine(expectedText: String) =
|
|||
mDevice.findObject(
|
||||
UiSelector()
|
||||
.resourceId("$packageName:id/mozac_browser_toolbar_edit_icon")
|
||||
.descriptionContains(expectedText)
|
||||
).waitForExists(waitingTime)
|
||||
.descriptionContains(expectedText),
|
||||
).waitForExists(waitingTime),
|
||||
)
|
||||
|
||||
private fun assertPastedToolbarText(expectedText: String) {
|
||||
|
@ -470,8 +470,8 @@ private fun assertPastedToolbarText(expectedText: String) {
|
|||
onView(
|
||||
allOf(
|
||||
withSubstring(expectedText),
|
||||
withId(R.id.mozac_browser_toolbar_edit_url_view)
|
||||
)
|
||||
withId(R.id.mozac_browser_toolbar_edit_url_view),
|
||||
),
|
||||
).check(matches(withEffectiveVisibility(ViewMatchers.Visibility.VISIBLE)))
|
||||
}
|
||||
|
||||
|
@ -482,5 +482,5 @@ private val voiceSearchButton = mDevice.findObject(UiSelector().description("Voi
|
|||
|
||||
private val searchSuggestionsList =
|
||||
UiScrollable(
|
||||
UiSelector().className("android.widget.ScrollView")
|
||||
UiSelector().className("android.widget.ScrollView"),
|
||||
)
|
||||
|
|
|
@ -127,7 +127,6 @@ class SettingsRobot {
|
|||
|
||||
fun openAboutFirefoxPreview(interact: SettingsSubMenuAboutRobot.() -> Unit):
|
||||
SettingsSubMenuAboutRobot.Transition {
|
||||
|
||||
aboutFirefoxHeading().click()
|
||||
|
||||
SettingsSubMenuAboutRobot().interact()
|
||||
|
@ -136,7 +135,6 @@ class SettingsRobot {
|
|||
|
||||
fun openSearchSubMenu(interact: SettingsSubMenuSearchRobot.() -> Unit):
|
||||
SettingsSubMenuSearchRobot.Transition {
|
||||
|
||||
fun searchEngineButton() = onView(withText("Search"))
|
||||
searchEngineButton().click()
|
||||
|
||||
|
@ -145,7 +143,6 @@ class SettingsRobot {
|
|||
}
|
||||
|
||||
fun openCustomizeSubMenu(interact: SettingsSubMenuThemeRobot.() -> Unit): SettingsSubMenuThemeRobot.Transition {
|
||||
|
||||
fun customizeButton() = onView(withText("Customize"))
|
||||
customizeButton().click()
|
||||
|
||||
|
@ -154,7 +151,6 @@ class SettingsRobot {
|
|||
}
|
||||
|
||||
fun openTabsSubMenu(interact: SettingsSubMenuTabsRobot.() -> Unit): SettingsSubMenuTabsRobot.Transition {
|
||||
|
||||
fun tabsButton() = onView(withText("Tabs"))
|
||||
tabsButton().click()
|
||||
|
||||
|
@ -163,7 +159,6 @@ class SettingsRobot {
|
|||
}
|
||||
|
||||
fun openHomepageSubMenu(interact: SettingsSubMenuHomepageRobot.() -> Unit): SettingsSubMenuHomepageRobot.Transition {
|
||||
|
||||
mDevice.findObject(UiSelector().textContains("Homepage")).waitForExists(waitingTime)
|
||||
onView(withText(R.string.preferences_home_2)).click()
|
||||
|
||||
|
@ -172,7 +167,6 @@ class SettingsRobot {
|
|||
}
|
||||
|
||||
fun openAutofillSubMenu(interact: SettingsSubMenuAutofillRobot.() -> Unit): SettingsSubMenuAutofillRobot.Transition {
|
||||
|
||||
mDevice.findObject(UiSelector().textContains(getStringResource(R.string.preferences_autofill))).waitForExists(waitingTime)
|
||||
onView(withText(R.string.preferences_autofill)).click()
|
||||
|
||||
|
@ -194,16 +188,16 @@ class SettingsRobot {
|
|||
|
||||
fun openLanguageSubMenu(
|
||||
localizedText: String = getStringResource(R.string.preferences_language),
|
||||
interact: SettingsSubMenuLanguageRobot.() -> Unit
|
||||
interact: SettingsSubMenuLanguageRobot.() -> Unit,
|
||||
): SettingsSubMenuLanguageRobot.Transition {
|
||||
onView(withId(R.id.recycler_view))
|
||||
.perform(
|
||||
RecyclerViewActions.actionOnItem<RecyclerView.ViewHolder>(
|
||||
hasDescendant(
|
||||
withText(localizedText)
|
||||
withText(localizedText),
|
||||
),
|
||||
ViewActions.click()
|
||||
)
|
||||
ViewActions.click(),
|
||||
),
|
||||
)
|
||||
|
||||
SettingsSubMenuLanguageRobot().interact()
|
||||
|
@ -333,8 +327,8 @@ private fun assertSettingsToolbar() =
|
|||
CoreMatchers.allOf(
|
||||
withId(R.id.navigationToolbar),
|
||||
hasDescendant(ViewMatchers.withContentDescription(R.string.action_bar_up_description)),
|
||||
hasDescendant(withText(R.string.settings))
|
||||
)
|
||||
hasDescendant(withText(R.string.settings)),
|
||||
),
|
||||
).check(matches(withEffectiveVisibility(Visibility.VISIBLE)))
|
||||
|
||||
private fun assertGeneralHeading() {
|
||||
|
@ -404,7 +398,7 @@ private fun assertPrivacyHeading() {
|
|||
private fun assertHTTPSOnlyModeButton() {
|
||||
scrollToElementByText(getStringResource(R.string.preferences_https_only_title))
|
||||
onView(
|
||||
withText(R.string.preferences_https_only_title)
|
||||
withText(R.string.preferences_https_only_title),
|
||||
).check(matches(withEffectiveVisibility(Visibility.VISIBLE)))
|
||||
}
|
||||
|
||||
|
@ -412,8 +406,8 @@ private fun assertHTTPSOnlyModeState(state: String) {
|
|||
onView(
|
||||
allOf(
|
||||
withText(R.string.preferences_https_only_title),
|
||||
hasSibling(withText(state))
|
||||
)
|
||||
hasSibling(withText(state)),
|
||||
),
|
||||
).check(matches(withEffectiveVisibility(Visibility.VISIBLE)))
|
||||
}
|
||||
|
||||
|
@ -421,8 +415,8 @@ private fun assertEnhancedTrackingProtectionButton() {
|
|||
mDevice.wait(Until.findObject(By.text("Privacy and Security")), waitingTime)
|
||||
onView(withId(R.id.recycler_view)).perform(
|
||||
RecyclerViewActions.scrollTo<RecyclerView.ViewHolder>(
|
||||
hasDescendant(withText("Enhanced Tracking Protection"))
|
||||
)
|
||||
hasDescendant(withText("Enhanced Tracking Protection")),
|
||||
),
|
||||
).check(matches(withEffectiveVisibility(Visibility.VISIBLE)))
|
||||
}
|
||||
|
||||
|
@ -466,8 +460,8 @@ private fun assertDeleteBrowsingDataState(state: String) {
|
|||
onView(
|
||||
allOf(
|
||||
withText(R.string.preferences_delete_browsing_data_on_quit),
|
||||
hasSibling(withText(state))
|
||||
)
|
||||
hasSibling(withText(state)),
|
||||
),
|
||||
).check(matches(withEffectiveVisibility(Visibility.VISIBLE)))
|
||||
}
|
||||
|
||||
|
@ -500,10 +494,10 @@ fun assertOpenLinksInAppsSwitchState(enabled: Boolean) {
|
|||
hasCousin(
|
||||
allOf(
|
||||
withClassName(endsWith("Switch")),
|
||||
isChecked()
|
||||
)
|
||||
)
|
||||
)
|
||||
isChecked(),
|
||||
),
|
||||
),
|
||||
),
|
||||
)
|
||||
} else {
|
||||
openLinksInAppsButton()
|
||||
|
@ -512,10 +506,10 @@ fun assertOpenLinksInAppsSwitchState(enabled: Boolean) {
|
|||
hasCousin(
|
||||
allOf(
|
||||
withClassName(endsWith("Switch")),
|
||||
isNotChecked()
|
||||
)
|
||||
)
|
||||
)
|
||||
isNotChecked(),
|
||||
),
|
||||
),
|
||||
),
|
||||
)
|
||||
}
|
||||
}
|
||||
|
@ -530,8 +524,8 @@ private fun assertDeveloperToolsHeading() {
|
|||
private fun assertAdvancedHeading() {
|
||||
onView(withId(R.id.recycler_view)).perform(
|
||||
RecyclerViewActions.scrollTo<RecyclerView.ViewHolder>(
|
||||
hasDescendant(withText("Add-ons"))
|
||||
)
|
||||
hasDescendant(withText("Add-ons")),
|
||||
),
|
||||
)
|
||||
|
||||
onView(withText("Add-ons"))
|
||||
|
@ -541,8 +535,8 @@ private fun assertAdvancedHeading() {
|
|||
private fun assertAddonsButton() {
|
||||
onView(withId(R.id.recycler_view)).perform(
|
||||
RecyclerViewActions.scrollTo<RecyclerView.ViewHolder>(
|
||||
hasDescendant(withText("Add-ons"))
|
||||
)
|
||||
hasDescendant(withText("Add-ons")),
|
||||
),
|
||||
)
|
||||
|
||||
addonsManagerButton()
|
||||
|
|
|
@ -90,8 +90,8 @@ private fun assertAboutToolbar() =
|
|||
onView(
|
||||
allOf(
|
||||
withId(R.id.navigationToolbar),
|
||||
hasDescendant(withText("About $appName"))
|
||||
)
|
||||
hasDescendant(withText("About $appName")),
|
||||
),
|
||||
).check(matches(withEffectiveVisibility(ViewMatchers.Visibility.VISIBLE)))
|
||||
|
||||
private fun assertVersionNumber() {
|
||||
|
@ -146,7 +146,7 @@ private fun assertSupport() {
|
|||
TestHelper.verifyUrl(
|
||||
"support.mozilla.org",
|
||||
"org.mozilla.fenix.debug:id/mozac_browser_toolbar_url_view",
|
||||
R.id.mozac_browser_toolbar_url_view
|
||||
R.id.mozac_browser_toolbar_url_view,
|
||||
)
|
||||
}
|
||||
|
||||
|
@ -164,8 +164,8 @@ private fun assertCrashes() {
|
|||
|
||||
assertTrue(
|
||||
mDevice.findObject(
|
||||
UiSelector().textContains("No crash reports have been submitted.")
|
||||
).waitForExists(waitingTime)
|
||||
UiSelector().textContains("No crash reports have been submitted."),
|
||||
).waitForExists(waitingTime),
|
||||
)
|
||||
|
||||
for (i in 1..3) {
|
||||
|
@ -183,7 +183,7 @@ private fun assertPrivacyNotice() {
|
|||
TestHelper.verifyUrl(
|
||||
"/privacy/firefox",
|
||||
"org.mozilla.fenix.debug:id/mozac_browser_toolbar_url_view",
|
||||
R.id.mozac_browser_toolbar_url_view
|
||||
R.id.mozac_browser_toolbar_url_view,
|
||||
)
|
||||
}
|
||||
|
||||
|
@ -197,7 +197,7 @@ private fun assertKnowYourRights() {
|
|||
TestHelper.verifyUrl(
|
||||
SupportUtils.SumoTopic.YOUR_RIGHTS.topicStr,
|
||||
"org.mozilla.fenix.debug:id/mozac_browser_toolbar_url_view",
|
||||
R.id.mozac_browser_toolbar_url_view
|
||||
R.id.mozac_browser_toolbar_url_view,
|
||||
)
|
||||
}
|
||||
|
||||
|
@ -211,7 +211,7 @@ private fun assertLicensingInformation() {
|
|||
TestHelper.verifyUrl(
|
||||
"about:license",
|
||||
"org.mozilla.fenix.debug:id/mozac_browser_toolbar_url_view",
|
||||
R.id.mozac_browser_toolbar_url_view
|
||||
R.id.mozac_browser_toolbar_url_view,
|
||||
)
|
||||
}
|
||||
|
||||
|
@ -238,6 +238,7 @@ class BuildDateAssertion {
|
|||
companion object {
|
||||
// this pattern represents the following date format: "Monday 12/30 @ 6:49 PM"
|
||||
private const val DATE_PATTERN = "EEEE M/d @ h:m a"
|
||||
|
||||
//
|
||||
private const val NUM_OF_HOURS = 1
|
||||
|
||||
|
@ -287,7 +288,7 @@ class BuildDateAssertion {
|
|||
val maxDate = calendar.time
|
||||
calendar.add(
|
||||
Calendar.HOUR_OF_DAY,
|
||||
hours * -2
|
||||
hours * -2,
|
||||
) // Gets the minDate by subtracting from maxDate
|
||||
val minDate = calendar.time
|
||||
return updatedDate.after(minDate) && updatedDate.before(maxDate)
|
||||
|
@ -295,7 +296,7 @@ class BuildDateAssertion {
|
|||
|
||||
private fun LocalDateTime.isWithinRangeOf(
|
||||
hours: Int,
|
||||
baselineDate: LocalDateTime
|
||||
baselineDate: LocalDateTime,
|
||||
): Boolean {
|
||||
val upperBound = baselineDate.plusHours(hours.toLong())
|
||||
val lowerBound = baselineDate.minusHours(hours.toLong())
|
||||
|
|
|
@ -53,7 +53,7 @@ class SettingsSubMenuAddonsManagerRobot {
|
|||
fun clickInstallAddon(addonName: String) {
|
||||
mDevice.waitNotNull(
|
||||
Until.findObject(By.textContains(addonName)),
|
||||
waitingTime
|
||||
waitingTime,
|
||||
)
|
||||
|
||||
installButtonForAddon(addonName)
|
||||
|
@ -66,12 +66,12 @@ class SettingsSubMenuAddonsManagerRobot {
|
|||
try {
|
||||
assertFalse(
|
||||
mDevice.findObject(UiSelector().text("Failed to install $addonName"))
|
||||
.waitForExists(waitingTime)
|
||||
.waitForExists(waitingTime),
|
||||
)
|
||||
|
||||
assertTrue(
|
||||
mDevice.findObject(UiSelector().text("Okay, Got it"))
|
||||
.waitForExists(waitingTimeLong)
|
||||
.waitForExists(waitingTimeLong),
|
||||
)
|
||||
break
|
||||
} catch (e: AssertionError) {
|
||||
|
@ -93,8 +93,8 @@ class SettingsSubMenuAddonsManagerRobot {
|
|||
withParent(instanceOf(RelativeLayout::class.java)),
|
||||
hasSibling(withText("$addonName has been added to $appName")),
|
||||
hasSibling(withText("Open it in the menu")),
|
||||
hasSibling(withText("Allow in private browsing"))
|
||||
)
|
||||
hasSibling(withText("Allow in private browsing")),
|
||||
),
|
||||
)
|
||||
.check(matches(withEffectiveVisibility(Visibility.VISIBLE)))
|
||||
}
|
||||
|
@ -122,7 +122,7 @@ class SettingsSubMenuAddonsManagerRobot {
|
|||
assertTrue(
|
||||
"Addon install confirmation prompt not displayed",
|
||||
mDevice.findObject(UiSelector().text("Allow in private browsing"))
|
||||
.waitForExists(waitingTimeLong)
|
||||
.waitForExists(waitingTimeLong),
|
||||
)
|
||||
onView(withId(R.id.allow_in_private_browsing)).click()
|
||||
}
|
||||
|
@ -148,7 +148,7 @@ class SettingsSubMenuAddonsManagerRobot {
|
|||
|
||||
fun openDetailedMenuForAddon(
|
||||
addonName: String,
|
||||
interact: SettingsSubMenuAddonsManagerAddonDetailedMenuRobot.() -> Unit
|
||||
interact: SettingsSubMenuAddonsManagerAddonDetailedMenuRobot.() -> Unit,
|
||||
): SettingsSubMenuAddonsManagerAddonDetailedMenuRobot.Transition {
|
||||
scrollToElementByText(addonName)
|
||||
|
||||
|
@ -158,10 +158,10 @@ class SettingsSubMenuAddonsManagerRobot {
|
|||
hasDescendant(
|
||||
allOf(
|
||||
withId(R.id.add_on_name),
|
||||
withText(addonName)
|
||||
)
|
||||
)
|
||||
)
|
||||
withText(addonName),
|
||||
),
|
||||
),
|
||||
),
|
||||
).check(matches(withEffectiveVisibility(Visibility.VISIBLE)))
|
||||
.perform(click())
|
||||
|
||||
|
@ -175,8 +175,8 @@ class SettingsSubMenuAddonsManagerRobot {
|
|||
allOf(
|
||||
withContentDescription(R.string.mozac_feature_addons_install_addon_content_description),
|
||||
isDescendantOfA(withId(R.id.add_on_item)),
|
||||
hasSibling(hasDescendant(withText(addonName)))
|
||||
)
|
||||
hasSibling(hasDescendant(withText(addonName))),
|
||||
),
|
||||
)
|
||||
|
||||
private fun assertAddonIsEnabled(addonName: String) {
|
||||
|
@ -191,8 +191,8 @@ class SettingsSubMenuAddonsManagerRobot {
|
|||
onView(
|
||||
allOf(
|
||||
withId(R.id.permissions),
|
||||
withText(containsString("It requires your permission to:"))
|
||||
)
|
||||
withText(containsString("It requires your permission to:")),
|
||||
),
|
||||
)
|
||||
.check(matches(isCompletelyDisplayed()))
|
||||
|
||||
|
@ -208,8 +208,8 @@ class SettingsSubMenuAddonsManagerRobot {
|
|||
allOf(
|
||||
withId(R.id.add_button),
|
||||
isDescendantOfA(withId(R.id.add_on_item)),
|
||||
hasSibling(hasDescendant(withText(addonName)))
|
||||
)
|
||||
hasSibling(hasDescendant(withText(addonName))),
|
||||
),
|
||||
).check(matches(withEffectiveVisibility(Visibility.GONE)))
|
||||
}
|
||||
|
||||
|
@ -251,11 +251,11 @@ class SettingsSubMenuAddonsManagerRobot {
|
|||
hasDescendant(withText("uBlock Origin")),
|
||||
hasDescendant(withText("Finally, an efficient wide-spectrum content blocker. Easy on CPU and memory.")),
|
||||
hasDescendant(withId(R.id.rating)),
|
||||
hasDescendant(withId(R.id.users_count))
|
||||
)
|
||||
hasDescendant(withId(R.id.users_count)),
|
||||
),
|
||||
),
|
||||
hasDescendant(withId(R.id.add_button))
|
||||
)
|
||||
hasDescendant(withId(R.id.add_button)),
|
||||
),
|
||||
).check(matches(isCompletelyDisplayed()))
|
||||
}
|
||||
|
||||
|
@ -270,11 +270,11 @@ class SettingsSubMenuAddonsManagerRobot {
|
|||
hasDescendant(
|
||||
allOf(
|
||||
withId(R.id.add_on_name),
|
||||
withText(addonName)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
withText(addonName),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
).check(matches(withEffectiveVisibility(Visibility.VISIBLE)))
|
||||
}
|
||||
}
|
||||
|
|
|
@ -50,7 +50,7 @@ class SettingsSubMenuAutofillRobot {
|
|||
zipCode: String,
|
||||
country: String,
|
||||
phoneNumber: String,
|
||||
emailAddress: String
|
||||
emailAddress: String,
|
||||
) {
|
||||
firstNameTextInput.waitForExists(waitingTime)
|
||||
firstNameTextInput.setText(firstName)
|
||||
|
|
|
@ -58,13 +58,12 @@ private fun goBackButton() =
|
|||
private fun assertNavigationToolBarHeader() = onView(
|
||||
allOf(
|
||||
withParent(withId(R.id.navigationToolbar)),
|
||||
withText(R.string.preferences_data_collection)
|
||||
)
|
||||
withText(R.string.preferences_data_collection),
|
||||
),
|
||||
)
|
||||
.check(matches(withEffectiveVisibility(Visibility.VISIBLE)))
|
||||
|
||||
private fun assertDataCollectionOptions() {
|
||||
|
||||
onView(withText(R.string.preference_usage_data))
|
||||
.check(matches(withEffectiveVisibility(Visibility.VISIBLE)))
|
||||
|
||||
|
|
|
@ -62,23 +62,23 @@ private fun goBackButton() = onView(withContentDescription("Navigate up"))
|
|||
private fun assertNavigationToolBarHeader() = onView(
|
||||
allOf(
|
||||
withId(R.id.navigationToolbar),
|
||||
withChild(withText(R.string.preferences_delete_browsing_data_on_quit))
|
||||
)
|
||||
withChild(withText(R.string.preferences_delete_browsing_data_on_quit)),
|
||||
),
|
||||
)
|
||||
.check(matches(withEffectiveVisibility(Visibility.VISIBLE)))
|
||||
|
||||
private fun deleteBrowsingOnQuitButton() = onView(
|
||||
allOf(
|
||||
withParentIndex(0),
|
||||
withChild(withText(R.string.preferences_delete_browsing_data_on_quit))
|
||||
)
|
||||
withChild(withText(R.string.preferences_delete_browsing_data_on_quit)),
|
||||
),
|
||||
)
|
||||
|
||||
private fun assertDeleteBrowsingOnQuitButton() = deleteBrowsingOnQuitButton()
|
||||
.check(matches(withEffectiveVisibility(Visibility.VISIBLE)))
|
||||
|
||||
private fun assertDeleteBrowsingOnQuitButtonSummary() = onView(
|
||||
withText(R.string.preference_summary_delete_browsing_data_on_quit_2)
|
||||
withText(R.string.preference_summary_delete_browsing_data_on_quit_2),
|
||||
)
|
||||
.check(matches(withEffectiveVisibility(Visibility.VISIBLE)))
|
||||
|
||||
|
|
|
@ -141,7 +141,7 @@ class SettingsSubMenuDeleteBrowsingDataRobot {
|
|||
fun clickCancelButtonInDialogBoxAndVerifyContentsInDialogBox() {
|
||||
mDevice.wait(
|
||||
Until.findObject(By.text("Delete browsing data")),
|
||||
waitingTime
|
||||
waitingTime,
|
||||
)
|
||||
clickDeleteBrowsingDataButton()
|
||||
verifyDialogElements()
|
||||
|
@ -176,8 +176,8 @@ private fun navigationToolBarHeader() =
|
|||
onView(
|
||||
allOf(
|
||||
withId(R.id.navigationToolbar),
|
||||
withChild(withText(R.string.preferences_delete_browsing_data))
|
||||
)
|
||||
withChild(withText(R.string.preferences_delete_browsing_data)),
|
||||
),
|
||||
)
|
||||
|
||||
private fun deleteBrowsingDataButton() = onView(withId(R.id.delete_data))
|
||||
|
@ -288,8 +288,8 @@ private fun assertBrowsingHistoryDescription(addresses: String) =
|
|||
private fun assertDeleteBrowsingDataSnackbar() {
|
||||
assertTrue(
|
||||
mDevice.findObject(
|
||||
UiSelector().text("Browsing data deleted")
|
||||
).waitUntilGone(waitingTime)
|
||||
UiSelector().text("Browsing data deleted"),
|
||||
).waitUntilGone(waitingTime),
|
||||
)
|
||||
}
|
||||
|
||||
|
|
|
@ -65,22 +65,22 @@ private fun assertNavigationToolBarHeader() {
|
|||
private fun assertExceptionDefault() =
|
||||
assertTrue(
|
||||
mDevice.findObject(
|
||||
UiSelector().text("Exceptions let you disable tracking protection for selected sites.")
|
||||
).waitForExists(waitingTime)
|
||||
UiSelector().text("Exceptions let you disable tracking protection for selected sites."),
|
||||
).waitForExists(waitingTime),
|
||||
)
|
||||
|
||||
private fun assertExceptionLearnMoreText() =
|
||||
assertTrue(
|
||||
mDevice.findObject(
|
||||
UiSelector().text("Learn more")
|
||||
).waitForExists(waitingTime)
|
||||
UiSelector().text("Learn more"),
|
||||
).waitForExists(waitingTime),
|
||||
)
|
||||
|
||||
private fun assertExceptionURL(url: String) =
|
||||
assertTrue(
|
||||
mDevice.findObject(
|
||||
UiSelector().textContains(url.replace("http://", "https://"))
|
||||
).waitForExists(waitingTime)
|
||||
UiSelector().textContains(url.replace("http://", "https://")),
|
||||
).waitForExists(waitingTime),
|
||||
)
|
||||
|
||||
private fun disableExceptionsButton() =
|
||||
|
|
|
@ -86,13 +86,12 @@ class SettingsSubMenuEnhancedTrackingProtectionRobot {
|
|||
}
|
||||
|
||||
fun openExceptions(
|
||||
interact: SettingsSubMenuEnhancedTrackingProtectionExceptionsRobot.() -> Unit
|
||||
interact: SettingsSubMenuEnhancedTrackingProtectionExceptionsRobot.() -> Unit,
|
||||
): SettingsSubMenuEnhancedTrackingProtectionExceptionsRobot.Transition {
|
||||
|
||||
onView(withId(R.id.recycler_view)).perform(
|
||||
RecyclerViewActions.scrollTo<RecyclerView.ViewHolder>(
|
||||
hasDescendant(withText("Exceptions"))
|
||||
)
|
||||
hasDescendant(withText("Exceptions")),
|
||||
),
|
||||
)
|
||||
|
||||
openExceptions().click()
|
||||
|
@ -107,8 +106,8 @@ private fun assertNavigationToolBarHeader() {
|
|||
onView(
|
||||
allOf(
|
||||
withParent(withId(org.mozilla.fenix.R.id.navigationToolbar)),
|
||||
withText("Enhanced Tracking Protection")
|
||||
)
|
||||
withText("Enhanced Tracking Protection"),
|
||||
),
|
||||
)
|
||||
.check(matches(withEffectiveVisibility(Visibility.VISIBLE)))
|
||||
}
|
||||
|
@ -122,8 +121,8 @@ private fun assertEnhancedTrackingProtectionHeaderDescription() {
|
|||
onView(
|
||||
allOf(
|
||||
withParent(withParentIndex(0)),
|
||||
withText("Keep your data to yourself. $appName protects you from many of the most common trackers that follow what you do online.")
|
||||
)
|
||||
withText("Keep your data to yourself. $appName protects you from many of the most common trackers that follow what you do online."),
|
||||
),
|
||||
)
|
||||
.check(matches(withEffectiveVisibility(Visibility.VISIBLE)))
|
||||
}
|
||||
|
@ -132,8 +131,8 @@ private fun assertLearnMoreText() {
|
|||
onView(
|
||||
allOf(
|
||||
withParent(withParentIndex(0)),
|
||||
withText("Learn more")
|
||||
)
|
||||
withText("Learn more"),
|
||||
),
|
||||
)
|
||||
.check(matches(withEffectiveVisibility(Visibility.VISIBLE)))
|
||||
}
|
||||
|
@ -142,8 +141,8 @@ private fun assertEnhancedTrackingProtectionTextWithSwitchWidget() {
|
|||
onView(
|
||||
allOf(
|
||||
withParentIndex(1),
|
||||
withChild(withText("Enhanced Tracking Protection"))
|
||||
)
|
||||
withChild(withText("Enhanced Tracking Protection")),
|
||||
),
|
||||
)
|
||||
.check(matches(withEffectiveVisibility(Visibility.VISIBLE)))
|
||||
}
|
||||
|
@ -172,26 +171,26 @@ private fun assertTrackingProtectionSwitchEnabled() {
|
|||
onView(withResourceName("switch_widget")).check(
|
||||
matches(
|
||||
isChecked(
|
||||
true
|
||||
)
|
||||
)
|
||||
true,
|
||||
),
|
||||
),
|
||||
)
|
||||
}
|
||||
|
||||
private fun assertRadioButtonDefaults() {
|
||||
onView(
|
||||
withText("Strict")
|
||||
withText("Strict"),
|
||||
).assertIsChecked(false)
|
||||
|
||||
onView(
|
||||
allOf(
|
||||
withId(org.mozilla.fenix.R.id.radio_button),
|
||||
hasSibling(withText("Standard (default)"))
|
||||
)
|
||||
hasSibling(withText("Standard (default)")),
|
||||
),
|
||||
).assertIsChecked(true)
|
||||
|
||||
onView(
|
||||
withText("Custom")
|
||||
withText("Custom"),
|
||||
).assertIsChecked(false)
|
||||
}
|
||||
|
||||
|
|
|
@ -65,8 +65,8 @@ class SettingsSubMenuHomepageRobot {
|
|||
assertTrue(
|
||||
mDevice.findObject(
|
||||
UiSelector()
|
||||
.textContains(expectedText)
|
||||
).waitForExists(waitingTimeShort)
|
||||
.textContains(expectedText),
|
||||
).waitForExists(waitingTimeShort),
|
||||
)
|
||||
|
||||
fun verifySponsoredShortcutsCheckBox(checked: Boolean) {
|
||||
|
@ -78,11 +78,11 @@ class SettingsSubMenuHomepageRobot {
|
|||
withChild(
|
||||
allOf(
|
||||
withClassName(endsWith("CheckBox")),
|
||||
isChecked()
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
isChecked(),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
)
|
||||
} else {
|
||||
sponsoredShortcuts()
|
||||
|
@ -92,11 +92,11 @@ class SettingsSubMenuHomepageRobot {
|
|||
withChild(
|
||||
allOf(
|
||||
withClassName(endsWith("CheckBox")),
|
||||
isNotChecked()
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
isNotChecked(),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
)
|
||||
}
|
||||
}
|
||||
|
@ -146,8 +146,8 @@ private fun homepageButton() =
|
|||
allOf(
|
||||
withId(R.id.title),
|
||||
withText(R.string.opening_screen_homepage),
|
||||
hasSibling(withId(R.id.radio_button))
|
||||
)
|
||||
hasSibling(withId(R.id.radio_button)),
|
||||
),
|
||||
)
|
||||
|
||||
private fun lastTabButton() =
|
||||
|
@ -155,8 +155,8 @@ private fun lastTabButton() =
|
|||
allOf(
|
||||
withId(R.id.title),
|
||||
withText(R.string.opening_screen_last_tab),
|
||||
hasSibling(withId(R.id.radio_button))
|
||||
)
|
||||
hasSibling(withId(R.id.radio_button)),
|
||||
),
|
||||
)
|
||||
|
||||
private fun homepageAfterFourHoursButton() =
|
||||
|
@ -164,8 +164,8 @@ private fun homepageAfterFourHoursButton() =
|
|||
allOf(
|
||||
withId(R.id.title),
|
||||
withText(R.string.opening_screen_after_four_hours_of_inactivity),
|
||||
hasSibling(withId(R.id.radio_button))
|
||||
)
|
||||
hasSibling(withId(R.id.radio_button)),
|
||||
),
|
||||
)
|
||||
|
||||
private fun goBackButton() = onView(allOf(withContentDescription(R.string.action_bar_up_description)))
|
||||
|
|
|
@ -40,7 +40,7 @@ class SettingsSubMenuLanguageRobot {
|
|||
languagesList
|
||||
.getChildByText(UiSelector().text(language), language, true)
|
||||
.getFromParent(UiSelector().resourceId("$packageName:id/locale_selected_icon"))
|
||||
.waitForExists(waitingTime)
|
||||
.waitForExists(waitingTime),
|
||||
)
|
||||
}
|
||||
|
||||
|
@ -84,7 +84,7 @@ private val languagesList =
|
|||
UiScrollable(
|
||||
UiSelector()
|
||||
.resourceId("$packageName:id/locale_list")
|
||||
.scrollable(true)
|
||||
.scrollable(true),
|
||||
)
|
||||
|
||||
private fun language(name: String) = mDevice.findObject(UiSelector().text(name))
|
||||
|
|
|
@ -101,9 +101,9 @@ private fun assertDefaultValueAutofillLogins(context: Context) = onView(
|
|||
ViewMatchers.withText(
|
||||
context.getString(
|
||||
R.string.preferences_passwords_autofill2,
|
||||
context.getString(R.string.app_name)
|
||||
)
|
||||
)
|
||||
context.getString(R.string.app_name),
|
||||
),
|
||||
),
|
||||
)
|
||||
.check(matches(withEffectiveVisibility(ViewMatchers.Visibility.VISIBLE)))
|
||||
|
||||
|
|
|
@ -33,7 +33,7 @@ class SettingsSubMenuLoginsAndPasswordsSavedLoginsRobot {
|
|||
fun verifySavedLoginsAfterSync() {
|
||||
mDevice.waitNotNull(
|
||||
Until.findObjects(By.text("https://accounts.google.com")),
|
||||
TestAssetHelper.waitingTime
|
||||
TestAssetHelper.waitingTime,
|
||||
)
|
||||
assertSavedLoginAppears()
|
||||
}
|
||||
|
|
|
@ -53,7 +53,7 @@ class SettingsSubMenuPrivateBrowsingRobot {
|
|||
fun cancelPrivateShortcutAddition() {
|
||||
mDevice.wait(
|
||||
Until.findObject(text("Add private browsing shortcut")),
|
||||
waitingTime
|
||||
waitingTime,
|
||||
)
|
||||
addPrivateBrowsingShortcutButton().click()
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
|
||||
|
@ -65,7 +65,7 @@ class SettingsSubMenuPrivateBrowsingRobot {
|
|||
fun addPrivateShortcutToHomescreen() {
|
||||
mDevice.wait(
|
||||
Until.findObject(text("Add private browsing shortcut")),
|
||||
waitingTime
|
||||
waitingTime,
|
||||
)
|
||||
addPrivateBrowsingShortcutButton().click()
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
|
||||
|
@ -95,8 +95,8 @@ private fun assertNavigationToolBarHeader() {
|
|||
onView(
|
||||
CoreMatchers.allOf(
|
||||
withId(R.id.navigationToolbar),
|
||||
withChild(withText(R.string.preferences_private_browsing_options))
|
||||
)
|
||||
withChild(withText(R.string.preferences_private_browsing_options)),
|
||||
),
|
||||
)
|
||||
.check((matches(withEffectiveVisibility(Visibility.VISIBLE))))
|
||||
}
|
||||
|
@ -122,7 +122,7 @@ private fun privateBrowsingShortcutIcon() = mDevice.findObject(text("Private $ap
|
|||
private fun assertAddPrivateBrowsingShortcutButton() {
|
||||
mDevice.wait(
|
||||
Until.findObject(text("Add private browsing shortcut")),
|
||||
waitingTime
|
||||
waitingTime,
|
||||
)
|
||||
addPrivateBrowsingShortcutButton()
|
||||
.check(matches(withEffectiveVisibility(Visibility.VISIBLE)))
|
||||
|
|
|
@ -54,8 +54,8 @@ class SettingsSubMenuSearchRobot {
|
|||
fun toggleVoiceSearch() {
|
||||
onView(withId(androidx.preference.R.id.recycler_view)).perform(
|
||||
RecyclerViewActions.scrollTo<RecyclerView.ViewHolder>(
|
||||
hasDescendant(withText("Show voice search"))
|
||||
)
|
||||
hasDescendant(withText("Show voice search")),
|
||||
),
|
||||
)
|
||||
onView(withText("Show voice search")).perform(click())
|
||||
}
|
||||
|
@ -63,8 +63,8 @@ class SettingsSubMenuSearchRobot {
|
|||
fun switchSearchHistoryToggle() {
|
||||
onView(withId(androidx.preference.R.id.recycler_view)).perform(
|
||||
RecyclerViewActions.scrollTo<RecyclerView.ViewHolder>(
|
||||
hasDescendant(withText("Search browsing history"))
|
||||
)
|
||||
hasDescendant(withText("Search browsing history")),
|
||||
),
|
||||
)
|
||||
searchHistoryToggle.click()
|
||||
}
|
||||
|
@ -72,8 +72,8 @@ class SettingsSubMenuSearchRobot {
|
|||
fun switchSearchBookmarksToggle() {
|
||||
onView(withId(androidx.preference.R.id.recycler_view)).perform(
|
||||
RecyclerViewActions.scrollTo<RecyclerView.ViewHolder>(
|
||||
hasDescendant(withText("Search bookmarks"))
|
||||
)
|
||||
hasDescendant(withText("Search bookmarks")),
|
||||
),
|
||||
)
|
||||
searchBookmarksToggle.click()
|
||||
}
|
||||
|
@ -88,8 +88,8 @@ class SettingsSubMenuSearchRobot {
|
|||
addSearchEngineSaveButton().click()
|
||||
assertTrue(
|
||||
mDevice.findObject(
|
||||
UiSelector().textContains("Default search engine")
|
||||
).waitForExists(waitingTime)
|
||||
UiSelector().textContains("Default search engine"),
|
||||
).waitForExists(waitingTime),
|
||||
)
|
||||
}
|
||||
|
||||
|
@ -111,16 +111,16 @@ class SettingsSubMenuSearchRobot {
|
|||
mDevice.findObject(
|
||||
UiSelector()
|
||||
.resourceId("$packageName:id/edit_engine_name")
|
||||
.text(engineName)
|
||||
).waitForExists(waitingTime)
|
||||
.text(engineName),
|
||||
).waitForExists(waitingTime),
|
||||
)
|
||||
|
||||
assertTrue(
|
||||
mDevice.findObject(
|
||||
UiSelector()
|
||||
.resourceId("$packageName:id/edit_search_string")
|
||||
.text(engineURL)
|
||||
).waitForExists(waitingTime)
|
||||
.text(engineURL),
|
||||
).waitForExists(waitingTime),
|
||||
)
|
||||
} catch (e: AssertionError) {
|
||||
println("The name or the search string were not set properly")
|
||||
|
@ -139,23 +139,23 @@ class SettingsSubMenuSearchRobot {
|
|||
mDevice.findObject(
|
||||
UiSelector()
|
||||
.resourceId("$packageName:id/edit_engine_name")
|
||||
.text(engineName)
|
||||
).waitForExists(waitingTime)
|
||||
.text(engineName),
|
||||
).waitForExists(waitingTime),
|
||||
)
|
||||
|
||||
assertTrue(
|
||||
mDevice.findObject(
|
||||
UiSelector()
|
||||
.resourceId("$packageName:id/edit_search_string")
|
||||
.text(engineURL)
|
||||
).waitForExists(waitingTime)
|
||||
.text(engineURL),
|
||||
).waitForExists(waitingTime),
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
fun openEngineOverflowMenu(searchEngineName: String) {
|
||||
mDevice.findObject(
|
||||
UiSelector().resourceId("org.mozilla.fenix.debug:id/overflow_menu")
|
||||
UiSelector().resourceId("org.mozilla.fenix.debug:id/overflow_menu"),
|
||||
).waitForExists(waitingTime)
|
||||
threeDotMenu(searchEngineName).click()
|
||||
}
|
||||
|
@ -166,8 +166,8 @@ class SettingsSubMenuSearchRobot {
|
|||
onView(withId(R.id.save_button)).click()
|
||||
assertTrue(
|
||||
mDevice.findObject(
|
||||
UiSelector().textContains("Saved")
|
||||
).waitForExists(waitingTime)
|
||||
UiSelector().textContains("Saved"),
|
||||
).waitForExists(waitingTime),
|
||||
)
|
||||
}
|
||||
|
||||
|
@ -192,8 +192,8 @@ private fun assertSearchToolbar() =
|
|||
allOf(
|
||||
withId(R.id.navigationToolbar),
|
||||
hasDescendant(withContentDescription(R.string.action_bar_up_description)),
|
||||
hasDescendant(withText(R.string.preferences_search))
|
||||
)
|
||||
hasDescendant(withText(R.string.preferences_search)),
|
||||
),
|
||||
).check(matches(withEffectiveVisibility(ViewMatchers.Visibility.VISIBLE)))
|
||||
|
||||
private fun assertDefaultSearchEngineHeader() =
|
||||
|
@ -218,8 +218,8 @@ private fun assertSearchEngineList() {
|
|||
private fun assertShowSearchSuggestions() {
|
||||
onView(withId(androidx.preference.R.id.recycler_view)).perform(
|
||||
RecyclerViewActions.scrollTo<RecyclerView.ViewHolder>(
|
||||
hasDescendant(withText("Show search suggestions"))
|
||||
)
|
||||
hasDescendant(withText("Show search suggestions")),
|
||||
),
|
||||
)
|
||||
onView(withText("Show search suggestions"))
|
||||
.check(matches(withEffectiveVisibility(ViewMatchers.Visibility.VISIBLE)))
|
||||
|
@ -228,8 +228,8 @@ private fun assertShowSearchSuggestions() {
|
|||
private fun assertShowSearchShortcuts() {
|
||||
onView(withId(androidx.preference.R.id.recycler_view)).perform(
|
||||
RecyclerViewActions.scrollTo<RecyclerView.ViewHolder>(
|
||||
hasDescendant(withText("Show search engines"))
|
||||
)
|
||||
hasDescendant(withText("Show search engines")),
|
||||
),
|
||||
)
|
||||
onView(withText("Show search engines"))
|
||||
.check(matches(withEffectiveVisibility(ViewMatchers.Visibility.VISIBLE)))
|
||||
|
@ -238,8 +238,8 @@ private fun assertShowSearchShortcuts() {
|
|||
private fun assertShowClipboardSuggestions() {
|
||||
onView(withId(androidx.preference.R.id.recycler_view)).perform(
|
||||
RecyclerViewActions.scrollTo<RecyclerView.ViewHolder>(
|
||||
hasDescendant(withText("Show clipboard suggestions"))
|
||||
)
|
||||
hasDescendant(withText("Show clipboard suggestions")),
|
||||
),
|
||||
)
|
||||
onView(withText("Show clipboard suggestions"))
|
||||
.check(matches(withEffectiveVisibility(ViewMatchers.Visibility.VISIBLE)))
|
||||
|
@ -248,8 +248,8 @@ private fun assertShowClipboardSuggestions() {
|
|||
private fun assertSearchBrowsingHistory() {
|
||||
onView(withId(androidx.preference.R.id.recycler_view)).perform(
|
||||
RecyclerViewActions.scrollTo<RecyclerView.ViewHolder>(
|
||||
hasDescendant(withText("Search browsing history"))
|
||||
)
|
||||
hasDescendant(withText("Search browsing history")),
|
||||
),
|
||||
)
|
||||
searchHistoryToggle
|
||||
.check(matches(withEffectiveVisibility(ViewMatchers.Visibility.VISIBLE)))
|
||||
|
@ -260,8 +260,8 @@ private val searchHistoryToggle = onView(withText("Search browsing history"))
|
|||
private fun assertSearchBookmarks() {
|
||||
onView(withId(androidx.preference.R.id.recycler_view)).perform(
|
||||
RecyclerViewActions.scrollTo<RecyclerView.ViewHolder>(
|
||||
hasDescendant(withText("Search bookmarks"))
|
||||
)
|
||||
hasDescendant(withText("Search bookmarks")),
|
||||
),
|
||||
)
|
||||
searchBookmarksToggle
|
||||
.check(matches(withEffectiveVisibility(ViewMatchers.Visibility.VISIBLE)))
|
||||
|
@ -278,8 +278,8 @@ private fun selectSearchEngine(searchEngine: String) {
|
|||
private fun toggleShowSearchSuggestions() {
|
||||
onView(withId(androidx.preference.R.id.recycler_view)).perform(
|
||||
RecyclerViewActions.scrollTo<RecyclerView.ViewHolder>(
|
||||
hasDescendant(withText("Show search suggestions"))
|
||||
)
|
||||
hasDescendant(withText("Show search suggestions")),
|
||||
),
|
||||
)
|
||||
|
||||
onView(withText("Show search suggestions"))
|
||||
|
@ -289,8 +289,8 @@ private fun toggleShowSearchSuggestions() {
|
|||
private fun toggleShowSearchShortcuts() {
|
||||
onView(withId(androidx.preference.R.id.recycler_view)).perform(
|
||||
RecyclerViewActions.scrollTo<RecyclerView.ViewHolder>(
|
||||
hasDescendant(withText("Show search engines"))
|
||||
)
|
||||
hasDescendant(withText("Show search engines")),
|
||||
),
|
||||
)
|
||||
|
||||
onView(withText("Show search engines"))
|
||||
|
@ -318,6 +318,6 @@ private fun threeDotMenu(searchEngineName: String) =
|
|||
onView(
|
||||
allOf(
|
||||
withId(R.id.overflow_menu),
|
||||
withParent(withChild(withText(searchEngineName)))
|
||||
)
|
||||
withParent(withChild(withText(searchEngineName))),
|
||||
),
|
||||
)
|
||||
|
|
|
@ -124,22 +124,22 @@ class SettingsSubMenuSitePermissionsCommonRobot {
|
|||
fun verifySystemGrantedPermission(permissionCategory: String) {
|
||||
assertTrue(
|
||||
mDevice.findObject(
|
||||
UiSelector().className("android.widget.RelativeLayout")
|
||||
UiSelector().className("android.widget.RelativeLayout"),
|
||||
).getChild(
|
||||
UiSelector()
|
||||
.resourceId("android:id/title")
|
||||
.textContains(permissionCategory)
|
||||
).waitForExists(waitingTime)
|
||||
.textContains(permissionCategory),
|
||||
).waitForExists(waitingTime),
|
||||
)
|
||||
|
||||
assertTrue(
|
||||
mDevice.findObject(
|
||||
UiSelector().className("android.widget.RelativeLayout")
|
||||
UiSelector().className("android.widget.RelativeLayout"),
|
||||
).getChild(
|
||||
UiSelector()
|
||||
.resourceId("android:id/summary")
|
||||
.textContains("Only while app is in use")
|
||||
).waitForExists(waitingTime)
|
||||
.textContains("Only while app is in use"),
|
||||
).waitForExists(waitingTime),
|
||||
)
|
||||
}
|
||||
|
||||
|
@ -166,7 +166,6 @@ private fun assertVideoAndAudioBlockedRecommended() = onView(withId(R.id.fourth_
|
|||
.check((matches(withEffectiveVisibility(Visibility.VISIBLE))))
|
||||
|
||||
private fun assertCheckAutoPayRadioButtonDefault() {
|
||||
|
||||
// Allow audio and video
|
||||
onView(withId(R.id.block_radio))
|
||||
.assertIsChecked(isChecked = false)
|
||||
|
@ -199,8 +198,8 @@ private fun assertBlockedByAndroid() {
|
|||
blockedByAndroidContainer().waitForExists(waitingTime)
|
||||
assertTrue(
|
||||
mDevice.findObject(
|
||||
UiSelector().textContains(getStringResource(R.string.phone_feature_blocked_by_android))
|
||||
).waitForExists(waitingTimeShort)
|
||||
UiSelector().textContains(getStringResource(R.string.phone_feature_blocked_by_android)),
|
||||
).waitForExists(waitingTimeShort),
|
||||
)
|
||||
}
|
||||
|
||||
|
@ -208,8 +207,8 @@ private fun assertUnblockedByAndroid() {
|
|||
blockedByAndroidContainer().waitUntilGone(waitingTime)
|
||||
assertFalse(
|
||||
mDevice.findObject(
|
||||
UiSelector().textContains(getStringResource(R.string.phone_feature_blocked_by_android))
|
||||
).waitForExists(waitingTimeShort)
|
||||
UiSelector().textContains(getStringResource(R.string.phone_feature_blocked_by_android)),
|
||||
).waitForExists(waitingTimeShort),
|
||||
)
|
||||
}
|
||||
|
||||
|
|
|
@ -36,13 +36,12 @@ class SettingsSubMenuSitePermissionsRobot {
|
|||
}
|
||||
|
||||
fun openAutoPlay(
|
||||
interact: SettingsSubMenuSitePermissionsCommonRobot.() -> Unit
|
||||
interact: SettingsSubMenuSitePermissionsCommonRobot.() -> Unit,
|
||||
): SettingsSubMenuSitePermissionsCommonRobot.Transition {
|
||||
|
||||
onView(withId(R.id.recycler_view)).perform(
|
||||
RecyclerViewActions.scrollTo<RecyclerView.ViewHolder>(
|
||||
hasDescendant(withText("Autoplay"))
|
||||
)
|
||||
hasDescendant(withText("Autoplay")),
|
||||
),
|
||||
)
|
||||
|
||||
openAutoPlay().click()
|
||||
|
@ -52,13 +51,12 @@ class SettingsSubMenuSitePermissionsRobot {
|
|||
}
|
||||
|
||||
fun openCamera(
|
||||
interact: SettingsSubMenuSitePermissionsCommonRobot.() -> Unit
|
||||
interact: SettingsSubMenuSitePermissionsCommonRobot.() -> Unit,
|
||||
): SettingsSubMenuSitePermissionsCommonRobot.Transition {
|
||||
|
||||
onView(withId(R.id.recycler_view)).perform(
|
||||
RecyclerViewActions.scrollTo<RecyclerView.ViewHolder>(
|
||||
hasDescendant(withText("Camera"))
|
||||
)
|
||||
hasDescendant(withText("Camera")),
|
||||
),
|
||||
)
|
||||
|
||||
openCamera().click()
|
||||
|
@ -68,13 +66,12 @@ class SettingsSubMenuSitePermissionsRobot {
|
|||
}
|
||||
|
||||
fun openLocation(
|
||||
interact: SettingsSubMenuSitePermissionsCommonRobot.() -> Unit
|
||||
interact: SettingsSubMenuSitePermissionsCommonRobot.() -> Unit,
|
||||
): SettingsSubMenuSitePermissionsCommonRobot.Transition {
|
||||
|
||||
onView(withId(R.id.recycler_view)).perform(
|
||||
RecyclerViewActions.scrollTo<RecyclerView.ViewHolder>(
|
||||
hasDescendant(withText("Location"))
|
||||
)
|
||||
hasDescendant(withText("Location")),
|
||||
),
|
||||
)
|
||||
|
||||
openLocation().click()
|
||||
|
@ -84,13 +81,12 @@ class SettingsSubMenuSitePermissionsRobot {
|
|||
}
|
||||
|
||||
fun openMicrophone(
|
||||
interact: SettingsSubMenuSitePermissionsCommonRobot.() -> Unit
|
||||
interact: SettingsSubMenuSitePermissionsCommonRobot.() -> Unit,
|
||||
): SettingsSubMenuSitePermissionsCommonRobot.Transition {
|
||||
|
||||
onView(withId(R.id.recycler_view)).perform(
|
||||
RecyclerViewActions.scrollTo<RecyclerView.ViewHolder>(
|
||||
hasDescendant(withText("Microphone"))
|
||||
)
|
||||
hasDescendant(withText("Microphone")),
|
||||
),
|
||||
)
|
||||
|
||||
openMicrophone().click()
|
||||
|
@ -100,13 +96,12 @@ class SettingsSubMenuSitePermissionsRobot {
|
|||
}
|
||||
|
||||
fun openNotification(
|
||||
interact: SettingsSubMenuSitePermissionsCommonRobot.() -> Unit
|
||||
interact: SettingsSubMenuSitePermissionsCommonRobot.() -> Unit,
|
||||
): SettingsSubMenuSitePermissionsCommonRobot.Transition {
|
||||
|
||||
onView(withId(R.id.recycler_view)).perform(
|
||||
RecyclerViewActions.scrollTo<RecyclerView.ViewHolder>(
|
||||
hasDescendant(withText("Notification"))
|
||||
)
|
||||
hasDescendant(withText("Notification")),
|
||||
),
|
||||
)
|
||||
|
||||
openNotification().click()
|
||||
|
@ -116,13 +111,12 @@ class SettingsSubMenuSitePermissionsRobot {
|
|||
}
|
||||
|
||||
fun openPersistentStorage(
|
||||
interact: SettingsSubMenuSitePermissionsCommonRobot.() -> Unit
|
||||
interact: SettingsSubMenuSitePermissionsCommonRobot.() -> Unit,
|
||||
): SettingsSubMenuSitePermissionsCommonRobot.Transition {
|
||||
|
||||
onView(withId(R.id.recycler_view)).perform(
|
||||
RecyclerViewActions.scrollTo<RecyclerView.ViewHolder>(
|
||||
hasDescendant(withText("Persistent Storage"))
|
||||
)
|
||||
hasDescendant(withText("Persistent Storage")),
|
||||
),
|
||||
)
|
||||
|
||||
openPersistentStorage().click()
|
||||
|
@ -132,13 +126,12 @@ class SettingsSubMenuSitePermissionsRobot {
|
|||
}
|
||||
|
||||
fun openExceptions(
|
||||
interact: SettingsSubMenuSitePermissionsExceptionsRobot.() -> Unit
|
||||
interact: SettingsSubMenuSitePermissionsExceptionsRobot.() -> Unit,
|
||||
): SettingsSubMenuSitePermissionsExceptionsRobot.Transition {
|
||||
|
||||
onView(withId(R.id.recycler_view)).perform(
|
||||
RecyclerViewActions.scrollTo<RecyclerView.ViewHolder>(
|
||||
hasDescendant(withText("Exceptions"))
|
||||
)
|
||||
hasDescendant(withText("Exceptions")),
|
||||
),
|
||||
)
|
||||
|
||||
openExceptions().click()
|
||||
|
@ -152,7 +145,6 @@ class SettingsSubMenuSitePermissionsRobot {
|
|||
.check(matches(withEffectiveVisibility(Visibility.VISIBLE)))
|
||||
|
||||
private fun assertSitePermissionsSubMenuItems() {
|
||||
|
||||
onView(withText("Autoplay"))
|
||||
.check(matches(withEffectiveVisibility(Visibility.VISIBLE)))
|
||||
|
||||
|
@ -164,24 +156,24 @@ class SettingsSubMenuSitePermissionsRobot {
|
|||
"Blocked by Android"
|
||||
onView(withId(R.id.recycler_view)).perform(
|
||||
RecyclerViewActions.scrollTo<RecyclerView.ViewHolder>(
|
||||
allOf(hasDescendant(withText("Camera")), hasDescendant(withText(cameraText)))
|
||||
)
|
||||
allOf(hasDescendant(withText("Camera")), hasDescendant(withText(cameraText))),
|
||||
),
|
||||
).check(matches(withEffectiveVisibility(Visibility.VISIBLE)))
|
||||
|
||||
val locationText =
|
||||
"Blocked by Android"
|
||||
onView(withId(R.id.recycler_view)).perform(
|
||||
RecyclerViewActions.scrollTo<RecyclerView.ViewHolder>(
|
||||
allOf(hasDescendant(withText("Location")), hasDescendant(withText(locationText)))
|
||||
)
|
||||
allOf(hasDescendant(withText("Location")), hasDescendant(withText(locationText))),
|
||||
),
|
||||
).check(matches(withEffectiveVisibility(Visibility.VISIBLE)))
|
||||
|
||||
val microphoneText =
|
||||
"Blocked by Android"
|
||||
onView(withId(R.id.recycler_view)).perform(
|
||||
RecyclerViewActions.scrollTo<RecyclerView.ViewHolder>(
|
||||
allOf(hasDescendant(withText("Microphone")), hasDescendant(withText(microphoneText)))
|
||||
)
|
||||
allOf(hasDescendant(withText("Microphone")), hasDescendant(withText(microphoneText))),
|
||||
),
|
||||
).check(matches(withEffectiveVisibility(Visibility.VISIBLE)))
|
||||
|
||||
onView(withText("Notification"))
|
||||
|
@ -192,8 +184,8 @@ class SettingsSubMenuSitePermissionsRobot {
|
|||
|
||||
onView(withId(R.id.recycler_view)).perform(
|
||||
RecyclerViewActions.scrollTo<RecyclerView.ViewHolder>(
|
||||
allOf(hasDescendant(withText("Notification")), hasDescendant(withText(notificationText)))
|
||||
)
|
||||
allOf(hasDescendant(withText("Notification")), hasDescendant(withText(notificationText))),
|
||||
),
|
||||
).check(matches(withEffectiveVisibility(Visibility.VISIBLE)))
|
||||
|
||||
onView(withText("Persistent Storage"))
|
||||
|
@ -206,9 +198,9 @@ class SettingsSubMenuSitePermissionsRobot {
|
|||
RecyclerViewActions.scrollTo<RecyclerView.ViewHolder>(
|
||||
allOf(
|
||||
hasDescendant(withText("Persistent Storage")),
|
||||
hasDescendant(withText(persistentStorageText))
|
||||
)
|
||||
)
|
||||
hasDescendant(withText(persistentStorageText)),
|
||||
),
|
||||
),
|
||||
).check(matches(withEffectiveVisibility(Visibility.VISIBLE)))
|
||||
}
|
||||
}
|
||||
|
|
|
@ -56,6 +56,6 @@ private fun assertTurnOnSyncToolbarTitle() =
|
|||
onView(
|
||||
allOf(
|
||||
withParent(withId(R.id.navigationToolbar)),
|
||||
withText(R.string.preferences_sync_2)
|
||||
)
|
||||
withText(R.string.preferences_sync_2),
|
||||
),
|
||||
).check(matches(isDisplayed()))
|
||||
|
|
|
@ -35,9 +35,9 @@ class ShareOverlayRobot {
|
|||
matches(
|
||||
allOf(
|
||||
hasSibling(withId(R.id.share_tab_favicon)),
|
||||
hasSibling(withId(R.id.share_tab_url))
|
||||
)
|
||||
)
|
||||
hasSibling(withId(R.id.share_tab_url)),
|
||||
),
|
||||
),
|
||||
)
|
||||
}
|
||||
}
|
||||
|
@ -66,8 +66,8 @@ class ShareOverlayRobot {
|
|||
Intents.intended(
|
||||
allOf(
|
||||
IntentMatchers.hasExtra(Intent.EXTRA_TEXT, text),
|
||||
IntentMatchers.hasExtra(Intent.EXTRA_SUBJECT, subject)
|
||||
)
|
||||
IntentMatchers.hasExtra(Intent.EXTRA_SUBJECT, subject),
|
||||
),
|
||||
)
|
||||
}
|
||||
|
||||
|
@ -83,8 +83,8 @@ private fun sendToDeviceTitle() =
|
|||
onView(
|
||||
allOf(
|
||||
withText("SEND TO DEVICE"),
|
||||
withResourceName("accountHeaderText")
|
||||
)
|
||||
withResourceName("accountHeaderText"),
|
||||
),
|
||||
)
|
||||
|
||||
private fun assertSendToDeviceTitle() = sendToDeviceTitle()
|
||||
|
@ -94,8 +94,8 @@ private fun shareALinkTitle() =
|
|||
onView(
|
||||
allOf(
|
||||
withText("ALL ACTIONS"),
|
||||
withResourceName("apps_link_header")
|
||||
)
|
||||
withResourceName("apps_link_header"),
|
||||
),
|
||||
)
|
||||
|
||||
private fun assertShareALinkTitle() = shareALinkTitle()
|
||||
|
|
|
@ -31,7 +31,7 @@ class SitePermissionsRobot {
|
|||
fun verifyMicrophonePermissionPrompt(url: String) {
|
||||
assertTrue(
|
||||
mDevice.findObject(UiSelector().text("Allow $url to use your microphone?"))
|
||||
.waitForExists(waitingTime)
|
||||
.waitForExists(waitingTime),
|
||||
)
|
||||
assertTrue(denyPagePermissionButton.text.equals("Don’t allow"))
|
||||
assertTrue(allowPagePermissionButton.text.equals("Allow"))
|
||||
|
@ -40,7 +40,7 @@ class SitePermissionsRobot {
|
|||
fun verifyCameraPermissionPrompt(url: String) {
|
||||
assertTrue(
|
||||
mDevice.findObject(UiSelector().text("Allow $url to use your camera?"))
|
||||
.waitForExists(waitingTime)
|
||||
.waitForExists(waitingTime),
|
||||
)
|
||||
assertTrue(denyPagePermissionButton.text.equals("Don’t allow"))
|
||||
assertTrue(allowPagePermissionButton.text.equals("Allow"))
|
||||
|
@ -49,7 +49,7 @@ class SitePermissionsRobot {
|
|||
fun verifyAudioVideoPermissionPrompt(url: String) {
|
||||
assertTrue(
|
||||
mDevice.findObject(UiSelector().text("Allow $url to use your camera and microphone?"))
|
||||
.waitForExists(waitingTime)
|
||||
.waitForExists(waitingTime),
|
||||
)
|
||||
assertTrue(denyPagePermissionButton.text.equals("Don’t allow"))
|
||||
assertTrue(allowPagePermissionButton.text.equals("Allow"))
|
||||
|
@ -58,7 +58,7 @@ class SitePermissionsRobot {
|
|||
fun verifyLocationPermissionPrompt(url: String) {
|
||||
assertTrue(
|
||||
mDevice.findObject(UiSelector().text("Allow $url to use your location?"))
|
||||
.waitForExists(waitingTime)
|
||||
.waitForExists(waitingTime),
|
||||
)
|
||||
assertTrue(denyPagePermissionButton.text.equals("Don’t allow"))
|
||||
assertTrue(allowPagePermissionButton.text.equals("Allow"))
|
||||
|
@ -68,7 +68,7 @@ class SitePermissionsRobot {
|
|||
if (!blocked) {
|
||||
assertTrue(
|
||||
mDevice.findObject(UiSelector().text("Allow $url to send notifications?"))
|
||||
.waitForExists(waitingTime)
|
||||
.waitForExists(waitingTime),
|
||||
)
|
||||
assertTrue(denyPagePermissionButton.text.equals("Never"))
|
||||
assertTrue(allowPagePermissionButton.text.equals("Always"))
|
||||
|
@ -77,7 +77,7 @@ class SitePermissionsRobot {
|
|||
the Notifications permission prompt won't be displayed anymore */
|
||||
assertFalse(
|
||||
mDevice.findObject(UiSelector().text("Allow $url to send notifications?"))
|
||||
.exists()
|
||||
.exists(),
|
||||
)
|
||||
}
|
||||
}
|
||||
|
|
|
@ -53,7 +53,7 @@ private fun assertTurnOnSyncMenu() {
|
|||
mDevice.findObject(
|
||||
UiSelector()
|
||||
.resourceId("$packageName:id/signInScanButton")
|
||||
.resourceId("$packageName:id/signInEmailButton")
|
||||
).waitForExists(waitingTime)
|
||||
.resourceId("$packageName:id/signInEmailButton"),
|
||||
).waitForExists(waitingTime),
|
||||
)
|
||||
}
|
||||
|
|
|
@ -43,6 +43,6 @@ private fun assertSystemNotificationsView() {
|
|||
.waitForExists(waitingTime)
|
||||
assertTrue(
|
||||
mDevice.findObject(UiSelector().textContains("All ${TestHelper.appName} notifications"))
|
||||
.waitForExists(waitingTime)
|
||||
.waitForExists(waitingTime),
|
||||
)
|
||||
}
|
||||
|
|
|
@ -61,7 +61,7 @@ class TabDrawerRobot {
|
|||
fun verifyBrowserTabsTrayURL(url: String) {
|
||||
mDevice.waitNotNull(
|
||||
Until.findObject(By.res("$packageName:id/mozac_browser_tabstray_url")),
|
||||
waitingTime
|
||||
waitingTime,
|
||||
)
|
||||
onView(withId(R.id.mozac_browser_tabstray_url))
|
||||
.check(matches(withText(containsString(url))))
|
||||
|
@ -70,10 +70,13 @@ class TabDrawerRobot {
|
|||
fun verifyNormalBrowsingButtonIsDisplayed() = assertNormalBrowsingButton()
|
||||
fun verifyNormalBrowsingButtonIsSelected(isSelected: Boolean) =
|
||||
assertNormalBrowsingButtonIsSelected(isSelected)
|
||||
|
||||
fun verifyPrivateBrowsingButtonIsSelected(isSelected: Boolean) =
|
||||
assertPrivateBrowsingButtonIsSelected(isSelected)
|
||||
|
||||
fun verifySyncedTabsButtonIsSelected(isSelected: Boolean) =
|
||||
assertSyncedTabsButtonIsSelected(isSelected)
|
||||
|
||||
fun verifyExistingOpenTabs(vararg titles: String) = assertExistingOpenTabs(*titles)
|
||||
fun verifyCloseTabsButton(title: String) = assertCloseTabsButton(title)
|
||||
|
||||
|
@ -127,8 +130,8 @@ class TabDrawerRobot {
|
|||
fun verifySnackBarText(expectedText: String) {
|
||||
assertTrue(
|
||||
mDevice.findObject(
|
||||
UiSelector().text(expectedText)
|
||||
).waitForExists(waitingTime)
|
||||
UiSelector().text(expectedText),
|
||||
).waitForExists(waitingTime),
|
||||
)
|
||||
}
|
||||
|
||||
|
@ -137,7 +140,7 @@ class TabDrawerRobot {
|
|||
mDevice.findObject(
|
||||
UiSelector()
|
||||
.resourceId("$packageName:id/snackbar_btn")
|
||||
.text(expectedText)
|
||||
.text(expectedText),
|
||||
)
|
||||
|
||||
snackBarButton.waitForExists(waitingTime)
|
||||
|
@ -147,21 +150,22 @@ class TabDrawerRobot {
|
|||
fun verifyTabMediaControlButtonState(action: String) {
|
||||
try {
|
||||
mDevice.findObject(
|
||||
UiSelector().resourceId("$packageName:id/tab_tray_empty_view")
|
||||
UiSelector().resourceId("$packageName:id/tab_tray_empty_view"),
|
||||
).waitUntilGone(waitingTime)
|
||||
|
||||
mDevice.findObject(
|
||||
UiSelector().resourceId("$packageName:id/tab_tray_grid_item")
|
||||
UiSelector().resourceId("$packageName:id/tab_tray_grid_item"),
|
||||
).waitForExists(waitingTime)
|
||||
|
||||
mDevice.findObject(
|
||||
UiSelector()
|
||||
.resourceId("$packageName:id/play_pause_button")
|
||||
.descriptionContains(action)
|
||||
.descriptionContains(action),
|
||||
).waitForExists(waitingTime)
|
||||
|
||||
assertTrue(
|
||||
mDevice.findObject(UiSelector().descriptionContains(action)).waitForExists(waitingTime)
|
||||
mDevice.findObject(UiSelector().descriptionContains(action))
|
||||
.waitForExists(waitingTime),
|
||||
)
|
||||
} catch (e: AssertionFailedError) {
|
||||
// In some cases the tab media button isn't updated after performing an action on it
|
||||
|
@ -171,7 +175,7 @@ class TabDrawerRobot {
|
|||
mDevice.pressBack()
|
||||
mDevice.findObject(
|
||||
UiSelector()
|
||||
.resourceId("$packageName:id/toolbar")
|
||||
.resourceId("$packageName:id/toolbar"),
|
||||
).waitForExists(waitingTime)
|
||||
|
||||
browserScreen {
|
||||
|
@ -180,21 +184,22 @@ class TabDrawerRobot {
|
|||
tabMediaControlButton().click()
|
||||
|
||||
mDevice.findObject(
|
||||
UiSelector().resourceId("$packageName:id/tab_tray_empty_view")
|
||||
UiSelector().resourceId("$packageName:id/tab_tray_empty_view"),
|
||||
).waitUntilGone(waitingTime)
|
||||
|
||||
mDevice.findObject(
|
||||
UiSelector().resourceId("$packageName:id/tab_tray_grid_item")
|
||||
UiSelector().resourceId("$packageName:id/tab_tray_grid_item"),
|
||||
).waitForExists(waitingTime)
|
||||
|
||||
mDevice.findObject(
|
||||
UiSelector()
|
||||
.resourceId("$packageName:id/play_pause_button")
|
||||
.descriptionContains(action)
|
||||
.descriptionContains(action),
|
||||
).waitForExists(waitingTime)
|
||||
|
||||
assertTrue(
|
||||
mDevice.findObject(UiSelector().descriptionContains(action)).waitForExists(waitingTime)
|
||||
mDevice.findObject(UiSelector().descriptionContains(action))
|
||||
.waitForExists(waitingTime),
|
||||
)
|
||||
}
|
||||
}
|
||||
|
@ -205,9 +210,9 @@ class TabDrawerRobot {
|
|||
Until.findObjects(
|
||||
By
|
||||
.res("$packageName:id/play_pause_button")
|
||||
.descContains(action)
|
||||
.descContains(action),
|
||||
),
|
||||
waitingTime
|
||||
waitingTime,
|
||||
)
|
||||
|
||||
tabMediaControlButton().click()
|
||||
|
@ -235,7 +240,7 @@ class TabDrawerRobot {
|
|||
fun longClickTab(title: String) {
|
||||
mDevice.waitNotNull(
|
||||
findObject(text(title)),
|
||||
waitingTime
|
||||
waitingTime,
|
||||
)
|
||||
|
||||
tab(title).perform(longClick())
|
||||
|
@ -244,7 +249,7 @@ class TabDrawerRobot {
|
|||
fun createCollection(
|
||||
vararg tabTitles: String,
|
||||
collectionName: String,
|
||||
firstCollection: Boolean = true
|
||||
firstCollection: Boolean = true,
|
||||
) {
|
||||
tabDrawer {
|
||||
clickSelectTabsOption()
|
||||
|
@ -252,8 +257,9 @@ class TabDrawerRobot {
|
|||
selectTab(tab, tabTitles.indexOf(tab) + 1)
|
||||
}
|
||||
}.clickSaveCollection {
|
||||
if (!firstCollection)
|
||||
if (!firstCollection) {
|
||||
clickAddNewCollection()
|
||||
}
|
||||
typeCollectionNameAndSave(collectionName)
|
||||
}
|
||||
}
|
||||
|
@ -261,7 +267,7 @@ class TabDrawerRobot {
|
|||
fun verifyTabsMultiSelectionCounter(numOfTabs: Int) {
|
||||
assertTrue(
|
||||
mDevice.findObject(UiSelector().text("$numOfTabs selected"))
|
||||
.waitForExists(waitingTime)
|
||||
.waitForExists(waitingTime),
|
||||
)
|
||||
}
|
||||
|
||||
|
@ -279,7 +285,7 @@ class TabDrawerRobot {
|
|||
tabsCounter().click()
|
||||
mDevice.waitNotNull(
|
||||
Until.findObject(By.res("$packageName:id/tab_layout")),
|
||||
waitingTime
|
||||
waitingTime,
|
||||
)
|
||||
|
||||
TabDrawerRobot().interact()
|
||||
|
@ -290,7 +296,7 @@ class TabDrawerRobot {
|
|||
mDevice.waitForIdle(waitingTime)
|
||||
|
||||
onView(withId(R.id.handle)).perform(
|
||||
click()
|
||||
click(),
|
||||
)
|
||||
BrowserRobot().interact()
|
||||
return BrowserRobot.Transition()
|
||||
|
@ -332,7 +338,10 @@ class TabDrawerRobot {
|
|||
return BrowserRobot.Transition()
|
||||
}
|
||||
|
||||
fun openTabFromGroup(title: String, interact: BrowserRobot.() -> Unit): BrowserRobot.Transition {
|
||||
fun openTabFromGroup(
|
||||
title: String,
|
||||
interact: BrowserRobot.() -> Unit,
|
||||
): BrowserRobot.Transition {
|
||||
val tab = UiScrollable(UiSelector().resourceId("$packageName:id/tab_group_list"))
|
||||
.setAsHorizontalList()
|
||||
.getChildByText(
|
||||
|
@ -340,7 +349,7 @@ class TabDrawerRobot {
|
|||
.resourceId("$packageName:id/mozac_browser_tabstray_title")
|
||||
.textContains(title),
|
||||
title,
|
||||
true
|
||||
true,
|
||||
)
|
||||
tab.click()
|
||||
|
||||
|
@ -357,20 +366,22 @@ class TabDrawerRobot {
|
|||
}
|
||||
|
||||
fun advanceToHalfExpandedState(interact: TabDrawerRobot.() -> Unit): Transition {
|
||||
onView(withId(R.id.tab_wrapper)).perform(object : ViewAction {
|
||||
override fun getDescription(): String {
|
||||
return "Advance a BottomSheetBehavior to STATE_HALF_EXPANDED"
|
||||
}
|
||||
onView(withId(R.id.tab_wrapper)).perform(
|
||||
object : ViewAction {
|
||||
override fun getDescription(): String {
|
||||
return "Advance a BottomSheetBehavior to STATE_HALF_EXPANDED"
|
||||
}
|
||||
|
||||
override fun getConstraints(): Matcher<View> {
|
||||
return ViewMatchers.isAssignableFrom(View::class.java)
|
||||
}
|
||||
override fun getConstraints(): Matcher<View> {
|
||||
return ViewMatchers.isAssignableFrom(View::class.java)
|
||||
}
|
||||
|
||||
override fun perform(uiController: UiController?, view: View?) {
|
||||
val behavior = BottomSheetBehavior.from(view!!)
|
||||
behavior.state = BottomSheetBehavior.STATE_HALF_EXPANDED
|
||||
}
|
||||
})
|
||||
override fun perform(uiController: UiController?, view: View?) {
|
||||
val behavior = BottomSheetBehavior.from(view!!)
|
||||
behavior.state = BottomSheetBehavior.STATE_HALF_EXPANDED
|
||||
}
|
||||
},
|
||||
)
|
||||
TabDrawerRobot().interact()
|
||||
return Transition()
|
||||
}
|
||||
|
@ -380,19 +391,21 @@ class TabDrawerRobot {
|
|||
var behavior: BottomSheetBehavior<*>? = null
|
||||
|
||||
// Null check here since it's possible that the view is already animated away from the screen.
|
||||
onView(withId(R.id.tab_wrapper))?.perform(object : ViewAction {
|
||||
override fun getDescription(): String {
|
||||
return "Postpone actions to after the BottomSheetBehavior has settled"
|
||||
}
|
||||
onView(withId(R.id.tab_wrapper))?.perform(
|
||||
object : ViewAction {
|
||||
override fun getDescription(): String {
|
||||
return "Postpone actions to after the BottomSheetBehavior has settled"
|
||||
}
|
||||
|
||||
override fun getConstraints(): Matcher<View> {
|
||||
return ViewMatchers.isAssignableFrom(View::class.java)
|
||||
}
|
||||
override fun getConstraints(): Matcher<View> {
|
||||
return ViewMatchers.isAssignableFrom(View::class.java)
|
||||
}
|
||||
|
||||
override fun perform(uiController: UiController?, view: View?) {
|
||||
behavior = BottomSheetBehavior.from(view!!)
|
||||
}
|
||||
})
|
||||
override fun perform(uiController: UiController?, view: View?) {
|
||||
behavior = BottomSheetBehavior.from(view!!)
|
||||
}
|
||||
},
|
||||
)
|
||||
|
||||
behavior?.let {
|
||||
runWithIdleRes(BottomSheetBehaviorStateIdlingResource(it)) {
|
||||
|
@ -405,12 +418,11 @@ class TabDrawerRobot {
|
|||
|
||||
fun openRecentlyClosedTabs(interact: RecentlyClosedTabsRobot.() -> Unit):
|
||||
RecentlyClosedTabsRobot.Transition {
|
||||
|
||||
threeDotMenu().click()
|
||||
|
||||
mDevice.waitNotNull(
|
||||
Until.findObject(text("Recently closed tabs")),
|
||||
waitingTime
|
||||
waitingTime,
|
||||
)
|
||||
|
||||
val menuRecentlyClosedTabs = mDevice.findObject(text("Recently closed tabs"))
|
||||
|
@ -440,25 +452,28 @@ private fun tabMediaControlButton() =
|
|||
|
||||
private fun closeTabButton() =
|
||||
mDevice.findObject(UiSelector().resourceId("$packageName:id/mozac_browser_tabstray_close"))
|
||||
|
||||
private fun assertCloseTabsButton(title: String) =
|
||||
assertTrue(
|
||||
mDevice.findObject(
|
||||
UiSelector()
|
||||
.resourceId("$packageName:id/mozac_browser_tabstray_close")
|
||||
.descriptionContains("Close tab $title")
|
||||
).waitForExists(waitingTime)
|
||||
.descriptionContains("Close tab $title"),
|
||||
).waitForExists(waitingTime),
|
||||
)
|
||||
|
||||
private fun normalBrowsingButton() = onView(
|
||||
anyOf(
|
||||
withContentDescription(containsString("open tabs. Tap to switch tabs.")),
|
||||
withContentDescription(containsString("open tab. Tap to switch tabs."))
|
||||
)
|
||||
withContentDescription(containsString("open tab. Tap to switch tabs.")),
|
||||
),
|
||||
)
|
||||
|
||||
private fun privateBrowsingButton() = onView(withContentDescription("Private tabs"))
|
||||
private fun syncedTabsButton() = onView(withContentDescription("Synced tabs"))
|
||||
private fun newTabButton() = mDevice.findObject(UiSelector().resourceId("$packageName:id/new_tab_button"))
|
||||
private fun newTabButton() =
|
||||
mDevice.findObject(UiSelector().resourceId("$packageName:id/new_tab_button"))
|
||||
|
||||
private fun threeDotMenu() = onView(withId(R.id.tab_tray_overflow))
|
||||
|
||||
private fun assertExistingOpenTabs(vararg tabTitles: String) {
|
||||
|
@ -469,7 +484,7 @@ private fun assertExistingOpenTabs(vararg tabTitles: String) {
|
|||
tabsList
|
||||
.getChildByText(UiSelector().text(title), title, true)
|
||||
assertTrue(
|
||||
tabItem(title).waitForExists(waitingTimeLong)
|
||||
tabItem(title).waitForExists(waitingTimeLong),
|
||||
)
|
||||
}
|
||||
}
|
||||
|
@ -477,13 +492,13 @@ private fun assertExistingOpenTabs(vararg tabTitles: String) {
|
|||
|
||||
private fun assertExistingTabList() {
|
||||
mDevice.findObject(
|
||||
UiSelector().resourceId("$packageName:id/tabsTray")
|
||||
UiSelector().resourceId("$packageName:id/tabsTray"),
|
||||
).waitForExists(waitingTime)
|
||||
|
||||
assertTrue(
|
||||
mDevice.findObject(
|
||||
UiSelector().resourceId("$packageName:id/tab_item")
|
||||
).waitForExists(waitingTime)
|
||||
UiSelector().resourceId("$packageName:id/tab_item"),
|
||||
).waitForExists(waitingTime),
|
||||
)
|
||||
}
|
||||
|
||||
|
@ -491,32 +506,32 @@ private fun assertNoOpenTabsInNormalBrowsing() =
|
|||
onView(
|
||||
allOf(
|
||||
withId(R.id.tab_tray_empty_view),
|
||||
withText(R.string.no_open_tabs_description)
|
||||
)
|
||||
withText(R.string.no_open_tabs_description),
|
||||
),
|
||||
).check(matches(withEffectiveVisibility(ViewMatchers.Visibility.VISIBLE)))
|
||||
|
||||
private fun assertNoOpenTabsInPrivateBrowsing() =
|
||||
onView(
|
||||
allOf(
|
||||
withId(R.id.tab_tray_empty_view),
|
||||
withText(R.string.no_private_tabs_description)
|
||||
)
|
||||
withText(R.string.no_private_tabs_description),
|
||||
),
|
||||
).check(matches(withEffectiveVisibility(ViewMatchers.Visibility.VISIBLE)))
|
||||
|
||||
private fun assertNormalBrowsingNewTabButton() =
|
||||
onView(
|
||||
allOf(
|
||||
withId(R.id.new_tab_button),
|
||||
withContentDescription(R.string.add_tab)
|
||||
)
|
||||
withContentDescription(R.string.add_tab),
|
||||
),
|
||||
).check(matches(withEffectiveVisibility(ViewMatchers.Visibility.VISIBLE)))
|
||||
|
||||
private fun assertPrivateBrowsingNewTabButton() =
|
||||
onView(
|
||||
allOf(
|
||||
withId(R.id.new_tab_button),
|
||||
withContentDescription(R.string.add_private_tab)
|
||||
)
|
||||
withContentDescription(R.string.add_private_tab),
|
||||
),
|
||||
).check(matches(withEffectiveVisibility(ViewMatchers.Visibility.VISIBLE)))
|
||||
|
||||
private fun assertSelectTabsButton() =
|
||||
|
@ -587,19 +602,21 @@ private fun assertSyncedTabsButtonIsSelected(isSelected: Boolean) {
|
|||
private fun assertTabThumbnail() {
|
||||
assertTrue(
|
||||
mDevice.findObject(
|
||||
UiSelector().resourceId("$packageName:id/mozac_browser_tabstray_thumbnail")
|
||||
).waitForExists(waitingTime)
|
||||
UiSelector().resourceId("$packageName:id/mozac_browser_tabstray_thumbnail"),
|
||||
).waitForExists(waitingTime),
|
||||
)
|
||||
}
|
||||
private val tabsList = UiScrollable(UiSelector().className("androidx.recyclerview.widget.RecyclerView"))
|
||||
|
||||
private val tabsList =
|
||||
UiScrollable(UiSelector().className("androidx.recyclerview.widget.RecyclerView"))
|
||||
|
||||
// This Espresso tab selector is used for actions that UIAutomator doesn't handle very well: swipe and long-tap
|
||||
private fun tab(title: String) =
|
||||
onView(
|
||||
allOf(
|
||||
withId(R.id.mozac_browser_tabstray_title),
|
||||
withText(title)
|
||||
)
|
||||
withText(title),
|
||||
),
|
||||
)
|
||||
|
||||
// This tab selector is used for actions that involve waiting and asserting the existence of the view
|
||||
|
@ -607,7 +624,7 @@ private fun tabItem(title: String) =
|
|||
mDevice.findObject(
|
||||
UiSelector()
|
||||
.resourceId("$packageName:id/tab_item")
|
||||
.childSelector(UiSelector().text(title))
|
||||
.childSelector(UiSelector().text(title)),
|
||||
)
|
||||
|
||||
private fun tabsCounter() = onView(withId(R.id.tab_button))
|
||||
|
@ -618,16 +635,16 @@ private fun tabsSettingsButton() =
|
|||
onView(
|
||||
allOf(
|
||||
withId(R.id.simple_text),
|
||||
withText(R.string.tab_tray_menu_tab_settings)
|
||||
)
|
||||
withText(R.string.tab_tray_menu_tab_settings),
|
||||
),
|
||||
)
|
||||
|
||||
private fun recentlyClosedTabsButton() =
|
||||
onView(
|
||||
allOf(
|
||||
withId(R.id.simple_text),
|
||||
withText(R.string.tab_tray_menu_recently_closed)
|
||||
)
|
||||
withText(R.string.tab_tray_menu_recently_closed),
|
||||
),
|
||||
)
|
||||
|
||||
private fun visibleOrGone(visibility: Boolean) =
|
||||
|
|
|
@ -85,7 +85,9 @@ class ThreeDotMenuMainRobot {
|
|||
expandMenu()
|
||||
if (state) {
|
||||
desktopSiteButton().check(matches(isChecked()))
|
||||
} else desktopSiteButton().check(matches(not(isChecked())))
|
||||
} else {
|
||||
desktopSiteButton().check(matches(not(isChecked())))
|
||||
}
|
||||
}
|
||||
|
||||
fun verifyPageThreeDotMainMenuItems() {
|
||||
|
@ -128,7 +130,7 @@ class ThreeDotMenuMainRobot {
|
|||
try {
|
||||
assertTrue(
|
||||
"Addon not listed in the Add-ons menu",
|
||||
mDevice.findObject(UiSelector().text(addonName)).waitForExists(waitingTime)
|
||||
mDevice.findObject(UiSelector().text(addonName)).waitForExists(waitingTime),
|
||||
)
|
||||
break
|
||||
} catch (e: AssertionError) {
|
||||
|
@ -148,7 +150,7 @@ class ThreeDotMenuMainRobot {
|
|||
class Transition {
|
||||
fun openSettings(
|
||||
localizedText: String = getStringResource(R.string.browser_menu_settings),
|
||||
interact: SettingsRobot.() -> Unit
|
||||
interact: SettingsRobot.() -> Unit,
|
||||
): SettingsRobot.Transition {
|
||||
// We require one swipe to display the full size 3-dot menu. On smaller devices
|
||||
// such as the Pixel 2, we require two swipes to display the "Settings" menu item
|
||||
|
@ -215,19 +217,18 @@ class ThreeDotMenuMainRobot {
|
|||
}
|
||||
|
||||
fun openCustomizeHome(interact: SettingsSubMenuHomepageRobot.() -> Unit): SettingsSubMenuHomepageRobot.Transition {
|
||||
|
||||
mDevice.wait(
|
||||
Until
|
||||
.findObject(
|
||||
By.textContains("$packageName:id/browser_menu_customize_home_1")
|
||||
By.textContains("$packageName:id/browser_menu_customize_home_1"),
|
||||
),
|
||||
waitingTime
|
||||
waitingTime,
|
||||
)
|
||||
|
||||
customizeHomeButton().click()
|
||||
|
||||
mDevice.findObject(
|
||||
UiSelector().resourceId("$packageName:id/recycler_view")
|
||||
UiSelector().resourceId("$packageName:id/recycler_view"),
|
||||
).waitForExists(waitingTime)
|
||||
|
||||
SettingsSubMenuHomepageRobot().interact()
|
||||
|
@ -418,8 +419,8 @@ private fun customizeHomeButton() =
|
|||
onView(
|
||||
allOf(
|
||||
withId(R.id.text),
|
||||
withText(R.string.browser_menu_customize_home_1)
|
||||
)
|
||||
withText(R.string.browser_menu_customize_home_1),
|
||||
),
|
||||
)
|
||||
|
||||
private fun assertCustomizeHomeButton() =
|
||||
|
@ -495,8 +496,8 @@ private fun assertFindInPageButton() = findInPageButton()
|
|||
private fun whatsNewButton() = onView(
|
||||
allOf(
|
||||
withText("What’s new"),
|
||||
withEffectiveVisibility(Visibility.VISIBLE)
|
||||
)
|
||||
withEffectiveVisibility(Visibility.VISIBLE),
|
||||
),
|
||||
)
|
||||
|
||||
private fun assertWhatsNewButton() = whatsNewButton()
|
||||
|
@ -534,18 +535,17 @@ private fun assertAddToTopSitesButton() {
|
|||
onView(withId(R.id.mozac_browser_menu_recyclerView))
|
||||
.perform(
|
||||
RecyclerViewActions.scrollTo<RecyclerView.ViewHolder>(
|
||||
hasDescendant(withText(R.string.browser_menu_add_to_shortcuts))
|
||||
)
|
||||
hasDescendant(withText(R.string.browser_menu_add_to_shortcuts)),
|
||||
),
|
||||
).check(matches(withEffectiveVisibility(Visibility.VISIBLE)))
|
||||
}
|
||||
|
||||
private fun assertRemoveFromShortcutsButton() {
|
||||
|
||||
onView(withId(R.id.mozac_browser_menu_recyclerView))
|
||||
.perform(
|
||||
RecyclerViewActions.scrollTo<RecyclerView.ViewHolder>(
|
||||
hasDescendant(withText(R.string.browser_menu_settings))
|
||||
)
|
||||
hasDescendant(withText(R.string.browser_menu_settings)),
|
||||
),
|
||||
).check(matches(withEffectiveVisibility(Visibility.VISIBLE)))
|
||||
}
|
||||
|
||||
|
@ -556,8 +556,8 @@ private fun assertAddToMobileHome() {
|
|||
onView(withId(R.id.mozac_browser_menu_recyclerView))
|
||||
.perform(
|
||||
RecyclerViewActions.scrollTo<RecyclerView.ViewHolder>(
|
||||
hasDescendant(withText(R.string.browser_menu_add_to_homescreen))
|
||||
)
|
||||
hasDescendant(withText(R.string.browser_menu_add_to_homescreen)),
|
||||
),
|
||||
).check(matches(withEffectiveVisibility(Visibility.VISIBLE)))
|
||||
}
|
||||
|
||||
|
@ -573,8 +573,8 @@ private fun openInAppButton() =
|
|||
onView(
|
||||
allOf(
|
||||
withText("Open in app"),
|
||||
withEffectiveVisibility(Visibility.VISIBLE)
|
||||
)
|
||||
withEffectiveVisibility(Visibility.VISIBLE),
|
||||
),
|
||||
)
|
||||
|
||||
private fun downloadsButton() = onView(withText(R.string.library_downloads))
|
||||
|
@ -594,7 +594,7 @@ private fun shareAllTabsButton() =
|
|||
private fun assertShareAllTabsButton() {
|
||||
shareAllTabsButton()
|
||||
.check(
|
||||
matches(isDisplayed())
|
||||
matches(isDisplayed()),
|
||||
)
|
||||
}
|
||||
|
||||
|
|
|
@ -17,7 +17,7 @@ class DebugFenixApplication : FenixApplication() {
|
|||
if (!AppWatcher.isInstalled) {
|
||||
AppWatcher.manualInstall(
|
||||
application = application,
|
||||
watchersToInstall = AppWatcher.appDefaultWatchers(application)
|
||||
watchersToInstall = AppWatcher.appDefaultWatchers(application),
|
||||
)
|
||||
}
|
||||
|
||||
|
|
|
@ -18,7 +18,7 @@ import org.mozilla.fenix.ext.isOnline
|
|||
import java.lang.ref.WeakReference
|
||||
|
||||
class AppRequestInterceptor(
|
||||
private val context: Context
|
||||
private val context: Context,
|
||||
) : RequestInterceptor {
|
||||
|
||||
private var navController: WeakReference<NavController>? = null
|
||||
|
@ -35,9 +35,8 @@ class AppRequestInterceptor(
|
|||
isSameDomain: Boolean,
|
||||
isRedirect: Boolean,
|
||||
isDirectNavigation: Boolean,
|
||||
isSubframeRequest: Boolean
|
||||
isSubframeRequest: Boolean,
|
||||
): RequestInterceptor.InterceptionResponse? {
|
||||
|
||||
interceptAmoRequest(uri, isSameDomain, hasUserGesture)?.let { response ->
|
||||
return response
|
||||
}
|
||||
|
@ -51,14 +50,14 @@ class AppRequestInterceptor(
|
|||
isSameDomain,
|
||||
isRedirect,
|
||||
isDirectNavigation,
|
||||
isSubframeRequest
|
||||
isSubframeRequest,
|
||||
)
|
||||
}
|
||||
|
||||
override fun onErrorRequest(
|
||||
session: EngineSession,
|
||||
errorType: ErrorType,
|
||||
uri: String?
|
||||
uri: String?,
|
||||
): RequestInterceptor.ErrorResponse? {
|
||||
val improvedErrorType = improveErrorType(errorType)
|
||||
val riskLevel = getRiskLevel(improvedErrorType)
|
||||
|
@ -71,7 +70,7 @@ class AppRequestInterceptor(
|
|||
uri = uri,
|
||||
htmlResource = riskLevel.htmlRes,
|
||||
titleOverride = { type -> getErrorPageTitle(context, type) },
|
||||
descriptionOverride = { type -> getErrorPageDescription(context, type) }
|
||||
descriptionOverride = { type -> getErrorPageDescription(context, type) },
|
||||
)
|
||||
|
||||
return RequestInterceptor.ErrorResponse(errorPageUri)
|
||||
|
@ -87,20 +86,18 @@ class AppRequestInterceptor(
|
|||
private fun interceptAmoRequest(
|
||||
uri: String,
|
||||
isSameDomain: Boolean,
|
||||
hasUserGesture: Boolean
|
||||
hasUserGesture: Boolean,
|
||||
): RequestInterceptor.InterceptionResponse? {
|
||||
// First we execute a quick check to see if this is a request we're interested in i.e. a
|
||||
// request triggered by the user and coming from AMO.
|
||||
if (hasUserGesture && isSameDomain && uri.startsWith(AMO_BASE_URL)) {
|
||||
|
||||
// Check if this is a request to install an add-on.
|
||||
val matchResult = AMO_INSTALL_URL_REGEX.toRegex().find(uri)
|
||||
if (matchResult != null) {
|
||||
|
||||
// Navigate and trigger add-on installation.
|
||||
matchResult.groupValues.getOrNull(1)?.let { addonId ->
|
||||
navController?.get()?.navigate(
|
||||
NavGraphDirections.actionGlobalAddonsManagementFragment(addonId)
|
||||
NavGraphDirections.actionGlobalAddonsManagementFragment(addonId),
|
||||
)
|
||||
|
||||
// We've redirected to the add-ons management fragment, skip original request.
|
||||
|
@ -152,16 +149,19 @@ class AppRequestInterceptor(
|
|||
ErrorType.ERROR_NO_INTERNET,
|
||||
ErrorType.ERROR_HTTPS_ONLY,
|
||||
ErrorType.ERROR_BAD_HSTS_CERT,
|
||||
ErrorType.ERROR_UNKNOWN_PROTOCOL -> RiskLevel.Low
|
||||
ErrorType.ERROR_UNKNOWN_PROTOCOL,
|
||||
-> RiskLevel.Low
|
||||
|
||||
ErrorType.ERROR_SECURITY_BAD_CERT,
|
||||
ErrorType.ERROR_SECURITY_SSL,
|
||||
ErrorType.ERROR_PORT_BLOCKED -> RiskLevel.Medium
|
||||
ErrorType.ERROR_PORT_BLOCKED,
|
||||
-> RiskLevel.Medium
|
||||
|
||||
ErrorType.ERROR_SAFEBROWSING_HARMFUL_URI,
|
||||
ErrorType.ERROR_SAFEBROWSING_MALWARE_URI,
|
||||
ErrorType.ERROR_SAFEBROWSING_PHISHING_URI,
|
||||
ErrorType.ERROR_SAFEBROWSING_UNWANTED_URI -> RiskLevel.High
|
||||
ErrorType.ERROR_SAFEBROWSING_UNWANTED_URI,
|
||||
-> RiskLevel.High
|
||||
}
|
||||
|
||||
private fun getErrorPageTitle(context: Context, type: ErrorType): String? {
|
||||
|
|
|
@ -37,5 +37,5 @@ enum class BrowserDirection(@IdRes val fragmentId: Int) {
|
|||
FromAddonPermissionsDetailsFragment(R.id.addonPermissionsDetailFragment),
|
||||
FromLoginDetailFragment(R.id.loginDetailFragment),
|
||||
FromTabsTray(R.id.tabsTrayFragment),
|
||||
FromRecentlyClosed(R.id.recentlyClosedFragment)
|
||||
FromRecentlyClosed(R.id.recentlyClosedFragment),
|
||||
}
|
||||
|
|
|
@ -8,7 +8,8 @@ enum class ReleaseChannel {
|
|||
Debug,
|
||||
Nightly,
|
||||
Beta,
|
||||
Release;
|
||||
Release,
|
||||
;
|
||||
|
||||
val isReleased: Boolean
|
||||
get() = when (this) {
|
||||
|
|
|
@ -103,6 +103,7 @@ object FeatureFlags {
|
|||
* Enables receiving from the messaging framework.
|
||||
*/
|
||||
const val messagingFeature = true
|
||||
|
||||
/**
|
||||
* Enables compose on the tabs tray items.
|
||||
*/
|
||||
|
|
|
@ -159,11 +159,11 @@ open class FenixApplication : LocaleAwareApplication(), Provider {
|
|||
configuration = Configuration(
|
||||
channel = BuildConfig.BUILD_TYPE,
|
||||
httpClient = ConceptFetchHttpUploader(
|
||||
lazy(LazyThreadSafetyMode.NONE) { components.core.client }
|
||||
)
|
||||
lazy(LazyThreadSafetyMode.NONE) { components.core.client },
|
||||
),
|
||||
),
|
||||
uploadEnabled = telemetryEnabled,
|
||||
buildInfo = GleanBuildInfo.buildInfo
|
||||
buildInfo = GleanBuildInfo.buildInfo,
|
||||
)
|
||||
|
||||
// We avoid blocking the main thread on startup by setting startup metrics on the background thread.
|
||||
|
@ -275,15 +275,15 @@ open class FenixApplication : LocaleAwareApplication(), Provider {
|
|||
components.core.topSitesStorage.getTopSites(
|
||||
totalSites = components.settings.topSitesMaxLimit,
|
||||
frecencyConfig = TopSitesFrecencyConfig(
|
||||
FrecencyThresholdOption.SKIP_ONE_TIME_PAGES
|
||||
FrecencyThresholdOption.SKIP_ONE_TIME_PAGES,
|
||||
) {
|
||||
!Uri.parse(it.url)
|
||||
.containsQueryParameters(components.settings.frecencyFilterQuery)
|
||||
},
|
||||
providerConfig = TopSitesProviderConfig(
|
||||
showProviderTopSites = components.settings.showContileFeature,
|
||||
maxThreshold = TOP_SITES_PROVIDER_MAX_THRESHOLD
|
||||
)
|
||||
maxThreshold = TOP_SITES_PROVIDER_MAX_THRESHOLD,
|
||||
),
|
||||
)
|
||||
|
||||
// This service uses `historyStorage`, and so we can only touch it when we know
|
||||
|
@ -291,7 +291,7 @@ open class FenixApplication : LocaleAwareApplication(), Provider {
|
|||
// places library will be able to load, which requires first running Megazord.init().
|
||||
// The visual completeness tasks are scheduled after the Megazord.init() call.
|
||||
components.core.historyMetadataService.cleanup(
|
||||
System.currentTimeMillis() - Core.HISTORY_METADATA_MAX_AGE_IN_MS
|
||||
System.currentTimeMillis() - Core.HISTORY_METADATA_MAX_AGE_IN_MS,
|
||||
)
|
||||
}
|
||||
}
|
||||
|
@ -436,11 +436,13 @@ open class FenixApplication : LocaleAwareApplication(), Provider {
|
|||
}
|
||||
|
||||
private fun setupNimbusObserver(nimbus: Observable<NimbusInterface.Observer>) {
|
||||
nimbus.register(object : NimbusInterface.Observer {
|
||||
override fun onUpdatesApplied(updated: List<EnrolledExperiment>) {
|
||||
onNimbusStartupAndUpdate()
|
||||
}
|
||||
})
|
||||
nimbus.register(
|
||||
object : NimbusInterface.Observer {
|
||||
override fun onUpdatesApplied(updated: List<EnrolledExperiment>) {
|
||||
onNimbusStartupAndUpdate()
|
||||
}
|
||||
},
|
||||
)
|
||||
}
|
||||
|
||||
private fun onNimbusStartupAndUpdate() {
|
||||
|
@ -472,10 +474,10 @@ open class FenixApplication : LocaleAwareApplication(), Provider {
|
|||
message = "onTrimMemory()",
|
||||
data = mapOf(
|
||||
"level" to level.toString(),
|
||||
"main" to isMainProcess().toString()
|
||||
"main" to isMainProcess().toString(),
|
||||
),
|
||||
level = Breadcrumb.Level.INFO
|
||||
)
|
||||
level = Breadcrumb.Level.INFO,
|
||||
),
|
||||
)
|
||||
|
||||
runOnlyInMainProcess {
|
||||
|
@ -491,34 +493,34 @@ open class FenixApplication : LocaleAwareApplication(), Provider {
|
|||
when {
|
||||
settings.shouldUseLightTheme -> {
|
||||
AppCompatDelegate.setDefaultNightMode(
|
||||
AppCompatDelegate.MODE_NIGHT_NO
|
||||
AppCompatDelegate.MODE_NIGHT_NO,
|
||||
)
|
||||
}
|
||||
settings.shouldUseDarkTheme -> {
|
||||
AppCompatDelegate.setDefaultNightMode(
|
||||
AppCompatDelegate.MODE_NIGHT_YES
|
||||
AppCompatDelegate.MODE_NIGHT_YES,
|
||||
)
|
||||
}
|
||||
SDK_INT < Build.VERSION_CODES.P && settings.shouldUseAutoBatteryTheme -> {
|
||||
AppCompatDelegate.setDefaultNightMode(
|
||||
AppCompatDelegate.MODE_NIGHT_AUTO_BATTERY
|
||||
AppCompatDelegate.MODE_NIGHT_AUTO_BATTERY,
|
||||
)
|
||||
}
|
||||
SDK_INT >= Build.VERSION_CODES.P && settings.shouldFollowDeviceTheme -> {
|
||||
AppCompatDelegate.setDefaultNightMode(
|
||||
AppCompatDelegate.MODE_NIGHT_FOLLOW_SYSTEM
|
||||
AppCompatDelegate.MODE_NIGHT_FOLLOW_SYSTEM,
|
||||
)
|
||||
}
|
||||
// First run of app no default set, set the default to Follow System for 28+ and Normal Mode otherwise
|
||||
else -> {
|
||||
if (SDK_INT >= Build.VERSION_CODES.P) {
|
||||
AppCompatDelegate.setDefaultNightMode(
|
||||
AppCompatDelegate.MODE_NIGHT_FOLLOW_SYSTEM
|
||||
AppCompatDelegate.MODE_NIGHT_FOLLOW_SYSTEM,
|
||||
)
|
||||
settings.shouldFollowDeviceTheme = true
|
||||
} else {
|
||||
AppCompatDelegate.setDefaultNightMode(
|
||||
AppCompatDelegate.MODE_NIGHT_NO
|
||||
AppCompatDelegate.MODE_NIGHT_NO,
|
||||
)
|
||||
settings.shouldUseLightTheme = true
|
||||
}
|
||||
|
@ -542,13 +544,12 @@ open class FenixApplication : LocaleAwareApplication(), Provider {
|
|||
components.addonUpdater,
|
||||
onCrash = { exception ->
|
||||
components.analytics.crashReporter.submitCaughtException(exception)
|
||||
}
|
||||
},
|
||||
)
|
||||
WebExtensionSupport.initialize(
|
||||
components.core.engine,
|
||||
components.core.store,
|
||||
onNewTabOverride = {
|
||||
_, engineSession, url ->
|
||||
onNewTabOverride = { _, engineSession, url ->
|
||||
val shouldCreatePrivateSession =
|
||||
components.core.store.state.selectedTab?.content?.private
|
||||
?: components.settings.openLinksInAPrivateTab
|
||||
|
@ -557,22 +558,20 @@ open class FenixApplication : LocaleAwareApplication(), Provider {
|
|||
url = url,
|
||||
selectTab = true,
|
||||
engineSession = engineSession,
|
||||
private = shouldCreatePrivateSession
|
||||
private = shouldCreatePrivateSession,
|
||||
)
|
||||
},
|
||||
onCloseTabOverride = {
|
||||
_, sessionId ->
|
||||
onCloseTabOverride = { _, sessionId ->
|
||||
components.useCases.tabsUseCases.removeTab(sessionId)
|
||||
},
|
||||
onSelectTabOverride = {
|
||||
_, sessionId ->
|
||||
onSelectTabOverride = { _, sessionId ->
|
||||
components.useCases.tabsUseCases.selectTab(sessionId)
|
||||
},
|
||||
onExtensionsLoaded = { extensions ->
|
||||
components.addonUpdater.registerForFutureUpdates(extensions)
|
||||
subscribeForNewAddonsIfNeeded(components.supportedAddonsChecker, extensions)
|
||||
},
|
||||
onUpdatePermissionRequest = components.addonUpdater::onUpdatePermissionRequest
|
||||
onUpdatePermissionRequest = components.addonUpdater::onUpdatePermissionRequest,
|
||||
)
|
||||
} catch (e: UnsupportedOperationException) {
|
||||
Logger.error("Failed to initialize web extension support", e)
|
||||
|
@ -582,7 +581,7 @@ open class FenixApplication : LocaleAwareApplication(), Provider {
|
|||
@VisibleForTesting
|
||||
internal fun subscribeForNewAddonsIfNeeded(
|
||||
checker: DefaultSupportedAddonsChecker,
|
||||
installedExtensions: List<WebExtension>
|
||||
installedExtensions: List<WebExtension>,
|
||||
) {
|
||||
val hasUnsupportedAddons = installedExtensions.any { it.isUnsupported() }
|
||||
if (hasUnsupportedAddons) {
|
||||
|
@ -608,7 +607,7 @@ open class FenixApplication : LocaleAwareApplication(), Provider {
|
|||
browserStore: BrowserStore,
|
||||
settings: Settings,
|
||||
browsersCache: BrowsersCache = BrowsersCache,
|
||||
mozillaProductDetector: MozillaProductDetector = MozillaProductDetector
|
||||
mozillaProductDetector: MozillaProductDetector = MozillaProductDetector,
|
||||
) {
|
||||
setPreferenceMetrics(settings)
|
||||
with(Metrics) {
|
||||
|
@ -617,7 +616,7 @@ open class FenixApplication : LocaleAwareApplication(), Provider {
|
|||
when (Config.channel.isMozillaOnline) {
|
||||
true -> "MozillaOnline"
|
||||
false -> "Mozilla"
|
||||
}
|
||||
},
|
||||
)
|
||||
|
||||
defaultBrowser.set(browsersCache.all(applicationContext).isDefaultBrowser)
|
||||
|
@ -631,7 +630,11 @@ open class FenixApplication : LocaleAwareApplication(), Provider {
|
|||
TopSites.contextId.set(UUID.fromString(settings.contileContextId))
|
||||
}
|
||||
|
||||
mozillaProducts.set(mozillaProductDetector.getInstalledMozillaProducts(applicationContext))
|
||||
mozillaProducts.set(
|
||||
mozillaProductDetector.getInstalledMozillaProducts(
|
||||
applicationContext,
|
||||
),
|
||||
)
|
||||
|
||||
adjustCampaign.set(settings.adjustCampaignId)
|
||||
adjustAdGroup.set(settings.adjustAdGroup)
|
||||
|
@ -680,7 +683,7 @@ open class FenixApplication : LocaleAwareApplication(), Provider {
|
|||
when (settings.toolbarPosition) {
|
||||
ToolbarPosition.BOTTOM -> CustomizationFragment.Companion.Position.BOTTOM.name
|
||||
ToolbarPosition.TOP -> CustomizationFragment.Companion.Position.TOP.name
|
||||
}
|
||||
},
|
||||
)
|
||||
|
||||
tabViewSetting.set(settings.getTabViewPingString())
|
||||
|
@ -725,7 +728,7 @@ open class FenixApplication : LocaleAwareApplication(), Provider {
|
|||
|
||||
@Suppress("ComplexMethod")
|
||||
private fun setPreferenceMetrics(
|
||||
settings: Settings
|
||||
settings: Settings,
|
||||
) {
|
||||
with(Preferences) {
|
||||
searchSuggestionsEnabled.set(settings.shouldShowSearchSuggestions)
|
||||
|
@ -750,7 +753,7 @@ open class FenixApplication : LocaleAwareApplication(), Provider {
|
|||
settings.shouldUseFixedTopToolbar -> "fixed_top"
|
||||
settings.shouldUseBottomToolbar -> "bottom"
|
||||
else -> "top"
|
||||
}
|
||||
},
|
||||
)
|
||||
|
||||
enhancedTrackingProtection.set(
|
||||
|
@ -760,7 +763,7 @@ open class FenixApplication : LocaleAwareApplication(), Provider {
|
|||
settings.useStrictTrackingProtection -> "strict"
|
||||
settings.useCustomTrackingProtection -> "custom"
|
||||
else -> ""
|
||||
}
|
||||
},
|
||||
)
|
||||
etpCustomCookiesSelection.set(settings.blockCookiesSelectionInCustomTrackingProtection)
|
||||
|
||||
|
@ -783,7 +786,7 @@ open class FenixApplication : LocaleAwareApplication(), Provider {
|
|||
settings.shouldFollowDeviceTheme -> "system"
|
||||
settings.shouldUseAutoBatteryTheme -> "battery"
|
||||
else -> ""
|
||||
}
|
||||
},
|
||||
)
|
||||
|
||||
inactiveTabsEnabled.set(settings.inactiveTabsAreEnabled)
|
||||
|
@ -804,7 +807,7 @@ open class FenixApplication : LocaleAwareApplication(), Provider {
|
|||
settings.alwaysOpenTheLastTabWhenOpeningTheApp -> "last tab"
|
||||
settings.openHomepageAfterFourHoursOfInactivity -> "homepage after four hours"
|
||||
else -> ""
|
||||
}
|
||||
},
|
||||
)
|
||||
}
|
||||
|
||||
|
|
|
@ -21,7 +21,7 @@ class FenixLogSink(private val logsDebug: Boolean = true) : LogSink {
|
|||
priority: Log.Priority,
|
||||
tag: String?,
|
||||
throwable: Throwable?,
|
||||
message: String?
|
||||
message: String?,
|
||||
) {
|
||||
if (priority == Log.Priority.DEBUG && !logsDebug) {
|
||||
return
|
||||
|
|
|
@ -17,45 +17,46 @@ enum class GlobalDirections(val navDirections: NavDirections, val destinationId:
|
|||
Home(NavGraphDirections.actionGlobalHome(), R.id.homeFragment),
|
||||
Bookmarks(
|
||||
NavGraphDirections.actionGlobalBookmarkFragment(BookmarkRoot.Root.id),
|
||||
R.id.bookmarkFragment
|
||||
R.id.bookmarkFragment,
|
||||
),
|
||||
History(
|
||||
NavGraphDirections.actionGlobalHistoryFragment(),
|
||||
R.id.historyFragment
|
||||
R.id.historyFragment,
|
||||
),
|
||||
Settings(
|
||||
NavGraphDirections.actionGlobalSettingsFragment(),
|
||||
R.id.settingsFragment
|
||||
R.id.settingsFragment,
|
||||
),
|
||||
Sync(
|
||||
NavGraphDirections.actionGlobalTurnOnSync(),
|
||||
R.id.turnOnSyncFragment
|
||||
R.id.turnOnSyncFragment,
|
||||
),
|
||||
SearchEngine(
|
||||
NavGraphDirections.actionGlobalSearchEngineFragment(),
|
||||
R.id.searchEngineFragment
|
||||
R.id.searchEngineFragment,
|
||||
),
|
||||
Accessibility(
|
||||
NavGraphDirections.actionGlobalAccessibilityFragment(),
|
||||
R.id.accessibilityFragment
|
||||
R.id.accessibilityFragment,
|
||||
),
|
||||
DeleteData(
|
||||
NavGraphDirections.actionGlobalDeleteBrowsingDataFragment(),
|
||||
R.id.deleteBrowsingDataFragment
|
||||
R.id.deleteBrowsingDataFragment,
|
||||
),
|
||||
SettingsAddonManager(
|
||||
NavGraphDirections.actionGlobalAddonsManagementFragment(),
|
||||
R.id.addonsManagementFragment
|
||||
R.id.addonsManagementFragment,
|
||||
),
|
||||
SettingsLogins(
|
||||
NavGraphDirections.actionGlobalSavedLoginsAuthFragment(),
|
||||
R.id.saveLoginSettingFragment
|
||||
R.id.saveLoginSettingFragment,
|
||||
),
|
||||
SettingsTrackingProtection(
|
||||
NavGraphDirections.actionGlobalTrackingProtectionFragment(),
|
||||
R.id.trackingProtectionFragment
|
||||
R.id.trackingProtectionFragment,
|
||||
),
|
||||
WallpaperSettings(
|
||||
NavGraphDirections.actionGlobalWallpaperSettingsFragment(), R.id.wallpaperSettingsFragment
|
||||
)
|
||||
NavGraphDirections.actionGlobalWallpaperSettingsFragment(),
|
||||
R.id.wallpaperSettingsFragment,
|
||||
),
|
||||
}
|
||||
|
|
|
@ -181,7 +181,7 @@ open class HomeActivity : LocaleAwareAppCompatActivity(), NavHostActivity {
|
|||
StartSearchIntentProcessor(),
|
||||
OpenBrowserIntentProcessor(this, ::getIntentSessionId),
|
||||
OpenSpecificTabIntentProcessor(this),
|
||||
DefaultBrowserIntentProcessor(this)
|
||||
DefaultBrowserIntentProcessor(this),
|
||||
)
|
||||
}
|
||||
|
||||
|
@ -219,8 +219,8 @@ open class HomeActivity : LocaleAwareAppCompatActivity(), NavHostActivity {
|
|||
message = "onCreate()",
|
||||
data = mapOf(
|
||||
"recreated" to (savedInstanceState != null).toString(),
|
||||
"intent" to (intent?.action ?: "null")
|
||||
)
|
||||
"intent" to (intent?.action ?: "null"),
|
||||
),
|
||||
)
|
||||
|
||||
components.publicSuffixList.prefetch()
|
||||
|
@ -238,7 +238,7 @@ open class HomeActivity : LocaleAwareAppCompatActivity(), NavHostActivity {
|
|||
privateNotificationObserver = PrivateNotificationFeature(
|
||||
applicationContext,
|
||||
components.core.store,
|
||||
PrivateNotificationService::class
|
||||
PrivateNotificationService::class,
|
||||
).also {
|
||||
it.start()
|
||||
}
|
||||
|
@ -265,8 +265,9 @@ open class HomeActivity : LocaleAwareAppCompatActivity(), NavHostActivity {
|
|||
lifecycle.addObserver(
|
||||
BreadcrumbsRecorder(
|
||||
components.analytics.crashReporter,
|
||||
navHost.navController, ::getBreadcrumbMessage
|
||||
)
|
||||
navHost.navController,
|
||||
::getBreadcrumbMessage,
|
||||
),
|
||||
)
|
||||
|
||||
val safeIntent = intent?.toSafeIntent()
|
||||
|
@ -318,7 +319,9 @@ open class HomeActivity : LocaleAwareAppCompatActivity(), NavHostActivity {
|
|||
}
|
||||
|
||||
components.core.engine.profiler?.addMarker(
|
||||
MarkersActivityLifecycleCallbacks.MARKER_NAME, startTimeProfiler, "HomeActivity.onCreate"
|
||||
MarkersActivityLifecycleCallbacks.MARKER_NAME,
|
||||
startTimeProfiler,
|
||||
"HomeActivity.onCreate",
|
||||
)
|
||||
StartupTimeline.onActivityCreateEndHome(this) // DO NOT MOVE ANYTHING BELOW HERE.
|
||||
}
|
||||
|
@ -338,7 +341,7 @@ open class HomeActivity : LocaleAwareAppCompatActivity(), NavHostActivity {
|
|||
components.performance.visualCompletenessQueue,
|
||||
components.startupStateProvider,
|
||||
safeIntent,
|
||||
binding.rootContainer
|
||||
binding.rootContainer,
|
||||
)
|
||||
}
|
||||
|
||||
|
@ -350,7 +353,7 @@ open class HomeActivity : LocaleAwareAppCompatActivity(), NavHostActivity {
|
|||
// Diagnostic breadcrumb for "Display already aquired" crash:
|
||||
// https://github.com/mozilla-mobile/android-components/issues/7960
|
||||
breadcrumb(
|
||||
message = "onResume()"
|
||||
message = "onResume()",
|
||||
)
|
||||
|
||||
lifecycleScope.launch(IO) {
|
||||
|
@ -379,12 +382,14 @@ open class HomeActivity : LocaleAwareAppCompatActivity(), NavHostActivity {
|
|||
// Diagnostic breadcrumb for "Display already aquired" crash:
|
||||
// https://github.com/mozilla-mobile/android-components/issues/7960
|
||||
breadcrumb(
|
||||
message = "onStart()"
|
||||
message = "onStart()",
|
||||
)
|
||||
|
||||
ProfilerMarkers.homeActivityOnStart(binding.rootContainer, components.core.engine.profiler)
|
||||
components.core.engine.profiler?.addMarker(
|
||||
MarkersActivityLifecycleCallbacks.MARKER_NAME, startProfilerTime, "HomeActivity.onStart"
|
||||
MarkersActivityLifecycleCallbacks.MARKER_NAME,
|
||||
startProfilerTime,
|
||||
"HomeActivity.onStart",
|
||||
) // DO NOT MOVE ANYTHING BELOW THIS addMarker CALL.
|
||||
}
|
||||
|
||||
|
@ -396,8 +401,8 @@ open class HomeActivity : LocaleAwareAppCompatActivity(), NavHostActivity {
|
|||
breadcrumb(
|
||||
message = "onStop()",
|
||||
data = mapOf(
|
||||
"finishing" to isFinishing.toString()
|
||||
)
|
||||
"finishing" to isFinishing.toString(),
|
||||
),
|
||||
)
|
||||
}
|
||||
|
||||
|
@ -410,7 +415,7 @@ open class HomeActivity : LocaleAwareAppCompatActivity(), NavHostActivity {
|
|||
components.core.bookmarksStorage.getTree(BookmarkRoot.Root.id, true)?.let {
|
||||
val desktopRootNode = DesktopFolders(
|
||||
applicationContext,
|
||||
showMobileRoot = false
|
||||
showMobileRoot = false,
|
||||
).withOptionalDesktopFolders(it)
|
||||
settings().desktopBookmarksSize = getBookmarkCount(desktopRootNode)
|
||||
}
|
||||
|
@ -427,8 +432,8 @@ open class HomeActivity : LocaleAwareAppCompatActivity(), NavHostActivity {
|
|||
breadcrumb(
|
||||
message = "onPause()",
|
||||
data = mapOf(
|
||||
"finishing" to isFinishing.toString()
|
||||
)
|
||||
"finishing" to isFinishing.toString(),
|
||||
),
|
||||
)
|
||||
|
||||
// Every time the application goes into the background, it is possible that the user
|
||||
|
@ -466,8 +471,8 @@ open class HomeActivity : LocaleAwareAppCompatActivity(), NavHostActivity {
|
|||
breadcrumb(
|
||||
message = "onDestroy()",
|
||||
data = mapOf(
|
||||
"finishing" to isFinishing.toString()
|
||||
)
|
||||
"finishing" to isFinishing.toString(),
|
||||
),
|
||||
)
|
||||
|
||||
components.core.contileTopSitesUpdater.stopPeriodicWork()
|
||||
|
@ -482,7 +487,7 @@ open class HomeActivity : LocaleAwareAppCompatActivity(), NavHostActivity {
|
|||
// Diagnostic breadcrumb for "Display already aquired" crash:
|
||||
// https://github.com/mozilla-mobile/android-components/issues/7960
|
||||
breadcrumb(
|
||||
message = "onConfigurationChanged()"
|
||||
message = "onConfigurationChanged()",
|
||||
)
|
||||
}
|
||||
|
||||
|
@ -490,7 +495,7 @@ open class HomeActivity : LocaleAwareAppCompatActivity(), NavHostActivity {
|
|||
// Diagnostic breadcrumb for "Display already aquired" crash:
|
||||
// https://github.com/mozilla-mobile/android-components/issues/7960
|
||||
breadcrumb(
|
||||
message = "recreate()"
|
||||
message = "recreate()",
|
||||
)
|
||||
|
||||
super.recreate()
|
||||
|
@ -513,8 +518,8 @@ open class HomeActivity : LocaleAwareAppCompatActivity(), NavHostActivity {
|
|||
breadcrumb(
|
||||
message = "onNewIntent()",
|
||||
data = mapOf(
|
||||
"intent" to intent.action.toString()
|
||||
)
|
||||
"intent" to intent.action.toString(),
|
||||
),
|
||||
)
|
||||
|
||||
val tab = components.core.store.state.findActiveMediaTab()
|
||||
|
@ -524,7 +529,7 @@ open class HomeActivity : LocaleAwareAppCompatActivity(), NavHostActivity {
|
|||
|
||||
val intentProcessors =
|
||||
listOf(
|
||||
CrashReporterIntentProcessor(components.appStore)
|
||||
CrashReporterIntentProcessor(components.appStore),
|
||||
) + externalSourceIntentProcessors
|
||||
val intentHandled =
|
||||
intentProcessors.any { it.process(intent, navHost.navController, this.intent) }
|
||||
|
@ -548,19 +553,19 @@ open class HomeActivity : LocaleAwareAppCompatActivity(), NavHostActivity {
|
|||
parent: View?,
|
||||
name: String,
|
||||
context: Context,
|
||||
attrs: AttributeSet
|
||||
attrs: AttributeSet,
|
||||
): View? = when (name) {
|
||||
EngineView::class.java.name -> components.core.engine.createView(context, attrs).apply {
|
||||
selectionActionDelegate = DefaultSelectionActionDelegate(
|
||||
BrowserStoreSearchAdapter(
|
||||
components.core.store,
|
||||
tabId = getIntentSessionId(intent.toSafeIntent())
|
||||
tabId = getIntentSessionId(intent.toSafeIntent()),
|
||||
),
|
||||
resources = context.resources,
|
||||
shareTextClicked = { share(it) },
|
||||
emailTextClicked = { email(it) },
|
||||
callTextClicked = { call(it) },
|
||||
actionSorter = ::actionSorter
|
||||
actionSorter = ::actionSorter,
|
||||
)
|
||||
}.asView()
|
||||
else -> super.onCreateView(parent, name, context, attrs)
|
||||
|
@ -757,7 +762,7 @@ open class HomeActivity : LocaleAwareAppCompatActivity(), NavHostActivity {
|
|||
NavigationUI.setupWithNavController(
|
||||
navigationToolbar,
|
||||
navHost.navController,
|
||||
AppBarConfiguration.Builder(*topLevelDestinationIds).build()
|
||||
AppBarConfiguration.Builder(*topLevelDestinationIds).build(),
|
||||
)
|
||||
|
||||
navigationToolbar.setNavigationOnClickListener {
|
||||
|
@ -783,7 +788,7 @@ open class HomeActivity : LocaleAwareAppCompatActivity(), NavHostActivity {
|
|||
forceSearch: Boolean = false,
|
||||
flags: EngineSession.LoadUrlFlags = EngineSession.LoadUrlFlags.none(),
|
||||
requestDesktopMode: Boolean = false,
|
||||
historyMetadata: HistoryMetadataKey? = null
|
||||
historyMetadata: HistoryMetadataKey? = null,
|
||||
) {
|
||||
openToBrowser(from, customTabSessionId)
|
||||
load(searchTermOrURL, newTab, engine, forceSearch, flags, requestDesktopMode, historyMetadata)
|
||||
|
@ -800,7 +805,7 @@ open class HomeActivity : LocaleAwareAppCompatActivity(), NavHostActivity {
|
|||
|
||||
protected open fun getNavDirections(
|
||||
from: BrowserDirection,
|
||||
customTabSessionId: String?
|
||||
customTabSessionId: String?,
|
||||
): NavDirections? = when (from) {
|
||||
BrowserDirection.FromGlobal ->
|
||||
NavGraphDirections.actionGlobalBrowser(customTabSessionId)
|
||||
|
@ -849,7 +854,7 @@ open class HomeActivity : LocaleAwareAppCompatActivity(), NavHostActivity {
|
|||
BrowserDirection.FromRecentlyClosed ->
|
||||
RecentlyClosedFragmentDirections.actionGlobalBrowser(customTabSessionId)
|
||||
BrowserDirection.FromStudiesFragment -> StudiesFragmentDirections.actionGlobalBrowser(
|
||||
customTabSessionId
|
||||
customTabSessionId,
|
||||
)
|
||||
}
|
||||
|
||||
|
@ -867,7 +872,7 @@ open class HomeActivity : LocaleAwareAppCompatActivity(), NavHostActivity {
|
|||
forceSearch: Boolean,
|
||||
flags: EngineSession.LoadUrlFlags = EngineSession.LoadUrlFlags.none(),
|
||||
requestDesktopMode: Boolean = false,
|
||||
historyMetadata: HistoryMetadataKey? = null
|
||||
historyMetadata: HistoryMetadataKey? = null,
|
||||
) {
|
||||
val startTime = components.core.engine.profiler?.getProfilerTime()
|
||||
val mode = browsingModeManager.mode
|
||||
|
@ -886,12 +891,12 @@ open class HomeActivity : LocaleAwareAppCompatActivity(), NavHostActivity {
|
|||
url = searchTermOrURL.toNormalizedUrl(),
|
||||
flags = flags,
|
||||
private = private,
|
||||
historyMetadata = historyMetadata
|
||||
historyMetadata = historyMetadata,
|
||||
)
|
||||
} else {
|
||||
components.useCases.sessionUseCases.loadUrl(
|
||||
url = searchTermOrURL.toNormalizedUrl(),
|
||||
flags = flags
|
||||
flags = flags,
|
||||
)
|
||||
components.core.store.state.selectedTabId
|
||||
}
|
||||
|
@ -907,7 +912,7 @@ open class HomeActivity : LocaleAwareAppCompatActivity(), NavHostActivity {
|
|||
SessionState.Source.Internal.UserEntered,
|
||||
true,
|
||||
mode.isPrivate,
|
||||
searchEngine = engine
|
||||
searchEngine = engine,
|
||||
)
|
||||
} else {
|
||||
components.useCases.searchUseCases.defaultSearch.invoke(searchTermOrURL, engine)
|
||||
|
@ -920,7 +925,7 @@ open class HomeActivity : LocaleAwareAppCompatActivity(), NavHostActivity {
|
|||
components.core.engine.profiler?.addMarker(
|
||||
"HomeActivity.load",
|
||||
startTime,
|
||||
"newTab: $newTab"
|
||||
"newTab: $newTab",
|
||||
)
|
||||
}
|
||||
}
|
||||
|
@ -990,7 +995,7 @@ open class HomeActivity : LocaleAwareAppCompatActivity(), NavHostActivity {
|
|||
private fun openPopup(webExtensionState: WebExtensionState) {
|
||||
val action = NavGraphDirections.actionGlobalWebExtensionActionPopupFragment(
|
||||
webExtensionId = webExtensionState.id,
|
||||
webExtensionTitle = webExtensionState.name
|
||||
webExtensionTitle = webExtensionState.name,
|
||||
)
|
||||
navHost.navController.navigate(action)
|
||||
}
|
||||
|
@ -1006,7 +1011,7 @@ open class HomeActivity : LocaleAwareAppCompatActivity(), NavHostActivity {
|
|||
private fun captureSnapshotTelemetryMetrics() = CoroutineScope(IO).launch {
|
||||
// PWA
|
||||
val recentlyUsedPwaCount = components.core.webAppShortcutManager.recentlyUsedWebAppsCount(
|
||||
activeThresholdMs = PWA_RECENTLY_USED_THRESHOLD
|
||||
activeThresholdMs = PWA_RECENTLY_USED_THRESHOLD,
|
||||
)
|
||||
if (recentlyUsedPwaCount == 0) {
|
||||
Metrics.hasRecentPwas.set(false)
|
||||
|
@ -1047,7 +1052,7 @@ open class HomeActivity : LocaleAwareAppCompatActivity(), NavHostActivity {
|
|||
it.process(
|
||||
intent,
|
||||
navHost.navController,
|
||||
this.intent
|
||||
this.intent,
|
||||
)
|
||||
}
|
||||
}
|
||||
|
|
|
@ -48,7 +48,9 @@ class IntentReceiverActivity : Activity() {
|
|||
processIntent(intent)
|
||||
|
||||
components.core.engine.profiler?.addMarker(
|
||||
MarkersActivityLifecycleCallbacks.MARKER_NAME, startTimeProfiler, "IntentReceiverActivity.onCreate"
|
||||
MarkersActivityLifecycleCallbacks.MARKER_NAME,
|
||||
startTimeProfiler,
|
||||
"IntentReceiverActivity.onCreate",
|
||||
)
|
||||
StartupTimeline.onActivityCreateEndIntentReceiver() // DO NOT MOVE ANYTHING BELOW HERE.
|
||||
}
|
||||
|
@ -78,7 +80,7 @@ class IntentReceiverActivity : Activity() {
|
|||
if (!intent.hasExtra(HomeActivity.OPEN_TO_BROWSER)) {
|
||||
intent.putExtra(
|
||||
HomeActivity.OPEN_TO_BROWSER,
|
||||
intentProcessorType.shouldOpenToBrowser(intent)
|
||||
intentProcessorType.shouldOpenToBrowser(intent),
|
||||
)
|
||||
}
|
||||
// StrictMode violation on certain devices such as Samsung
|
||||
|
@ -92,13 +94,13 @@ class IntentReceiverActivity : Activity() {
|
|||
val modeDependentProcessors = if (private) {
|
||||
listOf(
|
||||
components.intentProcessors.privateCustomTabIntentProcessor,
|
||||
components.intentProcessors.privateIntentProcessor
|
||||
components.intentProcessors.privateIntentProcessor,
|
||||
)
|
||||
} else {
|
||||
Events.openedLink.record(Events.OpenedLinkExtra("NORMAL"))
|
||||
listOf(
|
||||
components.intentProcessors.customTabIntentProcessor,
|
||||
components.intentProcessors.intentProcessor
|
||||
components.intentProcessors.intentProcessor,
|
||||
)
|
||||
}
|
||||
|
||||
|
|
|
@ -21,7 +21,7 @@ import org.mozilla.fenix.ext.components
|
|||
* @param homeActivity [HomeActivity] used for navigating to browser or accessing various app components.
|
||||
*/
|
||||
class ServiceWorkerSupportFeature(
|
||||
private val homeActivity: HomeActivity
|
||||
private val homeActivity: HomeActivity,
|
||||
) : ServiceWorkerDelegate, DefaultLifecycleObserver {
|
||||
override fun onDestroy(owner: LifecycleOwner) {
|
||||
homeActivity.components.core.engine.unregisterServiceWorkerDelegate()
|
||||
|
@ -38,7 +38,7 @@ class ServiceWorkerSupportFeature(
|
|||
components.useCases.tabsUseCases.addTab(
|
||||
flags = LoadUrlFlags.external(),
|
||||
engineSession = engineSession,
|
||||
source = SessionState.Source.Internal.None
|
||||
source = SessionState.Source.Internal.None,
|
||||
)
|
||||
}
|
||||
|
||||
|
|
|
@ -40,7 +40,7 @@ interface AddonDetailsInteractor {
|
|||
*/
|
||||
class AddonDetailsBindingDelegate(
|
||||
private val binding: FragmentAddOnDetailsBinding,
|
||||
private val interactor: AddonDetailsInteractor
|
||||
private val interactor: AddonDetailsInteractor,
|
||||
) {
|
||||
|
||||
private val dateFormatter = DateFormat.getDateInstance()
|
||||
|
@ -115,7 +115,7 @@ class AddonDetailsBindingDelegate(
|
|||
|
||||
private fun addActionToLinks(
|
||||
spannableStringBuilder: SpannableStringBuilder,
|
||||
link: URLSpan
|
||||
link: URLSpan,
|
||||
) {
|
||||
val start = spannableStringBuilder.getSpanStart(link)
|
||||
val end = spannableStringBuilder.getSpanEnd(link)
|
||||
|
|
|
@ -49,7 +49,7 @@ class AddonDetailsFragment : Fragment(R.layout.fragment_add_on_details), AddonDe
|
|||
(activity as HomeActivity).openToBrowserAndLoad(
|
||||
searchTermOrURL = addonSiteUrl.toString(),
|
||||
newTab = true,
|
||||
from = BrowserDirection.FromAddonDetailsFragment
|
||||
from = BrowserDirection.FromAddonDetailsFragment,
|
||||
)
|
||||
}
|
||||
|
||||
|
|
|
@ -25,7 +25,7 @@ class AddonInternalSettingsFragment : AddonPopupBaseFragment() {
|
|||
override fun onCreateView(
|
||||
inflater: LayoutInflater,
|
||||
container: ViewGroup?,
|
||||
savedInstanceState: Bundle?
|
||||
savedInstanceState: Bundle?,
|
||||
): View? {
|
||||
initializeSession()
|
||||
return inflater.inflate(R.layout.fragment_add_on_internal_settings, container, false)
|
||||
|
|
|
@ -26,7 +26,7 @@ interface AddonPermissionsDetailsInteractor {
|
|||
*/
|
||||
class AddonPermissionDetailsBindingDelegate(
|
||||
val binding: FragmentAddOnPermissionsBinding,
|
||||
private val interactor: AddonPermissionsDetailsInteractor
|
||||
private val interactor: AddonPermissionsDetailsInteractor,
|
||||
) {
|
||||
|
||||
fun bind(addon: Addon) {
|
||||
|
@ -41,8 +41,8 @@ class AddonPermissionDetailsBindingDelegate(
|
|||
adapter = AddonPermissionsAdapter(
|
||||
sortedPermissions,
|
||||
style = AddonPermissionsAdapter.Style(
|
||||
ThemeManager.resolveAttribute(R.attr.textPrimary, context)
|
||||
)
|
||||
ThemeManager.resolveAttribute(R.attr.textPrimary, context),
|
||||
),
|
||||
)
|
||||
}
|
||||
}
|
||||
|
|
|
@ -42,7 +42,7 @@ class AddonPermissionsDetailsFragment :
|
|||
(activity as HomeActivity).openToBrowserAndLoad(
|
||||
searchTermOrURL = addonSiteUrl.toString(),
|
||||
newTab = true,
|
||||
from = BrowserDirection.FromAddonPermissionsDetailsFragment
|
||||
from = BrowserDirection.FromAddonPermissionsDetailsFragment,
|
||||
)
|
||||
}
|
||||
}
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue