mirror of
https://github.com/HASwitchPlate/openHASP.git
synced 2025-07-25 20:26:41 +00:00
Update tests
This commit is contained in:
parent
67542199a8
commit
6879cf12f5
@ -8,4 +8,4 @@ variables:
|
|||||||
username: hasp
|
username: hasp
|
||||||
password: hasp
|
password: hasp
|
||||||
port: 1883
|
port: 1883
|
||||||
plate: DESKTOP-1T7EDMU
|
plate: ubuntu-desktop-20-04
|
||||||
|
293
test/test_checkbox.tavern.yaml
Normal file
293
test/test_checkbox.tavern.yaml
Normal file
@ -0,0 +1,293 @@
|
|||||||
|
# test_page.tavern.yaml
|
||||||
|
---
|
||||||
|
test_name: Obj Standard Properties
|
||||||
|
|
||||||
|
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: obj
|
||||||
|
vals:
|
||||||
|
- checkbox
|
||||||
|
- parametrize:
|
||||||
|
key:
|
||||||
|
- hidden
|
||||||
|
- hidden_inv
|
||||||
|
- x
|
||||||
|
- y
|
||||||
|
- w
|
||||||
|
- h
|
||||||
|
- radius
|
||||||
|
- opacity
|
||||||
|
- str1
|
||||||
|
- str2
|
||||||
|
vals:
|
||||||
|
- [1, 0, 120, 121, 122, 123, 0, 255, "I'm sorry.", "louie"]
|
||||||
|
- [1, 0, -10, -10, 256, 257, 1, 64, "louie", " The cat stretched."]
|
||||||
|
- [
|
||||||
|
0,
|
||||||
|
1,
|
||||||
|
1024,
|
||||||
|
1025,
|
||||||
|
1026,
|
||||||
|
1027,
|
||||||
|
5,
|
||||||
|
0,
|
||||||
|
"The pipe began to rust while new.",
|
||||||
|
"",
|
||||||
|
]
|
||||||
|
- [
|
||||||
|
0,
|
||||||
|
1,
|
||||||
|
80,
|
||||||
|
81,
|
||||||
|
82,
|
||||||
|
83,
|
||||||
|
32535,
|
||||||
|
192,
|
||||||
|
"",
|
||||||
|
" Oak is strong and also gives shade.",
|
||||||
|
]
|
||||||
|
|
||||||
|
stages:
|
||||||
|
- name: Page 1
|
||||||
|
mqtt_publish:
|
||||||
|
topic: hasp/{plate}/command
|
||||||
|
payload: "page 1"
|
||||||
|
mqtt_response:
|
||||||
|
topic: hasp/{plate}/state/page
|
||||||
|
payload: "1"
|
||||||
|
timeout: 1
|
||||||
|
delay_after: 0
|
||||||
|
|
||||||
|
- name: Clear page
|
||||||
|
mqtt_publish:
|
||||||
|
topic: hasp/{plate}/command/clearpage
|
||||||
|
payload: ""
|
||||||
|
delay_after: 0.2
|
||||||
|
|
||||||
|
- name: Create object
|
||||||
|
mqtt_publish:
|
||||||
|
topic: hasp/{plate}/command/jsonl
|
||||||
|
json:
|
||||||
|
obj: "{obj}"
|
||||||
|
id: 1
|
||||||
|
x: 128
|
||||||
|
y: 128
|
||||||
|
delay_after: 0
|
||||||
|
|
||||||
|
- name: Test x
|
||||||
|
mqtt_publish:
|
||||||
|
topic: hasp/{plate}/command/json
|
||||||
|
payload: '["p1b1.x={x}","p1b1.x"]'
|
||||||
|
mqtt_response:
|
||||||
|
topic: hasp/{plate}/state/p1b1
|
||||||
|
json:
|
||||||
|
x: !int "{x:d}"
|
||||||
|
timeout: 1
|
||||||
|
|
||||||
|
- name: Test y
|
||||||
|
mqtt_publish:
|
||||||
|
topic: hasp/{plate}/command/json
|
||||||
|
payload: '["p1b1.y={y}","p1b1.y"]'
|
||||||
|
mqtt_response:
|
||||||
|
topic: hasp/{plate}/state/p1b1
|
||||||
|
json:
|
||||||
|
y: !int "{y:d}"
|
||||||
|
timeout: 1
|
||||||
|
|
||||||
|
# - name: Test w
|
||||||
|
# mqtt_publish:
|
||||||
|
# topic: hasp/{plate}/command/json
|
||||||
|
# payload: '["p1b1.w={w}","p1b1.w"]'
|
||||||
|
# mqtt_response:
|
||||||
|
# topic: hasp/{plate}/state/p1b1
|
||||||
|
# json:
|
||||||
|
# w: !int "{w:d}"
|
||||||
|
# timeout: 1
|
||||||
|
|
||||||
|
# - name: Test h
|
||||||
|
# mqtt_publish:
|
||||||
|
# topic: hasp/{plate}/command/json
|
||||||
|
# payload: '["p1b1.h={h}","p1b1.h"]'
|
||||||
|
# delay_after: 0
|
||||||
|
# mqtt_response:
|
||||||
|
# topic: hasp/{plate}/state/p1b1
|
||||||
|
# json:
|
||||||
|
# h: !int "{h:d}"
|
||||||
|
# timeout: 1
|
||||||
|
|
||||||
|
- name: Test enabled
|
||||||
|
mqtt_publish:
|
||||||
|
topic: hasp/{plate}/command/json
|
||||||
|
payload: '["p1b1.enabled={hidden}","p1b1.enabled"]'
|
||||||
|
delay_after: 0
|
||||||
|
mqtt_response:
|
||||||
|
topic: hasp/{plate}/state/p1b1
|
||||||
|
json:
|
||||||
|
enabled: !int "{hidden:d}"
|
||||||
|
timeout: 1
|
||||||
|
|
||||||
|
- name: Test click
|
||||||
|
mqtt_publish:
|
||||||
|
topic: hasp/{plate}/command/json
|
||||||
|
payload: '["p1b1.click={hidden}","p1b1.click"]'
|
||||||
|
delay_after: 0
|
||||||
|
mqtt_response:
|
||||||
|
topic: hasp/{plate}/state/p1b1
|
||||||
|
json:
|
||||||
|
click: !int "{hidden:d}"
|
||||||
|
timeout: 1
|
||||||
|
|
||||||
|
- name: Test swipe
|
||||||
|
mqtt_publish:
|
||||||
|
topic: hasp/{plate}/command/json
|
||||||
|
payload: '["p1b1.swipe={hidden_inv}","p1b1.swipe"]'
|
||||||
|
delay_after: 0
|
||||||
|
mqtt_response:
|
||||||
|
topic: hasp/{plate}/state/p1b1
|
||||||
|
json:
|
||||||
|
swipe: !int "{hidden_inv:d}"
|
||||||
|
timeout: 1
|
||||||
|
|
||||||
|
- name: Set vis
|
||||||
|
mqtt_publish:
|
||||||
|
topic: hasp/{plate}/command
|
||||||
|
payload: "p1b1.vis={hidden}"
|
||||||
|
delay_after: 0
|
||||||
|
- name: Get hidden
|
||||||
|
mqtt_publish:
|
||||||
|
topic: hasp/{plate}/command
|
||||||
|
payload: "p1b1.hidden"
|
||||||
|
mqtt_response:
|
||||||
|
topic: hasp/{plate}/state/p1b1
|
||||||
|
json:
|
||||||
|
hidden: !int "{hidden_inv:d}"
|
||||||
|
timeout: 1
|
||||||
|
- name: Get vis
|
||||||
|
mqtt_publish:
|
||||||
|
topic: hasp/{plate}/command
|
||||||
|
payload: "p1b1.vis"
|
||||||
|
mqtt_response:
|
||||||
|
topic: hasp/{plate}/state/p1b1
|
||||||
|
json:
|
||||||
|
vis: !int "{hidden:d}"
|
||||||
|
timeout: 1
|
||||||
|
|
||||||
|
- name: Set hidden
|
||||||
|
mqtt_publish:
|
||||||
|
topic: hasp/{plate}/command
|
||||||
|
payload: "p1b1.hidden={hidden}"
|
||||||
|
delay_after: 0
|
||||||
|
- name: Get hidden
|
||||||
|
mqtt_publish:
|
||||||
|
topic: hasp/{plate}/command
|
||||||
|
payload: "p1b1.hidden"
|
||||||
|
mqtt_response:
|
||||||
|
topic: hasp/{plate}/state/p1b1
|
||||||
|
json:
|
||||||
|
hidden: !int "{hidden:d}"
|
||||||
|
timeout: 1
|
||||||
|
|
||||||
|
- name: Get vis
|
||||||
|
mqtt_publish:
|
||||||
|
topic: hasp/{plate}/command
|
||||||
|
payload: "p1b1.vis"
|
||||||
|
mqtt_response:
|
||||||
|
topic: hasp/{plate}/state/p1b1
|
||||||
|
json:
|
||||||
|
vis: !int "{hidden_inv:d}"
|
||||||
|
timeout: 1
|
||||||
|
|
||||||
|
- name: Test opacity
|
||||||
|
mqtt_publish:
|
||||||
|
topic: hasp/{plate}/command/json
|
||||||
|
payload: '["p1b1.opacity={opacity}","p1b1.opacity"]'
|
||||||
|
mqtt_response:
|
||||||
|
topic: hasp/{plate}/state/p1b1
|
||||||
|
json:
|
||||||
|
opacity: !int "{opacity:d}"
|
||||||
|
timeout: 1
|
||||||
|
|
||||||
|
- name: Test radius
|
||||||
|
mqtt_publish:
|
||||||
|
topic: hasp/{plate}/command/json
|
||||||
|
payload: '["p1b1.radius={radius}","p1b1.radius"]'
|
||||||
|
mqtt_response:
|
||||||
|
topic: hasp/{plate}/state/p1b1
|
||||||
|
json:
|
||||||
|
radius: !int "{radius:d}"
|
||||||
|
timeout: 1
|
||||||
|
|
||||||
|
- name: Set value_str
|
||||||
|
mqtt_publish:
|
||||||
|
topic: "hasp/{plate}/command/p1b1.value_str"
|
||||||
|
payload: "{str1}{str2}"
|
||||||
|
delay_after: 0.05
|
||||||
|
- 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
|
||||||
|
|
||||||
|
- name: Get obj type
|
||||||
|
mqtt_publish:
|
||||||
|
topic: hasp/{plate}/command
|
||||||
|
payload: "p1b1.obj"
|
||||||
|
mqtt_response:
|
||||||
|
topic: hasp/{plate}/state/p1b1
|
||||||
|
json:
|
||||||
|
obj: "{obj}"
|
||||||
|
timeout: 1
|
||||||
|
|
||||||
|
- name: Test groupid
|
||||||
|
mqtt_publish:
|
||||||
|
topic: hasp/{plate}/command/json
|
||||||
|
payload: '["p1b1.groupid={hidden}","p1b1.groupid"]'
|
||||||
|
mqtt_response:
|
||||||
|
topic: hasp/{plate}/state/p1b1
|
||||||
|
json:
|
||||||
|
groupid: !int "{hidden:d}"
|
||||||
|
timeout: 1
|
||||||
|
|
||||||
|
- name: Test val
|
||||||
|
mqtt_publish:
|
||||||
|
topic: hasp/{plate}/command/json
|
||||||
|
payload: '["p1b1.val={hidden}","p1b1.val"]'
|
||||||
|
mqtt_response:
|
||||||
|
topic: hasp/{plate}/state/p1b1
|
||||||
|
json:
|
||||||
|
val: !int "{hidden:d}"
|
||||||
|
timeout: 1
|
||||||
|
|
||||||
|
- name: Set text
|
||||||
|
mqtt_publish:
|
||||||
|
topic: "hasp/{plate}/command/p1b1.text"
|
||||||
|
payload: "{str1}{str2}"
|
||||||
|
delay_after: 0.05
|
||||||
|
- name: Get text
|
||||||
|
mqtt_publish:
|
||||||
|
topic: hasp/{plate}/command
|
||||||
|
payload: "p1b1.text"
|
||||||
|
mqtt_response:
|
||||||
|
topic: hasp/{plate}/state/p1b1
|
||||||
|
json:
|
||||||
|
text: "{str1}{str2}"
|
||||||
|
timeout: 1
|
288
test/test_led.tavern.yaml
Normal file
288
test/test_led.tavern.yaml
Normal file
@ -0,0 +1,288 @@
|
|||||||
|
# test_page.tavern.yaml
|
||||||
|
---
|
||||||
|
test_name: Obj Standard Properties
|
||||||
|
|
||||||
|
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: obj
|
||||||
|
vals:
|
||||||
|
- led
|
||||||
|
- parametrize:
|
||||||
|
key:
|
||||||
|
- hidden
|
||||||
|
- hidden_inv
|
||||||
|
- x
|
||||||
|
- y
|
||||||
|
- w
|
||||||
|
- h
|
||||||
|
- radius
|
||||||
|
- opacity
|
||||||
|
- str1
|
||||||
|
- str2
|
||||||
|
vals:
|
||||||
|
- [1, 0, 120, 121, 122, 123, 0, 255, "I'm sorry.", "louie"]
|
||||||
|
- [1, 0, -10, -10, 256, 257, 1, 64, "louie", " The cat stretched."]
|
||||||
|
- [
|
||||||
|
0,
|
||||||
|
1,
|
||||||
|
1024,
|
||||||
|
1025,
|
||||||
|
1026,
|
||||||
|
1027,
|
||||||
|
5,
|
||||||
|
0,
|
||||||
|
"The pipe began to rust while new.",
|
||||||
|
"",
|
||||||
|
]
|
||||||
|
- [
|
||||||
|
0,
|
||||||
|
1,
|
||||||
|
80,
|
||||||
|
81,
|
||||||
|
82,
|
||||||
|
83,
|
||||||
|
32535,
|
||||||
|
192,
|
||||||
|
"",
|
||||||
|
" Oak is strong and also gives shade.",
|
||||||
|
]
|
||||||
|
|
||||||
|
stages:
|
||||||
|
- name: Page 1
|
||||||
|
mqtt_publish:
|
||||||
|
topic: hasp/{plate}/command
|
||||||
|
payload: "page 1"
|
||||||
|
mqtt_response:
|
||||||
|
topic: hasp/{plate}/state/page
|
||||||
|
payload: "1"
|
||||||
|
timeout: 1
|
||||||
|
delay_after: 0
|
||||||
|
|
||||||
|
- name: Clear page
|
||||||
|
mqtt_publish:
|
||||||
|
topic: hasp/{plate}/command/clearpage
|
||||||
|
payload: ""
|
||||||
|
delay_after: 0.2
|
||||||
|
|
||||||
|
- name: Create object
|
||||||
|
mqtt_publish:
|
||||||
|
topic: hasp/{plate}/command/jsonl
|
||||||
|
json:
|
||||||
|
obj: "{obj}"
|
||||||
|
id: 1
|
||||||
|
x: 128
|
||||||
|
y: 128
|
||||||
|
delay_after: 0
|
||||||
|
|
||||||
|
- name: Test x
|
||||||
|
mqtt_publish:
|
||||||
|
topic: hasp/{plate}/command/json
|
||||||
|
payload: '["p1b1.x={x}","p1b1.x"]'
|
||||||
|
mqtt_response:
|
||||||
|
topic: hasp/{plate}/state/p1b1
|
||||||
|
json:
|
||||||
|
x: !int "{x:d}"
|
||||||
|
timeout: 1
|
||||||
|
|
||||||
|
- name: Test y
|
||||||
|
mqtt_publish:
|
||||||
|
topic: hasp/{plate}/command/json
|
||||||
|
payload: '["p1b1.y={y}","p1b1.y"]'
|
||||||
|
mqtt_response:
|
||||||
|
topic: hasp/{plate}/state/p1b1
|
||||||
|
json:
|
||||||
|
y: !int "{y:d}"
|
||||||
|
timeout: 1
|
||||||
|
|
||||||
|
- name: Test w
|
||||||
|
mqtt_publish:
|
||||||
|
topic: hasp/{plate}/command/json
|
||||||
|
payload: '["p1b1.w={w}","p1b1.w"]'
|
||||||
|
mqtt_response:
|
||||||
|
topic: hasp/{plate}/state/p1b1
|
||||||
|
json:
|
||||||
|
w: !int "{w:d}"
|
||||||
|
timeout: 1
|
||||||
|
|
||||||
|
- name: Test h
|
||||||
|
mqtt_publish:
|
||||||
|
topic: hasp/{plate}/command/json
|
||||||
|
payload: '["p1b1.h={h}","p1b1.h"]'
|
||||||
|
delay_after: 0
|
||||||
|
mqtt_response:
|
||||||
|
topic: hasp/{plate}/state/p1b1
|
||||||
|
json:
|
||||||
|
h: !int "{h:d}"
|
||||||
|
timeout: 1
|
||||||
|
|
||||||
|
- name: Test enabled
|
||||||
|
mqtt_publish:
|
||||||
|
topic: hasp/{plate}/command/json
|
||||||
|
payload: '["p1b1.enabled={hidden}","p1b1.enabled"]'
|
||||||
|
delay_after: 0
|
||||||
|
mqtt_response:
|
||||||
|
topic: hasp/{plate}/state/p1b1
|
||||||
|
json:
|
||||||
|
enabled: !int "{hidden:d}"
|
||||||
|
timeout: 1
|
||||||
|
|
||||||
|
- name: Test click
|
||||||
|
mqtt_publish:
|
||||||
|
topic: hasp/{plate}/command/json
|
||||||
|
payload: '["p1b1.click={hidden}","p1b1.click"]'
|
||||||
|
delay_after: 0
|
||||||
|
mqtt_response:
|
||||||
|
topic: hasp/{plate}/state/p1b1
|
||||||
|
json:
|
||||||
|
click: !int "{hidden:d}"
|
||||||
|
timeout: 1
|
||||||
|
|
||||||
|
- name: Test swipe
|
||||||
|
mqtt_publish:
|
||||||
|
topic: hasp/{plate}/command/json
|
||||||
|
payload: '["p1b1.swipe={hidden_inv}","p1b1.swipe"]'
|
||||||
|
delay_after: 0
|
||||||
|
mqtt_response:
|
||||||
|
topic: hasp/{plate}/state/p1b1
|
||||||
|
json:
|
||||||
|
swipe: !int "{hidden_inv:d}"
|
||||||
|
timeout: 1
|
||||||
|
|
||||||
|
- name: Set vis
|
||||||
|
mqtt_publish:
|
||||||
|
topic: hasp/{plate}/command
|
||||||
|
payload: "p1b1.vis={hidden}"
|
||||||
|
delay_after: 0
|
||||||
|
- name: Get hidden
|
||||||
|
mqtt_publish:
|
||||||
|
topic: hasp/{plate}/command
|
||||||
|
payload: "p1b1.hidden"
|
||||||
|
mqtt_response:
|
||||||
|
topic: hasp/{plate}/state/p1b1
|
||||||
|
json:
|
||||||
|
hidden: !int "{hidden_inv:d}"
|
||||||
|
timeout: 1
|
||||||
|
- name: Get vis
|
||||||
|
mqtt_publish:
|
||||||
|
topic: hasp/{plate}/command
|
||||||
|
payload: "p1b1.vis"
|
||||||
|
mqtt_response:
|
||||||
|
topic: hasp/{plate}/state/p1b1
|
||||||
|
json:
|
||||||
|
vis: !int "{hidden:d}"
|
||||||
|
timeout: 1
|
||||||
|
|
||||||
|
- name: Set hidden
|
||||||
|
mqtt_publish:
|
||||||
|
topic: hasp/{plate}/command
|
||||||
|
payload: "p1b1.hidden={hidden}"
|
||||||
|
delay_after: 0
|
||||||
|
- name: Get hidden
|
||||||
|
mqtt_publish:
|
||||||
|
topic: hasp/{plate}/command
|
||||||
|
payload: "p1b1.hidden"
|
||||||
|
mqtt_response:
|
||||||
|
topic: hasp/{plate}/state/p1b1
|
||||||
|
json:
|
||||||
|
hidden: !int "{hidden:d}"
|
||||||
|
timeout: 1
|
||||||
|
|
||||||
|
- name: Get vis
|
||||||
|
mqtt_publish:
|
||||||
|
topic: hasp/{plate}/command
|
||||||
|
payload: "p1b1.vis"
|
||||||
|
mqtt_response:
|
||||||
|
topic: hasp/{plate}/state/p1b1
|
||||||
|
json:
|
||||||
|
vis: !int "{hidden_inv:d}"
|
||||||
|
timeout: 1
|
||||||
|
|
||||||
|
- name: Test opacity
|
||||||
|
mqtt_publish:
|
||||||
|
topic: hasp/{plate}/command/json
|
||||||
|
payload: '["p1b1.opacity={opacity}","p1b1.opacity"]'
|
||||||
|
mqtt_response:
|
||||||
|
topic: hasp/{plate}/state/p1b1
|
||||||
|
json:
|
||||||
|
opacity: !int "{opacity:d}"
|
||||||
|
timeout: 1
|
||||||
|
|
||||||
|
- name: Test radius
|
||||||
|
mqtt_publish:
|
||||||
|
topic: hasp/{plate}/command/json
|
||||||
|
payload: '["p1b1.radius={radius}","p1b1.radius"]'
|
||||||
|
mqtt_response:
|
||||||
|
topic: hasp/{plate}/state/p1b1
|
||||||
|
json:
|
||||||
|
radius: !int "{radius:d}"
|
||||||
|
timeout: 1
|
||||||
|
|
||||||
|
- name: Test radius2
|
||||||
|
mqtt_publish:
|
||||||
|
topic: hasp/{plate}/command/json
|
||||||
|
payload: '["p1b1.radius2={radius}","p1b1.radius2"]'
|
||||||
|
mqtt_response:
|
||||||
|
topic: hasp/{plate}/state/p1b1
|
||||||
|
json:
|
||||||
|
radius2: !int "{radius:d}"
|
||||||
|
timeout: 1
|
||||||
|
|
||||||
|
- name: Set value_str
|
||||||
|
mqtt_publish:
|
||||||
|
topic: "hasp/{plate}/command/p1b1.value_str"
|
||||||
|
payload: "{str1}{str2}"
|
||||||
|
delay_after: 0.05
|
||||||
|
- 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
|
||||||
|
|
||||||
|
- name: Get obj type
|
||||||
|
mqtt_publish:
|
||||||
|
topic: hasp/{plate}/command
|
||||||
|
payload: "p1b1.obj"
|
||||||
|
mqtt_response:
|
||||||
|
topic: hasp/{plate}/state/p1b1
|
||||||
|
json:
|
||||||
|
obj: "{obj}"
|
||||||
|
timeout: 1
|
||||||
|
|
||||||
|
- name: Test groupid
|
||||||
|
mqtt_publish:
|
||||||
|
topic: hasp/{plate}/command/json
|
||||||
|
payload: '["p1b1.groupid={hidden}","p1b1.groupid"]'
|
||||||
|
mqtt_response:
|
||||||
|
topic: hasp/{plate}/state/p1b1
|
||||||
|
json:
|
||||||
|
groupid: !int "{hidden:d}"
|
||||||
|
timeout: 1
|
||||||
|
|
||||||
|
- name: Test val
|
||||||
|
mqtt_publish:
|
||||||
|
topic: hasp/{plate}/command/json
|
||||||
|
payload: '["p1b1.val={opacity}","p1b1.val"]'
|
||||||
|
mqtt_response:
|
||||||
|
topic: hasp/{plate}/state/p1b1
|
||||||
|
json:
|
||||||
|
val: !int "{opacity:d}"
|
||||||
|
timeout: 1
|
@ -30,8 +30,8 @@ marks:
|
|||||||
- btn
|
- btn
|
||||||
- label
|
- label
|
||||||
- slider
|
- slider
|
||||||
- checkbox
|
#- checkbox
|
||||||
- switch
|
#- switch
|
||||||
- bar
|
- bar
|
||||||
- arc
|
- arc
|
||||||
# - led # has a shadow bug
|
# - led # has a shadow bug
|
||||||
|
288
test/test_switch.tavern.yaml
Normal file
288
test/test_switch.tavern.yaml
Normal file
@ -0,0 +1,288 @@
|
|||||||
|
# test_page.tavern.yaml
|
||||||
|
---
|
||||||
|
test_name: Obj Standard Properties
|
||||||
|
|
||||||
|
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: obj
|
||||||
|
vals:
|
||||||
|
- switch
|
||||||
|
- parametrize:
|
||||||
|
key:
|
||||||
|
- hidden
|
||||||
|
- hidden_inv
|
||||||
|
- x
|
||||||
|
- y
|
||||||
|
- w
|
||||||
|
- h
|
||||||
|
- radius
|
||||||
|
- opacity
|
||||||
|
- str1
|
||||||
|
- str2
|
||||||
|
vals:
|
||||||
|
- [1, 0, 120, 121, 122, 123, 0, 255, "I'm sorry.", "louie"]
|
||||||
|
- [1, 0, -10, -10, 256, 257, 1, 64, "louie", " The cat stretched."]
|
||||||
|
- [
|
||||||
|
0,
|
||||||
|
1,
|
||||||
|
1024,
|
||||||
|
1025,
|
||||||
|
1026,
|
||||||
|
1027,
|
||||||
|
5,
|
||||||
|
0,
|
||||||
|
"The pipe began to rust while new.",
|
||||||
|
"",
|
||||||
|
]
|
||||||
|
- [
|
||||||
|
0,
|
||||||
|
1,
|
||||||
|
80,
|
||||||
|
81,
|
||||||
|
82,
|
||||||
|
83,
|
||||||
|
32535,
|
||||||
|
192,
|
||||||
|
"",
|
||||||
|
" Oak is strong and also gives shade.",
|
||||||
|
]
|
||||||
|
|
||||||
|
stages:
|
||||||
|
- name: Page 1
|
||||||
|
mqtt_publish:
|
||||||
|
topic: hasp/{plate}/command
|
||||||
|
payload: "page 1"
|
||||||
|
mqtt_response:
|
||||||
|
topic: hasp/{plate}/state/page
|
||||||
|
payload: "1"
|
||||||
|
timeout: 1
|
||||||
|
delay_after: 0
|
||||||
|
|
||||||
|
- name: Clear page
|
||||||
|
mqtt_publish:
|
||||||
|
topic: hasp/{plate}/command/clearpage
|
||||||
|
payload: ""
|
||||||
|
delay_after: 0.2
|
||||||
|
|
||||||
|
- name: Create object
|
||||||
|
mqtt_publish:
|
||||||
|
topic: hasp/{plate}/command/jsonl
|
||||||
|
json:
|
||||||
|
obj: "{obj}"
|
||||||
|
id: 1
|
||||||
|
x: 128
|
||||||
|
y: 128
|
||||||
|
delay_after: 0
|
||||||
|
|
||||||
|
- name: Test x
|
||||||
|
mqtt_publish:
|
||||||
|
topic: hasp/{plate}/command/json
|
||||||
|
payload: '["p1b1.x={x}","p1b1.x"]'
|
||||||
|
mqtt_response:
|
||||||
|
topic: hasp/{plate}/state/p1b1
|
||||||
|
json:
|
||||||
|
x: !int "{x:d}"
|
||||||
|
timeout: 1
|
||||||
|
|
||||||
|
- name: Test y
|
||||||
|
mqtt_publish:
|
||||||
|
topic: hasp/{plate}/command/json
|
||||||
|
payload: '["p1b1.y={y}","p1b1.y"]'
|
||||||
|
mqtt_response:
|
||||||
|
topic: hasp/{plate}/state/p1b1
|
||||||
|
json:
|
||||||
|
y: !int "{y:d}"
|
||||||
|
timeout: 1
|
||||||
|
|
||||||
|
- name: Test w
|
||||||
|
mqtt_publish:
|
||||||
|
topic: hasp/{plate}/command/json
|
||||||
|
payload: '["p1b1.w={w}","p1b1.w"]'
|
||||||
|
mqtt_response:
|
||||||
|
topic: hasp/{plate}/state/p1b1
|
||||||
|
json:
|
||||||
|
w: !int "{w:d}"
|
||||||
|
timeout: 1
|
||||||
|
|
||||||
|
- name: Test h
|
||||||
|
mqtt_publish:
|
||||||
|
topic: hasp/{plate}/command/json
|
||||||
|
payload: '["p1b1.h={h}","p1b1.h"]'
|
||||||
|
delay_after: 0
|
||||||
|
mqtt_response:
|
||||||
|
topic: hasp/{plate}/state/p1b1
|
||||||
|
json:
|
||||||
|
h: !int "{h:d}"
|
||||||
|
timeout: 1
|
||||||
|
|
||||||
|
- name: Test enabled
|
||||||
|
mqtt_publish:
|
||||||
|
topic: hasp/{plate}/command/json
|
||||||
|
payload: '["p1b1.enabled={hidden}","p1b1.enabled"]'
|
||||||
|
delay_after: 0
|
||||||
|
mqtt_response:
|
||||||
|
topic: hasp/{plate}/state/p1b1
|
||||||
|
json:
|
||||||
|
enabled: !int "{hidden:d}"
|
||||||
|
timeout: 1
|
||||||
|
|
||||||
|
- name: Test click
|
||||||
|
mqtt_publish:
|
||||||
|
topic: hasp/{plate}/command/json
|
||||||
|
payload: '["p1b1.click={hidden}","p1b1.click"]'
|
||||||
|
delay_after: 0
|
||||||
|
mqtt_response:
|
||||||
|
topic: hasp/{plate}/state/p1b1
|
||||||
|
json:
|
||||||
|
click: !int "{hidden:d}"
|
||||||
|
timeout: 1
|
||||||
|
|
||||||
|
- name: Test swipe
|
||||||
|
mqtt_publish:
|
||||||
|
topic: hasp/{plate}/command/json
|
||||||
|
payload: '["p1b1.swipe={hidden_inv}","p1b1.swipe"]'
|
||||||
|
delay_after: 0
|
||||||
|
mqtt_response:
|
||||||
|
topic: hasp/{plate}/state/p1b1
|
||||||
|
json:
|
||||||
|
swipe: !int "{hidden_inv:d}"
|
||||||
|
timeout: 1
|
||||||
|
|
||||||
|
- name: Set vis
|
||||||
|
mqtt_publish:
|
||||||
|
topic: hasp/{plate}/command
|
||||||
|
payload: "p1b1.vis={hidden}"
|
||||||
|
delay_after: 0
|
||||||
|
- name: Get hidden
|
||||||
|
mqtt_publish:
|
||||||
|
topic: hasp/{plate}/command
|
||||||
|
payload: "p1b1.hidden"
|
||||||
|
mqtt_response:
|
||||||
|
topic: hasp/{plate}/state/p1b1
|
||||||
|
json:
|
||||||
|
hidden: !int "{hidden_inv:d}"
|
||||||
|
timeout: 1
|
||||||
|
- name: Get vis
|
||||||
|
mqtt_publish:
|
||||||
|
topic: hasp/{plate}/command
|
||||||
|
payload: "p1b1.vis"
|
||||||
|
mqtt_response:
|
||||||
|
topic: hasp/{plate}/state/p1b1
|
||||||
|
json:
|
||||||
|
vis: !int "{hidden:d}"
|
||||||
|
timeout: 1
|
||||||
|
|
||||||
|
- name: Set hidden
|
||||||
|
mqtt_publish:
|
||||||
|
topic: hasp/{plate}/command
|
||||||
|
payload: "p1b1.hidden={hidden}"
|
||||||
|
delay_after: 0
|
||||||
|
- name: Get hidden
|
||||||
|
mqtt_publish:
|
||||||
|
topic: hasp/{plate}/command
|
||||||
|
payload: "p1b1.hidden"
|
||||||
|
mqtt_response:
|
||||||
|
topic: hasp/{plate}/state/p1b1
|
||||||
|
json:
|
||||||
|
hidden: !int "{hidden:d}"
|
||||||
|
timeout: 1
|
||||||
|
|
||||||
|
- name: Get vis
|
||||||
|
mqtt_publish:
|
||||||
|
topic: hasp/{plate}/command
|
||||||
|
payload: "p1b1.vis"
|
||||||
|
mqtt_response:
|
||||||
|
topic: hasp/{plate}/state/p1b1
|
||||||
|
json:
|
||||||
|
vis: !int "{hidden_inv:d}"
|
||||||
|
timeout: 1
|
||||||
|
|
||||||
|
- name: Test opacity
|
||||||
|
mqtt_publish:
|
||||||
|
topic: hasp/{plate}/command/json
|
||||||
|
payload: '["p1b1.opacity={opacity}","p1b1.opacity"]'
|
||||||
|
mqtt_response:
|
||||||
|
topic: hasp/{plate}/state/p1b1
|
||||||
|
json:
|
||||||
|
opacity: !int "{opacity:d}"
|
||||||
|
timeout: 1
|
||||||
|
|
||||||
|
- name: Test radius
|
||||||
|
mqtt_publish:
|
||||||
|
topic: hasp/{plate}/command/json
|
||||||
|
payload: '["p1b1.radius={radius}","p1b1.radius"]'
|
||||||
|
mqtt_response:
|
||||||
|
topic: hasp/{plate}/state/p1b1
|
||||||
|
json:
|
||||||
|
radius: !int "{radius:d}"
|
||||||
|
timeout: 1
|
||||||
|
|
||||||
|
- name: Test radius2
|
||||||
|
mqtt_publish:
|
||||||
|
topic: hasp/{plate}/command/json
|
||||||
|
payload: '["p1b1.radius2={radius}","p1b1.radius2"]'
|
||||||
|
mqtt_response:
|
||||||
|
topic: hasp/{plate}/state/p1b1
|
||||||
|
json:
|
||||||
|
radius2: !int "{radius:d}"
|
||||||
|
timeout: 1
|
||||||
|
|
||||||
|
- name: Set value_str
|
||||||
|
mqtt_publish:
|
||||||
|
topic: "hasp/{plate}/command/p1b1.value_str"
|
||||||
|
payload: "{str1}{str2}"
|
||||||
|
delay_after: 0.05
|
||||||
|
- 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
|
||||||
|
|
||||||
|
- name: Get obj type
|
||||||
|
mqtt_publish:
|
||||||
|
topic: hasp/{plate}/command
|
||||||
|
payload: "p1b1.obj"
|
||||||
|
mqtt_response:
|
||||||
|
topic: hasp/{plate}/state/p1b1
|
||||||
|
json:
|
||||||
|
obj: "{obj}"
|
||||||
|
timeout: 1
|
||||||
|
|
||||||
|
- name: Test groupid
|
||||||
|
mqtt_publish:
|
||||||
|
topic: hasp/{plate}/command/json
|
||||||
|
payload: '["p1b1.groupid={hidden}","p1b1.groupid"]'
|
||||||
|
mqtt_response:
|
||||||
|
topic: hasp/{plate}/state/p1b1
|
||||||
|
json:
|
||||||
|
groupid: !int "{hidden:d}"
|
||||||
|
timeout: 1
|
||||||
|
|
||||||
|
- name: Test val
|
||||||
|
mqtt_publish:
|
||||||
|
topic: hasp/{plate}/command/json
|
||||||
|
payload: '["p1b1.val={hidden}","p1b1.val"]'
|
||||||
|
mqtt_response:
|
||||||
|
topic: hasp/{plate}/state/p1b1
|
||||||
|
json:
|
||||||
|
val: !int "{hidden:d}"
|
||||||
|
timeout: 1
|
Loading…
x
Reference in New Issue
Block a user