From 2288f61108fef71554d4c6ca11f2630a37caf023 Mon Sep 17 00:00:00 2001 From: Benoit Marty Date: Thu, 12 Jan 2023 17:25:54 +0100 Subject: [PATCH 01/15] Ignore tmp folder. --- .gitignore | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.gitignore b/.gitignore index f6e1ef5b8b..01fece71fb 100644 --- a/.gitignore +++ b/.gitignore @@ -83,3 +83,5 @@ lint/outputs/ lint/tmp/ # lint/reports/ /.idea/deploymentTargetDropDown.xml + +/tmp From de6532e0739f4aabafef32a56cdb2fb06180b7a2 Mon Sep 17 00:00:00 2001 From: Benoit Marty Date: Thu, 12 Jan 2023 17:36:42 +0100 Subject: [PATCH 02/15] Setup Maestro and add first tests. Also configure CI --- .github/workflows/maestro.yml | 35 ++++++++++++++ .maestro/README.md | 48 +++++++++++++++++++ .maestro/allTests.yaml | 7 +++ .maestro/tests/account/changeServer.yaml | 5 ++ .maestro/tests/account/login.yaml | 13 +++++ .maestro/tests/account/logout.yaml | 9 ++++ .../tests/assertions/assertHomeDisplayed.yaml | 5 ++ .../tests/assertions/assertInitDisplayed.yaml | 5 ++ .../assertions/assertLoginDisplayed.yaml | 5 ++ .maestro/tests/init.yaml | 7 +++ .maestro/tests/roomList/roomList.yaml | 6 +++ .maestro/tests/roomList/searchRoomList.yaml | 15 ++++++ .../tests/roomList/timeline/timeline.yaml | 14 ++++++ .maestro/tests/settings/settings.yaml | 12 +++++ .../android/x/component/ShowkaseButton.kt | 2 +- 15 files changed, 187 insertions(+), 1 deletion(-) create mode 100644 .github/workflows/maestro.yml create mode 100644 .maestro/README.md create mode 100644 .maestro/allTests.yaml create mode 100644 .maestro/tests/account/changeServer.yaml create mode 100644 .maestro/tests/account/login.yaml create mode 100644 .maestro/tests/account/logout.yaml create mode 100644 .maestro/tests/assertions/assertHomeDisplayed.yaml create mode 100644 .maestro/tests/assertions/assertInitDisplayed.yaml create mode 100644 .maestro/tests/assertions/assertLoginDisplayed.yaml create mode 100644 .maestro/tests/init.yaml create mode 100644 .maestro/tests/roomList/roomList.yaml create mode 100644 .maestro/tests/roomList/searchRoomList.yaml create mode 100644 .maestro/tests/roomList/timeline/timeline.yaml create mode 100644 .maestro/tests/settings/settings.yaml diff --git a/.github/workflows/maestro.yml b/.github/workflows/maestro.yml new file mode 100644 index 0000000000..da7d35a080 --- /dev/null +++ b/.github/workflows/maestro.yml @@ -0,0 +1,35 @@ +name: Meastro + +on: + pull_request: { } + push: + branches: [ main, develop ] + +# Enrich gradle.properties for CI/CD +env: + GRADLE_OPTS: -Dorg.gradle.jvmargs="-Xmx3072m -Dfile.encoding=UTF-8 -XX:+HeapDumpOnOutOfMemoryError" -Dkotlin.daemon.jvm.options="-Xmx2560m" -Dkotlin.incremental=false + CI_GRADLE_ARG_PROPERTIES: --stacktrace -PpreDexEnable=false --max-workers 2 --no-daemon + +jobs: + maestro-cloud: + name: Build debug APKs + runs-on: ubuntu-latest + if: github.ref != 'refs/heads/main' + strategy: + fail-fast: false + # Allow all jobs on develop. Just one per PR. + concurrency: + group: ${{ github.ref == 'refs/heads/develop' && format('build-develop-{0}', github.sha) || format('build-debug-{0}', github.ref) }} + cancel-in-progress: true + steps: + - uses: actions/checkout@v3 + - name: Assemble debug APK + run: ./gradlew assembleDebug $CI_GRADLE_ARG_PROPERTIES + - uses: mobile-dev-inc/action-maestro-cloud@v1.1.1 + with: + api-key: ${{ secrets.MAESTRO_CLOUD_API_KEY }} + app-file: app/build/outputs/apk/debug/app-debug.apk + env: | + USERNAME=maestroelement + PASSWORD=${{ secrets.MATRIX_MAESTRO_ACCOUNT_PASSWORD }} + APP_ID=io.element.android.x.debug diff --git a/.maestro/README.md b/.maestro/README.md new file mode 100644 index 0000000000..119aad7ba3 --- /dev/null +++ b/.maestro/README.md @@ -0,0 +1,48 @@ +# Maestro + +Maestro is a framework that we are using to test navigation across the application. +To setup, please refer at [https://maestro.mobile.dev](https://maestro.mobile.dev) + + + +* [Run test](#run-test) + * [Output](#output) +* [Write test](#write-test) + + + +## Run test + +From root dir of the project + +*Note: Since ElementX does not allow account creation nor room creation, we have to use an existing account with an existing room to run maestro test suite. So to run locally, please replace `user` and `123` with your test matrix.org account credentials, and `my room` with one of a room this account has join. Note that the test will send messages to this room.* + +```shell +maestro test \ + -e APP_ID=io.element.android.x.debug \ + -e USERNAME=user \ + -e PASSWORD=123 \ + -e ROOM_NAME="my room" \ + .maestro/allTest.yaml +``` + +### Output + +Test result will be printed on the console, and screenshots will be generated at `./build/maestro` + +## Write test + +Tests are yaml file. Generally each yaml file should leave the app in the same screen than at the beginning. + +Start the app and run this command to help writing test. + +```shell +maestro studio +``` + +Note that sometimes, this prevent running the test. So kill the `meastro studio` process to be able to run the test again. + +## CI + +The CI is running maestro using the workflow `.github/worflow/maestro.yaml` and [maestro cloud](https://cloud.mobile.dev/). For now we are limited to 100 runs a month. +Some GitHub secret are used to be able to do that: `MAESTRO_CLOUD_API_KEY`, for now api key from `benoitm@element.io` maestro cloud account, and `MATRIX_MAESTRO_ACCOUNT_PASSWORD` which is the password of the account @maestroelement:matrix.org. This account contains a room `MyRoom` to ba able to run the maestro test suite. diff --git a/.maestro/allTests.yaml b/.maestro/allTests.yaml new file mode 100644 index 0000000000..8283e9fed5 --- /dev/null +++ b/.maestro/allTests.yaml @@ -0,0 +1,7 @@ +appId: ${APP_ID} +--- +- runFlow: tests/init.yaml +- runFlow: tests/account/login.yaml +- runFlow: tests/settings/settings.yaml +- runFlow: tests/roomList/roomList.yaml +- runFlow: tests/account/logout.yaml diff --git a/.maestro/tests/account/changeServer.yaml b/.maestro/tests/account/changeServer.yaml new file mode 100644 index 0000000000..3f360e70a1 --- /dev/null +++ b/.maestro/tests/account/changeServer.yaml @@ -0,0 +1,5 @@ +appId: ${APP_ID} +--- +- tapOn: "Change" +- takeScreenshot: build/maestro/200-ChangeServer +- tapOn: "Continue" diff --git a/.maestro/tests/account/login.yaml b/.maestro/tests/account/login.yaml new file mode 100644 index 0000000000..1541ee37d6 --- /dev/null +++ b/.maestro/tests/account/login.yaml @@ -0,0 +1,13 @@ +appId: ${APP_ID} +--- +- tapOn: "Sign in" +- runFlow: ../assertions/assertLoginDisplayed.yaml +- takeScreenshot: build/maestro/100-SignIn +- runFlow: changeServer.yaml +- runFlow: ../assertions/assertLoginDisplayed.yaml +- tapOn: "Email or username" +- inputText: ${USERNAME} +- tapOn: "Password" +- inputText: ${PASSWORD} +- tapOn: "Continue" +- runFlow: ../assertions/assertHomeDisplayed.yaml diff --git a/.maestro/tests/account/logout.yaml b/.maestro/tests/account/logout.yaml new file mode 100644 index 0000000000..894b5ec03c --- /dev/null +++ b/.maestro/tests/account/logout.yaml @@ -0,0 +1,9 @@ +appId: ${APP_ID} +--- +- tapOn: "Settings" +- tapOn: "Sign out" +- takeScreenshot: build/maestro/900-SignOutDialg +- tapOn: + text: "Sign out" + index: 1 +- runFlow: ../assertions/assertInitDisplayed.yaml diff --git a/.maestro/tests/assertions/assertHomeDisplayed.yaml b/.maestro/tests/assertions/assertHomeDisplayed.yaml new file mode 100644 index 0000000000..6e9eec50db --- /dev/null +++ b/.maestro/tests/assertions/assertHomeDisplayed.yaml @@ -0,0 +1,5 @@ +appId: ${APP_ID} +--- +- extendedWaitUntil: + visible: "All Chats" + timeout: 10_000 diff --git a/.maestro/tests/assertions/assertInitDisplayed.yaml b/.maestro/tests/assertions/assertInitDisplayed.yaml new file mode 100644 index 0000000000..0bcef846c6 --- /dev/null +++ b/.maestro/tests/assertions/assertInitDisplayed.yaml @@ -0,0 +1,5 @@ +appId: ${APP_ID} +--- +- extendedWaitUntil: + visible: "Own your conversations." + timeout: 10_000 diff --git a/.maestro/tests/assertions/assertLoginDisplayed.yaml b/.maestro/tests/assertions/assertLoginDisplayed.yaml new file mode 100644 index 0000000000..0d6461de86 --- /dev/null +++ b/.maestro/tests/assertions/assertLoginDisplayed.yaml @@ -0,0 +1,5 @@ +appId: ${APP_ID} +--- +- extendedWaitUntil: + visible: "Welcome back" + timeout: 10_000 diff --git a/.maestro/tests/init.yaml b/.maestro/tests/init.yaml new file mode 100644 index 0000000000..178cb85d34 --- /dev/null +++ b/.maestro/tests/init.yaml @@ -0,0 +1,7 @@ +appId: ${APP_ID} +--- +- clearState +- launchApp +- tapOn: "Close showkase button" +- runFlow: ./assertions/assertInitDisplayed.yaml +- takeScreenshot: build/maestro/000-FirstScreen diff --git a/.maestro/tests/roomList/roomList.yaml b/.maestro/tests/roomList/roomList.yaml new file mode 100644 index 0000000000..3a26048791 --- /dev/null +++ b/.maestro/tests/roomList/roomList.yaml @@ -0,0 +1,6 @@ +appId: ${APP_ID} +--- +- takeScreenshot: build/maestro/300-RoomList +- runFlow: searchRoomList.yaml +- runFlow: timeline/timeline.yaml + diff --git a/.maestro/tests/roomList/searchRoomList.yaml b/.maestro/tests/roomList/searchRoomList.yaml new file mode 100644 index 0000000000..fe859defbb --- /dev/null +++ b/.maestro/tests/roomList/searchRoomList.yaml @@ -0,0 +1,15 @@ +appId: ${APP_ID} +--- +- tapOn: "search" +- inputText: ${ROOM_NAME.substring(0, 3)} +- takeScreenshot: build/maestro/400-SearchRoom +- tapOn: ${ROOM_NAME} +# Close keyboard +- hideKeyboard +# Back from timeline +- back +# Close keyboard +- hideKeyboard +# Back from search +- back +- runFlow: ../assertions/assertHomeDisplayed.yaml diff --git a/.maestro/tests/roomList/timeline/timeline.yaml b/.maestro/tests/roomList/timeline/timeline.yaml new file mode 100644 index 0000000000..95d1c1ff57 --- /dev/null +++ b/.maestro/tests/roomList/timeline/timeline.yaml @@ -0,0 +1,14 @@ +appId: ${APP_ID} +--- +# This is the name of one room +# TODO Create a room on a new account +- tapOn: ${ROOM_NAME} +- takeScreenshot: build/maestro/500-Timeline +- tapOn: "Message…" +- inputText: "Hello world!" +- tapOn: "Toggle full screen mode" +- tapOn: "Toggle full screen mode" +- tapOn: "Send" +- hideKeyboard +- back +- runFlow: ../../assertions/assertHomeDisplayed.yaml diff --git a/.maestro/tests/settings/settings.yaml b/.maestro/tests/settings/settings.yaml new file mode 100644 index 0000000000..6d54953242 --- /dev/null +++ b/.maestro/tests/settings/settings.yaml @@ -0,0 +1,12 @@ +appId: ${APP_ID} +--- +- tapOn: "Settings" +- assertVisible: "Rage shake to report bug" +- takeScreenshot: build/maestro/600-Settings +- tapOn: + text: "Report bug" + index: 1 +- assertVisible: "Describe your problem here" +- back +- back +- runFlow: ../assertions/assertHomeDisplayed.yaml diff --git a/app/src/main/java/io/element/android/x/component/ShowkaseButton.kt b/app/src/main/java/io/element/android/x/component/ShowkaseButton.kt index bd8906c2a7..689b46dcdc 100644 --- a/app/src/main/java/io/element/android/x/component/ShowkaseButton.kt +++ b/app/src/main/java/io/element/android/x/component/ShowkaseButton.kt @@ -48,7 +48,7 @@ internal fun ShowkaseButton( .size(16.dp), onClick = onCloseClicked, ) { - Icon(imageVector = Icons.Filled.Close, contentDescription = "") + Icon(imageVector = Icons.Filled.Close, contentDescription = "Close showkase button") } } } From 8b9b6f99566fa1f257897c1538108a90555e60d3 Mon Sep 17 00:00:00 2001 From: Benoit Marty Date: Thu, 12 Jan 2023 17:47:41 +0100 Subject: [PATCH 03/15] Rename job, add missing parameter ROOM_NAME and update TOC --- .github/workflows/maestro.yml | 3 ++- .maestro/README.md | 1 + 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/.github/workflows/maestro.yml b/.github/workflows/maestro.yml index da7d35a080..91a73366a6 100644 --- a/.github/workflows/maestro.yml +++ b/.github/workflows/maestro.yml @@ -12,7 +12,7 @@ env: jobs: maestro-cloud: - name: Build debug APKs + name: Meastro test suite runs-on: ubuntu-latest if: github.ref != 'refs/heads/main' strategy: @@ -32,4 +32,5 @@ jobs: env: | USERNAME=maestroelement PASSWORD=${{ secrets.MATRIX_MAESTRO_ACCOUNT_PASSWORD }} + ROOM_NAME=MyRoom APP_ID=io.element.android.x.debug diff --git a/.maestro/README.md b/.maestro/README.md index 119aad7ba3..6a86ab5f14 100644 --- a/.maestro/README.md +++ b/.maestro/README.md @@ -8,6 +8,7 @@ To setup, please refer at [https://maestro.mobile.dev](https://maestro.mobile.de * [Run test](#run-test) * [Output](#output) * [Write test](#write-test) +* [CI](#ci) From 2d83d1901a53d48c8766aea8a5f1a7103609f912 Mon Sep 17 00:00:00 2001 From: Benoit Marty Date: Thu, 12 Jan 2023 18:05:24 +0100 Subject: [PATCH 04/15] Typo in doc --- .maestro/README.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.maestro/README.md b/.maestro/README.md index 6a86ab5f14..966528f752 100644 --- a/.maestro/README.md +++ b/.maestro/README.md @@ -33,9 +33,9 @@ Test result will be printed on the console, and screenshots will be generated at ## Write test -Tests are yaml file. Generally each yaml file should leave the app in the same screen than at the beginning. +Tests are yaml files. Generally each yaml file should leave the app in the same screen than at the beginning. -Start the app and run this command to help writing test. +Start the ElementX app and run this command to help writing test. ```shell maestro studio @@ -46,4 +46,4 @@ Note that sometimes, this prevent running the test. So kill the `meastro studio` ## CI The CI is running maestro using the workflow `.github/worflow/maestro.yaml` and [maestro cloud](https://cloud.mobile.dev/). For now we are limited to 100 runs a month. -Some GitHub secret are used to be able to do that: `MAESTRO_CLOUD_API_KEY`, for now api key from `benoitm@element.io` maestro cloud account, and `MATRIX_MAESTRO_ACCOUNT_PASSWORD` which is the password of the account @maestroelement:matrix.org. This account contains a room `MyRoom` to ba able to run the maestro test suite. +Some GitHub secrets are used to be able to do that: `MAESTRO_CLOUD_API_KEY`, for now api key from `benoitm@element.io` maestro cloud account, and `MATRIX_MAESTRO_ACCOUNT_PASSWORD` which is the password of the account `@maestroelement:matrix.org`. This account contains a room `MyRoom` to be able to run the maestro test suite. From f810a2ceaf82894df46efd5afae8bfcb5c4b239a Mon Sep 17 00:00:00 2001 From: Benoit Marty Date: Thu, 12 Jan 2023 18:13:15 +0100 Subject: [PATCH 05/15] Allow concurrency with the build job. --- .github/workflows/maestro.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/maestro.yml b/.github/workflows/maestro.yml index 91a73366a6..d3d0962037 100644 --- a/.github/workflows/maestro.yml +++ b/.github/workflows/maestro.yml @@ -19,7 +19,7 @@ jobs: fail-fast: false # Allow all jobs on develop. Just one per PR. concurrency: - group: ${{ github.ref == 'refs/heads/develop' && format('build-develop-{0}', github.sha) || format('build-debug-{0}', github.ref) }} + group: ${{ github.ref == 'refs/heads/develop' && format('maestro-develop-{0}', github.sha) || format('maestro-debug-{0}', github.ref) }} cancel-in-progress: true steps: - uses: actions/checkout@v3 From 1ee73a153be17ad84914781b13d6283f611d9a97 Mon Sep 17 00:00:00 2001 From: Benoit Marty Date: Fri, 13 Jan 2023 16:52:21 +0100 Subject: [PATCH 06/15] Add doc for future --- .maestro/README.md | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/.maestro/README.md b/.maestro/README.md index 966528f752..b4f7ead266 100644 --- a/.maestro/README.md +++ b/.maestro/README.md @@ -9,6 +9,7 @@ To setup, please refer at [https://maestro.mobile.dev](https://maestro.mobile.de * [Output](#output) * [Write test](#write-test) * [CI](#ci) +* [Future](#future) @@ -47,3 +48,8 @@ Note that sometimes, this prevent running the test. So kill the `meastro studio` The CI is running maestro using the workflow `.github/worflow/maestro.yaml` and [maestro cloud](https://cloud.mobile.dev/). For now we are limited to 100 runs a month. Some GitHub secrets are used to be able to do that: `MAESTRO_CLOUD_API_KEY`, for now api key from `benoitm@element.io` maestro cloud account, and `MATRIX_MAESTRO_ACCOUNT_PASSWORD` which is the password of the account `@maestroelement:matrix.org`. This account contains a room `MyRoom` to be able to run the maestro test suite. + +## Future + +- run on Element X iOS. This is already working but it need some change on the test to make it works. Could pass a PLATFORM parameter to have unique test and use conditional test. +- run specific test on both iOS and Android devices to make them communicate together. Could be possible to test room invite and join, verification, call, etc. To be done when Element X will be able to create account and create room. A main script would be able to detect the Android device and the iOS device, and run several maestro tests sequentially, using `--device` parameter to perform a global test. From 8e2a28f057e49cf19a73fe217d9676ba2d4ef159 Mon Sep 17 00:00:00 2001 From: Benoit Marty Date: Fri, 13 Jan 2023 17:01:45 +0100 Subject: [PATCH 07/15] Fix wording issue --- .maestro/tests/assertions/assertLoginDisplayed.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.maestro/tests/assertions/assertLoginDisplayed.yaml b/.maestro/tests/assertions/assertLoginDisplayed.yaml index 0d6461de86..41f1ff3306 100644 --- a/.maestro/tests/assertions/assertLoginDisplayed.yaml +++ b/.maestro/tests/assertions/assertLoginDisplayed.yaml @@ -1,5 +1,5 @@ appId: ${APP_ID} --- - extendedWaitUntil: - visible: "Welcome back" + visible: "Welcome back!" timeout: 10_000 From 91d70e6f9b12ba08d9324d17d8553d669c777e3d Mon Sep 17 00:00:00 2001 From: Benoit Marty Date: Fri, 13 Jan 2023 17:07:56 +0100 Subject: [PATCH 08/15] Fix wording issue --- .maestro/tests/account/login.yaml | 2 +- .../element/android/x/features/onboarding/OnBoardingScreen.kt | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/.maestro/tests/account/login.yaml b/.maestro/tests/account/login.yaml index 1541ee37d6..ceeff061a7 100644 --- a/.maestro/tests/account/login.yaml +++ b/.maestro/tests/account/login.yaml @@ -1,6 +1,6 @@ appId: ${APP_ID} --- -- tapOn: "Sign in" +- tapOn: "Get started" - runFlow: ../assertions/assertLoginDisplayed.yaml - takeScreenshot: build/maestro/100-SignIn - runFlow: changeServer.yaml diff --git a/features/onboarding/src/main/java/io/element/android/x/features/onboarding/OnBoardingScreen.kt b/features/onboarding/src/main/java/io/element/android/x/features/onboarding/OnBoardingScreen.kt index 77f798fb4e..f6e0ed0db4 100644 --- a/features/onboarding/src/main/java/io/element/android/x/features/onboarding/OnBoardingScreen.kt +++ b/features/onboarding/src/main/java/io/element/android/x/features/onboarding/OnBoardingScreen.kt @@ -52,6 +52,7 @@ import com.google.accompanist.pager.rememberPagerState import io.element.android.x.designsystem.components.VectorButton import kotlinx.coroutines.delay import kotlinx.coroutines.launch +import io.element.android.x.element.resources.R as ElementR @OptIn(ExperimentalPagerApi::class) @Composable @@ -119,7 +120,7 @@ fun OnBoardingScreen( ) */ VectorButton( - text = "Sign in", + text = stringResource(id = ElementR.string.login_splash_submit), onClick = { onSignIn() }, From d55cdc10a437d4fc35d0edb385c3660d8dd6326b Mon Sep 17 00:00:00 2001 From: Benoit Marty Date: Fri, 13 Jan 2023 17:09:12 +0100 Subject: [PATCH 09/15] clearKeychain (iOS) --- .maestro/tests/init.yaml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.maestro/tests/init.yaml b/.maestro/tests/init.yaml index 178cb85d34..656c654fcb 100644 --- a/.maestro/tests/init.yaml +++ b/.maestro/tests/init.yaml @@ -1,7 +1,8 @@ appId: ${APP_ID} --- - clearState -- launchApp +- launchApp: + clearKeychain: true - tapOn: "Close showkase button" - runFlow: ./assertions/assertInitDisplayed.yaml - takeScreenshot: build/maestro/000-FirstScreen From 67ce11a5365515e20877a431d5b164d886ad964f Mon Sep 17 00:00:00 2001 From: Benoit Marty Date: Fri, 13 Jan 2023 17:11:08 +0100 Subject: [PATCH 10/15] Add comments for iOS --- .maestro/README.md | 14 ++++++++++++++ .maestro/tests/account/login.yaml | 8 ++++++++ 2 files changed, 22 insertions(+) diff --git a/.maestro/README.md b/.maestro/README.md index b4f7ead266..15915cbf1c 100644 --- a/.maestro/README.md +++ b/.maestro/README.md @@ -9,6 +9,7 @@ To setup, please refer at [https://maestro.mobile.dev](https://maestro.mobile.de * [Output](#output) * [Write test](#write-test) * [CI](#ci) +* [iOS](#ios) * [Future](#future) @@ -49,6 +50,19 @@ Note that sometimes, this prevent running the test. So kill the `meastro studio` The CI is running maestro using the workflow `.github/worflow/maestro.yaml` and [maestro cloud](https://cloud.mobile.dev/). For now we are limited to 100 runs a month. Some GitHub secrets are used to be able to do that: `MAESTRO_CLOUD_API_KEY`, for now api key from `benoitm@element.io` maestro cloud account, and `MATRIX_MAESTRO_ACCOUNT_PASSWORD` which is the password of the account `@maestroelement:matrix.org`. This account contains a room `MyRoom` to be able to run the maestro test suite. +## iOS + +Need to install `idb-companion` first + +```shell +brew install idb-companion +``` + +Also: +https://github.com/mobile-dev-inc/maestro/issues/146 +https://github.com/mobile-dev-inc/maestro/issues/107 +So you have to change your input keyboard to QWERTY for it to work properly. + ## Future - run on Element X iOS. This is already working but it need some change on the test to make it works. Could pass a PLATFORM parameter to have unique test and use conditional test. diff --git a/.maestro/tests/account/login.yaml b/.maestro/tests/account/login.yaml index ceeff061a7..e3b07bc8ae 100644 --- a/.maestro/tests/account/login.yaml +++ b/.maestro/tests/account/login.yaml @@ -6,8 +6,16 @@ appId: ${APP_ID} - runFlow: changeServer.yaml - runFlow: ../assertions/assertLoginDisplayed.yaml - tapOn: "Email or username" +# ios +# - tapOn: +# id: "usernameTextField" +# index: 0 - inputText: ${USERNAME} - tapOn: "Password" +# iOS +#- tapOn: +# id: "passwordTextField" +# index: 0 - inputText: ${PASSWORD} - tapOn: "Continue" - runFlow: ../assertions/assertHomeDisplayed.yaml From 339c6297a1da5b61c6e3b12d64c4347e4ce998cc Mon Sep 17 00:00:00 2001 From: Benoit Marty Date: Fri, 13 Jan 2023 17:29:39 +0100 Subject: [PATCH 11/15] Fix wording issue --- .maestro/tests/account/login.yaml | 2 +- .../io/element/android/x/features/login/root/LoginRootScreen.kt | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.maestro/tests/account/login.yaml b/.maestro/tests/account/login.yaml index e3b07bc8ae..1baf07be5b 100644 --- a/.maestro/tests/account/login.yaml +++ b/.maestro/tests/account/login.yaml @@ -5,7 +5,7 @@ appId: ${APP_ID} - takeScreenshot: build/maestro/100-SignIn - runFlow: changeServer.yaml - runFlow: ../assertions/assertLoginDisplayed.yaml -- tapOn: "Email or username" +- tapOn: "Username or email" # ios # - tapOn: # id: "usernameTextField" diff --git a/features/login/src/main/java/io/element/android/x/features/login/root/LoginRootScreen.kt b/features/login/src/main/java/io/element/android/x/features/login/root/LoginRootScreen.kt index d71cb909c3..247f25fddf 100644 --- a/features/login/src/main/java/io/element/android/x/features/login/root/LoginRootScreen.kt +++ b/features/login/src/main/java/io/element/android/x/features/login/root/LoginRootScreen.kt @@ -138,7 +138,7 @@ fun LoginRootScreen( .fillMaxWidth() .padding(top = 60.dp), label = { - Text(text = "Email or username") + Text(text = stringResource(id = ElementR.string.login_signin_username_hint)) }, onValueChange = { loginFieldState = it From 8b5c3cdcb90ccf073523e8d56f121b5a683c1dc8 Mon Sep 17 00:00:00 2001 From: Benoit Marty Date: Fri, 13 Jan 2023 17:40:05 +0100 Subject: [PATCH 12/15] Update doc. --- .maestro/README.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.maestro/README.md b/.maestro/README.md index 15915cbf1c..fc2a71d90e 100644 --- a/.maestro/README.md +++ b/.maestro/README.md @@ -45,6 +45,8 @@ maestro studio Note that sometimes, this prevent running the test. So kill the `meastro studio` process to be able to run the test again. +Also, if updating the application code, do not forget to deploy again the application before running the maestro tests. + ## CI The CI is running maestro using the workflow `.github/worflow/maestro.yaml` and [maestro cloud](https://cloud.mobile.dev/). For now we are limited to 100 runs a month. From 62523416ec168b79abb83ba25383dc71f547fa34 Mon Sep 17 00:00:00 2001 From: Benoit Marty Date: Fri, 13 Jan 2023 17:54:18 +0100 Subject: [PATCH 13/15] Add another test: cancel sign out. --- .maestro/tests/account/logout.yaml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.maestro/tests/account/logout.yaml b/.maestro/tests/account/logout.yaml index 894b5ec03c..3c9dd07972 100644 --- a/.maestro/tests/account/logout.yaml +++ b/.maestro/tests/account/logout.yaml @@ -3,6 +3,9 @@ appId: ${APP_ID} - tapOn: "Settings" - tapOn: "Sign out" - takeScreenshot: build/maestro/900-SignOutDialg +# Ensure cancel cancels +- tapOn: "Cancel" +- tapOn: "Sign out" - tapOn: text: "Sign out" index: 1 From 0c3382fd26601b523ac7e24f6e26d7332867a5f4 Mon Sep 17 00:00:00 2001 From: Benoit Marty Date: Tue, 17 Jan 2023 18:14:12 +0100 Subject: [PATCH 14/15] Fix compilation issue after rebase. --- .../io/element/android/x/features/login/root/LoginRootScreen.kt | 2 ++ 1 file changed, 2 insertions(+) diff --git a/features/login/src/main/java/io/element/android/x/features/login/root/LoginRootScreen.kt b/features/login/src/main/java/io/element/android/x/features/login/root/LoginRootScreen.kt index 247f25fddf..76b523ee70 100644 --- a/features/login/src/main/java/io/element/android/x/features/login/root/LoginRootScreen.kt +++ b/features/login/src/main/java/io/element/android/x/features/login/root/LoginRootScreen.kt @@ -48,6 +48,7 @@ import androidx.compose.runtime.remember import androidx.compose.runtime.setValue import androidx.compose.ui.Alignment import androidx.compose.ui.Modifier +import androidx.compose.ui.res.stringResource import androidx.compose.ui.text.font.FontWeight import androidx.compose.ui.text.input.ImeAction import androidx.compose.ui.text.input.KeyboardType @@ -61,6 +62,7 @@ import io.element.android.x.core.compose.textFieldState import io.element.android.x.designsystem.ElementXTheme import io.element.android.x.features.login.error.loginError import io.element.android.x.matrix.core.SessionId +import io.element.android.x.element.resources.R as ElementR @OptIn(ExperimentalMaterial3Api::class) @Composable From 8adbb4310d7f36154f245ce5a8c8002ef1b5bf87 Mon Sep 17 00:00:00 2001 From: Benoit Marty Date: Tue, 17 Jan 2023 18:18:39 +0100 Subject: [PATCH 15/15] Update string. --- .../io/element/android/x/features/login/root/LoginRootScreen.kt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/features/login/src/main/java/io/element/android/x/features/login/root/LoginRootScreen.kt b/features/login/src/main/java/io/element/android/x/features/login/root/LoginRootScreen.kt index 76b523ee70..aa7814ccf2 100644 --- a/features/login/src/main/java/io/element/android/x/features/login/root/LoginRootScreen.kt +++ b/features/login/src/main/java/io/element/android/x/features/login/root/LoginRootScreen.kt @@ -97,7 +97,7 @@ fun LoginRootScreen( val isError = state.loggedInState is LoggedInState.ErrorLoggingIn // Title Text( - text = "Welcome back", + text = stringResource(id = ElementR.string.ftue_auth_welcome_back_title), modifier = Modifier .fillMaxWidth() .padding(horizontal = 16.dp, vertical = 48.dp),