Skip to content

Commit

Permalink
Improve coverage for addPrivateBrowsingShortcut Ui test
Browse files Browse the repository at this point in the history
  • Loading branch information
AndiAJ authored and mergify[bot] committed Sep 14, 2021
1 parent cbb8f80 commit d33df2b
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -364,6 +364,7 @@ class SettingsPrivacyTest {
}.openThreeDotMenu {
}.openSettings {
}.openPrivateBrowsingSubMenu {
cancelPrivateShortcutAddition()
addPrivateShortcutToHomescreen()
verifyPrivateBrowsingShortcutIcon()
}.openPrivateBrowsingShortcut {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,18 @@ class SettingsSubMenuPrivateBrowsingRobot {

fun clickOpenLinksInPrivateTabSwitch() = openLinksInPrivateTabSwitch().click()

fun cancelPrivateShortcutAddition() {
mDevice.wait(
Until.findObject(text("Add private browsing shortcut")),
waitingTime
)
addPrivateBrowsingShortcutButton().click()
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
mDevice.wait(Until.findObject(By.textContains("CANCEL")), waitingTime)
cancelShortcutAdditionButton().click()
}
}

fun addPrivateShortcutToHomescreen() {
mDevice.wait(
Until.findObject(text("Add private browsing shortcut")),
Expand Down Expand Up @@ -105,6 +117,9 @@ private fun goBackButton() = onView(withContentDescription("Navigate up"))
private fun addAutomaticallyButton() =
mDevice.findObject(UiSelector().textStartsWith("add automatically"))

private fun cancelShortcutAdditionButton() =
mDevice.findObject(UiSelector().textContains("CANCEL"))

private fun privateBrowsingShortcutIcon() = mDevice.findObject(text("Private $appName"))

private fun assertAddPrivateBrowsingShortcutButton() {
Expand Down

0 comments on commit d33df2b

Please sign in to comment.