From b1397aee5124afd1fa7453818accfa9bb7c2e06c Mon Sep 17 00:00:00 2001 From: Adam Brown Date: Fri, 5 Nov 2021 15:35:57 +0000 Subject: [PATCH] relying on createRoom to close itself rather than the newRoom flow --- .../java/im/vector/app/ui/robot/CreateNewRoomRobot.kt | 5 +++-- .../java/im/vector/app/ui/robot/NewRoomRobot.kt | 5 ++++- .../java/im/vector/app/ui/robot/RoomListRobot.kt | 7 +++++-- 3 files changed, 12 insertions(+), 5 deletions(-) diff --git a/vector/src/androidTest/java/im/vector/app/ui/robot/CreateNewRoomRobot.kt b/vector/src/androidTest/java/im/vector/app/ui/robot/CreateNewRoomRobot.kt index 24fa48181d..505dfb33e9 100644 --- a/vector/src/androidTest/java/im/vector/app/ui/robot/CreateNewRoomRobot.kt +++ b/vector/src/androidTest/java/im/vector/app/ui/robot/CreateNewRoomRobot.kt @@ -16,7 +16,7 @@ package im.vector.app.ui.robot -import androidx.test.espresso.Espresso +import androidx.test.espresso.Espresso.pressBack import androidx.test.espresso.matcher.ViewMatchers.withId import com.adevinta.android.barista.assertion.BaristaListAssertions import com.adevinta.android.barista.interaction.BaristaClickInteractions @@ -38,11 +38,12 @@ class CreateNewRoomRobot( waitUntilViewVisible(withId(R.id.composerEditText)) } block(RoomDetailRobot()) + pressBack() } fun crawl() { // Room access bottom sheet BaristaClickInteractions.clickOn(R.string.room_settings_room_access_private_title) - Espresso.pressBack() + pressBack() } } diff --git a/vector/src/androidTest/java/im/vector/app/ui/robot/NewRoomRobot.kt b/vector/src/androidTest/java/im/vector/app/ui/robot/NewRoomRobot.kt index ee50cbcf21..6a7fabece0 100644 --- a/vector/src/androidTest/java/im/vector/app/ui/robot/NewRoomRobot.kt +++ b/vector/src/androidTest/java/im/vector/app/ui/robot/NewRoomRobot.kt @@ -20,12 +20,15 @@ import androidx.test.espresso.Espresso import com.adevinta.android.barista.interaction.BaristaClickInteractions import im.vector.app.R -class NewRoomRobot { +class NewRoomRobot( + var createdRoom: Boolean = false +) { fun createNewRoom(block: CreateNewRoomRobot.() -> Unit) { BaristaClickInteractions.clickOn(R.string.create_new_room) val createNewRoomRobot = CreateNewRoomRobot() block(createNewRoomRobot) + createdRoom = createNewRoomRobot.createdRoom if (!createNewRoomRobot.createdRoom) { Espresso.pressBack() } diff --git a/vector/src/androidTest/java/im/vector/app/ui/robot/RoomListRobot.kt b/vector/src/androidTest/java/im/vector/app/ui/robot/RoomListRobot.kt index e95132b562..bc7d4ac76b 100644 --- a/vector/src/androidTest/java/im/vector/app/ui/robot/RoomListRobot.kt +++ b/vector/src/androidTest/java/im/vector/app/ui/robot/RoomListRobot.kt @@ -45,7 +45,10 @@ class RoomListRobot { waitUntilActivityVisible { BaristaVisibilityAssertions.assertDisplayed(R.id.publicRoomsList) } - block(NewRoomRobot()) - Espresso.pressBack() + val newRoomRobot = NewRoomRobot() + block(newRoomRobot) + if (!newRoomRobot.createdRoom) { + Espresso.pressBack() + } } }