mirror of
https://github.com/HASwitchPlate/openHASP.git
synced 2025-07-29 06:06:40 +00:00
Update tavern tests
This commit is contained in:
parent
55961c5b4f
commit
46505290bf
@ -2,6 +2,34 @@
|
|||||||
---
|
---
|
||||||
test_name: Obj Standard Properties
|
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}"
|
||||||
|
|
||||||
|
stages:
|
||||||
|
- name: Page 1
|
||||||
|
mqtt_publish:
|
||||||
|
topic: hasp/{plate}/command
|
||||||
|
payload: "page 1"
|
||||||
|
mqtt_response:
|
||||||
|
topic: hasp/{plate}/state/page
|
||||||
|
payload: "1"
|
||||||
|
timeout: 1
|
||||||
|
|
||||||
|
---
|
||||||
|
test_name: Obj Standard Properties
|
||||||
|
|
||||||
includes:
|
includes:
|
||||||
- !include config.yaml
|
- !include config.yaml
|
||||||
|
|
||||||
@ -77,27 +105,15 @@ marks:
|
|||||||
- btn
|
- btn
|
||||||
|
|
||||||
stages:
|
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: Set bg_color
|
- name: Set bg_color
|
||||||
mqtt_publish:
|
mqtt_publish:
|
||||||
topic: hasp/{plate}/command
|
topic: hasp/{plate}/command
|
||||||
payload: "p[1].b[0].bg_color={color}"
|
payload: "p[1].b[0].bg_color={color}"
|
||||||
delay_after: 0.02
|
|
||||||
|
|
||||||
- name: Clear page
|
- name: Clear page
|
||||||
mqtt_publish:
|
mqtt_publish:
|
||||||
topic: hasp/{plate}/command/clearpage
|
topic: hasp/{plate}/command/clearpage
|
||||||
payload: ""
|
payload: ""
|
||||||
delay_after: 0.02
|
|
||||||
|
|
||||||
- name: Create object
|
- name: Create object
|
||||||
mqtt_publish:
|
mqtt_publish:
|
||||||
@ -105,17 +121,12 @@ stages:
|
|||||||
json:
|
json:
|
||||||
obj: "{obj}"
|
obj: "{obj}"
|
||||||
id: 1
|
id: 1
|
||||||
txt: "{color}"
|
text: "{color}"
|
||||||
r: !int "{r:d}"
|
|
||||||
g: !int "{g:d}"
|
|
||||||
b: !int "{b:d}"
|
|
||||||
delay_after: 0.02
|
|
||||||
|
|
||||||
- name: Set bg_color
|
- name: Set bg_color
|
||||||
mqtt_publish:
|
mqtt_publish:
|
||||||
topic: hasp/{plate}/command
|
topic: hasp/{plate}/command
|
||||||
payload: "p[1].b[0].bg_color={rgb565}"
|
payload: "p[1].b[0].bg_color={rgb565}"
|
||||||
delay_after: 0.02
|
|
||||||
|
|
||||||
- name: Test named COLOR
|
- name: Test named COLOR
|
||||||
mqtt_publish:
|
mqtt_publish:
|
||||||
@ -134,7 +145,6 @@ stages:
|
|||||||
mqtt_publish:
|
mqtt_publish:
|
||||||
topic: hasp/{plate}/command
|
topic: hasp/{plate}/command
|
||||||
payload: "p[1].b[1].text_color=123"
|
payload: "p[1].b[1].text_color=123"
|
||||||
delay_after: 0.02
|
|
||||||
|
|
||||||
- name: Test hex COLOR
|
- name: Test hex COLOR
|
||||||
mqtt_publish:
|
mqtt_publish:
|
||||||
@ -153,7 +163,6 @@ stages:
|
|||||||
mqtt_publish:
|
mqtt_publish:
|
||||||
topic: hasp/{plate}/command
|
topic: hasp/{plate}/command
|
||||||
payload: "p[1].b[1].text_color=529"
|
payload: "p[1].b[1].text_color=529"
|
||||||
delay_after: 0.02
|
|
||||||
|
|
||||||
- name: Test rgb565 COLOR
|
- name: Test rgb565 COLOR
|
||||||
mqtt_publish:
|
mqtt_publish:
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
# test_page.tavern.yaml
|
# test_page.tavern.yaml
|
||||||
---
|
---
|
||||||
test_name: Page command
|
test_name: Obj Standard Properties
|
||||||
|
|
||||||
includes:
|
includes:
|
||||||
- !include config.yaml
|
- !include config.yaml
|
||||||
@ -77,7 +77,10 @@ paho-mqtt:
|
|||||||
connect:
|
connect:
|
||||||
host: "{host}"
|
host: "{host}"
|
||||||
port: !int "{port:d}"
|
port: !int "{port:d}"
|
||||||
timeout: 1
|
timeout: 3
|
||||||
|
auth:
|
||||||
|
username: "{username}"
|
||||||
|
password: "{password}"
|
||||||
|
|
||||||
stages:
|
stages:
|
||||||
- name: Test reboot command
|
- name: Test reboot command
|
||||||
@ -104,6 +107,9 @@ paho-mqtt:
|
|||||||
host: "{host}"
|
host: "{host}"
|
||||||
port: !int "{port:d}"
|
port: !int "{port:d}"
|
||||||
timeout: 3
|
timeout: 3
|
||||||
|
auth:
|
||||||
|
username: "{username}"
|
||||||
|
password: "{password}"
|
||||||
|
|
||||||
stages:
|
stages:
|
||||||
- name: Test idle
|
- name: Test idle
|
||||||
|
@ -34,7 +34,7 @@ marks:
|
|||||||
- switch
|
- switch
|
||||||
- bar
|
- bar
|
||||||
- arc
|
- arc
|
||||||
- led
|
# - led # has a shadow bug
|
||||||
- obj
|
- obj
|
||||||
- lmeter
|
- lmeter
|
||||||
- dropdown
|
- dropdown
|
||||||
|
91
test/test_range.tavern.yaml
Normal file
91
test/test_range.tavern.yaml
Normal file
@ -0,0 +1,91 @@
|
|||||||
|
# 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:
|
||||||
|
- arc
|
||||||
|
- bar
|
||||||
|
- slider
|
||||||
|
- gauge
|
||||||
|
- lmeter
|
||||||
|
- parametrize:
|
||||||
|
key:
|
||||||
|
- min
|
||||||
|
- max
|
||||||
|
- val
|
||||||
|
vals:
|
||||||
|
- [-1000, 10000, 90]
|
||||||
|
- [128, 512, 256]
|
||||||
|
- [-15, 0, -5]
|
||||||
|
|
||||||
|
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: ""
|
||||||
|
|
||||||
|
- name: Create object
|
||||||
|
mqtt_publish:
|
||||||
|
topic: hasp/{plate}/command/jsonl
|
||||||
|
json:
|
||||||
|
obj: "{obj}"
|
||||||
|
id: 1
|
||||||
|
x: 128
|
||||||
|
y: 128
|
||||||
|
|
||||||
|
- name: Test min
|
||||||
|
mqtt_publish:
|
||||||
|
topic: hasp/{plate}/command/json
|
||||||
|
payload: '["p1b1.min={min}","p1b1.min"]'
|
||||||
|
mqtt_response:
|
||||||
|
topic: hasp/{plate}/state/p1b1
|
||||||
|
json:
|
||||||
|
min: !int "{min:d}"
|
||||||
|
timeout: 1
|
||||||
|
|
||||||
|
- name: Test max
|
||||||
|
mqtt_publish:
|
||||||
|
topic: hasp/{plate}/command/json
|
||||||
|
payload: '["p1b1.max={max}","p1b1.max"]'
|
||||||
|
mqtt_response:
|
||||||
|
topic: hasp/{plate}/state/p1b1
|
||||||
|
json:
|
||||||
|
max: !int "{max:d}"
|
||||||
|
timeout: 1
|
||||||
|
|
||||||
|
- name: Test val
|
||||||
|
mqtt_publish:
|
||||||
|
topic: hasp/{plate}/command/json
|
||||||
|
payload: '["p1b1.val={val}","p1b1.val"]'
|
||||||
|
mqtt_response:
|
||||||
|
topic: hasp/{plate}/state/p1b1
|
||||||
|
json:
|
||||||
|
val: !int "{val:d}"
|
||||||
|
timeout: 1
|
87
test/test_spinner.tavern.yaml
Normal file
87
test/test_spinner.tavern.yaml
Normal file
@ -0,0 +1,87 @@
|
|||||||
|
# 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:
|
||||||
|
- spinner
|
||||||
|
- parametrize:
|
||||||
|
key:
|
||||||
|
- speed
|
||||||
|
- direction
|
||||||
|
- angle
|
||||||
|
vals:
|
||||||
|
- [1000, 0, 90]
|
||||||
|
- [2000, 1, 120]
|
||||||
|
- [1500, 0, 30]
|
||||||
|
|
||||||
|
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: ""
|
||||||
|
|
||||||
|
- name: Create object
|
||||||
|
mqtt_publish:
|
||||||
|
topic: hasp/{plate}/command/jsonl
|
||||||
|
json:
|
||||||
|
obj: "{obj}"
|
||||||
|
id: 1
|
||||||
|
x: 128
|
||||||
|
y: 128
|
||||||
|
|
||||||
|
- name: Test speed
|
||||||
|
mqtt_publish:
|
||||||
|
topic: hasp/{plate}/command/json
|
||||||
|
payload: '["p1b1.speed={speed}","p1b1.speed"]'
|
||||||
|
mqtt_response:
|
||||||
|
topic: hasp/{plate}/state/p1b1
|
||||||
|
json:
|
||||||
|
speed: !int "{speed:d}"
|
||||||
|
timeout: 1
|
||||||
|
|
||||||
|
- name: Test direction
|
||||||
|
mqtt_publish:
|
||||||
|
topic: hasp/{plate}/command/json
|
||||||
|
payload: '["p1b1.direction={direction}","p1b1.direction"]'
|
||||||
|
mqtt_response:
|
||||||
|
topic: hasp/{plate}/state/p1b1
|
||||||
|
json:
|
||||||
|
direction: !int "{direction:d}"
|
||||||
|
timeout: 1
|
||||||
|
|
||||||
|
- name: Test angle
|
||||||
|
mqtt_publish:
|
||||||
|
topic: hasp/{plate}/command/json
|
||||||
|
payload: '["p1b1.angle={angle}","p1b1.angle"]'
|
||||||
|
mqtt_response:
|
||||||
|
topic: hasp/{plate}/state/p1b1
|
||||||
|
json:
|
||||||
|
angle: !int "{angle:d}"
|
||||||
|
timeout: 1
|
@ -98,13 +98,13 @@ stages:
|
|||||||
|
|
||||||
- name: Set value_str
|
- name: Set value_str
|
||||||
mqtt_publish:
|
mqtt_publish:
|
||||||
topic: "hasp/{plate}/command/p[1].b[1].value_str"
|
topic: "hasp/{plate}/command"
|
||||||
payload: "{str1}{str2}"
|
payload: "p1b1.value_str={str1}{str2}"
|
||||||
delay_after: 0
|
delay_after: 0
|
||||||
- name: Get value_str
|
- name: Get value_str
|
||||||
mqtt_publish:
|
mqtt_publish:
|
||||||
topic: hasp/{plate}/command
|
topic: hasp/{plate}/command/p1b1.value_str
|
||||||
payload: "p[1].b[1].value_str"
|
payload: ""
|
||||||
mqtt_response:
|
mqtt_response:
|
||||||
topic: hasp/{plate}/state/p1b1
|
topic: hasp/{plate}/state/p1b1
|
||||||
json:
|
json:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user