tapping the timeline settings via the overflow small devices can't tap the title

- waiting for the message edits bottom sheet
- waiting for the reactions bottom sheet
This commit is contained in:
Adam Brown 2021-11-11 10:16:29 +00:00
parent 97d768e392
commit 38f0640d2c
2 changed files with 18 additions and 6 deletions

View file

@ -17,9 +17,13 @@
package im.vector.app.ui.robot
import androidx.test.espresso.Espresso.pressBack
import androidx.test.espresso.matcher.ViewMatchers.withText
import com.adevinta.android.barista.interaction.BaristaClickInteractions.clickOn
import com.adevinta.android.barista.interaction.BaristaListInteractions.clickListItem
import com.google.android.material.bottomsheet.BottomSheetBehavior
import im.vector.app.R
import im.vector.app.features.home.room.detail.timeline.edithistory.ViewEditHistoryBottomSheet
import im.vector.app.interactWithSheet
import java.lang.Thread.sleep
class MessageMenuRobot(
@ -36,7 +40,9 @@ class MessageMenuRobot(
fun editHistory() {
clickOn(R.string.message_view_edit_history)
pressBack()
interactWithSheet<ViewEditHistoryBottomSheet>(withText(R.string.message_edits), openState = BottomSheetBehavior.STATE_COLLAPSED) {
pressBack()
}
autoClosed = true
}

View file

@ -30,9 +30,11 @@ import com.adevinta.android.barista.interaction.BaristaClickInteractions.longCli
import com.adevinta.android.barista.interaction.BaristaEditTextInteractions.writeTo
import com.adevinta.android.barista.interaction.BaristaMenuClickInteractions.clickMenu
import com.adevinta.android.barista.interaction.BaristaMenuClickInteractions.openMenu
import com.google.android.material.bottomsheet.BottomSheetBehavior
import im.vector.app.R
import im.vector.app.espresso.tools.waitUntilViewVisible
import im.vector.app.features.home.room.detail.timeline.action.MessageActionsBottomSheet
import im.vector.app.features.home.room.detail.timeline.reactions.ViewReactionsBottomSheet
import im.vector.app.features.reactions.data.EmojiDataSource
import im.vector.app.interactWithSheet
import im.vector.app.waitForView
@ -71,7 +73,9 @@ class RoomDetailRobot {
// Open reactions
longClickOn(quickReaction)
// wait for bottom sheet
pressBack()
interactWithSheet<ViewReactionsBottomSheet>(withText(R.string.reactions), openState = BottomSheetBehavior.STATE_COLLAPSED) {
pressBack()
}
// Test add reaction
openMessageMenu(message) {
addReactionFromEmojiPicker()
@ -81,16 +85,18 @@ class RoomDetailRobot {
edit()
}
// TODO Cancel action
writeTo(R.id.composerEditText, "Hello universe!")
val edit = "Hello universe - long message to avoid espresso tapping edited!"
writeTo(R.id.composerEditText, edit)
// Wait a bit for the keyboard layout to update
waitUntilViewVisible(withId(R.id.sendButton))
clickOn(R.id.sendButton)
// Wait for the UI to update
waitUntilViewVisible(withText("Hello universe! (edited)"))
waitUntilViewVisible(withText("$edit (edited)"))
// Open edit history
openMessageMenu("Hello universe! (edited)") {
openMessageMenu("$edit (edited)") {
editHistory()
}
waitUntilViewVisible(withId(R.id.composerEditText))
}
fun openMessageMenu(message: String, block: MessageMenuRobot.() -> Unit) {
@ -111,7 +117,7 @@ class RoomDetailRobot {
}
fun openSettings(block: RoomSettingsRobot.() -> Unit) {
clickOn(R.id.roomToolbarTitleView)
clickMenu(R.id.timeline_setting)
waitForView(withId(R.id.roomProfileAvatarView))
sleep(1000)
block(RoomSettingsRobot())