Skip to content
Draft
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
54 changes: 54 additions & 0 deletions maestro/01.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
appId: me.hackerchick.catima.debug
name: Generate main screen overview with 8 cards
---
- launchApp:
appId: "me.hackerchick.catima.debug"
clearState: true
- evalScript: ${output.counter = 0}
# We only care about cardCount at this moment, but this way we can keep the card list in one script
- runScript:
file: js/01-getCardInfo.js
env:
INDEX: ${output.counter}
- repeat:
while:
true: ${output.counter < output.cardCount}
commands:
- runScript:
file: js/01-getCardInfo.js
env:
INDEX: ${output.counter}
- tapOn:
id: "me.hackerchick.catima.debug:id/fabAdd" # Add
- tapOn:
id: "me.hackerchick.catima.debug:id/fabOtherOptions" # More options
- tapOn:
id: "android:id/text1"
index: 0 # Add a card with no barcode
- inputText: 123456
- tapOn:
id: "android:id/button1" # OK
- tapOn:
id: "me.hackerchick.catima.debug:id/thumbnail" # Thumbnail
- tapOn:
id: "android:id/text1"
index: 0 # Select color
- tapOn:
id: "android:id/button3" # Custom
# BUG: Erase text twice to work around https://github.com/mobile-dev-inc/maestro/issues/495
- repeat:
times: 2
commands:
- tapOn:
id: "me.hackerchick.catima.debug:id/cpv_hex"
- eraseText
- inputText: ${output.cardColor}
- tapOn:
id: "android:id/button1" # Select
- tapOn:
id: "me.hackerchick.catima.debug:id/storeNameEdit" # Name
- inputText: ${output.cardName}
- tapOn:
id: "me.hackerchick.catima.debug:id/fabSave" # Save
- evalScript: ${output.counter = output.counter + 1}
- takeScreenshot: "screenshot-01"
34 changes: 34 additions & 0 deletions maestro/js/01-getCardInfo.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
const cards = [{
name: "Bookshop",
color: "673ab7"
}, {
name: "Cafeteria",
color: "795548"
}, {
name: "Clothing Store",
color: "ff4fa5"
}, {
name: "Department Store",
color: "000000"
}, {
name: "Grocery Store",
color: "4caf50"
}, {
name: "Pharmacy",
color: "00286e"
}, {
name: "Restaurant",
color: "59a2be"
}, {
name: "Shoe Store",
color: "9c27b0"
}]

// For some reason Maestro passes this as a string with the value "0.0"
var index = Math.round(INDEX)

console.log("Returning card " + (index + 1) + " of " + cards.length + " with name " + cards[index]['name'] + " and color " + cards[index]['color'])

output.cardCount = cards.length
output.cardName = cards[index]['name']
output.cardColor = cards[index]['color']