From 6f5d8d6ece06a1855ecba8bf322873320ca77a62 Mon Sep 17 00:00:00 2001 From: valere Date: Wed, 28 Dec 2022 18:09:28 +0100 Subject: [PATCH 1/2] FIx UI Tests --- .../androidTest/java/im/vector/app/EspressoExt.kt | 2 +- .../im/vector/app/ui/UiAllScreensSanityTest.kt | 8 +++++--- .../vector/app/ui/robot/space/SpaceCreateRobot.kt | 14 ++++++++------ .../im/vector/app/ui/robot/space/SpaceMenuRobot.kt | 5 ++--- 4 files changed, 16 insertions(+), 13 deletions(-) diff --git a/vector-app/src/androidTest/java/im/vector/app/EspressoExt.kt b/vector-app/src/androidTest/java/im/vector/app/EspressoExt.kt index 72137ed8e8..68a54e9901 100644 --- a/vector-app/src/androidTest/java/im/vector/app/EspressoExt.kt +++ b/vector-app/src/androidTest/java/im/vector/app/EspressoExt.kt @@ -89,7 +89,7 @@ fun getString(@StringRes id: Int): String { return EspressoHelper.getCurrentActivity()!!.resources.getString(id) } -fun waitForView(viewMatcher: Matcher, timeout: Long = 10_000, waitForDisplayed: Boolean = true): ViewAction { +fun waitForView(viewMatcher: Matcher, timeout: Long = 20_000, waitForDisplayed: Boolean = true): ViewAction { return object : ViewAction { private val clock = DefaultClock() diff --git a/vector-app/src/androidTest/java/im/vector/app/ui/UiAllScreensSanityTest.kt b/vector-app/src/androidTest/java/im/vector/app/ui/UiAllScreensSanityTest.kt index 52607bd9a1..177bde83ec 100644 --- a/vector-app/src/androidTest/java/im/vector/app/ui/UiAllScreensSanityTest.kt +++ b/vector-app/src/androidTest/java/im/vector/app/ui/UiAllScreensSanityTest.kt @@ -28,7 +28,6 @@ import im.vector.app.espresso.tools.ScreenshotFailureRule import im.vector.app.features.MainActivity import im.vector.app.getString import im.vector.app.ui.robot.ElementRobot -import im.vector.app.ui.robot.settings.labs.LabFeature import im.vector.app.ui.robot.settings.labs.LabFeaturesPreferences import im.vector.app.ui.robot.withDeveloperMode import org.junit.Rule @@ -130,6 +129,9 @@ class UiAllScreensSanityTest { addSpace().also { openMenu(publicSpaceName) } leaveSpace() + // Some instability with the bottomsheet + // not sure what's the source, maybe the expanded state? + Thread.sleep(10_000) } } @@ -175,7 +177,7 @@ class UiAllScreensSanityTest { * Testing multiple threads screens */ private fun testThreadScreens() { - elementRobot.toggleLabFeature(LabFeature.THREAD_MESSAGES) +// elementRobot.toggleLabFeature(LabFeature.THREAD_MESSAGES) elementRobot.newRoom { createNewRoom { crawl() @@ -189,6 +191,6 @@ class UiAllScreensSanityTest { } } } - elementRobot.toggleLabFeature(LabFeature.THREAD_MESSAGES) +// elementRobot.toggleLabFeature(LabFeature.THREAD_MESSAGES) } } diff --git a/vector-app/src/androidTest/java/im/vector/app/ui/robot/space/SpaceCreateRobot.kt b/vector-app/src/androidTest/java/im/vector/app/ui/robot/space/SpaceCreateRobot.kt index e5147c2085..ad6d5e5df3 100644 --- a/vector-app/src/androidTest/java/im/vector/app/ui/robot/space/SpaceCreateRobot.kt +++ b/vector-app/src/androidTest/java/im/vector/app/ui/robot/space/SpaceCreateRobot.kt @@ -28,7 +28,6 @@ import androidx.test.espresso.matcher.ViewMatchers.withText import com.adevinta.android.barista.interaction.BaristaClickInteractions.clickOn import im.vector.app.R import im.vector.app.espresso.tools.waitUntilActivityVisible -import im.vector.app.espresso.tools.waitUntilDialogVisible import im.vector.app.espresso.tools.waitUntilViewVisible import im.vector.app.features.home.HomeActivity import im.vector.app.features.home.room.detail.RoomDetailActivity @@ -86,14 +85,17 @@ class SpaceCreateRobot { clickOn(R.id.nextButton) waitUntilViewVisible(withId(R.id.recyclerView)) clickOn(R.id.nextButton) +// waitUntilActivityVisible { +// waitUntilDialogVisible(withId(R.id.inviteByMxidButton)) +// } +// // close invite dialog +// pressBack() waitUntilActivityVisible { - waitUntilDialogVisible(withId(R.id.inviteByMxidButton)) + pressBack() } - // close invite dialog - pressBack() - waitUntilViewVisible(withId(R.id.timelineRecyclerView)) +// waitUntilViewVisible(withId(R.id.timelineRecyclerView)) // close room - pressBack() +// pressBack() waitUntilViewVisible(withId(R.id.roomListContainer)) } } diff --git a/vector-app/src/androidTest/java/im/vector/app/ui/robot/space/SpaceMenuRobot.kt b/vector-app/src/androidTest/java/im/vector/app/ui/robot/space/SpaceMenuRobot.kt index d04746bcd6..73a063857a 100644 --- a/vector-app/src/androidTest/java/im/vector/app/ui/robot/space/SpaceMenuRobot.kt +++ b/vector-app/src/androidTest/java/im/vector/app/ui/robot/space/SpaceMenuRobot.kt @@ -89,9 +89,8 @@ class SpaceMenuRobot { clickOnSheet(R.id.leaveSpace) waitUntilActivityVisible { waitUntilViewVisible(ViewMatchers.withId(R.id.roomList)) + clickOn(R.id.spaceLeaveSelectAll) + clickOn(R.id.spaceLeaveButton) } - clickOn(R.id.spaceLeaveSelectAll) - clickOn(R.id.spaceLeaveButton) - waitUntilViewVisible(ViewMatchers.withId(R.id.groupListView)) } } From 53b1bec5dbda7ea21ef3f3d54724597892e66511 Mon Sep 17 00:00:00 2001 From: valere Date: Thu, 29 Dec 2022 10:51:57 +0100 Subject: [PATCH 2/2] try fix lint --- .../java/im/vector/app/ui/UiAllScreensSanityTest.kt | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/vector-app/src/androidTest/java/im/vector/app/ui/UiAllScreensSanityTest.kt b/vector-app/src/androidTest/java/im/vector/app/ui/UiAllScreensSanityTest.kt index 177bde83ec..3439bcfced 100644 --- a/vector-app/src/androidTest/java/im/vector/app/ui/UiAllScreensSanityTest.kt +++ b/vector-app/src/androidTest/java/im/vector/app/ui/UiAllScreensSanityTest.kt @@ -129,12 +129,13 @@ class UiAllScreensSanityTest { addSpace().also { openMenu(publicSpaceName) } leaveSpace() - // Some instability with the bottomsheet - // not sure what's the source, maybe the expanded state? - Thread.sleep(10_000) } } + // Some instability with the bottomsheet + // not sure what's the source, maybe the expanded state? + Thread.sleep(10_000) + elementRobot.space { selectSpace(spaceName) } elementRobot.layoutPreferences { @@ -177,7 +178,6 @@ class UiAllScreensSanityTest { * Testing multiple threads screens */ private fun testThreadScreens() { -// elementRobot.toggleLabFeature(LabFeature.THREAD_MESSAGES) elementRobot.newRoom { createNewRoom { crawl() @@ -191,6 +191,5 @@ class UiAllScreensSanityTest { } } } -// elementRobot.toggleLabFeature(LabFeature.THREAD_MESSAGES) } }