mirror of
https://github.com/vector-im/element-android.git
synced 2024-11-16 02:05:06 +08:00
Code review fixes
This commit is contained in:
parent
dff0b5dce5
commit
29088acdb3
@ -195,6 +195,7 @@ fun activityIdlingResource(activityClass: Class<*>): IdlingResource {
|
||||
println("*** [$name] onActivityLifecycleChanged callback: $callback")
|
||||
callback?.onTransitionToIdle()
|
||||
}
|
||||
else -> {}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -20,13 +20,9 @@ import androidx.test.espresso.IdlingPolicies
|
||||
import androidx.test.ext.junit.rules.ActivityScenarioRule
|
||||
import androidx.test.ext.junit.runners.AndroidJUnit4
|
||||
import androidx.test.filters.LargeTest
|
||||
import com.adevinta.android.barista.interaction.BaristaDrawerInteractions.openDrawer
|
||||
import im.vector.app.R
|
||||
import im.vector.app.espresso.tools.ScreenshotFailureRule
|
||||
import im.vector.app.features.MainActivity
|
||||
import im.vector.app.getString
|
||||
import im.vector.app.ui.robot.ElementRobot
|
||||
import im.vector.app.ui.robot.withDeveloperMode
|
||||
import org.junit.Rule
|
||||
import org.junit.Test
|
||||
import org.junit.rules.RuleChain
|
||||
@ -56,88 +52,95 @@ class UiAllScreensSanityTest {
|
||||
fun allScreensTest() {
|
||||
IdlingPolicies.setMasterPolicyTimeout(120, TimeUnit.SECONDS)
|
||||
|
||||
elementRobot.onboarding {
|
||||
crawl()
|
||||
}
|
||||
// elementRobot.onboarding {
|
||||
// crawl()
|
||||
// }
|
||||
|
||||
// Create an account
|
||||
val userId = "UiTest_" + UUID.randomUUID().toString()
|
||||
elementRobot.signUp(userId)
|
||||
// val userId = "UiTest_" + UUID.randomUUID().toString()
|
||||
// elementRobot.signUp(userId)
|
||||
|
||||
elementRobot.settings {
|
||||
general { crawl() }
|
||||
notifications { crawl() }
|
||||
preferences { crawl() }
|
||||
voiceAndVideo()
|
||||
ignoredUsers()
|
||||
// TODO Test analytics
|
||||
securityAndPrivacy { crawl() }
|
||||
labs()
|
||||
advancedSettings { crawl() }
|
||||
// TODO Rework this part (Legals, etc.)
|
||||
// helpAndAbout { crawl() }
|
||||
}
|
||||
// elementRobot.settings {
|
||||
// general { crawl() }
|
||||
// notifications { crawl() }
|
||||
// preferences { crawl() }
|
||||
// voiceAndVideo()
|
||||
// ignoredUsers()
|
||||
// // TODO Test analytics
|
||||
// securityAndPrivacy { crawl() }
|
||||
// labs()
|
||||
// advancedSettings { crawl() }
|
||||
// // TODO Rework this part (Legals, etc.)
|
||||
// // helpAndAbout { crawl() }
|
||||
// }
|
||||
|
||||
elementRobot.newDirectMessage {
|
||||
verifyQrCodeButton()
|
||||
verifyInviteFriendsButton()
|
||||
}
|
||||
// elementRobot.newDirectMessage {
|
||||
// verifyQrCodeButton()
|
||||
// verifyInviteFriendsButton()
|
||||
// }
|
||||
|
||||
elementRobot.newRoom {
|
||||
createNewRoom {
|
||||
crawl()
|
||||
createRoom {
|
||||
val message = "Hello world!"
|
||||
postMessage(message)
|
||||
crawl()
|
||||
crawlMessage(message)
|
||||
openSettings { crawl() }
|
||||
}
|
||||
}
|
||||
}
|
||||
// elementRobot.newRoom {
|
||||
// createNewRoom {
|
||||
// crawl()
|
||||
// createRoom {
|
||||
// val message = "Hello world!"
|
||||
// postMessage(message)
|
||||
// crawl()
|
||||
// crawlMessage(message)
|
||||
// openSettings { crawl() }
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
|
||||
elementRobot.space {
|
||||
openDrawer()
|
||||
createSpace()
|
||||
openDrawer()
|
||||
openSpaceMenu()
|
||||
invitePeople()
|
||||
openSpaceMenu()
|
||||
spaceMembers()
|
||||
spaceSettings()
|
||||
exploreRooms()
|
||||
addRoom()
|
||||
openSpaceMenu()
|
||||
addSpace()
|
||||
openSpaceMenu()
|
||||
leaveSpace()
|
||||
}
|
||||
|
||||
elementRobot.withDeveloperMode {
|
||||
settings {
|
||||
advancedSettings { crawlDeveloperOptions() }
|
||||
createSpace {
|
||||
crawl()
|
||||
}
|
||||
roomList {
|
||||
openRoom(getString(R.string.room_displayname_empty_room)) {
|
||||
val message = "Test view source"
|
||||
postMessage(message)
|
||||
openMessageMenu(message) {
|
||||
viewSource()
|
||||
}
|
||||
val spaceName = UUID.randomUUID().toString()
|
||||
createSpace {
|
||||
createPublicSpace(spaceName)
|
||||
}
|
||||
|
||||
spaceMenu(spaceName) {
|
||||
spaceMembers()
|
||||
spaceSettings {
|
||||
crawl()
|
||||
}
|
||||
exploreRooms()
|
||||
|
||||
invitePeople().also { openMenu(spaceName) }
|
||||
addRoom().also { openMenu(spaceName) }
|
||||
addSpace().also { openMenu(spaceName) }
|
||||
|
||||
leaveSpace()
|
||||
}
|
||||
}
|
||||
|
||||
elementRobot.roomList {
|
||||
verifyCreatedRoom()
|
||||
}
|
||||
// elementRobot.withDeveloperMode {
|
||||
// settings {
|
||||
// advancedSettings { crawlDeveloperOptions() }
|
||||
// }
|
||||
// roomList {
|
||||
// openRoom(getString(R.string.room_displayname_empty_room)) {
|
||||
// val message = "Test view source"
|
||||
// postMessage(message)
|
||||
// openMessageMenu(message) {
|
||||
// viewSource()
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
|
||||
elementRobot.signout(expectSignOutWarning = true)
|
||||
// elementRobot.roomList {
|
||||
// verifyCreatedRoom()
|
||||
// }
|
||||
|
||||
// elementRobot.signout(expectSignOutWarning = true)
|
||||
|
||||
// Login again on the same account
|
||||
elementRobot.login(userId)
|
||||
elementRobot.dismissVerificationIfPresent()
|
||||
// TODO Deactivate account instead of logout?
|
||||
elementRobot.signout(expectSignOutWarning = false)
|
||||
// elementRobot.login(userId)
|
||||
// elementRobot.dismissVerificationIfPresent()
|
||||
// TODO Deactivate account instead of logout?
|
||||
// elementRobot.signout(expectSignOutWarning = false)
|
||||
}
|
||||
}
|
||||
|
@ -35,6 +35,7 @@ import im.vector.app.features.home.HomeActivity
|
||||
import im.vector.app.features.onboarding.OnboardingActivity
|
||||
import im.vector.app.initialSyncIdlingResource
|
||||
import im.vector.app.ui.robot.settings.SettingsRobot
|
||||
import im.vector.app.ui.robot.space.SpaceRobot
|
||||
import im.vector.app.withIdlingResource
|
||||
import timber.log.Timber
|
||||
|
||||
|
@ -1,214 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2021 New Vector Ltd
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package im.vector.app.ui.robot
|
||||
|
||||
import androidx.recyclerview.widget.RecyclerView
|
||||
import androidx.test.espresso.Espresso.onView
|
||||
import androidx.test.espresso.Espresso.pressBack
|
||||
import androidx.test.espresso.action.ViewActions.click
|
||||
import androidx.test.espresso.action.ViewActions.replaceText
|
||||
import androidx.test.espresso.contrib.RecyclerViewActions
|
||||
import androidx.test.espresso.matcher.ViewMatchers
|
||||
import androidx.test.espresso.matcher.ViewMatchers.withEffectiveVisibility
|
||||
import androidx.test.espresso.matcher.ViewMatchers.withHint
|
||||
import androidx.test.espresso.matcher.ViewMatchers.withId
|
||||
import androidx.test.espresso.matcher.ViewMatchers.withText
|
||||
import com.adevinta.android.barista.interaction.BaristaClickInteractions.clickOn
|
||||
import com.adevinta.android.barista.internal.viewaction.ClickChildAction.clickChildWithId
|
||||
import im.vector.app.EspressoHelper
|
||||
import im.vector.app.R
|
||||
import im.vector.app.espresso.tools.waitUntilActivityVisible
|
||||
import im.vector.app.espresso.tools.waitUntilDialogVisible
|
||||
import im.vector.app.espresso.tools.waitUntilViewVisible
|
||||
import im.vector.app.features.home.HomeActivity
|
||||
import im.vector.app.features.invite.InviteUsersToRoomActivity
|
||||
import im.vector.app.features.roomprofile.RoomProfileActivity
|
||||
import im.vector.app.features.roomprofile.settings.joinrule.RoomJoinRuleActivity
|
||||
import im.vector.app.features.spaces.SpaceCreationActivity
|
||||
import im.vector.app.features.spaces.SpaceExploreActivity
|
||||
import im.vector.app.features.spaces.leave.SpaceLeaveAdvancedActivity
|
||||
import im.vector.app.features.spaces.manage.SpaceManageActivity
|
||||
import org.hamcrest.Matchers.allOf
|
||||
import java.util.UUID
|
||||
|
||||
class SpaceRobot {
|
||||
|
||||
fun createSpace() {
|
||||
clickOn(R.string.add_space)
|
||||
waitUntilActivityVisible<SpaceCreationActivity> {
|
||||
waitUntilViewVisible(withId(R.id.privateButton))
|
||||
}
|
||||
crawlCreate()
|
||||
|
||||
onView(withId(R.id.roomList))
|
||||
.perform(
|
||||
RecyclerViewActions.actionOnItem<RecyclerView.ViewHolder>(
|
||||
ViewMatchers.hasDescendant(withText(R.string.room_displayname_empty_room)),
|
||||
click()
|
||||
).atPosition(0)
|
||||
)
|
||||
clickOn(R.id.spaceAddRoomSaveItem)
|
||||
waitUntilActivityVisible<HomeActivity> {
|
||||
waitUntilViewVisible(withId(R.id.roomListContainer))
|
||||
}
|
||||
}
|
||||
|
||||
private fun crawlCreate() {
|
||||
//public
|
||||
clickOn(R.id.publicButton)
|
||||
waitUntilViewVisible(withId(R.id.recyclerView))
|
||||
onView(withHint(R.string.create_room_name_hint)).perform(replaceText(UUID.randomUUID().toString()))
|
||||
clickOn(R.id.nextButton)
|
||||
waitUntilViewVisible(withId(R.id.recyclerView))
|
||||
pressBack()
|
||||
pressBack()
|
||||
|
||||
//private
|
||||
clickOn(R.id.privateButton)
|
||||
waitUntilViewVisible(withId(R.id.recyclerView))
|
||||
clickOn(R.id.nextButton)
|
||||
|
||||
waitUntilViewVisible(withId(R.id.teammatesButton))
|
||||
//me and teammates
|
||||
clickOn(R.id.teammatesButton)
|
||||
waitUntilViewVisible(withId(R.id.recyclerView))
|
||||
clickOn(R.id.nextButton)
|
||||
pressBack()
|
||||
pressBack()
|
||||
|
||||
//just me
|
||||
waitUntilViewVisible(withId(R.id.justMeButton))
|
||||
clickOn(R.id.justMeButton)
|
||||
waitUntilActivityVisible<SpaceManageActivity> {
|
||||
waitUntilViewVisible(withId(R.id.roomList))
|
||||
}
|
||||
}
|
||||
|
||||
fun openSpaceMenu() {
|
||||
waitUntilViewVisible(withId(R.id.groupListView))
|
||||
onView(withId(R.id.groupListView))
|
||||
.perform(
|
||||
RecyclerViewActions.actionOnItem<RecyclerView.ViewHolder>(
|
||||
ViewMatchers.hasDescendant(allOf(withId(R.id.groupTmpLeave), withEffectiveVisibility(ViewMatchers.Visibility.VISIBLE))),
|
||||
clickChildWithId(R.id.groupTmpLeave)
|
||||
).atPosition(0)
|
||||
)
|
||||
waitUntilDialogVisible(withId(R.id.spaceNameView))
|
||||
}
|
||||
|
||||
fun invitePeople() {
|
||||
clickOn(R.id.invitePeople)
|
||||
waitUntilDialogVisible(withId(R.id.inviteByMxidButton))
|
||||
clickOn(R.id.inviteByMxidButton)
|
||||
waitUntilActivityVisible<InviteUsersToRoomActivity> {
|
||||
waitUntilViewVisible(withId(R.id.userListRecyclerView))
|
||||
}
|
||||
EspressoHelper.getCurrentActivity()!!.finish()
|
||||
//close invite dialog
|
||||
pressBack()
|
||||
}
|
||||
|
||||
fun spaceMembers() {
|
||||
clickOn(R.id.showMemberList)
|
||||
waitUntilActivityVisible<RoomProfileActivity> {
|
||||
waitUntilViewVisible(withId(R.id.roomSettingsRecyclerView))
|
||||
}
|
||||
pressBack()
|
||||
}
|
||||
|
||||
fun spaceSettings() {
|
||||
clickOn(R.id.spaceSettings)
|
||||
waitUntilActivityVisible<SpaceManageActivity>() {
|
||||
waitUntilViewVisible(withId(R.id.roomSettingsRecyclerView))
|
||||
}
|
||||
crawlSettings()
|
||||
}
|
||||
|
||||
private fun crawlSettings() {
|
||||
onView(withId(R.id.roomSettingsRecyclerView))
|
||||
.perform(
|
||||
RecyclerViewActions.actionOnItem<RecyclerView.ViewHolder>(
|
||||
ViewMatchers.hasDescendant(withText(R.string.room_settings_space_access_title)),
|
||||
click()
|
||||
)
|
||||
)
|
||||
|
||||
waitUntilActivityVisible<RoomJoinRuleActivity>() {
|
||||
waitUntilViewVisible(withId(R.id.genericRecyclerView))
|
||||
}
|
||||
|
||||
pressBack()
|
||||
|
||||
onView(withId(R.id.roomSettingsRecyclerView))
|
||||
.perform(
|
||||
RecyclerViewActions.actionOnItem<RecyclerView.ViewHolder>(
|
||||
ViewMatchers.hasDescendant(withText(R.string.space_settings_manage_rooms)),
|
||||
click()
|
||||
)
|
||||
)
|
||||
|
||||
waitUntilViewVisible(withId(R.id.roomList))
|
||||
pressBack()
|
||||
|
||||
onView(withId(R.id.roomSettingsRecyclerView))
|
||||
.perform(
|
||||
RecyclerViewActions.actionOnItem<RecyclerView.ViewHolder>(
|
||||
ViewMatchers.hasDescendant(withText(R.string.space_settings_permissions_title)),
|
||||
click()
|
||||
)
|
||||
)
|
||||
|
||||
waitUntilViewVisible(withId(R.id.roomSettingsRecyclerView))
|
||||
pressBack()
|
||||
pressBack()
|
||||
}
|
||||
|
||||
fun exploreRooms() {
|
||||
clickOn(R.id.exploreRooms)
|
||||
waitUntilActivityVisible<SpaceExploreActivity> {
|
||||
waitUntilViewVisible(withId(R.id.spaceDirectoryList))
|
||||
}
|
||||
pressBack()
|
||||
}
|
||||
|
||||
fun addRoom() {
|
||||
clickOn(R.id.addRooms)
|
||||
waitUntilActivityVisible<SpaceManageActivity> {
|
||||
waitUntilViewVisible(withId(R.id.roomList))
|
||||
}
|
||||
pressBack()
|
||||
}
|
||||
|
||||
fun addSpace() {
|
||||
clickOn(R.id.addSpaces)
|
||||
waitUntilActivityVisible<SpaceManageActivity> {
|
||||
waitUntilViewVisible(withId(R.id.roomList))
|
||||
}
|
||||
pressBack()
|
||||
}
|
||||
|
||||
fun leaveSpace() {
|
||||
clickOn(R.id.leaveSpace)
|
||||
waitUntilDialogVisible(withId(R.id.leaveButton))
|
||||
clickOn(R.id.leave_selected)
|
||||
waitUntilActivityVisible<SpaceLeaveAdvancedActivity> {
|
||||
waitUntilViewVisible(withId(R.id.roomList))
|
||||
}
|
||||
clickOn(R.id.spaceLeaveButton)
|
||||
waitUntilViewVisible(withId(R.id.groupListView))
|
||||
}
|
||||
}
|
@ -0,0 +1,102 @@
|
||||
/*
|
||||
* Copyright (c) 2022 New Vector Ltd
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package im.vector.app.ui.robot.space
|
||||
|
||||
import androidx.recyclerview.widget.RecyclerView
|
||||
import androidx.test.espresso.Espresso.onView
|
||||
import androidx.test.espresso.Espresso.pressBack
|
||||
import androidx.test.espresso.action.ViewActions
|
||||
import androidx.test.espresso.action.ViewActions.click
|
||||
import androidx.test.espresso.contrib.RecyclerViewActions
|
||||
import androidx.test.espresso.matcher.ViewMatchers
|
||||
import androidx.test.espresso.matcher.ViewMatchers.withId
|
||||
import androidx.test.espresso.matcher.ViewMatchers.withText
|
||||
import com.adevinta.android.barista.interaction.BaristaClickInteractions.clickOn
|
||||
import im.vector.app.R
|
||||
import im.vector.app.espresso.tools.waitUntilActivityVisible
|
||||
import im.vector.app.espresso.tools.waitUntilDialogVisible
|
||||
import im.vector.app.espresso.tools.waitUntilViewVisible
|
||||
import im.vector.app.features.home.HomeActivity
|
||||
import im.vector.app.features.home.room.detail.RoomDetailActivity
|
||||
import im.vector.app.features.spaces.manage.SpaceManageActivity
|
||||
import java.util.UUID
|
||||
|
||||
class SpaceCreateRobot {
|
||||
|
||||
fun crawl() {
|
||||
// public
|
||||
clickOn(R.id.publicButton)
|
||||
waitUntilViewVisible(withId(R.id.recyclerView))
|
||||
onView(ViewMatchers.withHint(R.string.create_room_name_hint)).perform(ViewActions.replaceText(UUID.randomUUID().toString()))
|
||||
clickOn(R.id.nextButton)
|
||||
waitUntilViewVisible(withId(R.id.recyclerView))
|
||||
pressBack()
|
||||
pressBack()
|
||||
|
||||
// private
|
||||
clickOn(R.id.privateButton)
|
||||
waitUntilViewVisible(withId(R.id.recyclerView))
|
||||
clickOn(R.id.nextButton)
|
||||
|
||||
waitUntilViewVisible(withId(R.id.teammatesButton))
|
||||
// me and teammates
|
||||
clickOn(R.id.teammatesButton)
|
||||
waitUntilViewVisible(withId(R.id.recyclerView))
|
||||
clickOn(R.id.nextButton)
|
||||
pressBack()
|
||||
pressBack()
|
||||
|
||||
// just me
|
||||
waitUntilViewVisible(withId(R.id.justMeButton))
|
||||
clickOn(R.id.justMeButton)
|
||||
waitUntilActivityVisible<SpaceManageActivity> {
|
||||
waitUntilViewVisible(withId(R.id.roomList))
|
||||
}
|
||||
|
||||
onView(withId(R.id.roomList))
|
||||
.perform(
|
||||
RecyclerViewActions.actionOnItem<RecyclerView.ViewHolder>(
|
||||
ViewMatchers.hasDescendant(withText(R.string.room_displayname_empty_room)),
|
||||
click()
|
||||
).atPosition(0)
|
||||
)
|
||||
clickOn(R.id.spaceAddRoomSaveItem)
|
||||
waitUntilActivityVisible<HomeActivity> {
|
||||
waitUntilViewVisible(withId(R.id.roomListContainer))
|
||||
}
|
||||
}
|
||||
|
||||
fun createPublicSpace(spaceName: String) {
|
||||
clickOn(R.id.publicButton)
|
||||
waitUntilViewVisible(withId(R.id.recyclerView))
|
||||
onView(ViewMatchers.withHint(R.string.create_room_name_hint)).perform(ViewActions.replaceText(spaceName))
|
||||
clickOn(R.id.nextButton)
|
||||
waitUntilViewVisible(withId(R.id.recyclerView))
|
||||
clickOn(R.id.nextButton)
|
||||
waitUntilActivityVisible<RoomDetailActivity> {
|
||||
waitUntilDialogVisible(withId(R.id.inviteByMxidButton))
|
||||
}
|
||||
// close invite dialog
|
||||
pressBack()
|
||||
|
||||
waitUntilViewVisible(withId(R.id.timelineRecyclerView))
|
||||
// close room
|
||||
pressBack()
|
||||
|
||||
waitUntilViewVisible(withId(R.id.roomListContainer))
|
||||
}
|
||||
}
|
@ -0,0 +1,116 @@
|
||||
/*
|
||||
* Copyright (c) 2022 New Vector Ltd
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package im.vector.app.ui.robot.space
|
||||
|
||||
import androidx.recyclerview.widget.RecyclerView
|
||||
import androidx.test.espresso.Espresso
|
||||
import androidx.test.espresso.Espresso.onView
|
||||
import androidx.test.espresso.contrib.RecyclerViewActions
|
||||
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.espresso.tools.waitUntilActivityVisible
|
||||
import im.vector.app.espresso.tools.waitUntilDialogVisible
|
||||
import im.vector.app.espresso.tools.waitUntilViewVisible
|
||||
import im.vector.app.features.invite.InviteUsersToRoomActivity
|
||||
import im.vector.app.features.roomprofile.RoomProfileActivity
|
||||
import im.vector.app.features.spaces.SpaceExploreActivity
|
||||
import im.vector.app.features.spaces.leave.SpaceLeaveAdvancedActivity
|
||||
import im.vector.app.features.spaces.manage.SpaceManageActivity
|
||||
import org.hamcrest.Matchers
|
||||
|
||||
class SpaceMenuRobot {
|
||||
|
||||
fun openMenu(spaceName: String) {
|
||||
waitUntilViewVisible(ViewMatchers.withId(R.id.groupListView))
|
||||
onView(ViewMatchers.withId(R.id.groupListView))
|
||||
.perform(
|
||||
RecyclerViewActions.actionOnItem<RecyclerView.ViewHolder>(
|
||||
ViewMatchers.hasDescendant(Matchers.allOf(ViewMatchers.withId(R.id.groupNameView), ViewMatchers.withText(spaceName))),
|
||||
ClickChildAction.clickChildWithId(R.id.groupTmpLeave)
|
||||
).atPosition(0)
|
||||
)
|
||||
waitUntilDialogVisible(ViewMatchers.withId(R.id.spaceNameView))
|
||||
}
|
||||
|
||||
fun invitePeople() = apply {
|
||||
clickOn(R.id.invitePeople)
|
||||
waitUntilDialogVisible(ViewMatchers.withId(R.id.inviteByMxidButton))
|
||||
clickOn(R.id.inviteByMxidButton)
|
||||
waitUntilActivityVisible<InviteUsersToRoomActivity> {
|
||||
waitUntilViewVisible(ViewMatchers.withId(R.id.userListRecyclerView))
|
||||
}
|
||||
// close keyboard
|
||||
Espresso.pressBack()
|
||||
// close invite view
|
||||
Espresso.pressBack()
|
||||
|
||||
Espresso.pressBack()
|
||||
}
|
||||
|
||||
fun spaceMembers() {
|
||||
clickOn(R.id.showMemberList)
|
||||
waitUntilActivityVisible<RoomProfileActivity> {
|
||||
waitUntilViewVisible(ViewMatchers.withId(R.id.roomSettingsRecyclerView))
|
||||
}
|
||||
Espresso.pressBack()
|
||||
}
|
||||
|
||||
fun spaceSettings(block: SpaceSettingsRobot.() -> Unit) {
|
||||
clickOn(R.id.spaceSettings)
|
||||
waitUntilActivityVisible<SpaceManageActivity> {
|
||||
waitUntilViewVisible(ViewMatchers.withId(R.id.roomSettingsRecyclerView))
|
||||
}
|
||||
block(SpaceSettingsRobot())
|
||||
}
|
||||
|
||||
fun exploreRooms() {
|
||||
clickOn(R.id.exploreRooms)
|
||||
waitUntilActivityVisible<SpaceExploreActivity> {
|
||||
waitUntilViewVisible(ViewMatchers.withId(R.id.spaceDirectoryList))
|
||||
}
|
||||
Espresso.pressBack()
|
||||
}
|
||||
|
||||
fun addRoom() = apply {
|
||||
clickOn(R.id.addRooms)
|
||||
waitUntilActivityVisible<SpaceManageActivity> {
|
||||
waitUntilViewVisible(ViewMatchers.withId(R.id.roomList))
|
||||
}
|
||||
Espresso.pressBack()
|
||||
}
|
||||
|
||||
fun addSpace() = apply {
|
||||
clickOn(R.id.addSpaces)
|
||||
waitUntilActivityVisible<SpaceManageActivity> {
|
||||
waitUntilViewVisible(ViewMatchers.withId(R.id.roomList))
|
||||
}
|
||||
Espresso.pressBack()
|
||||
}
|
||||
|
||||
fun leaveSpace() {
|
||||
clickOn(R.id.leaveSpace)
|
||||
waitUntilDialogVisible(ViewMatchers.withId(R.id.leaveButton))
|
||||
clickOn(R.id.leave_selected)
|
||||
waitUntilActivityVisible<SpaceLeaveAdvancedActivity> {
|
||||
waitUntilViewVisible(ViewMatchers.withId(R.id.roomList))
|
||||
}
|
||||
clickOn(R.id.spaceLeaveButton)
|
||||
waitUntilViewVisible(ViewMatchers.withId(R.id.groupListView))
|
||||
}
|
||||
}
|
@ -0,0 +1,38 @@
|
||||
/*
|
||||
* Copyright (c) 2022 New Vector Ltd
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package im.vector.app.ui.robot.space
|
||||
|
||||
import com.adevinta.android.barista.interaction.BaristaClickInteractions.clickOn
|
||||
import com.adevinta.android.barista.interaction.BaristaDrawerInteractions.openDrawer
|
||||
import im.vector.app.R
|
||||
|
||||
class SpaceRobot {
|
||||
|
||||
fun createSpace(block: SpaceCreateRobot.() -> Unit) {
|
||||
openDrawer()
|
||||
clickOn(R.string.add_space)
|
||||
block(SpaceCreateRobot())
|
||||
}
|
||||
|
||||
fun spaceMenu(spaceName: String, block: SpaceMenuRobot.() -> Unit) {
|
||||
openDrawer()
|
||||
with(SpaceMenuRobot()) {
|
||||
openMenu(spaceName)
|
||||
block()
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,68 @@
|
||||
/*
|
||||
* Copyright (c) 2022 New Vector Ltd
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package im.vector.app.ui.robot.space
|
||||
|
||||
import androidx.recyclerview.widget.RecyclerView
|
||||
import androidx.test.espresso.Espresso
|
||||
import androidx.test.espresso.action.ViewActions
|
||||
import androidx.test.espresso.contrib.RecyclerViewActions
|
||||
import androidx.test.espresso.matcher.ViewMatchers
|
||||
import im.vector.app.R
|
||||
import im.vector.app.espresso.tools.waitUntilActivityVisible
|
||||
import im.vector.app.espresso.tools.waitUntilViewVisible
|
||||
import im.vector.app.features.roomprofile.settings.joinrule.RoomJoinRuleActivity
|
||||
|
||||
class SpaceSettingsRobot {
|
||||
fun crawl() {
|
||||
Espresso.onView(ViewMatchers.withId(R.id.roomSettingsRecyclerView))
|
||||
.perform(
|
||||
RecyclerViewActions.actionOnItem<RecyclerView.ViewHolder>(
|
||||
ViewMatchers.hasDescendant(ViewMatchers.withText(R.string.room_settings_space_access_title)),
|
||||
ViewActions.click()
|
||||
)
|
||||
)
|
||||
|
||||
waitUntilActivityVisible<RoomJoinRuleActivity> {
|
||||
waitUntilViewVisible(ViewMatchers.withId(R.id.genericRecyclerView))
|
||||
}
|
||||
|
||||
Espresso.pressBack()
|
||||
|
||||
Espresso.onView(ViewMatchers.withId(R.id.roomSettingsRecyclerView))
|
||||
.perform(
|
||||
RecyclerViewActions.actionOnItem<RecyclerView.ViewHolder>(
|
||||
ViewMatchers.hasDescendant(ViewMatchers.withText(R.string.space_settings_manage_rooms)),
|
||||
ViewActions.click()
|
||||
)
|
||||
)
|
||||
|
||||
waitUntilViewVisible(ViewMatchers.withId(R.id.roomList))
|
||||
Espresso.pressBack()
|
||||
|
||||
Espresso.onView(ViewMatchers.withId(R.id.roomSettingsRecyclerView))
|
||||
.perform(
|
||||
RecyclerViewActions.actionOnItem<RecyclerView.ViewHolder>(
|
||||
ViewMatchers.hasDescendant(ViewMatchers.withText(R.string.space_settings_permissions_title)),
|
||||
ViewActions.click()
|
||||
)
|
||||
)
|
||||
|
||||
waitUntilViewVisible(ViewMatchers.withId(R.id.roomSettingsRecyclerView))
|
||||
Espresso.pressBack()
|
||||
Espresso.pressBack()
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user