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