Example plan
ws.yaml
New here? Get started. See Running the examplesfor this plan's fixture, runtime, database or browser requirements. The exec example needs no fixture; Postgres and Playwright need their optional dependencies.
A ws step sends two messages and collects the echoes; a second task collects what a server pushes on its own and reads when each message arrived. Start bin/vero-testserver in Terminal 1 in the foreground; run bin/vero run examples/ws.yaml in Terminal 2. The fixture's /fixtures/ws echoes every message, or pushes push ticks every milliseconds apart when asked.
apiVersion: vero.plan/v1
kind: Plan
metadata: { name: example-ws }
env:
baseUrl: ws://127.0.0.1:18080
lifecycle: { strategy: isolated } # the fixture keeps nothing from a socket
tasks:
- name: echo
steps:
- ws:
url: "{{ env.baseUrl }}/fixtures/ws"
send:
- json: { kind: "ping", run: "{{ run.id }}" }
- text: "plain text, as written"
expect: { count: 2, timeout: 2s }
assert:
- status == 101
- messages[0].body.kind == "ping"
- messages[0].body.run == run.id
- messages[1].text == "plain text, as written"
- closed == nil
- name: server-push
steps:
- ws:
url: "{{ env.baseUrl }}/fixtures/ws?push=3&every=50"
expect: { count: 3, timeout: 2s }
assert:
- messages count 3
- messages all (it.body.tick > 0)
- messages[2].at > messages[0].at
- duration.first < 1sThis page is examples/ws.yaml in the repository.