Example plan

playwright.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.

Log in, drive Chromium through Playwright on vero-testserver's /checkout page, then check the placed order with an http step. The login token is a result marked secret, so the page's careless console log is scrubbed. Install the pinned package and matching browser as described in the Playwright guide; start bin/vero-testserver in Terminal 1 in the foreground and run ORDERS_API_KEY=example-key-1234 bin/vero run examples/playwright.yaml in Terminal 2.

apiVersion: vero.plan/v1
kind: Plan
metadata:
  name: example-playwright
env:
  baseUrl: "${VERO_BASE_URL:-http://127.0.0.1:18080}"
  # The browser cache location varies by platform. Pass an optional absolute override through
  # input because script children receive only PATH, HOME and LANG from the parent.
  browsers: "${PLAYWRIGHT_BROWSERS_PATH:-}"
  apiKey: { secretRef: ORDERS_API_KEY }
lifecycle:
  strategy: unique           # every run signs in with its own key: the fixture's buckets never refill
tasks:
  - name: login
    steps:
      - http:
          method: POST
          url: "{{ env.baseUrl }}/auth/token"
          json: { key: "{{ env.apiKey }}-{{ run.id }}" }
        assert:
          - status == 200
        results:
          token: { secret: body.token }   # scrubbed from every output, the page's console included

  - name: browser-checkout
    steps:
      - script:
          runtime: node
          entry: ./playwright/checkout.mjs
          input:
            baseUrl: "{{ env.baseUrl }}"
            apiKey: "{{ env.apiKey }}-{{ run.id }}"
            sessionToken: "{{ tasks.login.results.token }}"
            browsersPath: "{{ env.browsers }}"
            sku: ABC-1
            qty: 2
          timeout: 60s
        assert:
          - ok == true
          - result.total == 2000
          - result.checkoutMs < 10000
        results:
          orderId: result.orderId

  - name: verify-order
    steps:
      - http:
          method: GET
          url: "{{ env.baseUrl }}/orders/{{ tasks.browser-checkout.results.orderId }}"
          headers: { Authorization: "Bearer {{ tasks.login.results.token }}" }
        assert:
          - status == 200
          - body.order.id == tasks.browser-checkout.results.orderId
          - body.order.qty == 2
          - body.order.total == 2000

This page is examples/playwright.yaml in the repository.

verodocs