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 40f927fbdf
commit 0389f782c9
5 changed files with 17 additions and 5 deletions

View file

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

View file

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

View file

@ -1,6 +1,7 @@
appId: ${APP_ID}
---
- tapOn: "Settings"
- tapOn:
id: "home_screen-settings"
- assertVisible: "Rageshake to report bug"
- takeScreenshot: build/maestro/600-Settings
- 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.matrix.api.core.UserId
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
@OptIn(ExperimentalMaterial3Api::class)
@ -101,14 +103,17 @@ private fun DefaultRoomListTopBar(
},
navigationIcon = {
if (matrixUser != null) {
IconButton(onClick = onOpenSettings) {
IconButton(
modifier = Modifier.testTag(TestTags.homeScreenSettings),
onClick = onOpenSettings
) {
Avatar(matrixUser.avatarData, contentDescription = stringResource(StringR.string.common_settings))
}
}
},
actions = {
IconButton(
onClick = onSearchClicked
onClick = onSearchClicked,
) {
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 changeServerContinue = TestTag("change_server-continue")
/**
* Room list / Home screen.
*/
val homeScreenSettings = TestTag("home_screen-settings")
}