From 5934c7d6b216d786a71c15d417338bcf475a5865 Mon Sep 17 00:00:00 2001 From: AndiAJ Date: Wed, 24 Nov 2021 13:14:51 +0200 Subject: [PATCH] Improve collection deletion UI coverage --- .../org/mozilla/fenix/ui/CollectionTest.kt | 27 +++++++++++++++++++ .../fenix/ui/robots/HomeScreenRobot.kt | 11 +++++--- 2 files changed, 34 insertions(+), 4 deletions(-) diff --git a/app/src/androidTest/java/org/mozilla/fenix/ui/CollectionTest.kt b/app/src/androidTest/java/org/mozilla/fenix/ui/CollectionTest.kt index c5e0b71e32..3d20608ec1 100644 --- a/app/src/androidTest/java/org/mozilla/fenix/ui/CollectionTest.kt +++ b/app/src/androidTest/java/org/mozilla/fenix/ui/CollectionTest.kt @@ -11,9 +11,11 @@ import org.junit.After import org.junit.Before import org.junit.Rule import org.junit.Test +import org.mozilla.fenix.customannotations.SmokeTest import org.mozilla.fenix.helpers.AndroidAssetDispatcher import org.mozilla.fenix.helpers.FeatureSettingsHelper import org.mozilla.fenix.helpers.HomeActivityTestRule +import org.mozilla.fenix.helpers.TestAssetHelper import org.mozilla.fenix.helpers.TestAssetHelper.getGenericAsset import org.mozilla.fenix.ui.robots.browserScreen import org.mozilla.fenix.ui.robots.homeScreen @@ -273,4 +275,29 @@ class CollectionTest { verifyMenuButton() } } + + @SmokeTest + @Test + fun undoDeleteCollectionTest() { + val webPage = TestAssetHelper.getGenericAsset(mockWebServer, 1) + + navigationToolbar { + }.enterURLAndEnterToBrowser(webPage.url) { + }.openTabDrawer { + createCollection(webPage.title, firstCollectionName) + snackBarButtonClick("VIEW") + } + + homeScreen { + }.expandCollection(firstCollectionName) { + clickCollectionThreeDotButton() + selectDeleteCollection() + } + + homeScreen { + verifySnackBarText("Collection deleted") + clickUndoCollectionDeletion("UNDO") + verifyCollectionIsDisplayed(firstCollectionName, true) + } + } } diff --git a/app/src/androidTest/java/org/mozilla/fenix/ui/robots/HomeScreenRobot.kt b/app/src/androidTest/java/org/mozilla/fenix/ui/robots/HomeScreenRobot.kt index 2f2529cfcf..8e9f44260a 100644 --- a/app/src/androidTest/java/org/mozilla/fenix/ui/robots/HomeScreenRobot.kt +++ b/app/src/androidTest/java/org/mozilla/fenix/ui/robots/HomeScreenRobot.kt @@ -151,10 +151,13 @@ class HomeScreenRobot { mDevice.waitNotNull(findObject(By.text(expectedText)), waitingTime) } - fun snackBarButtonClick(expectedText: String) { - onView(allOf(withId(R.id.snackbar_btn), withText(expectedText))).check( - matches(withEffectiveVisibility(Visibility.VISIBLE)) - ).perform(click()) + fun clickUndoCollectionDeletion(expectedText: String) { + onView( + allOf( + withId(R.id.snackbar_btn), + withText(expectedText) + ) + ).click() } class Transition {