openHASP/test/test_cpicker.tavern.yaml
2021-04-22 05:18:58 +02:00

228 lines
5.9 KiB
YAML

# test_page.tavern.yaml
---
test_name: Cpicker setup
includes:
- !include config.yaml
paho-mqtt:
client:
transport: tcp
client_id: tavern-tester
connect:
host: "{host}"
port: !int "{port:d}"
timeout: 3
auth:
username: "{username}"
password: "{password}"
stages:
- name: Page 1
mqtt_publish:
topic: hasp/{plate}/command
payload: "page 1"
mqtt_response:
topic: hasp/{plate}/state/page
payload: "1"
timeout: 1
- name: Clear page
mqtt_publish:
topic: hasp/{plate}/command/clearpage
payload: ""
---
test_name: Cpicker loop
includes:
- !include config.yaml
paho-mqtt:
client:
transport: tcp
client_id: tavern-tester
connect:
host: "{host}"
port: !int "{port:d}"
timeout: 3
auth:
username: "{username}"
password: "{password}"
marks:
- parametrize:
key:
- color
- hex
- r
- g
- b
- rgb565
vals:
- ["red", "#ff0000", 255, 0, 0, 63488]
- ["tan", "#d2b48c", 213, 182, 139, 54705]
- ["aqua", "#00ffff", 0, 255, 255, 2047]
- ["blue", "#0000ff", 0, 0, 255, 31]
- ["cyan", "#00ffff", 0, 255, 255, 2047]
- ["gold", "#ffd600", 255, 214, 0, 65184]
- ["gray", "#838183", 131, 129, 131, 33808]
- ["grey", "#838183", 131, 129, 131, 33808]
- ["lime", "#00ff00", 0, 255, 0, 2016]
- ["navy", "#000083", 0, 0, 131, 16]
- ["peru", "#cd8139", 205, 129, 57, 52263]
- ["pink", "#ffc2cd", 255, 194, 205, 65049]
- ["plum", "#dea1de", 222, 161, 222, 56603]
- ["snow", "#fffaff", 255, 250, 255, 65503]
- ["teal", "#008183", 0, 129, 131, 1040]
- ["azure", "#f6ffff", 246, 255, 255, 63487]
- ["beige", "#f6f6de", 246, 246, 222, 63419]
- ["black", "#000000", 0, 0, 0, 0]
- ["blush", "#b50000", 181, 0, 0, 45056]
- ["brown", "#a42829", 164, 40, 41, 41285]
- ["coral", "#ff7d52", 255, 125, 82, 64490]
- ["green", "#008100", 0, 129, 0, 1024]
- ["ivory", "#fffff6", 255, 255, 246, 65534]
- ["khaki", "#f6e28b", 246, 226, 139, 63281]
- ["linen", "#fff2ee", 255, 242, 238, 65436]
- ["olive", "#837d00", 131, 125, 0, 33792]
- ["wheat", "#f6dab5", 246, 218, 181, 63222]
- ["white", "#ffffff", 255, 255, 255, 65535]
- ["bisque", "#ffe6c5", 255, 230, 197, 65336]
- ["indigo", "#4a0083", 74, 0, 131, 18448]
- ["maroon", "#830000", 131, 0, 0, 32768]
- ["orange", "#ffa500", 255, 165, 0, 64800]
- ["orchid", "#de71d5", 222, 113, 213, 56218]
- ["purple", "#7b0083", 123, 0, 131, 32784]
- ["salmon", "#ff8173", 255, 129, 115, 64526]
- ["sienna", "#a44c29", 164, 76, 41, 41605]
- ["tomato", "#ff6141", 255, 97, 65, 64264]
- ["violet", "#ee81ee", 230, 129, 238, 60445]
- ["yellow", "#ffff00", 255, 255, 0, 65504]
- ["fuchsia", "#f600ff", 246, 0, 255, 63519]
- ["magenta", "#f600ff", 246, 0, 255, 63519]
- ["silver", "#c5c2c5", 197, 194, 197, 50712]
stages:
- name: Set bg_color
mqtt_publish:
topic: hasp/{plate}/command
payload: "p[1].b[0].bg_color={color}"
- name: Create cpicker
mqtt_publish:
topic: hasp/{plate}/command/jsonl
json:
obj: "cpicker"
id: 1
color: "{color}"
- name: Test named COLOR
mqtt_publish:
topic: hasp/{plate}/command
payload: "p1b1.color"
mqtt_response:
topic: hasp/{plate}/state/p1b1
json:
color: "{hex}"
r: !int "{r:d}"
g: !int "{g:d}"
b: !int "{b:d}"
timeout: 1
- name: Test hex COLOR
mqtt_publish:
topic: hasp/{plate}/command/json
payload: '["p1b1.color={hex}","p1b1.color"]'
mqtt_response:
topic: hasp/{plate}/state/p1b1
json:
color: "{hex}"
r: !int "{r:d}"
g: !int "{g:d}"
b: !int "{b:d}"
timeout: 1
- name: Reset
mqtt_publish:
topic: hasp/{plate}/command
payload: "p1b1.color=529"
- name: Test rgb565 COLOR
mqtt_publish:
topic: hasp/{plate}/command/json
payload: '["p1b1.color={rgb565}","p1b1.color"]'
mqtt_response:
topic: hasp/{plate}/state/p1b1
json:
color: "{hex}"
r: !int "{r:d}"
g: !int "{g:d}"
b: !int "{b:d}"
timeout: 1
---
test_name: Value String Loop
includes:
- !include config.yaml
paho-mqtt:
client:
transport: tcp
client_id: tavern-tester
connect:
host: "{host}"
port: !int "{port:d}"
timeout: 3
auth:
username: "{username}"
password: "{password}"
marks:
- parametrize:
key: str1
vals:
- "Test 123456 longer strings work too"
- "The cat stretched."
- "Jacob stood on his tiptoes."
- "The car turned the corner."
- "Kelly twirled in circles."
- "She opened the door."
- "Aaron made a picture."
- "I'm sorry."
- huey
- dewey
- ""
- parametrize:
key: str2
vals:
- louie
- " I danced."
- " Oak is strong and also gives shade."
- " Cats and dogs each hate the other."
- " The pipe began to rust while new."
- " Open the crate but don't break the glass."
- " Add the sum to the product of these three."
- " Thieves who rob friends deserve jail."
- " The ripe taste of cheese improves with age."
- " Act on these orders with great speed."
- " The hog crawled under the high fence."
- " Move the vat over the hot fire."
- ""
stages:
- name: Set value_str
mqtt_publish:
topic: "hasp/{plate}/command/p1b1.value_str"
payload: "{str1}{str2}"
- name: Get value_str
mqtt_publish:
topic: hasp/{plate}/command
payload: "p1b1.value_str"
mqtt_response:
topic: hasp/{plate}/state/p1b1
json:
value_str: "{str1}{str2}"
timeout: 1