diff --git a/.maestro/README.md b/.maestro/README.md index 8660c71d..8f002414 100644 --- a/.maestro/README.md +++ b/.maestro/README.md @@ -1,5 +1,11 @@ # Maestro +Install [maestro-runner](https://github.com/devicelab-dev/maestro-runner) before running the flows: + +```bash +curl -fsSL https://open.devicelab.dev/install/maestro-runner | bash +``` + Run E2E tests from the repository root: ```bash @@ -16,8 +22,11 @@ bun run maestro:test:ios bun run maestro:test:android ``` +Platform test commands retry failed flows up to two times after the initial run. + Use `bun run maestro:smoke` to run only the smoke flow. -`maestro:debug` writes failure artifacts to `.maestro/debug-output`. +`maestro:debug` enables verbose logging and captures artifacts for every step. +HTML, JSON, JUnit, Allure, log, and failure artifacts are written under `.maestro/debug-output`. The smoke flow targets the example app ID `com.pagerviewexample` and verifies the horizontal pager using stable `testID` selectors. diff --git a/.maestro/flows/basic-pager/verify-horizontal-ltr-swipe.yaml b/.maestro/flows/basic-pager/verify-horizontal-ltr-swipe.yaml index 22fc19da..de521df7 100644 --- a/.maestro/flows/basic-pager/verify-horizontal-ltr-swipe.yaml +++ b/.maestro/flows/basic-pager/verify-horizontal-ltr-swipe.yaml @@ -3,6 +3,10 @@ appId: com.pagerviewexample - tapOn: id: 'scroll-enabled-button' +- extendedWaitUntil: + visible: 'Scroll Disabled' + timeout: 5000 + - swipe: from: id: 'pager-view-horizontal' @@ -16,6 +20,10 @@ appId: com.pagerviewexample - tapOn: id: 'scroll-enabled-button' +- extendedWaitUntil: + visible: 'Scroll Enabled' + timeout: 5000 + - swipe: from: id: 'pager-view-horizontal' diff --git a/.maestro/flows/basic-pager/verify-horizontal-rtl-swipe.yaml b/.maestro/flows/basic-pager/verify-horizontal-rtl-swipe.yaml index fd8aa15d..94b8f24d 100644 --- a/.maestro/flows/basic-pager/verify-horizontal-rtl-swipe.yaml +++ b/.maestro/flows/basic-pager/verify-horizontal-rtl-swipe.yaml @@ -3,6 +3,10 @@ appId: com.pagerviewexample - tapOn: id: 'scroll-enabled-button' +- extendedWaitUntil: + visible: 'Scroll Disabled' + timeout: 5000 + - swipe: from: id: 'pager-view-horizontal' @@ -16,6 +20,10 @@ appId: com.pagerviewexample - tapOn: id: 'scroll-enabled-button' +- extendedWaitUntil: + visible: 'Scroll Enabled' + timeout: 5000 + - swipe: from: id: 'pager-view-horizontal' diff --git a/.maestro/flows/basic-pager/verify-vertical-swipe.yaml b/.maestro/flows/basic-pager/verify-vertical-swipe.yaml index a160d576..23c7f124 100644 --- a/.maestro/flows/basic-pager/verify-vertical-swipe.yaml +++ b/.maestro/flows/basic-pager/verify-vertical-swipe.yaml @@ -3,6 +3,10 @@ appId: com.pagerviewexample - tapOn: id: 'scroll-enabled-button' +- extendedWaitUntil: + visible: 'Scroll Disabled' + timeout: 5000 + - swipe: from: id: 'pager-view-vertical' @@ -15,6 +19,10 @@ appId: com.pagerviewexample - tapOn: id: 'scroll-enabled-button' +- extendedWaitUntil: + visible: 'Scroll Enabled' + timeout: 5000 + - swipe: from: id: 'pager-view-vertical' diff --git a/.maestro/tests/nested_pagerView_example.yaml b/.maestro/tests/nested_pagerView_example.yaml index a05e8fe8..099a70fd 100644 --- a/.maestro/tests/nested_pagerView_example.yaml +++ b/.maestro/tests/nested_pagerView_example.yaml @@ -1,5 +1,7 @@ appId: com.pagerviewexample --- +- runFlow: ../flows/basic-pager/ensure-ltr.yaml + - runFlow: ../setup/nested_pagerView_example_setup.yaml - swipe: diff --git a/package.json b/package.json index 089a547c..fce1fa1e 100644 --- a/package.json +++ b/package.json @@ -34,10 +34,10 @@ "example:ios": "cd example; bun ios", "example:android:release": "cd example;react-native run-android --mode \"Release\" --appId com.pagerviewexample --active-arch-only", "example:ios:release": "cd example;react-native run-ios --mode \"Release\"", - "maestro:test:android": "bash ./scripts/run-maestro-tests.sh android", - "maestro:test:ios": "bash ./scripts/run-maestro-tests.sh ios", - "maestro:smoke": "maestro test .maestro/smoke-test.yaml", - "maestro:debug": "maestro test --debug-output .maestro/debug-output --flatten-debug-output .maestro/smoke-test.yaml", + "maestro:test:android": "bash ./scripts/run-maestro-tests.sh android --retry", + "maestro:test:ios": "bash ./scripts/run-maestro-tests.sh ios --retry", + "maestro:smoke": "maestro-runner test --output .maestro/debug-output/smoke --flatten .maestro/smoke-test.yaml", + "maestro:debug": "maestro-runner --verbose test --artifacts always --output .maestro/debug-output/smoke-debug --flatten .maestro/smoke-test.yaml", "e2e:ios": "bun run example:ios:release && bun run maestro:test:ios", "e2e:android": "bun run example:android:release && bun run maestro:test:android" }, diff --git a/scripts/run-maestro-tests.sh b/scripts/run-maestro-tests.sh index 6af663d7..a7e21479 100644 --- a/scripts/run-maestro-tests.sh +++ b/scripts/run-maestro-tests.sh @@ -1,6 +1,6 @@ #!/bin/bash -# Source https://github.com/stripe/stripe-react-native/blob/master/scripts/run-maestro-tests +# Runs Maestro-compatible flows with https://github.com/devicelab-dev/maestro-runner set -uo pipefail if [ -t 1 ] && [ "${NO_COLOR:-}" != "1" ] && [ "${TERM:-}" != "dumb" ]; then @@ -79,6 +79,11 @@ case $PLATFORM in ;; esac +if ! command -v maestro-runner >/dev/null 2>&1; then + printError "maestro-runner is not installed. See https://open.devicelab.dev/install/maestro-runner" + exit 1 +fi + if { [ -n "$SHARD_COUNT" ] || [ -n "$SHARD_INDEX" ]; } && { [ -z "$SHARD_COUNT" ] || [ -z "$SHARD_INDEX" ]; }; then printError "Both SHARD_COUNT and SHARD_INDEX must be set to enable sharding." exit 1 @@ -142,18 +147,22 @@ runTest() { fi maestroCommand=( - maestro test + maestro-runner -p "$PLATFORM" - "$file" - -e APP_ID="$APPID" - --debug-output "$artifactDir" - --flatten-debug-output ) if [ -n "$DEVICE_ID" ]; then maestroCommand+=(--device "$DEVICE_ID") fi + maestroCommand+=( + test + -e APP_ID="$APPID" + --output "$artifactDir" + --flatten + "$file" + ) + "${maestroCommand[@]}" }