# test_page.tavern.yaml
---
test_name: Label Standard Properties

includes:
  - !include config.yaml

paho-mqtt: &mqtt_spec
  client:
    transport: tcp
    client_id: tavern-tester
  connect:
    host: "{host}"
    port: !int "{port:d}"
    timeout: 1
  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
    delay_after: 0.02

  - name: Clear page
    mqtt_publish:
      topic: hasp/{plate}/command/clearpage
      payload: ""
    delay_after: 0.02

  - name: Create object
    mqtt_publish:
      topic: hasp/{plate}/command/jsonl
      json:
        objid: 12
        id: 1
    delay_after: 0.02

  - name: Set x
    mqtt_publish:
      topic: hasp/{plate}/command
      payload: "p1b1.x=50"
    delay_after: 0.02
  - name: Get x
    mqtt_publish:
      topic: hasp/{plate}/command
      payload: "p1b1.x"
    mqtt_response:
      topic: hasp/{plate}/state/p1b1
      json:
        x: 50
      timeout: 1
  - name: Set x
    mqtt_publish:
      topic: hasp/{plate}/command
      payload: "p1b1.x=25"
  - name: Get x
    mqtt_publish:
      topic: hasp/{plate}/command
      payload: "p1b1.x"
    mqtt_response:
      topic: hasp/{plate}/state/p1b1
      json:
        x: 25
      timeout: 1

  - name: Set y
    mqtt_publish:
      topic: hasp/{plate}/command
      payload: "p1b1.y=50"
    delay_after: 0.02
  - name: Get y
    mqtt_publish:
      topic: hasp/{plate}/command
      payload: "p1b1.y"
    mqtt_response:
      topic: hasp/{plate}/state/p1b1
      json:
        y: 50
      timeout: 1
  - name: Set y
    mqtt_publish:
      topic: hasp/{plate}/command
      payload: "p1b1.y=25"
    delay_after: 0.02
  - name: Get y
    mqtt_publish:
      topic: hasp/{plate}/command
      payload: "p1b1.y"
    mqtt_response:
      topic: hasp/{plate}/state/p1b1
      json:
        y: 25
      timeout: 1

  - name: Set w
    mqtt_publish:
      topic: hasp/{plate}/command
      payload: "p1b1.w=50"
    delay_after: 0.02
  - name: Get w
    mqtt_publish:
      topic: hasp/{plate}/command
      payload: "p1b1.w"
    mqtt_response:
      topic: hasp/{plate}/state/p1b1
      json:
        w: !anything
      timeout: 1
  - name: Set w
    mqtt_publish:
      topic: hasp/{plate}/command
      payload: "p1b1.w=25"
  - name: Get w
    mqtt_publish:
      topic: hasp/{plate}/command
      payload: "p1b1.w"
    mqtt_response:
      topic: hasp/{plate}/state/p1b1
      json:
        w: !anything
      timeout: 1

  - name: Set h
    mqtt_publish:
      topic: hasp/{plate}/command
      payload: "p1b1.h=50"
    delay_after: 0.02
  - name: Get h
    mqtt_publish:
      topic: hasp/{plate}/command
      payload: "p1b1.h"
    mqtt_response:
      topic: hasp/{plate}/state/p1b1
      json:
        h: !anything
      timeout: 1
  - name: Set h
    mqtt_publish:
      topic: hasp/{plate}/command
      payload: "p1b1.h=25"
    delay_after: 0.02
  - name: Get h
    mqtt_publish:
      topic: hasp/{plate}/command
      payload: "p1b1.h"
    mqtt_response:
      topic: hasp/{plate}/state/p1b1
      json:
        h: !anything
      timeout: 1

  - name: Set mode
    mqtt_publish:
      topic: hasp/{plate}/command
      payload: "p1b1.mode=crop"
    delay_after: 0.02
  - name: Get mode
    mqtt_publish:
      topic: hasp/{plate}/command
      payload: "p1b1.mode"

  - name: Set w
    mqtt_publish:
      topic: hasp/{plate}/command
      payload: "p1b1.w=50"
    delay_after: 0.02
  - name: Get w
    mqtt_publish:
      topic: hasp/{plate}/command
      payload: "p1b1.w"
    mqtt_response:
      topic: hasp/{plate}/state/p1b1
      json:
        w: 50
      timeout: 1
  - name: Set w
    mqtt_publish:
      topic: hasp/{plate}/command
      payload: "p1b1.w=25"
  - name: Get w
    mqtt_publish:
      topic: hasp/{plate}/command
      payload: "p1b1.w"
    mqtt_response:
      topic: hasp/{plate}/state/p1b1
      json:
        w: 25
      timeout: 1

  - name: Set h
    mqtt_publish:
      topic: hasp/{plate}/command
      payload: "p1b1.h=50"
    delay_after: 0.02
  - name: Get h
    mqtt_publish:
      topic: hasp/{plate}/command
      payload: "p1b1.h"
    mqtt_response:
      topic: hasp/{plate}/state/p1b1
      json:
        h: 50
      timeout: 1
  - name: Set h
    mqtt_publish:
      topic: hasp/{plate}/command
      payload: "p1b1.h=45"
    delay_after: 0.02
  - name: Get h
    mqtt_publish:
      topic: hasp/{plate}/command
      payload: "p1b1.h"
    mqtt_response:
      topic: hasp/{plate}/state/p1b1
      json:
        h: 45
      timeout: 1

  - name: Set enabled
    mqtt_publish:
      topic: hasp/{plate}/command
      payload: "p1b1.enabled=0"
    delay_after: 0.02
  - name: Get enabled
    mqtt_publish:
      topic: hasp/{plate}/command
      payload: "p1b1.enabled"
    mqtt_response:
      topic: hasp/{plate}/state/p1b1
      json:
        enabled: 0
      timeout: 1
  - name: Set enabled
    mqtt_publish:
      topic: hasp/{plate}/command
      payload: "p1b1.enabled=1"
    delay_after: 0.02
  - name: Get enabled
    mqtt_publish:
      topic: hasp/{plate}/command
      payload: "p1b1.enabled"
    mqtt_response:
      topic: hasp/{plate}/state/p1b1
      json:
        enabled: 1
      timeout: 1

  - name: Set hidden
    mqtt_publish:
      topic: hasp/{plate}/command
      payload: "p1b1.hidden=1"
    delay_after: 0.02
  - name: Get hidden
    mqtt_publish:
      topic: hasp/{plate}/command
      payload: "p1b1.hidden"
    mqtt_response:
      topic: hasp/{plate}/state/p1b1
      json:
        hidden: 1
      timeout: 1
  - name: Get vis
    mqtt_publish:
      topic: hasp/{plate}/command
      payload: "p1b1.vis"
    mqtt_response:
      topic: hasp/{plate}/state/p1b1
      json:
        vis: 0
      timeout: 1

  - name: Set hidden
    mqtt_publish:
      topic: hasp/{plate}/command
      payload: "p1b1.hidden=0"
    delay_after: 0.02
  - name: Get hidden
    mqtt_publish:
      topic: hasp/{plate}/command
      payload: "p1b1.hidden"
    mqtt_response:
      topic: hasp/{plate}/state/p1b1
      json:
        hidden: 0
      timeout: 1
  - name: Get vis
    mqtt_publish:
      topic: hasp/{plate}/command
      payload: "p1b1.vis"
    mqtt_response:
      topic: hasp/{plate}/state/p1b1
      json:
        vis: 1
      timeout: 1

  - name: Set vis
    mqtt_publish:
      topic: hasp/{plate}/command
      payload: "p1b1.vis=0"
    delay_after: 0.02
  - name: Get hidden
    mqtt_publish:
      topic: hasp/{plate}/command
      payload: "p1b1.hidden"
    mqtt_response:
      topic: hasp/{plate}/state/p1b1
      json:
        hidden: 1
      timeout: 1
  - name: Get vis
    mqtt_publish:
      topic: hasp/{plate}/command
      payload: "p1b1.vis"
    mqtt_response:
      topic: hasp/{plate}/state/p1b1
      json:
        vis: 0
      timeout: 1

  - name: Set vis
    mqtt_publish:
      topic: hasp/{plate}/command
      payload: "p1b1.vis=1"
    delay_after: 0.02
  - name: Get hidden
    mqtt_publish:
      topic: hasp/{plate}/command
      payload: "p1b1.hidden"
    mqtt_response:
      topic: hasp/{plate}/state/p1b1
      json:
        hidden: 0
      timeout: 1
  - name: Get vis
    mqtt_publish:
      topic: hasp/{plate}/command
      payload: "p1b1.vis"
    mqtt_response:
      topic: hasp/{plate}/state/p1b1
      json:
        vis: 1
      timeout: 1
