testzeus-test-blocks
Author, verify, save, and run Test Blocks tests: ordered Playwright / tz Python steps
Category: core · Version: 1.0.0 · Requires: testzeus-auth
Triggers: test blocks, test_blocks, step-based test, playwright step, tz python, verify until this step, backend step, soql step
Requires testzeus-cli >= 0.0.33 and testzeus-sdk >= 0.0.30 (MCP >= 2.0.4). Check testzeus test-blocks --help before using the commands below.
Overview
A Test Blocks test (tests.executor == "test_blocks", authoring_mode == "box_graph") is an ordered list of steps. Each step is browser UI (Playwright page / expect plus tz), backend Python (tz only), or a typed SOQL / Apex / HTTP request compiled to tz.
This is not Gherkin. Do not call create_test with a test_feature, and do not use testzeus tests-authoring. Hypermind "code blocks" are unrelated reusable snippets — see testzeus-hypermind.
Official runs use executor test_blocks. A test is runnable only after verify then save (builder_status == "ready"). Saving immediately after adding steps leaves it invalid with UNVERIFIED errors.
Choose this skill when
- You are an external agent (Claude Code, Cursor, Codex, an MCP client, a script) and the user asks to create, write, or add a test or test case without naming Gherkin. Test Blocks is the default; do not ask which kind.
- The user says Test Blocks, step-based, Playwright steps, or
tzPython - They want run-until-this-step / verify-then-save, then a live run
the TestZeus platform (the in-app TestZeus chat) keeps asking Gherkin vs Test Blocks for an unqualified "create a test"; this default is for external agents only.
Use testzeus-test-authoring only when the user names Gherkin, a feature file, Given/When/Then, Magic Test, or tests from a spec, video, or recording. A Gherkin test that also calls HTTP or Salesforce is still Gherkin.
Write each step as one plain-English action or check (--instruction). A browser step must be one action ("Click New", "Type 'Acme' into Account Name", "Click Save"), not a task ("Create an Account named Acme and save it"): verify checks every browser step the way the Test Blocks builder does and holds the ones that are more than one action. Leave --source empty: verify writes the code from the live page. Mark checks with --assert (MCP is_assert). A check is hard by default: when it fails, the run stops. Use --assert-mode soft (MCP assert_mode: "soft") when the user wants the failure recorded and the run to go on; update-step --assert-mode hard|soft changes it later. Give each step a short --label.
Lifecycle
Web:
create → config (environment URL key) → add-step (repeat) → verify → save → (ask) runMobile (testing_type=mobile):
create (--testing-type mobile) → add-step (--type mobile) → verify → save → (ask) run- Create an empty Test Blocks test (environment, test data, knowledge bases). CLI/MCP: pass
testing_type=mobilefor device tests. - Web only: set the landing URL key:
testzeus environments get ENV_ID, thentestzeus test-blocks config TEST_ID --environment-url-key KEY. Salesforce-connected orgs skip this only when the org is usable (connection_statusis not EXPIRED). Changing the environment clears the key; set it again. Mobile tests skip the URL key — use a mobile environment with a device. - Add steps (instruction, optional source code, optional typed request). Mobile steps use
--type mobile/step_type=mobileandtz.device— not Playwrightpage. - Verify (leases a browser when a browser step needs one, a device for mobile steps, or neither for backend-only ranges).
- Save.
builder_statusbecomesreadyorinvalid. - Ask before the official live run.
Mobile UI: no browser tab, no Open browser, no record-from-browser — device pre-seeded recipes only (launch/close app, keys, screen checks).
Limits (use the UI)
Loops, If/else, End boxes, nesting, skip, reorder, duplicate, paste, convert-from-Gherkin, recording, locator pick, file uploads, and a live interactive browser are UI-only. CLI/MCP add-step always creates a linear intent step. steps/get now flatten nested scopes when present; still do not invent loop/If commands.
Do not add Test Blocks tests to a suite or schedule yet: suite nodes stay pending because Theseus does not dispatch them. Do not promise suite output chaining.
CLI
testzeus test-blocks create --name "Checkout health" --environment ENV_ID --data TD_ID
testzeus environments get ENV_ID
testzeus test-blocks config TEST_ID --environment-url-key KEY
testzeus test-blocks add-step TEST_ID --instruction "Open the dashboard"
# Mobile example:
# testzeus test-blocks create --name "App login" --testing-type mobile --environment ENV_ID
# testzeus test-blocks add-step TEST_ID --type mobile --instruction "Launch the app and sign in"
testzeus test-blocks add-step TEST_ID --type backend --assert \
--instruction "API is healthy" \
--source-file ./health_assert.py
testzeus test-blocks add-step TEST_ID --type soql --target-org ORG_KEY \
--request '{"query":"SELECT Id FROM Account LIMIT 1","outputName":"accounts"}'
testzeus test-blocks verify TEST_ID --no-wait
testzeus test-blocks get TEST_ID
testzeus test-blocks verify TEST_ID --through STEP_ID
testzeus test-blocks save TEST_ID
# Ask the user before:
testzeus test-blocks run TEST_ID --key RUN_KEY
testzeus test-blocks run-status RUN_IDInspect: get, steps. Edit: update-step, delete-steps TEST_ID STEP_ID... --yes (show the step ids first and get a yes). Config: --environment-url-key, --clear-data, --clear-knowledge-base. After any edit or delete, verify again before save.
records copy cannot copy a Test Blocks test (steps live outside the test row). records patch and tests update cannot change environment / test data on one — use testzeus test-blocks config.
Never put credentials in --instruction or --source. Use tz.testdata / [$.testdata...] and --source-file.
MCP tools (MCP clients)
create_test_blocks, get_test_blocks, add_test_blocks_step, update_test_blocks_step, delete_test_blocks_steps, update_test_blocks_config, verify_test_blocks, apply_test_blocks_split, dismiss_test_blocks_split, save_test_blocks, live_run_test_blocks, get_test_blocks_run_status.
Start with verify_test_blocks (wait=false), then get_test_blocks with wait_seconds (up to 25). If it is still verifying, tell the user and stop — identical polls are capped per turn. Prefer live_run_test_blocks (pass key on retries) only after the user says yes, unless they already asked to run. run_test / create_test_run_group check readiness for test_ids and tags, but they still skip live-run metadata — use live_run_test_blocks.
the TestZeus platform / platform tools
the TestZeus platform can author Test Blocks tests in chat:
create_test_blocks (pass every step in steps, and for web tests environment plus environment_url_key from get_environment.url_keys; Salesforce-connected orgs skip the URL key only when salesforce_orgs[].usable is true), get_test_blocks, add_test_blocks_steps, add_test_blocks_step, update_test_blocks_step, delete_test_blocks_steps, update_test_blocks_config, verify_test_blocks (wait=false), apply_test_blocks_split, dismiss_test_blocks_split, save_test_blocks, live_run_test_blocks, get_test_blocks_run_status.
Do not invent a Gherkin feature to "make create_test work". After create, call verify_test_blocks (wait=false), then get_test_blocks with wait_seconds, then save, then offer the live run and wait for a yes. Keep going through that sequence in the same turn until the test is saved, or verify is still running after the poll, or a live-run needs a yes. Ask only when an environment, URL key, or consent is missing. If verify is still running after that poll, tell the user it is still verifying and stop. Never put credentials in an instruction or source; use environment secrets, [$.environment.current.key], or test-data tokens. Users can still finish verifying in the Test Blocks UI; the canvas autosaves there.
Step kinds
| Kind | step_type |
Runs with |
|---|---|---|
| Browser | browser (default) |
page, expect, tz |
| Mobile | mobile |
Appium + tz (needs a mobile environment) |
| Advanced | backend |
tz only |
| Legacy typed | soql / apex / http |
compiled tz.salesforce.* / tz.api.* |
Assertion steps set isAssert (skips multi-intent split only; they still run as Python). soql/apex need a connected Salesforce org (--target-org / STEP_TYPE_NEEDS_SALESFORCE).
Variables
| Need | Token | Code |
|---|---|---|
| Test / suite params | [$.input.key] |
tz.input.key |
| Test data | [$.testdata.Dataset.key] |
tz.testdata.Dataset.key |
| Environment | [$.environment.current.key] |
tz.environment.current.<the key you set> |
| Scratchpad in this run | [$.temp.name] |
tz.setTemp / tz.temp.name |
| Suite / run outputs | [$.output.name] |
tz.setOutput / tz.output |
Temp vs output: temp dies with the run. Suite chaining is not available for Test Blocks yet.
Read the environment's real keys first. tz.environment.current.target_env_url is not a built-in — use the landing key you configured. The browser already starts at that URL; page.goto only if you navigate away. Relative tz.api.get('/health') needs base_url / api_url on the environment, or use a full https:// URL.
See references/tz.md for examples.
When verify is held: one action per browser step
Before anything runs, verify asks the model whether each plain-language browser step is one action, the same review the builder runs. Backend steps (soql/apex/http/backend), checks, loops and conditions are not reviewed. A held step stops verify before any browser starts:
- CLI:
verifyexits 1 and lists each held step with the suggested steps ([candidate_id] instruction). - MCP:
verify_test_blocksreturns{"status": "split_review", "held_steps": [...]}.
For each held step, prefer the split: testzeus test-blocks split TEST_ID STEP_ID --apply (all suggested steps, or --candidate ID repeated) / MCP apply_test_blocks_split. If no steps were suggested (needs_detail), reword the step as one action with update-step. Keep a step whole (--dismiss / dismiss_test_blocks_split) only when the user says it is one action. Then verify again.
When a step fails: fix and verify again
Verify stops at the first step it cannot do. Read why before you change anything:
- CLI:
testzeus --format json test-blocks get TEST_ID(table output shows only the status). MCP:get_test_blocks. - The reason is on the failed block, as the builder shows it:
authoring_progress.failure.headlineis what went wrong andrecommendationis how to fix it, both written by the model from everything it tried (e.g. "The footer shows 2 items left instead of 3.").implementation.verificationStatusisawaiting_authoring_helpafter 5 failed attempts.authoringProgress.errorCodeisAUTHORING_STEP_FAILED. - How the step was run (raw error, cause, code, execution trace) is not shown to customers. Do not look for it; work from the headline and recommendation. If they are not enough, send the user the test link: the builder's info icon on the failed step shows the details.
Then fix it in English, the same way a person fixes it in the UI:
- The step asks for something the page does not have (wrong text, missing element): reword the instruction to match what the page shows (
update-step --instruction), or ask the user what the right expectation is. - The step needs an action first (a dialog, a menu, a page load): insert that action as its own step (
add-step --after-step-id). - A check is too strict or vague: say exactly what to compare in the instruction.
Do not write or patch step code to force a pass, and do not weaken an assertion just to make it green. If the failure looks like a real product bug, stop and tell the user instead of rewording.
After any edit, run verify again, then save. Tell the user what failed, why, and what you changed. Hard cases (locator picks, recording a flow, loops) are fixed in the Test Blocks UI: give the user the test link.
A live run that fails reports per step in testzeus --format json test-blocks run-status RUN_ID: test_run_dashs[].test_run_dash_outputs.test_run_dash_output_steps[].metadata.failure has the same headline / recommendation, and the run attachments include screenshots and a Playwright trace. A live run repairs drifted steps itself when it can; a step that still fails needs the same English fix, then verify, save, run.
Failure modes
| Symptom | Cause | Fix |
|---|---|---|
| 400 choose and save an environment URL key | Web test has no landing key | config --environment-url-key KEY |
builder_status: invalid, UNVERIFIED |
Saved without a successful verify | verify then save |
409 test is not ready |
live-run before ready |
Verify, fix errors, save |
409 stale hash |
Graph changed under you | get, re-apply only if still correct; SDK retries once then raises — do not loop |
409 AUTHORING_CURSOR_CONFLICT / split review |
Another session or unresolved UI review | Wait, or finish in the UI |
create_test required test_feature |
Wrong API | create_test_blocks / testzeus test-blocks create |
records copy refused |
Steps are not on the test row | Create a new Test Blocks test and re-add steps |
delete-steps Aborted |
Confirmation prompt | Pass --yes after the user confirms the ids |
404 BROWSER_SESSION_ENDED on verify |
The browser from an earlier verify timed out | Run verify again; it starts a new browser (CLI/SDK with the fix). Older CLI: finish in the UI |
Related Skills
- testzeus-test-authoring — Gherkin / Hercules tests only
- testzeus-test-operations — run and inspect official runs
- testzeus-hypermind — unrelated reusable code snippets