fixing space menu items not being clicked on during sanity test
- adds a separate clickOn helper for interacting with dialog bottom sheets, it seems the space menu sheet lives in a separte root to the rest of the suite (could be the fast switching of highlighting existing issues)
This commit is contained in:
parent
924a4f8c94
commit
9a80ff7673
|
@ -27,6 +27,9 @@ import androidx.test.espresso.IdlingResource
|
|||
import androidx.test.espresso.PerformException
|
||||
import androidx.test.espresso.UiController
|
||||
import androidx.test.espresso.ViewAction
|
||||
import androidx.test.espresso.action.ViewActions
|
||||
import androidx.test.espresso.matcher.RootMatchers
|
||||
import androidx.test.espresso.matcher.ViewMatchers
|
||||
import androidx.test.espresso.matcher.ViewMatchers.isDisplayed
|
||||
import androidx.test.espresso.util.HumanReadables
|
||||
import androidx.test.espresso.util.TreeIterables
|
||||
|
@ -257,6 +260,10 @@ fun clickOnAndGoBack(@StringRes name: Int, block: () -> Unit) {
|
|||
Espresso.pressBack()
|
||||
}
|
||||
|
||||
fun clickOnSheet(id: Int) {
|
||||
Espresso.onView(ViewMatchers.withId(id)).inRoot(RootMatchers.isDialog()).perform(ViewActions.click())
|
||||
}
|
||||
|
||||
inline fun <reified T : VectorBaseBottomSheetDialogFragment<*>> interactWithSheet(
|
||||
contentMatcher: Matcher<View>,
|
||||
@BottomSheetBehavior.State openState: Int = BottomSheetBehavior.STATE_EXPANDED,
|
||||
|
|
|
@ -24,6 +24,7 @@ import androidx.test.espresso.matcher.ViewMatchers
|
|||
import com.adevinta.android.barista.interaction.BaristaClickInteractions.clickOn
|
||||
import com.adevinta.android.barista.internal.viewaction.ClickChildAction
|
||||
import im.vector.app.R
|
||||
import im.vector.app.clickOnSheet
|
||||
import im.vector.app.espresso.tools.waitUntilActivityVisible
|
||||
import im.vector.app.espresso.tools.waitUntilDialogVisible
|
||||
import im.vector.app.espresso.tools.waitUntilViewVisible
|
||||
|
@ -49,7 +50,7 @@ class SpaceMenuRobot {
|
|||
}
|
||||
|
||||
fun invitePeople() = apply {
|
||||
clickOn(R.id.invitePeople)
|
||||
clickOnSheet(R.id.invitePeople)
|
||||
waitUntilDialogVisible(ViewMatchers.withId(R.id.inviteByMxidButton))
|
||||
clickOn(R.id.inviteByMxidButton)
|
||||
waitUntilActivityVisible<InviteUsersToRoomActivity> {
|
||||
|
@ -62,7 +63,7 @@ class SpaceMenuRobot {
|
|||
}
|
||||
|
||||
fun spaceMembers() {
|
||||
clickOn(R.id.showMemberList)
|
||||
clickOnSheet(R.id.showMemberList)
|
||||
waitUntilActivityVisible<RoomProfileActivity> {
|
||||
waitUntilViewVisible(ViewMatchers.withId(R.id.roomSettingsRecyclerView))
|
||||
}
|
||||
|
@ -70,7 +71,7 @@ class SpaceMenuRobot {
|
|||
}
|
||||
|
||||
fun spaceSettings(block: SpaceSettingsRobot.() -> Unit) {
|
||||
clickOn(R.id.spaceSettings)
|
||||
clickOnSheet(R.id.spaceSettings)
|
||||
waitUntilActivityVisible<SpaceManageActivity> {
|
||||
waitUntilViewVisible(ViewMatchers.withId(R.id.roomSettingsRecyclerView))
|
||||
}
|
||||
|
@ -78,7 +79,7 @@ class SpaceMenuRobot {
|
|||
}
|
||||
|
||||
fun exploreRooms() {
|
||||
clickOn(R.id.exploreRooms)
|
||||
clickOnSheet(R.id.exploreRooms)
|
||||
waitUntilActivityVisible<SpaceExploreActivity> {
|
||||
waitUntilViewVisible(ViewMatchers.withId(R.id.spaceDirectoryList))
|
||||
}
|
||||
|
@ -86,7 +87,7 @@ class SpaceMenuRobot {
|
|||
}
|
||||
|
||||
fun addRoom() = apply {
|
||||
clickOn(R.id.addRooms)
|
||||
clickOnSheet(R.id.addRooms)
|
||||
waitUntilActivityVisible<SpaceManageActivity> {
|
||||
waitUntilViewVisible(ViewMatchers.withId(R.id.roomList))
|
||||
}
|
||||
|
@ -94,7 +95,7 @@ class SpaceMenuRobot {
|
|||
}
|
||||
|
||||
fun addSpace() = apply {
|
||||
clickOn(R.id.addSpaces)
|
||||
clickOnSheet(R.id.addSpaces)
|
||||
waitUntilActivityVisible<SpaceManageActivity> {
|
||||
waitUntilViewVisible(ViewMatchers.withId(R.id.roomList))
|
||||
}
|
||||
|
@ -102,7 +103,7 @@ class SpaceMenuRobot {
|
|||
}
|
||||
|
||||
fun leaveSpace() {
|
||||
clickOn(R.id.leaveSpace)
|
||||
clickOnSheet(R.id.leaveSpace)
|
||||
waitUntilDialogVisible(ViewMatchers.withId(R.id.leaveButton))
|
||||
clickOn(R.id.leave_selected)
|
||||
waitUntilActivityVisible<SpaceLeaveAdvancedActivity> {
|
||||
|
|
Loading…
Reference in New Issue