Skip to content

Commit

Permalink
Add notes for useful Maestro techniques
Browse files Browse the repository at this point in the history
  • Loading branch information
hueachilles committed Jan 23, 2024
1 parent 8bf0ee9 commit 9ef5ddb
Showing 1 changed file with 52 additions and 0 deletions.
52 changes: 52 additions & 0 deletions .maestro/advanced-techniques.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
[Cross platform techniques](https://blog.mobile.dev/best-practices-for-cross-platform-maestro-ui-testing-for-android-and-ios-98d1c471a838)

## Platform specific init scripts

Specify platform specific IDs.

In a test.yaml

```yaml
- runScript:
when:
platform: iOS
file: ios/init.js

#... more runScripts (for other platforms)

- tapOn:
id: ${output.wallpapers.wallpaperItem}
index: 0
```
ios/init.js
```js
output.wallpapers = {
wallpaperItem: 'imageItem',
}
```

## Run platform specific flows

In a test.yaml this runs `Date.yaml` only on iOS. `Date.yaml` is expected to specify tests.

```yaml
- runFlow:
when:
platform: iOS
file: Date.yaml
```
See further down page on how to test platform share window.
## Inline platform specific tests
```yaml
- runFlow:
when:
platform: Android
commands:
- assertVisible:
id: "setWallpaperIconButton"
```

0 comments on commit 9ef5ddb

Please sign in to comment.