mirror of
https://github.com/fork-maintainers/iceraven-browser
synced 2024-11-03 23:15:31 +00:00
Bug 1826094 - Add dialog verification to existing delete browsing UI tests
This commit is contained in:
parent
4125023a64
commit
502e88da2b
@ -119,6 +119,7 @@ class SettingsDeleteBrowsingDataTest {
|
||||
verifyAllCheckBoxesAreChecked()
|
||||
selectOnlyOpenTabsCheckBox()
|
||||
clickDeleteBrowsingDataButton()
|
||||
verifyDeleteBrowsingDataDialog()
|
||||
confirmDeletionAndAssertSnackbar()
|
||||
}
|
||||
settingsScreen {
|
||||
@ -140,9 +141,11 @@ class SettingsDeleteBrowsingDataTest {
|
||||
verifyAllCheckBoxesAreChecked()
|
||||
selectOnlyOpenTabsCheckBox()
|
||||
clickDeleteBrowsingDataButton()
|
||||
verifyDeleteBrowsingDataDialog()
|
||||
clickDialogCancelButton()
|
||||
verifyOpenTabsCheckBox(true)
|
||||
clickDeleteBrowsingDataButton()
|
||||
verifyDeleteBrowsingDataDialog()
|
||||
confirmDeletionAndAssertSnackbar()
|
||||
}
|
||||
settingsScreen {
|
||||
@ -174,9 +177,11 @@ class SettingsDeleteBrowsingDataTest {
|
||||
verifyBrowsingHistoryDetails("2")
|
||||
selectOnlyBrowsingHistoryCheckBox()
|
||||
clickDeleteBrowsingDataButton()
|
||||
verifyDeleteBrowsingDataDialog()
|
||||
clickDialogCancelButton()
|
||||
verifyBrowsingHistoryDetails(true)
|
||||
clickDeleteBrowsingDataButton()
|
||||
verifyDeleteBrowsingDataDialog()
|
||||
confirmDeletionAndAssertSnackbar()
|
||||
verifyBrowsingHistoryDetails("0")
|
||||
exitMenu()
|
||||
@ -213,6 +218,7 @@ class SettingsDeleteBrowsingDataTest {
|
||||
}.openSettingsSubMenuDeleteBrowsingData {
|
||||
selectOnlyCookiesCheckBox()
|
||||
clickDeleteBrowsingDataButton()
|
||||
verifyDeleteBrowsingDataDialog()
|
||||
confirmDeletionAndAssertSnackbar()
|
||||
exitMenu()
|
||||
}
|
||||
@ -242,6 +248,7 @@ class SettingsDeleteBrowsingDataTest {
|
||||
}.openSettingsSubMenuDeleteBrowsingData {
|
||||
selectOnlyCachedFilesCheckBox()
|
||||
clickDeleteBrowsingDataButton()
|
||||
verifyDeleteBrowsingDataDialog()
|
||||
confirmDeletionAndAssertSnackbar()
|
||||
exitMenu()
|
||||
}
|
||||
|
@ -14,9 +14,7 @@ import androidx.test.espresso.matcher.ViewMatchers.withContentDescription
|
||||
import androidx.test.espresso.matcher.ViewMatchers.withEffectiveVisibility
|
||||
import androidx.test.espresso.matcher.ViewMatchers.withId
|
||||
import androidx.test.espresso.matcher.ViewMatchers.withText
|
||||
import androidx.test.uiautomator.By
|
||||
import androidx.test.uiautomator.UiSelector
|
||||
import androidx.test.uiautomator.Until
|
||||
import org.hamcrest.CoreMatchers.allOf
|
||||
import org.junit.Assert.assertTrue
|
||||
import org.mozilla.fenix.R
|
||||
@ -33,9 +31,6 @@ class SettingsSubMenuDeleteBrowsingDataRobot {
|
||||
|
||||
fun verifyNavigationToolBarHeader() = assertNavigationToolBarHeader()
|
||||
fun verifyDeleteBrowsingDataButton() = assertDeleteBrowsingDataButton()
|
||||
fun verifyMessageInDialogBox() = assertMessageInDialogBox()
|
||||
fun verifyDeleteButtonInDialogBox() = assertDeleteButtonInDialogBox()
|
||||
fun verifyCancelButtonInDialogBox() = assertCancelButtonInDialogBox()
|
||||
fun verifyAllOptionsAndCheckBoxes() = assertAllOptionsAndCheckBoxes()
|
||||
fun verifyAllCheckBoxesAreChecked() = assertAllCheckBoxesAreChecked()
|
||||
fun verifyOpenTabsCheckBox(status: Boolean) = assertOpenTabsCheckBox(status)
|
||||
@ -47,10 +42,10 @@ class SettingsSubMenuDeleteBrowsingDataRobot {
|
||||
fun verifyOpenTabsDetails(tabNumber: String) = assertOpenTabsDescription(tabNumber)
|
||||
fun verifyBrowsingHistoryDetails(addresses: String) = assertBrowsingHistoryDescription(addresses)
|
||||
|
||||
fun verifyDialogElements() {
|
||||
verifyMessageInDialogBox()
|
||||
verifyDeleteButtonInDialogBox()
|
||||
verifyCancelButtonInDialogBox()
|
||||
fun verifyDeleteBrowsingDataDialog() {
|
||||
dialogMessage().check(matches(withEffectiveVisibility(Visibility.VISIBLE)))
|
||||
dialogCancelButton().check(matches(withEffectiveVisibility(Visibility.VISIBLE)))
|
||||
dialogDeleteButton().check(matches(withEffectiveVisibility(Visibility.VISIBLE)))
|
||||
}
|
||||
|
||||
fun switchOpenTabsCheckBox() = clickOpenTabsCheckBox()
|
||||
@ -138,27 +133,11 @@ class SettingsSubMenuDeleteBrowsingDataRobot {
|
||||
assertDownloadsCheckBox(false)
|
||||
}
|
||||
|
||||
fun clickCancelButtonInDialogBoxAndVerifyContentsInDialogBox() {
|
||||
mDevice.wait(
|
||||
Until.findObject(By.text("Delete browsing data")),
|
||||
waitingTime,
|
||||
)
|
||||
clickDeleteBrowsingDataButton()
|
||||
verifyDialogElements()
|
||||
cancelButton().click()
|
||||
}
|
||||
fun confirmDeletionAndAssertSnackbar() {
|
||||
dialogDeleteButton().click()
|
||||
assertDeleteBrowsingDataSnackbar()
|
||||
}
|
||||
|
||||
fun verifyDeleteBrowsingDataSubMenuItems() {
|
||||
verifyDeleteBrowsingDataButton()
|
||||
clickCancelButtonInDialogBoxAndVerifyContentsInDialogBox()
|
||||
verifyAllOptionsAndCheckBoxes()
|
||||
verifyAllCheckBoxesAreChecked()
|
||||
}
|
||||
|
||||
class Transition {
|
||||
fun goBack(interact: SettingsRobot.() -> Unit): SettingsRobot.Transition {
|
||||
goBackButton().click()
|
||||
@ -188,9 +167,6 @@ private fun assertNavigationToolBarHeader() =
|
||||
private fun assertDeleteBrowsingDataButton() =
|
||||
deleteBrowsingDataButton().check((matches(withEffectiveVisibility(Visibility.VISIBLE))))
|
||||
|
||||
private fun cancelButton() =
|
||||
mDevice.findObject(UiSelector().textStartsWith("CANCEL"))
|
||||
|
||||
private fun dialogDeleteButton() = onView(withText("Delete")).inRoot(isDialog())
|
||||
|
||||
private fun dialogCancelButton() = onView(withText("Cancel")).inRoot(isDialog())
|
||||
@ -242,15 +218,6 @@ private fun dialogMessage() =
|
||||
onView(withText("$appName will delete the selected browsing data."))
|
||||
.inRoot(isDialog())
|
||||
|
||||
private fun assertMessageInDialogBox() =
|
||||
dialogMessage().check(matches(withEffectiveVisibility(Visibility.VISIBLE)))
|
||||
|
||||
private fun assertDeleteButtonInDialogBox() =
|
||||
dialogDeleteButton().check(matches(withEffectiveVisibility(Visibility.VISIBLE)))
|
||||
|
||||
private fun assertCancelButtonInDialogBox() =
|
||||
dialogCancelButton().check(matches(withEffectiveVisibility(Visibility.VISIBLE)))
|
||||
|
||||
private fun assertAllOptionsAndCheckBoxes() {
|
||||
openTabsSubsection().check(matches(withEffectiveVisibility(Visibility.VISIBLE)))
|
||||
openTabsDescription("0").check(matches(withEffectiveVisibility(Visibility.VISIBLE)))
|
||||
|
Loading…
Reference in New Issue
Block a user