Skip to content

Assertions Reference

Assertions validate the outcome of a step. The AI agent includes assertions in QA plan steps when building plans via MCP tools. Each step can contain an assertions array with one or more assertion objects. All assertions in a step must pass for the step to be considered successful.

These assertions apply to steps with the http_request action type.

Check that the response status code matches an exact value.

{ "type": "status_code", "expected": 200 }
FieldTypeDescription
type"status_code"Assertion type identifier.
expectednumberThe expected HTTP status code.

Check that the response status code is one of the allowed values.

{ "type": "status_code_in", "expected": [200, 201] }
FieldTypeDescription
type"status_code_in"Assertion type identifier.
expectednumber[]An array of acceptable HTTP status codes.

Validate a value at a specific JSON path in the response body.

{ "type": "json_path", "path": "$.user.email", "expected": "alice@example.com" }
FieldTypeDescription
type"json_path"Assertion type identifier.
pathstringA JSONPath expression pointing to the value to check.
condition"exists" | "not_exists" | "contains"(optional) The comparison mode. Omit for exact match.
expectedany(optional when using exists/not_exists) The expected value.

Condition behavior:

  • Omitted — Performs an exact equality check between the value at path and expected.
  • "exists" — Passes if a value exists at the given path. The expected field is ignored.
  • "not_exists" — Passes if no value exists at the given path. The expected field is ignored.
  • "contains" — Passes if the string value at path contains expected as a substring.

These assertions apply to steps with the browser action type.

Check the text content of an element.

{ "type": "element_text", "selector": ".welcome-message" }
{ "type": "element_text", "selector": ".welcome-message", "contains": "Hello" }
FieldTypeDescription
type"element_text"Assertion type identifier.
selectorstringCSS selector for the target element.
containsstring(optional) Substring that the element’s text must contain. If omitted, asserts that the element has any text content.

Assert that an element is visible on the page.

{ "type": "element_visible", "selector": "#main-content" }
FieldTypeDescription
type"element_visible"Assertion type identifier.
selectorstringCSS selector for the target element.

Assert that an element is not visible on the page.

{ "type": "element_not_visible", "selector": ".error-banner" }
FieldTypeDescription
type"element_not_visible"Assertion type identifier.
selectorstringCSS selector for the target element.

Assert that the current page URL contains a substring.

{ "type": "url_contains", "expected": "/dashboard" }
FieldTypeDescription
type"url_contains"Assertion type identifier.
expectedstringSubstring that the URL must contain.

Assert that the page title matches an exact value.

{ "type": "title", "expected": "Dashboard - My App" }
FieldTypeDescription
type"title"Assertion type identifier.
expectedstringThe expected page title.

Capture a screenshot. This assertion always passes and is used for visual documentation.

{ "type": "screenshot", "name": "checkout-page", "description": "Final state of the checkout form" }
FieldTypeDescription
type"screenshot"Assertion type identifier.
namestring(optional) A name for the screenshot file.
descriptionstring(optional) A description of what the screenshot captures.

Assert the number of elements matching a selector.

{ "type": "element_count", "selector": ".cart-item", "expected": 3 }
FieldTypeDescription
type"element_count"Assertion type identifier.
selectorstringCSS selector for the target elements.
expectednumberThe expected number of matching elements.

Assert the value of an element’s attribute.

{ "type": "element_attribute", "selector": "#submit-btn", "attribute": "disabled", "expected": "true" }
FieldTypeDescription
type"element_attribute"Assertion type identifier.
selectorstringCSS selector for the target element.
attributestringThe attribute name to check.
expectedstringThe expected attribute value.

Assert that a cookie with the given name exists.

{ "type": "cookie_exists", "name": "session_id" }
FieldTypeDescription
type"cookie_exists"Assertion type identifier.
namestringThe cookie name to check for.

Assert the value of a cookie.

{ "type": "cookie_value", "name": "theme", "expected": "dark", "match": "exact" }
FieldTypeDescription
type"cookie_value"Assertion type identifier.
namestringThe cookie name.
expectedstringThe expected cookie value.
match"exact" | "contains"(optional) Match mode. Defaults to "exact".

Assert that a key exists in localStorage.

{ "type": "localstorage_exists", "key": "auth_token" }
FieldTypeDescription
type"localstorage_exists"Assertion type identifier.
keystringThe localStorage key to check for.

Assert the value of a localStorage entry.

{ "type": "localstorage_value", "key": "locale", "expected": "en-US", "match": "exact" }
FieldTypeDescription
type"localstorage_value"Assertion type identifier.
keystringThe localStorage key.
expectedstringThe expected value.
match"exact" | "contains"(optional) Match mode. Defaults to "exact".