Fix: Maestro tests fail when using settings (#358)

* Fix Maestro tests using 'Settings' to open the settings screen.

* Try to allow manually running Maestro tests.

* Also adjust logout flow.
This commit is contained in:
Jorge Martin Espinosa 2023-04-25 18:01:54 +02:00 committed by GitHub
parent dbbc14f683
commit 27824a279a
5 changed files with 17 additions and 5 deletions

View file

@ -16,7 +16,7 @@ jobs:
maestro-cloud: maestro-cloud:
name: Maestro test suite name: Maestro test suite
runs-on: ubuntu-latest runs-on: ubuntu-latest
if: github.event.review.state == 'approved' if: github.event.review.state == 'approved' || github.event_name == 'workflow_dispatch'
strategy: strategy:
fail-fast: false fail-fast: false
# Allow one per PR. # Allow one per PR.

View file

@ -1,6 +1,7 @@
appId: ${APP_ID} appId: ${APP_ID}
--- ---
- tapOn: "Settings" - tapOn:
id: "home_screen-settings"
- tapOn: "Sign out" - tapOn: "Sign out"
- takeScreenshot: build/maestro/900-SignOutDialg - takeScreenshot: build/maestro/900-SignOutDialg
# Ensure cancel cancels # Ensure cancel cancels

View file

@ -1,6 +1,7 @@
appId: ${APP_ID} appId: ${APP_ID}
--- ---
- tapOn: "Settings" - tapOn:
id: "home_screen-settings"
- assertVisible: "Rageshake to report bug" - assertVisible: "Rageshake to report bug"
- takeScreenshot: build/maestro/600-Settings - takeScreenshot: build/maestro/600-Settings
- tapOn: - tapOn:

View file

@ -45,6 +45,8 @@ import io.element.android.libraries.designsystem.theme.components.Text
import io.element.android.libraries.designsystem.utils.LogCompositions import io.element.android.libraries.designsystem.utils.LogCompositions
import io.element.android.libraries.matrix.api.core.UserId import io.element.android.libraries.matrix.api.core.UserId
import io.element.android.libraries.matrix.ui.model.MatrixUser import io.element.android.libraries.matrix.ui.model.MatrixUser
import io.element.android.libraries.testtags.TestTags
import io.element.android.libraries.testtags.testTag
import io.element.android.libraries.ui.strings.R as StringR import io.element.android.libraries.ui.strings.R as StringR
@OptIn(ExperimentalMaterial3Api::class) @OptIn(ExperimentalMaterial3Api::class)
@ -101,14 +103,17 @@ private fun DefaultRoomListTopBar(
}, },
navigationIcon = { navigationIcon = {
if (matrixUser != null) { if (matrixUser != null) {
IconButton(onClick = onOpenSettings) { IconButton(
modifier = Modifier.testTag(TestTags.homeScreenSettings),
onClick = onOpenSettings
) {
Avatar(matrixUser.avatarData, contentDescription = stringResource(StringR.string.common_settings)) Avatar(matrixUser.avatarData, contentDescription = stringResource(StringR.string.common_settings))
} }
} }
}, },
actions = { actions = {
IconButton( IconButton(
onClick = onSearchClicked onClick = onSearchClicked,
) { ) {
Icon(Icons.Default.Search, contentDescription = stringResource(StringR.string.action_search)) Icon(Icons.Default.Search, contentDescription = stringResource(StringR.string.action_search))
} }

View file

@ -38,6 +38,11 @@ object TestTags {
*/ */
val changeServerServer = TestTag("change_server-server") val changeServerServer = TestTag("change_server-server")
val changeServerContinue = TestTag("change_server-continue") val changeServerContinue = TestTag("change_server-continue")
/**
* Room list / Home screen.
*/
val homeScreenSettings = TestTag("home_screen-settings")
} }