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
import android.view.View
import androidx.test.espresso.Espresso.closeSoftKeyboard
import androidx.test.espresso.Espresso.onView
import androidx.test.espresso.Espresso.pressBack
import androidx.test.espresso.action.ViewActions
@ -91,8 +92,7 @@ class ElementRobot {
waitUntilActivityVisible<CreateDirectRoomActivity> {
waitUntilViewVisible(withId(R.id.userListSearch))
}
// close keyboard
pressBack()
closeSoftKeyboard()
block(NewDirectMessageRobot())
pressBack()
waitUntilViewVisible(withId(R.id.bottomNavigationView))

View File

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

View File

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