diff --git a/.maestro/advanced-techniques.md b/.maestro/advanced-techniques.md new file mode 100644 index 000000000..7e60a287c --- /dev/null +++ b/.maestro/advanced-techniques.md @@ -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" +``` \ No newline at end of file