Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ class CustomTabsTest {
InstrumentationRegistry.getInstrumentation().targetContext,
IntentReceiverActivity::class.java,
)
}
},
)

@Before
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -80,13 +80,15 @@ class AddonsManagerRobot {
.waitForExists(waitingTime)
mDevice.waitAndInteract(
Until.findObject(
By.text(getStringResource(addonsR.string.mozac_feature_addons_installed_dialog_okay_button_2))
)
By.text(getStringResource(addonsR.string.mozac_feature_addons_installed_dialog_okay_button_2)),
),
) {}
mDevice
.findObject(
UiSelector()
.textContains(getStringResource(addonsR.string.mozac_feature_addons_installed_dialog_okay_button_2))
.textContains(
getStringResource(addonsR.string.mozac_feature_addons_installed_dialog_okay_button_2),
),
)
.click()
}
Expand All @@ -109,7 +111,7 @@ class AddonsManagerRobot {
withContentDescription("Install $addonName"),
isDescendantOfA(withId(R.id.add_on_item)),
hasSibling(hasDescendant(withText(addonName))),
)
),
)

private fun removeAddonButton() = onView(withId(R.id.remove_add_on))
Expand All @@ -131,23 +133,23 @@ class AddonsManagerRobot {
allOf(
withId(addonsR.id.optional_or_required_text),
withText(containsString("Required permissions:")),
)
),
)
.check(matches(isCompletelyDisplayed()))

onView(
allOf(
withId(addonsR.id.allow_button),
withText(addonsR.string.mozac_feature_addons_permissions_dialog_add),
)
),
)
.check(matches(isCompletelyDisplayed()))

onView(
allOf(
withId(addonsR.id.deny_button),
withText(addonsR.string.mozac_feature_addons_permissions_dialog_cancel),
)
),
)
.check(matches(isCompletelyDisplayed()))
}
Expand All @@ -157,7 +159,7 @@ class AddonsManagerRobot {
allOf(
withId(addonsR.id.deny_button),
withText(addonsR.string.mozac_feature_addons_permissions_dialog_cancel),
)
),
)
.check(matches(isCompletelyDisplayed()))
.perform(click())
Expand Down Expand Up @@ -197,7 +199,7 @@ class AddonsManagerRobot {
hasSibling(withId(R.id.details)),
hasSibling(withId(R.id.permissions)),
hasSibling(withId(R.id.allow_in_private_browsing_switch)),
)
),
)
.check(matches(withEffectiveVisibility(ViewMatchers.Visibility.VISIBLE)))
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ private fun awesomeBar() =
allOf(
withId(toolbarR.id.mozac_browser_toolbar_edit_url_view),
isDescendantOfA(withId(toolbarR.id.mozac_browser_toolbar_container)),
)
),
)

private fun clearToolbarButton() =
Expand Down Expand Up @@ -121,7 +121,7 @@ private fun assertPastedToolbarText(expectedText: String) {
allOf(
withSubstring(expectedText),
withId(toolbarR.id.mozac_browser_toolbar_edit_url_view),
)
),
)
.check(matches(withEffectiveVisibility(ViewMatchers.Visibility.VISIBLE)))
}
Original file line number Diff line number Diff line change
Expand Up @@ -50,17 +50,17 @@ class BrowserRobot {
withSubstring(expectedUrl),
withId(toolbarR.id.mozac_browser_toolbar_url_view),
isDescendantOfA(withId(toolbarR.id.mozac_browser_toolbar_origin_view)),
)
),
)
.check(matches(withEffectiveVisibility(ViewMatchers.Visibility.VISIBLE)))
}

fun verifyAboutBrowser() {
assertTrue(
mDevice.findObject(UiSelector().resourceId("$packageName:id/about_content")).waitForExists(waitingTime)
mDevice.findObject(UiSelector().resourceId("$packageName:id/about_content")).waitForExists(waitingTime),
)
assertTrue(
mDevice.findObject(UiSelector().resourceId("$packageName:id/version_info")).waitForExists(waitingTime)
mDevice.findObject(UiSelector().resourceId("$packageName:id/version_info")).waitForExists(waitingTime),
)
}

