From 38f0640d2cbbe5a355d28976967f582cbe0aeebf Mon Sep 17 00:00:00 2001 From: Adam Brown Date: Thu, 11 Nov 2021 10:16:29 +0000 Subject: [PATCH] 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 --- .../im/vector/app/ui/robot/MessageMenuRobot.kt | 8 +++++++- .../im/vector/app/ui/robot/RoomDetailRobot.kt | 16 +++++++++++----- 2 files changed, 18 insertions(+), 6 deletions(-) diff --git a/vector/src/androidTest/java/im/vector/app/ui/robot/MessageMenuRobot.kt b/vector/src/androidTest/java/im/vector/app/ui/robot/MessageMenuRobot.kt index fd579c0d9f..934c6c76a1 100644 --- a/vector/src/androidTest/java/im/vector/app/ui/robot/MessageMenuRobot.kt +++ b/vector/src/androidTest/java/im/vector/app/ui/robot/MessageMenuRobot.kt @@ -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(withText(R.string.message_edits), openState = BottomSheetBehavior.STATE_COLLAPSED) { + pressBack() + } autoClosed = true } diff --git a/vector/src/androidTest/java/im/vector/app/ui/robot/RoomDetailRobot.kt b/vector/src/androidTest/java/im/vector/app/ui/robot/RoomDetailRobot.kt index 24fe5adf64..df1771546c 100644 --- a/vector/src/androidTest/java/im/vector/app/ui/robot/RoomDetailRobot.kt +++ b/vector/src/androidTest/java/im/vector/app/ui/robot/RoomDetailRobot.kt @@ -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(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())