Skip to content

Commit

Permalink
new app layout is enabled (#6959)
Browse files Browse the repository at this point in the history
  • Loading branch information
fedrunov authored Aug 31, 2022
1 parent 456d831 commit 657796c
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 8 deletions.
1 change: 1 addition & 0 deletions changelog.d/6958.feature
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
[App Layout] New App Layout is enabled by default
29 changes: 22 additions & 7 deletions vector/src/androidTest/java/im/vector/app/ui/robot/ElementRobot.kt
Original file line number Diff line number Diff line change
Expand Up @@ -33,12 +33,16 @@ import com.adevinta.android.barista.interaction.BaristaDialogInteractions.clickD
import com.adevinta.android.barista.interaction.BaristaDrawerInteractions.openDrawer
import im.vector.app.EspressoHelper
import im.vector.app.R
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
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
Expand All @@ -48,6 +52,8 @@ import timber.log.Timber

class ElementRobot {

var features: VectorFeatures = DefaultVectorFeatures()

fun onboarding(block: OnboardingRobot.() -> Unit) {
block(OnboardingRobot())
}
Expand All @@ -73,7 +79,7 @@ class ElementRobot {
val activity = EspressoHelper.getCurrentActivity()!!
val uiSession = (activity as HomeActivity).activeSessionHolder.getActiveSession()
withIdlingResource(initialSyncIdlingResource(uiSession)) {
waitUntilViewVisible(withId(R.id.bottomNavigationView))
waitUntilViewVisible(withId(R.id.roomListContainer))
}
}

Expand All @@ -82,7 +88,7 @@ class ElementRobot {
clickOn(R.id.homeDrawerHeaderSettingsView)
block(SettingsRobot())
if (shouldGoBack) pressBack()
waitUntilViewVisible(withId(R.id.bottomNavigationView))
waitUntilViewVisible(withId(R.id.roomListContainer))
}

fun newDirectMessage(block: NewDirectMessageRobot.() -> Unit) {
Expand All @@ -94,19 +100,19 @@ class ElementRobot {
closeSoftKeyboard()
block(NewDirectMessageRobot())
pressBack()
waitUntilViewVisible(withId(R.id.bottomNavigationView))
waitUntilViewVisible(withId(R.id.roomListContainer))
}

fun newRoom(block: NewRoomRobot.() -> Unit) {
clickOn(R.id.bottom_action_rooms)
RoomListRobot().newRoom { block() }
waitUntilViewVisible(withId(R.id.bottomNavigationView))
waitUntilViewVisible(withId(R.id.roomListContainer))
}

fun roomList(block: RoomListRobot.() -> Unit) {
clickOn(R.id.bottom_action_rooms)
block(RoomListRobot())
waitUntilViewVisible(withId(R.id.bottomNavigationView))
waitUntilViewVisible(withId(R.id.roomListContainer))
}

fun toggleLabFeature(labFeature: LabFeature) {
Expand Down Expand Up @@ -146,8 +152,17 @@ class ElementRobot {
}

fun signout(expectSignOutWarning: Boolean) {
clickOn(R.id.groupToolbarAvatarImageView)
clickOn(R.id.homeDrawerHeaderSignoutView)
if (features.isNewAppLayoutEnabled()) {
onView(withId((R.id.avatar)))
.perform(click())
waitUntilActivityVisible<VectorSettingsActivity> {
clickOn(R.string.settings_general_title)
}
clickOnPreference(R.string.action_sign_out)
} else {
clickOn(R.id.groupToolbarAvatarImageView)
clickOn(R.id.homeDrawerHeaderSignoutView)
}

val isShowingSignOutWarning = kotlin.runCatching {
waitUntilViewVisible(withId(R.id.exitAnywayButton))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,6 @@ class DefaultVectorFeatures : VectorFeatures {
override fun isLocationSharingEnabled() = Config.ENABLE_LOCATION_SHARING
override fun forceUsageOfOpusEncoder(): Boolean = false
override fun shouldStartDmOnFirstMessage(): Boolean = false
override fun isNewAppLayoutEnabled(): Boolean = false
override fun isNewAppLayoutEnabled(): Boolean = true
override fun isNewDeviceManagementEnabled(): Boolean = false
}

0 comments on commit 657796c

Please sign in to comment.