mirror of
https://github.com/vector-im/element-android.git
synced 2024-11-15 01:35:07 +08:00
Merge pull request #5320 from vector-im/feature/adm/space-ui-failures
Tentatively fixing space menu items not being clicked on during sanity test
This commit is contained in:
commit
93131da61a
1
changelog.d/5269.misc
Normal file
1
changelog.d/5269.misc
Normal file
@ -0,0 +1 @@
|
||||
Tentatively fixing the UI sanity test being unable to click on the space menu items
|
@ -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
Block a user