Expand Down Expand Up @@ -180,7 +180,7 @@ class BrowserRobot {
fun waitUntilCopyLinkSnackbarIsGone() =
mDevice
.findObject(
UiSelector().resourceId("$packageName:id/snackbar_text").textContains("Link copied to clipboard")
UiSelector().resourceId("$packageName:id/snackbar_text").textContains("Link copied to clipboard"),
)
.waitUntilGone(waitingTime)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ class CustomTabRobot {
assertTrue(
mDevice
.findObject(UiSelector().resourceId("$packageName:id/mozac_browser_menu_recyclerView"))
.waitUntilGone(waitingTime)
.waitUntilGone(waitingTime),
)
} catch (e: AssertionError) {
println("Failed to click request desktop toggle")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ private fun assertYouTubeApp() {
println("The native youtube app opens but needs to be updated")
// In case the app isn't up to date on the emulator an update message will be displayed
assertTrue(
mDevice.findObject(UiSelector().text("Update for a faster, better YouTube")).waitForExists(waitingTime)
mDevice.findObject(UiSelector().text("Update for a faster, better YouTube")).waitForExists(waitingTime),
)
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -115,87 +115,87 @@ private fun appearanceButton() =
allOf(
withId(R.id.readerViewAppearanceButton),
hasSibling(withId(R.id.toolbar)),
)
),
)

private fun appearanceMenu() =
onView(
allOf(
withId(R.id.readerViewAppearanceButton),
hasSibling(withId(R.id.swipeRefresh)),
)
),
)

private fun fontGroupButtons() =
onView(
allOf(
withId(readerviewR.id.mozac_feature_readerview_font_group),
withParent(withId(R.id.readerViewBar)),
)
),
)

private fun sansSerifButton() =
onView(
allOf(
withId(readerviewR.id.mozac_feature_readerview_font_sans_serif),
withParent(withId(readerviewR.id.mozac_feature_readerview_font_group)),
)
),
)

private fun serifButton() =
onView(
allOf(
withId(readerviewR.id.mozac_feature_readerview_font_serif),
withParent(withId(readerviewR.id.mozac_feature_readerview_font_group)),
)
),
)

private fun increaseFontSizeButton() =
onView(
allOf(
withText("+"),
withParent(withId(R.id.readerViewBar)),
)
),
)

private fun decreaseFontSizeButton() =
onView(
allOf(
withText("−"),
withParent(withId(R.id.readerViewBar)),
)
),
)

private fun colorSchemeGroupButtons() =
onView(
allOf(
withId(readerviewR.id.mozac_feature_readerview_color_scheme_group),
withParent(withId(R.id.readerViewBar)),
)
),
)

private fun lightColorButton() =
onView(
allOf(
withText("Light"),
withParent(withId(readerviewR.id.mozac_feature_readerview_color_scheme_group)),
)
),
)

private fun sepiaColorButton() =
onView(
allOf(
withText("Sepia"),
withParent(withId(readerviewR.id.mozac_feature_readerview_color_scheme_group)),
)
),
)

private fun darkColorButton() =
onView(
allOf(
withText("Dark"),
withParent(withId(readerviewR.id.mozac_feature_readerview_color_scheme_group)),
)
),
)

private fun assertAppearanceButtonExists() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ class SettingsViewRobot {

class Transition {
fun openSettingsViewPrivacy(
interact: SettingsViewPrivacyRobot.() -> Unit
interact: SettingsViewPrivacyRobot.() -> Unit,
): SettingsViewPrivacyRobot.Transition {
privacyButton().click()
SettingsViewPrivacyRobot().interact()
Expand Down Expand Up @@ -150,9 +150,9 @@ private fun assertSettingsView() {
.findObject(
UiSelector()
.resourceId("$packageName:id/action_bar")
.childSelector(UiSelector().textContains(getStringResource(R.string.settings)))
.childSelector(UiSelector().textContains(getStringResource(R.string.settings))),
)
.waitForExists(waitingTime)
.waitForExists(waitingTime),
)
}

Expand All @@ -173,7 +173,7 @@ private fun openLinksInAppsToggle() =
allOf(
withId(androidx.preference.R.id.switchWidget),
hasCousin(withText(R.string.open_links_in_apps)),
)
),
)

