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