From 169a255c7fa02b96c9c67db8ec226c8680902358 Mon Sep 17 00:00:00 2001 From: mcarare <“mihai.carare.dev@gmail.com”> Date: Mon, 2 Mar 2020 16:35:00 +0200 Subject: [PATCH] For #8766: Update UI Tests --- .../org/mozilla/fenix/ui/HomeScreenTest.kt | 6 +++--- .../mozilla/fenix/ui/TabbedBrowsingTest.kt | 10 +++++---- .../fenix/ui/robots/HomeScreenRobot.kt | 21 ++++++++++++++++++- 3 files changed, 29 insertions(+), 8 deletions(-) diff --git a/app/src/androidTest/java/org/mozilla/fenix/ui/HomeScreenTest.kt b/app/src/androidTest/java/org/mozilla/fenix/ui/HomeScreenTest.kt index d0b47eb89..074f1efb5 100644 --- a/app/src/androidTest/java/org/mozilla/fenix/ui/HomeScreenTest.kt +++ b/app/src/androidTest/java/org/mozilla/fenix/ui/HomeScreenTest.kt @@ -46,9 +46,9 @@ class HomeScreenTest { verifyAddTabButton() verifyNoTabsOpenedHeader() verifyNoTabsOpenedText() - verifyCollectionsHeader() - verifyNoCollectionsHeader() - verifyNoCollectionsText() + verifyCollectionsHeaderIsNotShown() + verifyNoCollectionsHeaderIsNotShown() + verifyNoCollectionsTextIsNotShown() verifyHomeToolbar() verifyHomeComponent() } diff --git a/app/src/androidTest/java/org/mozilla/fenix/ui/TabbedBrowsingTest.kt b/app/src/androidTest/java/org/mozilla/fenix/ui/TabbedBrowsingTest.kt index 4675da8fb..89fc9526a 100644 --- a/app/src/androidTest/java/org/mozilla/fenix/ui/TabbedBrowsingTest.kt +++ b/app/src/androidTest/java/org/mozilla/fenix/ui/TabbedBrowsingTest.kt @@ -65,8 +65,8 @@ class TabbedBrowsingTest { verifyOpenTabsHeader() verifyNoTabsOpenedText() verifyNoTabsOpenedHeader() - verifyNoCollectionsText() - verifyNoCollectionsHeader() + verifyNoCollectionsTextIsNotShown() + verifyNoCollectionsHeaderIsNotShown() verifyAddTabButton() } @@ -83,6 +83,8 @@ class TabbedBrowsingTest { TestAssetHelper.waitingTime ) verifyExistingTabList() + verifyNoCollectionsHeader() + verifyNoCollectionsText() }.openTabsListThreeDotMenu { verifyCloseAllTabsButton() @@ -153,8 +155,8 @@ class TabbedBrowsingTest { verifyShareTabButton() verifySaveCollection() }.closeAllTabs { - verifyNoCollectionsHeader() - verifyNoCollectionsText() + verifyNoCollectionsHeaderIsNotShown() + verifyNoCollectionsTextIsNotShown() verifyNoTabsOpenedHeader() verifyNoTabsOpenedText() } 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 a1b34902f..359786eb7 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 @@ -55,6 +55,9 @@ class HomeScreenRobot { fun verifyCollectionsHeader() = assertCollectionsHeader() fun verifyNoCollectionsHeader() = assertNoCollectionsHeader() fun verifyNoCollectionsText() = assertNoCollectionsText() + fun verifyNoCollectionsHeaderIsNotShown() = assertNoCollectionsHeaderIsNotVisible() + fun verifyCollectionsHeaderIsNotShown() = assertCollectionsHeaderIsNotVisible() + fun verifyNoCollectionsTextIsNotShown() = assertNoCollectionsTextIsNotVisible() fun verifyNoTabsOpenedHeader() = assertNoTabsOpenedHeader() fun verifyHomeWordmark() = assertHomeWordmark() fun verifyHomeToolbar() = assertHomeToolbar() @@ -322,13 +325,29 @@ private fun assertNoCollectionsHeader() = onView(allOf(withText("No collections"))) .check(matches(withEffectiveVisibility(Visibility.VISIBLE))) +private fun assertNoCollectionsHeaderIsNotVisible() = + onView(allOf(withText("No collections"))) + .check(doesNotExist()) + +private fun assertCollectionsHeaderIsNotVisible() = + onView(allOf(withText("Collections"))) + .check(doesNotExist()) + private fun assertNoCollectionsText() = + onView( + allOf( + withText("Collect the things that matter to you. To start, save open tabs to a new collection.") + ) + ) + .check(matches(withEffectiveVisibility(Visibility.VISIBLE))) + +private fun assertNoCollectionsTextIsNotVisible() = onView( allOf( withText("Collect the things that matter to you. To start, save open tabs to a new collection.") ) ) - .check(matches(withEffectiveVisibility(Visibility.VISIBLE))) + .check(doesNotExist()) private fun assertHomeComponent() = onView(ViewMatchers.withResourceName("sessionControlRecyclerView")) .check(matches(withEffectiveVisibility(Visibility.VISIBLE)))