private fun makeDefaultBrowserButton() = Espresso.onView(withText(R.string.preferences_make_default_browser))
Expand All @@ -191,7 +191,7 @@ private fun remoteDebuggingToggle() =
allOf(
withId(androidx.preference.R.id.switchWidget),
hasCousin(withText(R.string.preferences_remote_debugging)),
)
),
)

private fun customAddonCollectionButton() = onView(withText("Custom Add-on collection"))
Expand Down Expand Up @@ -261,7 +261,7 @@ private fun assertCustomAddonCollectionPanel() {
withId(androidx.appcompat.R.id.alertTitle),
withId(android.R.id.title),
),
)
),
)
.inRoot(isDialog())
.check(matches(isCompletelyDisplayed()))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,9 @@ class SyncedTabsRobot {
.findObject(
UiSelector()
.resourceId("$packageName:id/synced_tabs_status")
.textContains(getStringResource(R.string.synced_tabs_connect_to_sync_account))
.textContains(getStringResource(R.string.synced_tabs_connect_to_sync_account)),
)
.waitForExists(waitingTime)
.waitForExists(waitingTime),
)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ class ThreeDotMenuRobot {
}

fun switchRequestDesktopSiteToggle(
interact: NavigationToolbarRobot.() -> Unit
interact: NavigationToolbarRobot.() -> Unit,
): NavigationToolbarRobot.Transition {
try {
mDevice.findObject(UiSelector().textContains("Request desktop site")).waitForExists(waitingTime)
Expand All @@ -105,7 +105,7 @@ class ThreeDotMenuRobot {
assertTrue(
mDevice
.findObject(UiSelector().resourceId("$packageName:id/mozac_browser_menu_recyclerView"))
.waitUntilGone(waitingTime)
.waitUntilGone(waitingTime),
)
} catch (e: AssertionFailedError) {
println("Failed to click request desktop toggle")
Expand All @@ -119,7 +119,7 @@ class ThreeDotMenuRobot {
assertTrue(
mDevice
.findObject(UiSelector().resourceId("$packageName:id/mozac_browser_menu_recyclerView"))
.waitUntilGone(waitingTime)
.waitUntilGone(waitingTime),
)
}
NavigationToolbarRobot().interact()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ open class BrowserActivity : AppCompatActivity() {
override fun onActivityResult(requestCode: Int, resultCode: Int, data: Intent?) {
Logger.info(
"Activity onActivityResult received with " +
"requestCode: $requestCode, resultCode: $resultCode, data: $data"
"requestCode: $requestCode, resultCode: $resultCode, data: $data",
)

supportFragmentManager.fragments.forEach {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ open class BrowserApplication : Application() {
Dispatchers.Main +
CoroutineExceptionHandler { _, throwable ->
Logger.error("ApplicationScope: Unhandled error: ${throwable.message}", throwable)
}
},
)

val components by lazy { Components(this, applicationScope) }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -232,7 +232,7 @@ object NotificationManager {
context.getString(
R.string.fxa_tab_received_from_notification_name,
it.displayName,
)
),
)
return this
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ class AddonSettingsActivity : AppCompatActivity() {
Addon::class.java,
)
?.installedState
?.optionsPageUrl
?.optionsPageUrl,
)

engineSession = requireContext().components.core.engine.createSession()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -494,7 +494,7 @@ abstract class BaseBrowserFragment : Fragment(), UserInteractionHandler, Activit
): Boolean {
Logger.info(
"Fragment onActivityResult received with " +
"requestCode: $requestCode, resultCode: $resultCode, data: $data"
"requestCode: $requestCode, resultCode: $resultCode, data: $data",
)

return activityResultHandler.any { it.onActivityResult(requestCode, data, resultCode) }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ class BrowserFragment : BaseBrowserFragment(), UserInteractionHandler {
requireComponents.backgroundServices.syncedTabsStorage,
requireComponents.useCases.tabsUseCases.addTab,
requireComponents.core.icons,
)
),
)
awesomeBar.setOnRemoveSuggestionButtonClicked {
awesomeBar.addHiddenSuggestion(it)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ class BackgroundServices(
// If the queue is empty when the worker runs, that's OK; the worker
// won't do anything, and won't run again until the next call to `onAdded`.
override fun onRemoved() = Unit
}
},
)
}
}
Expand Down
Loading
Loading