robots are not checking feature flag for newAppLayout
This commit is contained in:
parent
37b216393e
commit
6badbe738d
|
@ -37,8 +37,6 @@ import im.vector.app.espresso.tools.clickOnPreference
|
|||
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.DefaultVectorFeatures
|
||||
import im.vector.app.features.VectorFeatures
|
||||
import im.vector.app.features.createdirect.CreateDirectRoomActivity
|
||||
import im.vector.app.features.home.HomeActivity
|
||||
import im.vector.app.features.onboarding.OnboardingActivity
|
||||
|
@ -46,13 +44,14 @@ import im.vector.app.features.settings.VectorSettingsActivity
|
|||
import im.vector.app.initialSyncIdlingResource
|
||||
import im.vector.app.ui.robot.settings.SettingsRobot
|
||||
import im.vector.app.ui.robot.settings.labs.LabFeature
|
||||
import im.vector.app.ui.robot.settings.labs.LabFeaturesPreferences
|
||||
import im.vector.app.ui.robot.space.SpaceRobot
|
||||
import im.vector.app.withIdlingResource
|
||||
import timber.log.Timber
|
||||
|
||||
class ElementRobot {
|
||||
private val features: VectorFeatures = DefaultVectorFeatures()
|
||||
|
||||
class ElementRobot(
|
||||
private val labsPreferences: LabFeaturesPreferences = LabFeaturesPreferences(false)
|
||||
) {
|
||||
fun onboarding(block: OnboardingRobot.() -> Unit) {
|
||||
block(OnboardingRobot())
|
||||
}
|
||||
|
@ -83,7 +82,7 @@ class ElementRobot {
|
|||
}
|
||||
|
||||
fun settings(shouldGoBack: Boolean = true, block: SettingsRobot.() -> Unit) {
|
||||
if (features.isNewAppLayoutEnabled()) {
|
||||
if (labsPreferences.isNewAppLayoutEnabled) {
|
||||
onView(withId((R.id.avatar))).perform(click())
|
||||
} else {
|
||||
openDrawer()
|
||||
|
@ -96,7 +95,7 @@ class ElementRobot {
|
|||
}
|
||||
|
||||
fun newDirectMessage(block: NewDirectMessageRobot.() -> Unit) {
|
||||
if (features.isNewAppLayoutEnabled()) {
|
||||
if (labsPreferences.isNewAppLayoutEnabled) {
|
||||
clickOn(R.id.newLayoutCreateChatButton)
|
||||
waitUntilDialogVisible(withId(R.id.start_chat))
|
||||
clickOn(R.id.start_chat)
|
||||
|
@ -111,29 +110,29 @@ class ElementRobot {
|
|||
closeSoftKeyboard()
|
||||
block(NewDirectMessageRobot())
|
||||
pressBack()
|
||||
if (features.isNewAppLayoutEnabled()) {
|
||||
if (labsPreferences.isNewAppLayoutEnabled) {
|
||||
pressBack() // close create dialog
|
||||
}
|
||||
waitUntilViewVisible(withId(R.id.roomListContainer))
|
||||
}
|
||||
|
||||
fun newRoom(block: NewRoomRobot.() -> Unit) {
|
||||
if (!features.isNewAppLayoutEnabled()) {
|
||||
if (!labsPreferences.isNewAppLayoutEnabled) {
|
||||
clickOn(R.id.bottom_action_rooms)
|
||||
}
|
||||
RoomListRobot().newRoom { block() }
|
||||
if (features.isNewAppLayoutEnabled()) {
|
||||
RoomListRobot(labsPreferences).newRoom { block() }
|
||||
if (labsPreferences.isNewAppLayoutEnabled) {
|
||||
pressBack() // close create dialog
|
||||
}
|
||||
waitUntilViewVisible(withId(R.id.roomListContainer))
|
||||
}
|
||||
|
||||
fun roomList(block: RoomListRobot.() -> Unit) {
|
||||
if (!features.isNewAppLayoutEnabled()) {
|
||||
if (!labsPreferences.isNewAppLayoutEnabled) {
|
||||
clickOn(R.id.bottom_action_rooms)
|
||||
}
|
||||
|
||||
block(RoomListRobot())
|
||||
block(RoomListRobot(labsPreferences))
|
||||
waitUntilViewVisible(withId(R.id.roomListContainer))
|
||||
}
|
||||
|
||||
|
@ -174,7 +173,7 @@ class ElementRobot {
|
|||
}
|
||||
|
||||
fun signout(expectSignOutWarning: Boolean) {
|
||||
if (features.isNewAppLayoutFeatureEnabled()) {
|
||||
if (labsPreferences.isNewAppLayoutEnabled) {
|
||||
onView(withId((R.id.avatar)))
|
||||
.perform(click())
|
||||
waitUntilActivityVisible<VectorSettingsActivity> {
|
||||
|
@ -224,7 +223,7 @@ class ElementRobot {
|
|||
}
|
||||
|
||||
fun space(block: SpaceRobot.() -> Unit) {
|
||||
block(SpaceRobot())
|
||||
block(SpaceRobot(labsPreferences))
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -23,14 +23,16 @@ import im.vector.app.R
|
|||
import im.vector.app.espresso.tools.waitUntilViewVisible
|
||||
import im.vector.app.features.DefaultVectorFeatures
|
||||
import im.vector.app.features.VectorFeatures
|
||||
import im.vector.app.ui.robot.settings.labs.LabFeaturesPreferences
|
||||
|
||||
class NewRoomRobot(
|
||||
var createdRoom: Boolean = false
|
||||
var createdRoom: Boolean = false,
|
||||
private val labsPreferences: LabFeaturesPreferences
|
||||
) {
|
||||
private val features: VectorFeatures = DefaultVectorFeatures()
|
||||
|
||||
fun createNewRoom(block: CreateNewRoomRobot.() -> Unit) {
|
||||
if (features.isNewAppLayoutEnabled()) {
|
||||
if (labsPreferences.isNewAppLayoutEnabled) {
|
||||
clickOn(R.string.create_new_room)
|
||||
}
|
||||
waitUntilViewVisible(withId(R.id.createRoomForm))
|
||||
|
|
|
@ -28,12 +28,10 @@ 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.features.DefaultVectorFeatures
|
||||
import im.vector.app.features.VectorFeatures
|
||||
import im.vector.app.features.roomdirectory.RoomDirectoryActivity
|
||||
import im.vector.app.ui.robot.settings.labs.LabFeaturesPreferences
|
||||
|
||||
class RoomListRobot {
|
||||
private val features: VectorFeatures = DefaultVectorFeatures()
|
||||
class RoomListRobot(private val labsPreferences: LabFeaturesPreferences) {
|
||||
|
||||
fun openRoom(roomName: String, block: RoomDetailRobot.() -> Unit) {
|
||||
clickOn(roomName)
|
||||
|
@ -53,7 +51,7 @@ class RoomListRobot {
|
|||
}
|
||||
|
||||
fun newRoom(block: NewRoomRobot.() -> Unit) {
|
||||
if (features.isNewAppLayoutEnabled()) {
|
||||
if (labsPreferences.isNewAppLayoutEnabled) {
|
||||
clickOn(R.id.newLayoutCreateChatButton)
|
||||
waitUntilDialogVisible(ViewMatchers.withId(R.id.create_room))
|
||||
clickOn(R.id.create_room)
|
||||
|
@ -63,7 +61,7 @@ class RoomListRobot {
|
|||
BaristaVisibilityAssertions.assertDisplayed(R.id.publicRoomsList)
|
||||
}
|
||||
}
|
||||
val newRoomRobot = NewRoomRobot()
|
||||
val newRoomRobot = NewRoomRobot(false, labsPreferences)
|
||||
block(newRoomRobot)
|
||||
if (!newRoomRobot.createdRoom) {
|
||||
pressBack()
|
||||
|
|
|
@ -0,0 +1,19 @@
|
|||
/*
|
||||
* 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.settings.labs
|
||||
|
||||
data class LabFeaturesPreferences(val isNewAppLayoutEnabled: Boolean)
|
|
@ -30,13 +30,14 @@ import im.vector.app.espresso.tools.waitUntilDialogVisible
|
|||
import im.vector.app.espresso.tools.waitUntilViewVisible
|
||||
import im.vector.app.features.DefaultVectorFeatures
|
||||
import im.vector.app.features.VectorFeatures
|
||||
import im.vector.app.ui.robot.settings.labs.LabFeaturesPreferences
|
||||
import org.hamcrest.Matchers
|
||||
|
||||
class SpaceRobot {
|
||||
class SpaceRobot(private val labsPreferences: LabFeaturesPreferences) {
|
||||
private val features: VectorFeatures = DefaultVectorFeatures()
|
||||
|
||||
fun createSpace(isFirstSpace: Boolean, block: SpaceCreateRobot.() -> Unit) {
|
||||
if (features.isNewAppLayoutEnabled()) {
|
||||
if (labsPreferences.isNewAppLayoutEnabled) {
|
||||
clickOn(R.id.newLayoutOpenSpacesButton)
|
||||
if (isFirstSpace) {
|
||||
waitUntilDialogVisible(ViewMatchers.withId(R.id.spaces_empty_group))
|
||||
|
@ -59,7 +60,7 @@ class SpaceRobot {
|
|||
}
|
||||
|
||||
fun spaceMenu(spaceName: String, block: SpaceMenuRobot.() -> Unit) {
|
||||
if (features.isNewAppLayoutEnabled()) {
|
||||
if (labsPreferences.isNewAppLayoutEnabled) {
|
||||
clickOn(R.id.newLayoutOpenSpacesButton)
|
||||
waitUntilDialogVisible(ViewMatchers.withId(R.id.groupListView))
|
||||
} else {
|
||||
|
@ -73,7 +74,7 @@ class SpaceRobot {
|
|||
|
||||
fun openMenu(spaceName: String) {
|
||||
waitUntilViewVisible(ViewMatchers.withId(R.id.groupListView))
|
||||
if (features.isNewAppLayoutEnabled()) {
|
||||
if (labsPreferences.isNewAppLayoutEnabled) {
|
||||
Espresso.onView(ViewMatchers.withId(R.id.groupListView))
|
||||
.perform(
|
||||
RecyclerViewActions.actionOnItem<RecyclerView.ViewHolder>(
|
||||
|
@ -95,7 +96,7 @@ class SpaceRobot {
|
|||
}
|
||||
|
||||
fun selectSpace(spaceName: String) {
|
||||
if (!features.isNewAppLayoutEnabled()) {
|
||||
if (!labsPreferences.isNewAppLayoutEnabled) {
|
||||
openDrawer()
|
||||
waitUntilViewVisible(ViewMatchers.withId(R.id.groupListView))
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue