From 9ef5ddb76671e7f7101e531ba058002a24e9120e Mon Sep 17 00:00:00 2001 From: hue Date: Tue, 23 Jan 2024 17:58:04 -0500 Subject: [PATCH] Add notes for useful Maestro techniques --- .maestro/advanced-techniques.md | 52 +++++++++++++++++++++++++++++++++ 1 file changed, 52 insertions(+) create mode 100644 .maestro/advanced-techniques.md diff --git a/.maestro/advanced-techniques.md b/.maestro/advanced-techniques.md new file mode 100644 index 00000000..7e60a287 --- /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