Skip to content

YAML Cases

Define test cases entirely in YAML — no Python code needed. The AI agent executes each step just like it would for a Python BaseCase.

Basic Structure

yaml
# case.yaml
name: My Search Test
headless: false
max_steps: 20
url: https://www.baidu.com
steps:
  - name: Search
    action: Search for "Playwright automation"

  - name: Verify
    verify: Search results are displayed

  - name: Screenshot
    screenshot: search_result

Place case.yaml (or case.yml) in a directory and run it with the CLI.

Running YAML Cases

bash
# Via CLI
skiritai run examples/beginner/baidu_search/03_yaml

# Via Python
from skiritai import run_yaml_case
from pathlib import Path
import asyncio

report = asyncio.run(run_yaml_case(Path("examples/beginner/baidu_search/03_yaml")))

Step Types

Step KeyDescriptionRequired Argument
actionNatural language action → AI executes itAction description string
verifyNatural language assertion → AI verifies (non-blocking on failure)Assertion string
screenshotCapture screenshot with given nameScreenshot name
analyzePre-analyze page DOM (injects context into next action)(ignored)
page_infoGet page title, URL, text summary(ignored)

Step-Level Options

Each step can specify an on_failure policy:

yaml
steps:
  - action: Click the "Advanced Settings" link
    on_failure: skip    # Continue even if this step fails

  - action: Submit the form
    on_failure: abort   # Stop execution on failure (default)
PolicyBehavior
abort (default)Stop the entire case on failure
skipLog warning and continue to the next step

Top-Level Fields

FieldRequiredDefaultDescription
nameNodirectory nameDisplay name for the case
stepsYesList of step definitions
headlessNoenv or falseRun browser in headless mode
max_stepsNo20Max agent tool-call steps per action
urlNoNavigate to this URL before running steps

Listing YAML Cases

bash
skiritai list examples/

YAML cases are automatically discovered alongside Python cases. Each directory with a case.yaml or case.yml file is listed as a case.

Released under the MIT License.