always attempting to close the keyboard to help avoid can't inject events error

This commit is contained in:
Adam Brown 2022-07-08 12:05:44 +01:00
parent 8db704f3b9
commit c7efd8a6f6
3 changed files with 8 additions and 2 deletions

View file

@ -17,6 +17,7 @@
package im.vector.app.ui.robot package im.vector.app.ui.robot
import android.view.View import android.view.View
import androidx.test.espresso.Espresso.closeSoftKeyboard
import androidx.test.espresso.Espresso.onView import androidx.test.espresso.Espresso.onView
import androidx.test.espresso.Espresso.pressBack import androidx.test.espresso.Espresso.pressBack
import androidx.test.espresso.action.ViewActions import androidx.test.espresso.action.ViewActions
@ -91,8 +92,7 @@ class ElementRobot {
waitUntilActivityVisible<CreateDirectRoomActivity> { waitUntilActivityVisible<CreateDirectRoomActivity> {
waitUntilViewVisible(withId(R.id.userListSearch)) waitUntilViewVisible(withId(R.id.userListSearch))
} }
// close keyboard closeSoftKeyboard()
pressBack()
block(NewDirectMessageRobot()) block(NewDirectMessageRobot())
pressBack() pressBack()
waitUntilViewVisible(withId(R.id.bottomNavigationView)) waitUntilViewVisible(withId(R.id.bottomNavigationView))

View file

@ -16,6 +16,7 @@
package im.vector.app.ui.robot package im.vector.app.ui.robot
import androidx.test.espresso.Espresso.closeSoftKeyboard
import androidx.test.espresso.Espresso.pressBack import androidx.test.espresso.Espresso.pressBack
import androidx.test.espresso.matcher.ViewMatchers.withId import androidx.test.espresso.matcher.ViewMatchers.withId
import androidx.test.espresso.matcher.ViewMatchers.withText import androidx.test.espresso.matcher.ViewMatchers.withText
@ -59,6 +60,7 @@ class MessageMenuRobot(
clickOn(R.string.message_add_reaction) clickOn(R.string.message_add_reaction)
// Wait for emoji to load, it's async now // Wait for emoji to load, it's async now
waitUntilActivityVisible<EmojiReactionPickerActivity> { waitUntilActivityVisible<EmojiReactionPickerActivity> {
closeSoftKeyboard()
waitUntilViewVisible(withId(R.id.emojiRecyclerView)) waitUntilViewVisible(withId(R.id.emojiRecyclerView))
waitUntilViewVisible(withText("😀")) waitUntilViewVisible(withText("😀"))
} }

View file

@ -17,6 +17,7 @@
package im.vector.app.ui.robot package im.vector.app.ui.robot
import androidx.recyclerview.widget.RecyclerView import androidx.recyclerview.widget.RecyclerView
import androidx.test.espresso.Espresso.closeSoftKeyboard
import androidx.test.espresso.Espresso.onView import androidx.test.espresso.Espresso.onView
import androidx.test.espresso.Espresso.pressBack import androidx.test.espresso.Espresso.pressBack
import androidx.test.espresso.action.ViewActions import androidx.test.espresso.action.ViewActions
@ -44,6 +45,7 @@ class RoomDetailRobot {
fun postMessage(content: String) { fun postMessage(content: String) {
writeTo(R.id.composerEditText, content) writeTo(R.id.composerEditText, content)
closeSoftKeyboard()
waitUntilViewVisible(withId(R.id.sendButton)) waitUntilViewVisible(withId(R.id.sendButton))
clickOn(R.id.sendButton) clickOn(R.id.sendButton)
waitUntilViewVisible(withText(content)) waitUntilViewVisible(withText(content))
@ -68,6 +70,7 @@ class RoomDetailRobot {
} }
val threadMessage = "Hello universe - long message to avoid espresso tapping edited!" val threadMessage = "Hello universe - long message to avoid espresso tapping edited!"
writeTo(R.id.composerEditText, threadMessage) writeTo(R.id.composerEditText, threadMessage)
closeSoftKeyboard()
waitUntilViewVisible(withId(R.id.sendButton)) waitUntilViewVisible(withId(R.id.sendButton))
clickOn(R.id.sendButton) clickOn(R.id.sendButton)
} }
@ -105,6 +108,7 @@ class RoomDetailRobot {
// TODO Cancel action // TODO Cancel action
val edit = "Hello universe - long message to avoid espresso tapping edited!" val edit = "Hello universe - long message to avoid espresso tapping edited!"
writeTo(R.id.composerEditText, edit) writeTo(R.id.composerEditText, edit)
closeSoftKeyboard()
// Wait a bit for the keyboard layout to update // Wait a bit for the keyboard layout to update
waitUntilViewVisible(withId(R.id.sendButton)) waitUntilViewVisible(withId(R.id.sendButton))
clickOn(R.id.sendButton) clickOn(R.id.sendButton)