relying on createRoom to close itself rather than the newRoom flow

This commit is contained in:
Adam Brown 2021-11-05 15:35:57 +00:00
parent 0405c2df8d
commit b1397aee51
3 changed files with 12 additions and 5 deletions

View File

@ -16,7 +16,7 @@
package im.vector.app.ui.robot 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 androidx.test.espresso.matcher.ViewMatchers.withId
import com.adevinta.android.barista.assertion.BaristaListAssertions import com.adevinta.android.barista.assertion.BaristaListAssertions
import com.adevinta.android.barista.interaction.BaristaClickInteractions import com.adevinta.android.barista.interaction.BaristaClickInteractions
@ -38,11 +38,12 @@ class CreateNewRoomRobot(
waitUntilViewVisible(withId(R.id.composerEditText)) waitUntilViewVisible(withId(R.id.composerEditText))
} }
block(RoomDetailRobot()) block(RoomDetailRobot())
pressBack()
} }
fun crawl() { fun crawl() {
// Room access bottom sheet // Room access bottom sheet
BaristaClickInteractions.clickOn(R.string.room_settings_room_access_private_title) BaristaClickInteractions.clickOn(R.string.room_settings_room_access_private_title)
Espresso.pressBack() pressBack()
} }
} }

View File

@ -20,12 +20,15 @@ import androidx.test.espresso.Espresso
import com.adevinta.android.barista.interaction.BaristaClickInteractions import com.adevinta.android.barista.interaction.BaristaClickInteractions
import im.vector.app.R import im.vector.app.R
class NewRoomRobot { class NewRoomRobot(
var createdRoom: Boolean = false
) {
fun createNewRoom(block: CreateNewRoomRobot.() -> Unit) { fun createNewRoom(block: CreateNewRoomRobot.() -> Unit) {
BaristaClickInteractions.clickOn(R.string.create_new_room) BaristaClickInteractions.clickOn(R.string.create_new_room)
val createNewRoomRobot = CreateNewRoomRobot() val createNewRoomRobot = CreateNewRoomRobot()
block(createNewRoomRobot) block(createNewRoomRobot)
createdRoom = createNewRoomRobot.createdRoom
if (!createNewRoomRobot.createdRoom) { if (!createNewRoomRobot.createdRoom) {
Espresso.pressBack() Espresso.pressBack()
} }

View File

@ -45,7 +45,10 @@ class RoomListRobot {
waitUntilActivityVisible<RoomDirectoryActivity> { waitUntilActivityVisible<RoomDirectoryActivity> {
BaristaVisibilityAssertions.assertDisplayed(R.id.publicRoomsList) BaristaVisibilityAssertions.assertDisplayed(R.id.publicRoomsList)
} }
block(NewRoomRobot()) val newRoomRobot = NewRoomRobot()
Espresso.pressBack() block(newRoomRobot)
if (!newRoomRobot.createdRoom) {
Espresso.pressBack()
}
} }
} }