Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 10 additions & 1 deletion .maestro/README.md
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -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.

Expand Down
8 changes: 8 additions & 0 deletions .maestro/flows/basic-pager/verify-horizontal-ltr-swipe.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,10 @@ appId: com.pagerviewexample
- tapOn:
id: 'scroll-enabled-button'

- extendedWaitUntil:
visible: 'Scroll Disabled'
timeout: 5000

- swipe:
from:
id: 'pager-view-horizontal'
Expand All @@ -16,6 +20,10 @@ appId: com.pagerviewexample
- tapOn:
id: 'scroll-enabled-button'

- extendedWaitUntil:
visible: 'Scroll Enabled'
timeout: 5000

- swipe:
from:
id: 'pager-view-horizontal'
Expand Down
8 changes: 8 additions & 0 deletions .maestro/flows/basic-pager/verify-horizontal-rtl-swipe.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,10 @@ appId: com.pagerviewexample
- tapOn:
id: 'scroll-enabled-button'

- extendedWaitUntil:
visible: 'Scroll Disabled'
timeout: 5000

- swipe:
from:
id: 'pager-view-horizontal'
Expand All @@ -16,6 +20,10 @@ appId: com.pagerviewexample
- tapOn:
id: 'scroll-enabled-button'

- extendedWaitUntil:
visible: 'Scroll Enabled'
timeout: 5000

- swipe:
from:
id: 'pager-view-horizontal'
Expand Down
8 changes: 8 additions & 0 deletions .maestro/flows/basic-pager/verify-vertical-swipe.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,10 @@ appId: com.pagerviewexample
- tapOn:
id: 'scroll-enabled-button'

- extendedWaitUntil:
visible: 'Scroll Disabled'
timeout: 5000

- swipe:
from:
id: 'pager-view-vertical'
Expand All @@ -15,6 +19,10 @@ appId: com.pagerviewexample
- tapOn:
id: 'scroll-enabled-button'

- extendedWaitUntil:
visible: 'Scroll Enabled'
timeout: 5000

- swipe:
from:
id: 'pager-view-vertical'
Expand Down
2 changes: 2 additions & 0 deletions .maestro/tests/nested_pagerView_example.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
appId: com.pagerviewexample
---
- runFlow: ../flows/basic-pager/ensure-ltr.yaml

- runFlow: ../setup/nested_pagerView_example_setup.yaml

Comment on lines +3 to 6
- swipe:
Expand Down
8 changes: 4 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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"
},
Expand Down
21 changes: 15 additions & 6 deletions scripts/run-maestro-tests.sh
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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[@]}"
}

Expand Down
Loading