naming the threads room creation to avoid multiple rooms with empty room as the name, causing ambiguous assertion errors

This commit is contained in:
Adam Brown 2022-07-08 12:04:12 +01:00
parent a5bf25f2b4
commit 8db704f3b9
2 changed files with 15 additions and 2 deletions

View file

@ -159,7 +159,7 @@ class UiAllScreensSanityTest {
elementRobot.newRoom {
createNewRoom {
crawl()
createRoom {
createRoom(roomName = "thread room") {
val message = "Hello This message will be a thread!"
postMessage(message)
replyToThread(message)

View file

@ -16,8 +16,15 @@
package im.vector.app.ui.robot
import androidx.test.espresso.Espresso.closeSoftKeyboard
import androidx.test.espresso.Espresso.onData
import androidx.test.espresso.Espresso.onView
import androidx.test.espresso.Espresso.pressBack
import androidx.test.espresso.action.ViewActions.replaceText
import androidx.test.espresso.assertion.ViewAssertions.matches
import androidx.test.espresso.matcher.ViewMatchers.withHint
import androidx.test.espresso.matcher.ViewMatchers.withId
import androidx.test.espresso.matcher.ViewMatchers.withText
import com.adevinta.android.barista.assertion.BaristaListAssertions
import com.adevinta.android.barista.interaction.BaristaClickInteractions
import com.adevinta.android.barista.interaction.BaristaListInteractions
@ -25,14 +32,20 @@ import im.vector.app.R
import im.vector.app.espresso.tools.waitUntilActivityVisible
import im.vector.app.espresso.tools.waitUntilViewVisible
import im.vector.app.features.home.room.detail.RoomDetailActivity
import org.hamcrest.CoreMatchers.allOf
class CreateNewRoomRobot(
var createdRoom: Boolean = false
) {
fun createRoom(block: RoomDetailRobot.() -> Unit) {
fun createRoom(roomName: String? = null, block: RoomDetailRobot.() -> Unit) {
createdRoom = true
BaristaListAssertions.assertListItemCount(R.id.createRoomForm, 12)
roomName?.let {
onView(allOf(withId(R.id.formTextInputTextInputEditText), withHint(R.string.create_room_name_hint)))
.perform(replaceText(roomName))
closeSoftKeyboard()
}
BaristaListInteractions.clickListItemChild(R.id.createRoomForm, 11, R.id.form_submit_button)
waitUntilActivityVisible<RoomDetailActivity> {
waitUntilViewVisible(withId(R.id.composerEditText))