Maestro quick start
Intro
Maestro is another testing framework, like Playwright, Selenium, or Cypress. Without further ado, let’s dive into the example scenario.
Before running Maestro, ensure it is installed correctly. You can follow the official installation guide for your specific environment
For this demonstration, we are running Maestro on a Windows environment. Using the YAML file provided by the official Maestro documentation, we made the following modifications:
Scripts
main.yml
I add the launchApp command , which was not present in the original script
appId: org.wikipedia
---
- launchApp
- runFlow: "search.yml"
- runFlow: "saved.yml"
- runFlow: "feed.yml"
- runFlow: "copy-paste.yml"
search.yml
Based on our area, I translate some contents. During the execution , we could also find out methods for locating beyond the language. Similar modifications were made to saved.ymal and feed.yml , including language translation and adjustments for localization-based element detection.
appId: org.wikipedia
---
- tapOn: "在維基百科搜尋"
- inputText: "Sun"
- tapOn:
id: "org.wikipedia:id/language_label"
index: 1
- assertVisible: "Star at the center of the Solar System"
- tapOn:
id: ".*page_list_item_title"
- tapOn:
id: ".*page_save"
- back
- back
- back
saved.yml
appId: org.wikipedia
---
- tapOn: '已儲存'
# "Saved"
- tapOn: '您的已儲存條目之預設清單'
# "Default list for your saved articles"
- assertVisible: "Sun"
- assertVisible: "Star at the center of the Solar System"
- back
feed.yml
appId: org.wikipedia
---
- tapOn: '探索'
# "Explore"
- scrollUntilVisible:
element: "Today on Wikipedia.*"
- tapOn: "Today on Wikipedia.*"
- back
copy-pasted.yml
By modifying 'Top read' to 'More top read' (with an added space), I discovered two key findings:
Finding 1.
The right arrow image is treated as a space.
Finding 2.
With Traditional Chinese and English as separate blocks, ‘Top read’ sections have distinct index calculations, requiring script adjustment.
appId: org.wikipedia
---
- tapOn: "探索"
- scrollUntilVisible:
element: "More top read "
- copyTextFrom:
id: ".*view_list_card_item_title"
index: 0
- tapOn: "探索"
- tapOn: "在維基百科搜尋"
- inputText: "${maestro.copiedText}"
- back
- back
Execution
We only need to run main.yml, and terminal would show the progress - with each steps.
If we keep the original "Explore" text in Traditional Chinese Wiki region:
Congrates !