mirror of
https://github.com/CatimaLoyalty/Android.git
synced 2026-01-02 03:57:57 -05:00
Compare commits
1 Commits
create-pul
...
feature/ma
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
0ddb88b45c |
54
maestro/01.yaml
Normal file
54
maestro/01.yaml
Normal file
@@ -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
maestro/js/01-getCardInfo.js
Normal file
34
maestro/js/01-getCardInfo.js
Normal file
@@ -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']
|
||||||
Reference in New Issue
Block a user