From ac54596ca36af41bd665ed8e809fab16cf848a01 Mon Sep 17 00:00:00 2001 From: Benoit Marty Date: Tue, 22 Sep 2026 16:43:58 +0200 Subject: [PATCH] Update Maestro tests --- .maestro/tests/account/logout.yaml | 6 +- .maestro/tests/settings/settings.yaml | 60 ++++++++++++++----- .../impl/root/PreferencesRootView.kt | 28 +++++---- .../android/libraries/testtags/TestTags.kt | 5 ++ 4 files changed, 70 insertions(+), 29 deletions(-) diff --git a/.maestro/tests/account/logout.yaml b/.maestro/tests/account/logout.yaml index a276182825..ec49033c40 100644 --- a/.maestro/tests/account/logout.yaml +++ b/.maestro/tests/account/logout.yaml @@ -2,6 +2,9 @@ appId: ${MAESTRO_APP_ID} --- - tapOn: id: "home_screen-settings" +- tapOn: + id: "settings-user_profile" +- assertVisible: "Your account" - tapOn: "Remove this device" - takeScreenshot: build/maestro/900-SignOutScreen - back @@ -9,7 +12,8 @@ appId: ${MAESTRO_APP_ID} # Ensure cancel cancels - tapOn: id: "dialog-negative" -- tapOn: "Remove this device" +- tapOn: + id: "sign-out-submit" - tapOn: id: "dialog-positive" - runFlow: ../assertions/assertInitDisplayed.yaml diff --git a/.maestro/tests/settings/settings.yaml b/.maestro/tests/settings/settings.yaml index 15181a458b..21ff077908 100644 --- a/.maestro/tests/settings/settings.yaml +++ b/.maestro/tests/settings/settings.yaml @@ -4,19 +4,35 @@ appId: ${MAESTRO_APP_ID} id: "home_screen-settings" - assertVisible: "Settings" - takeScreenshot: build/maestro/600-Settings + +## App settings section +- assertVisible: "Appearance" + +- tapOn: + text: "Media upload quality" +- assertVisible: "Media upload quality" +- back + +- tapOn: + text: "Screen lock" +- assertVisible: "Choose PIN" +- hideKeyboard +- back + +- tapOn: + text: "Location sharing" +- assertVisible: "Live location updates" +- back + +## General section - tapOn: text: "Analytics" - assertVisible: "Share analytics data" - back - tapOn: - text: "Notifications" -- assertVisible: "Enable notifications on this device" -- back - -- tapOn: - text: "Report a problem" -- assertVisible: "Report a problem" + text: "Labs" +- assertVisible: "Feeling experimental?" - back - tapOn: @@ -27,20 +43,32 @@ appId: ${MAESTRO_APP_ID} - back - tapOn: - text: "Screen lock" -- assertVisible: "Choose PIN" -- hideKeyboard -- back - -- tapOn: - text: "Advanced settings" + text: "Developer options" +- assertVisible: "Feature flags" - assertVisible: "View source" - back +## Account settings - tapOn: - text: "Developer options" -- assertVisible: "Feature flags" + id: "settings-user_profile" +- assertVisible: "Your account" +- takeScreenshot: build/maestro/610-AccountSettings + +- tapOn: + text: "Notifications" +- assertVisible: "Enable notifications on this device" +- back + +- tapOn: + text: "Moderation & safety" +- assertVisible: "Your appearance" +- back + +- tapOn: + text: "Report a problem" +- assertVisible: "Report a problem" - back +- back - back - runFlow: ../assertions/assertHomeDisplayed.yaml diff --git a/features/preferences/impl/src/main/kotlin/io/element/android/features/preferences/impl/root/PreferencesRootView.kt b/features/preferences/impl/src/main/kotlin/io/element/android/features/preferences/impl/root/PreferencesRootView.kt index e10736dbab..b781b3e5c3 100644 --- a/features/preferences/impl/src/main/kotlin/io/element/android/features/preferences/impl/root/PreferencesRootView.kt +++ b/features/preferences/impl/src/main/kotlin/io/element/android/features/preferences/impl/root/PreferencesRootView.kt @@ -66,6 +66,8 @@ import io.element.android.libraries.emoji.api.picker.EmojiPickerRenderer import io.element.android.libraries.emoji.api.picker.NoOpEmojiPickerRenderer import io.element.android.libraries.matrix.ui.components.MatrixUserRow import io.element.android.libraries.matrix.ui.model.getAvatarData +import io.element.android.libraries.testtags.TestTags +import io.element.android.libraries.testtags.testTag import io.element.android.libraries.ui.strings.CommonStrings import kotlinx.collections.immutable.toImmutableList @@ -95,9 +97,11 @@ fun PreferencesRootView( snackbarHost = { SnackbarHost(snackbarHostState) } ) { UserPreferences( - modifier = Modifier.clickable { - onOpenAccountSettings() - }, + modifier = Modifier + .testTag(TestTags.settingsUserProfile) + .clickable { + onOpenAccountSettings() + }, matrixUser = state.myUser, ) if (state.userStatusState != null) { @@ -152,8 +156,8 @@ private fun BoxScope.UserStatusUpdateIndicator(updateStatusAction: AsyncAction AsyncIndicator.Failure(text = stringResource(CommonStrings.common_failed)) }, ) @@ -248,10 +252,10 @@ private fun ColumnScope.MultiAccountSection( state.otherSessions.forEach { matrixUser -> MatrixUserRow( modifier = Modifier - .clickable { - state.eventSink(PreferencesRootEvent.SwitchToSession(matrixUser.userId)) - } - .padding(top = 2.dp, bottom = 2.dp, end = 8.dp), + .clickable { + state.eventSink(PreferencesRootEvent.SwitchToSession(matrixUser.userId)) + } + .padding(top = 2.dp, bottom = 2.dp, end = 8.dp), matrixUser = matrixUser, avatarSize = AvatarSize.AccountItem, verticalSpaceWidth = 16.dp, @@ -359,9 +363,9 @@ private fun ColumnScope.Footer( ) { Text( modifier = Modifier - .align(Alignment.CenterHorizontally) - .clickable(enabled = onClick != null, onClick = onClick ?: {}) - .padding(start = 16.dp, end = 16.dp, top = 16.dp, bottom = 24.dp), + .align(Alignment.CenterHorizontally) + .clickable(enabled = onClick != null, onClick = onClick ?: {}) + .padding(start = 16.dp, end = 16.dp, top = 16.dp, bottom = 24.dp), textAlign = TextAlign.Center, text = version, style = ElementTheme.typography.fontBodySmRegular, diff --git a/libraries/testtags/src/main/kotlin/io/element/android/libraries/testtags/TestTags.kt b/libraries/testtags/src/main/kotlin/io/element/android/libraries/testtags/TestTags.kt index 7fed08b3e9..942d20de91 100644 --- a/libraries/testtags/src/main/kotlin/io/element/android/libraries/testtags/TestTags.kt +++ b/libraries/testtags/src/main/kotlin/io/element/android/libraries/testtags/TestTags.kt @@ -48,6 +48,11 @@ object TestTags { val homeScreenSettings = TestTag("home_screen-settings") val homeScreenClearFilters = TestTag("home_screen-clear_filters") + /** + * Settings screen. + */ + val settingsUserProfile = TestTag("settings-user_profile") + /** * Room detail screen. */