YAML Steps

Multi doc YAML, types, numerics, JSON Schema, diff. Config and infra QA covered from the same suite.

Step phrasings in this group

The book sidebar lists each individual step page under this group.

Given the YAML response content from the file "config.yml"

Load YAML response content from a file under tests/assets/.

Given the YAML response content is the following:

Set YAML response content inline from a Gherkin doc string. Supports

Given the active YAML document is 1

Switch the active document for subsequent assertions. Index is 1-based to

Then the YAML response should have 1 document

Assert the multi-document stream has exactly N documents.

Then the response should be in YAML format

Assert the loaded response parses as YAML.

Then the response should not be in YAML format

Assert the loaded response is NOT valid YAML.

Then the YAML should have no duplicate keys

Assert the YAML has no duplicate keys at any level. Uses js-yaml's

Then the YAML element "/name" should exist

Assert at least one YAML node matches a path.

Then the YAML element "/missing" should not exist

Assert NO YAML node matches a path.

Then the YAML element "/name" should be equal to "example"

Assert a YAML node's scalar value equals an expected value.

Then the YAML element "/name" should not be equal to "Other"

Assert a YAML node's scalar value is NOT equal to an expected value.

Then the YAML element "/name" should contain "Web"

Assert a YAML node's serialised value contains a substring.

Then the YAML element "/name" should not contain "Error"

Assert a YAML node's serialised value does NOT contain a substring.

Then the YAML attribute "id" on element "/items/0" should exist

Assert a YAML node has a direct child key.

Then the YAML attribute "deprecated" on element "/items/0" should not exist

Assert a YAML node does NOT have a direct child key.

Then the YAML attribute "id" on element "/items/0" should be equal to "1"

Assert a YAML child key's value equals an expected value.

Then the YAML attribute "id" on element "/items/0" should not be equal to "0"

Assert a YAML child key's value is NOT equal to an expected value.

Then the YAML attribute "id" on element "/items/0" should contain "abc"

Assert a YAML child key's serialised value contains a substring.

Then the YAML attribute "id" on element "/items/0" should not contain "old"

Assert a YAML child key's serialised value does NOT contain a substring.

Then the YAML element "/items" should have 5 elements

Assert a YAML sequence / mapping at a path has exactly N entries.

Then the YAML value at "/spec/replicas" should be of type "integer"

Assert a YAML node's type. Accepts: string, integer, number, boolean,

Then the YAML value at "/labels" should be empty

Assert a YAML node is empty: empty string, empty array, empty object, or null.

Then the YAML value at "/items" should not be empty

Assert a YAML node is non-empty.

Then the YAML value at "/spec/replicas" should be greater than 0

Assert a numeric YAML node is greater than a value.

Then the YAML value at "/spec/replicas" should be greater than or equal to 1

Assert a numeric YAML node is greater than or equal to a value.

Then the YAML value at "/spec/replicas" should be less than 100

Assert a numeric YAML node is less than a value.

Then the YAML value at "/spec/replicas" should be less than or equal to 10

Assert a numeric YAML node is less than or equal to a value.

Then the YAML value at "/spec/replicas" should be between 1 and 10

Assert a numeric YAML node falls within an inclusive range.

Then the YAML array at "/spec/containers" should contain an item where "/name" is "nginx"

Assert an array contains an item where a sub-key has the expected value.

Then the YAML array at "/spec/containers" should contain no item where "/image" is "alpine:latest"

Assert NO item in an array has a sub-key matching a value.

Then every item in "/spec/containers" should have key "image"

Assert every item in an array has a non-null sub-key.

Then the YAML keys at "/metadata" should be exactly "name, namespace, labels"

Assert the keys at a path exactly match a comma-separated list (no extras).

Then the YAML at "/metadata" should have keys "name, namespace"

Assert every required key is present at a path (extras allowed).

Then the YAML should match JSON Schema "schemas/deployment.json"

Validate the active YAML document against a JSON Schema file. Bundles

Then the YAML should equal the file "expected.yaml" ignoring keys "/metadata/resourceVersion"

Assert the active YAML document equals the contents of an expected file,

Then the YAML should use the namespace "v1"

Assert the YAML document declares a namespace value (mirrors xml.steps.js).

Then the YAML should not use the namespace "v0"

Assert the YAML document does NOT declare a namespace value.

When I print last YAML response

Print the most recently set raw YAML response to stdout (debug aid).

Back to all step groups