From 38ad415ab55ee9de90a642b8ff4422a29da27ef5 Mon Sep 17 00:00:00 2001 From: Benoit Marty Date: Thu, 15 May 2025 17:14:41 +0200 Subject: [PATCH] Ensure the CI is marked as failed when Maestro test is failing (#4700) * Ensure the CI is marked as failed when Maestro test is failing * Fix typo in String to disable bookmark in ChromeCustomTab * Fix Maestro test now that matrix.org is using MAS to authenticate. * Fix Maestro test - other issues due to recent changes. * Maestro: add test on Element Call * Run through Chrome on boarding step. * Try suggestion from https://github.com/mobile-dev-inc/Maestro/issues/1126#issuecomment-2842220361 * Revert "Try suggestion from https://github.com/mobile-dev-inc/Maestro/issues/1126#issuecomment-2842220361" This reverts commit d400644622c1a240deb61040f9095e3221e07f21. * Add comment on Maestro flow. --- .github/workflows/maestro-local.yml | 8 +++++++- .maestro/tests/account/login.yaml | 20 ++++++++++--------- .maestro/tests/account/verifySession.yaml | 2 +- .../tests/roomList/createAndDeleteDM.yaml | 3 ++- .../tests/roomList/timeline/call/call.yaml | 13 ++++++++++++ .../tests/roomList/timeline/timeline.yaml | 1 + .../androidutils/browser/ChromeCustomTab.kt | 2 +- 7 files changed, 36 insertions(+), 13 deletions(-) create mode 100644 .maestro/tests/roomList/timeline/call/call.yaml diff --git a/.github/workflows/maestro-local.yml b/.github/workflows/maestro-local.yml index b07eb196fd..3cb3d46111 100644 --- a/.github/workflows/maestro-local.yml +++ b/.github/workflows/maestro-local.yml @@ -56,7 +56,7 @@ jobs: maestro-cloud: name: Maestro test suite runs-on: ubuntu-latest - needs: [build-apk] + needs: [ build-apk ] # Allow one per PR. concurrency: group: ${{ format('maestro-{0}', github.ref) }} @@ -80,6 +80,7 @@ jobs: - name: Install maestro run: curl -fsSL "https://get.maestro.mobile.dev" | bash - name: Run Maestro tests in emulator + id: maestro_test uses: reactivecircus/android-emulator-runner@v2 continue-on-error: true env: @@ -109,3 +110,8 @@ jobs: retention-days: 5 overwrite: true if-no-files-found: error + - name: Fail the workflow in case of error in test + if: steps.maestro_test.outcome != 'success' + run: | + echo "Maestro tests failed. Please check the logs." + exit 1 diff --git a/.maestro/tests/account/login.yaml b/.maestro/tests/account/login.yaml index 18054297d6..617df92e50 100644 --- a/.maestro/tests/account/login.yaml +++ b/.maestro/tests/account/login.yaml @@ -7,22 +7,24 @@ appId: ${MAESTRO_APP_ID} - runFlow: ../assertions/assertLoginDisplayed.yaml - tapOn: id: "login-continue" +## MAS page +## Conditional workflow to pass the Chrome first launch welcome page. +- runFlow: + when: + visible: 'Use without an account' + commands: + - tapOn: "Use without an account" +## Working when running Maestro locally, but not on the CI yet. - tapOn: - id: "login-email_username" + id: "form-1" - inputText: ${MAESTRO_USERNAME} - pressKey: Enter - tapOn: - id: "login-password" -- inputText: "wrong-password" -- pressKey: Enter -- tapOn: "Continue" -- tapOn: "OK" -- tapOn: - id: "login-password" -- eraseText: 20 + id: "form-3" - inputText: ${MAESTRO_PASSWORD} - pressKey: Enter - tapOn: "Continue" +## Back to native world - runFlow: ../assertions/assertSessionVerificationDisplayed.yaml - runFlow: ./verifySession.yaml - runFlow: ../assertions/assertAnalyticsDisplayed.yaml diff --git a/.maestro/tests/account/verifySession.yaml b/.maestro/tests/account/verifySession.yaml index a16322543f..f1f4552709 100644 --- a/.maestro/tests/account/verifySession.yaml +++ b/.maestro/tests/account/verifySession.yaml @@ -8,6 +8,6 @@ appId: ${MAESTRO_APP_ID} - hideKeyboard - tapOn: "Continue" - extendedWaitUntil: - visible: "Device verified" + visible: "Verification complete" timeout: 30000 - tapOn: "Continue" diff --git a/.maestro/tests/roomList/createAndDeleteDM.yaml b/.maestro/tests/roomList/createAndDeleteDM.yaml index 6e0d55ab26..7e33fd1d15 100644 --- a/.maestro/tests/roomList/createAndDeleteDM.yaml +++ b/.maestro/tests/roomList/createAndDeleteDM.yaml @@ -7,8 +7,9 @@ appId: ${MAESTRO_APP_ID} - tapOn: text: ${MAESTRO_INVITEE1_MXID} index: 1 +- tapOn: "Send invite" - takeScreenshot: build/maestro/330-createAndDeleteDM - tapOn: "maestroelement2" - scroll -- tapOn: "Leave conversation" +- tapOn: "Leave room" - tapOn: "Leave" diff --git a/.maestro/tests/roomList/timeline/call/call.yaml b/.maestro/tests/roomList/timeline/call/call.yaml new file mode 100644 index 0000000000..e390d0a3a1 --- /dev/null +++ b/.maestro/tests/roomList/timeline/call/call.yaml @@ -0,0 +1,13 @@ +appId: ${MAESTRO_APP_ID} +--- +- tapOn: "Start a call" +- takeScreenshot: build/maestro/700-Call +- extendedWaitUntil: + visible: "maestroelement" + timeout: 10000 +- takeScreenshot: build/maestro/710-Call +# Hangup +- tapOn: "End call" +- extendedWaitUntil: + visible: "MyRoom" + timeout: 10000 diff --git a/.maestro/tests/roomList/timeline/timeline.yaml b/.maestro/tests/roomList/timeline/timeline.yaml index 5f85366e9e..d82c5ea1ff 100644 --- a/.maestro/tests/roomList/timeline/timeline.yaml +++ b/.maestro/tests/roomList/timeline/timeline.yaml @@ -6,5 +6,6 @@ appId: ${MAESTRO_APP_ID} - runFlow: messages/text.yaml - runFlow: messages/location.yaml - runFlow: messages/poll.yaml +- runFlow: call/call.yaml - back - runFlow: ../../assertions/assertHomeDisplayed.yaml diff --git a/libraries/androidutils/src/main/kotlin/io/element/android/libraries/androidutils/browser/ChromeCustomTab.kt b/libraries/androidutils/src/main/kotlin/io/element/android/libraries/androidutils/browser/ChromeCustomTab.kt index 8e6bf24f91..5617d459f0 100644 --- a/libraries/androidutils/src/main/kotlin/io/element/android/libraries/androidutils/browser/ChromeCustomTab.kt +++ b/libraries/androidutils/src/main/kotlin/io/element/android/libraries/androidutils/browser/ChromeCustomTab.kt @@ -53,7 +53,7 @@ fun Activity.openUrlInChromeCustomTab( // Disable download button intent.putExtra("org.chromium.chrome.browser.customtabs.EXTRA_DISABLE_DOWNLOAD_BUTTON", true) // Disable bookmark button - intent.putExtra("org.chromium.chrome.browser.customtabs.EXTRA_DISABLE_START_BUTTON", true) + intent.putExtra("org.chromium.chrome.browser.customtabs.EXTRA_DISABLE_STAR_BUTTON", true) intent.putExtra(Browser.EXTRA_HEADERS, Bundle().apply { putString("Accept-Language", Locale.getDefault().toLanguageTag()) })