@vardot/varbase-e2e 2.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/AGENTS.md +148 -0
- package/CLAUDE.md +544 -0
- package/README.md +22 -0
- package/bin/generate-reports.js +363 -0
- package/bin/init-varbase-e2e.js +330 -0
- package/bin/postinstall.js +26 -0
- package/cucumber.js +125 -0
- package/docs/00-quick-start.md +102 -0
- package/docs/01-getting-started.md +102 -0
- package/docs/02-bbr-smart-waits.md +77 -0
- package/docs/03-selector-registry.md +95 -0
- package/docs/04-step-reference.md +801 -0
- package/docs/05-web-first-assertions.md +91 -0
- package/docs/06-network-and-dialogs.md +83 -0
- package/docs/07-auth-state.md +75 -0
- package/docs/08-clock-mocking.md +59 -0
- package/docs/09-api-testing.md +114 -0
- package/docs/10-accessibility.md +167 -0
- package/docs/11-debugging.md +129 -0
- package/docs/12-ai-agent-guide.md +338 -0
- package/docs/13-faq.md +236 -0
- package/docs/14-recipes-cookbook.md +255 -0
- package/docs/15-tag-conventions.md +76 -0
- package/docs/16-ci-cd.md +90 -0
- package/docs/README.md +125 -0
- package/docs/advanced-screenshots/then-i-save-fullscreen-screenshot.md +36 -0
- package/docs/advanced-screenshots/then-i-save-width-x-height-screenshot.md +34 -0
- package/docs/advanced-screenshots/when-i-save-screenshot-name-filename.md +45 -0
- package/docs/advanced-screenshots.md +52 -0
- package/docs/advanced-selectors.md +18 -0
- package/docs/api-step-definitions.md +45 -0
- package/docs/global-settings.md +267 -0
- package/docs/install-varbase-e2e/ddev-varbase-e2e.md +52 -0
- package/docs/install-varbase-e2e.md +34 -0
- package/docs/overview.md +40 -0
- package/docs/step-definitions/given-i-am-anonymous-user.md +67 -0
- package/docs/step-definitions/given-i-am-homepage.md +68 -0
- package/docs/step-definitions/given-i-am-specific-page.md +72 -0
- package/docs/step-definitions/then-i-should-be.md +56 -0
- package/docs/step-definitions/then-i-should-see.md +62 -0
- package/docs/step-definitions/then-item-checkbox.md +54 -0
- package/docs/step-definitions/then-item-link-should-contain-url.md +84 -0
- package/docs/step-definitions/then-item-should-contain.md +67 -0
- package/docs/step-definitions/then-radio-button-value-should-be-selected.md +68 -0
- package/docs/step-definitions/then-response-status-code-should-be-number.md +69 -0
- package/docs/step-definitions/then-value-radio-button-selected.md +62 -0
- package/docs/step-definitions/when-i-attach-file-file-name-element.md +71 -0
- package/docs/step-definitions/when-i-check-checkbox.md +60 -0
- package/docs/step-definitions/when-i-click-link.md +51 -0
- package/docs/step-definitions/when-i-click-operation-text-row.md +71 -0
- package/docs/step-definitions/when-i-fill.md +59 -0
- package/docs/step-definitions/when-i-go-homepage.md +60 -0
- package/docs/step-definitions/when-i-go-specific-page.md +67 -0
- package/docs/step-definitions/when-i-move-backward-one-page.md +49 -0
- package/docs/step-definitions/when-i-move-forward-one-page.md +58 -0
- package/docs/step-definitions/when-i-press-button.md +58 -0
- package/docs/step-definitions/when-i-reload-page.md +51 -0
- package/docs/step-definitions/when-i-scroll.md +73 -0
- package/docs/step-definitions/when-i-select-option-select-list.md +53 -0
- package/docs/step-definitions/when-i-select-radio-button-value.md +62 -0
- package/docs/step-definitions/when-i-uncheck-checkbox.md +57 -0
- package/docs/step-definitions/when-i-wait-ajax-finish.md +64 -0
- package/docs/step-definitions/when-i-wait.md +62 -0
- package/docs/step-definitions.md +82 -0
- package/docs/steps/README.md +137 -0
- package/docs/steps/a11y.md +731 -0
- package/docs/steps/action.md +181 -0
- package/docs/steps/api.md +679 -0
- package/docs/steps/assertion.md +328 -0
- package/docs/steps/auth.md +108 -0
- package/docs/steps/clock.md +171 -0
- package/docs/steps/cookie.md +293 -0
- package/docs/steps/debug.md +52 -0
- package/docs/steps/dialog.md +226 -0
- package/docs/steps/drupal-canvas.md +414 -0
- package/docs/steps/drupal-ckeditor.md +118 -0
- package/docs/steps/drupal-core.md +688 -0
- package/docs/steps/drupal-layout-builder.md +437 -0
- package/docs/steps/drupal-media.md +107 -0
- package/docs/steps/drupal-moderation.md +81 -0
- package/docs/steps/drupal-paragraphs.md +36 -0
- package/docs/steps/element.md +455 -0
- package/docs/steps/field.md +648 -0
- package/docs/steps/file-download.md +235 -0
- package/docs/steps/form.md +344 -0
- package/docs/steps/iframe.md +248 -0
- package/docs/steps/input.md +220 -0
- package/docs/steps/javascript.md +111 -0
- package/docs/steps/keyboard.md +107 -0
- package/docs/steps/link.md +217 -0
- package/docs/steps/metatag.md +99 -0
- package/docs/steps/modal.md +232 -0
- package/docs/steps/navigation.md +275 -0
- package/docs/steps/network.md +284 -0
- package/docs/steps/path.md +203 -0
- package/docs/steps/response.md +102 -0
- package/docs/steps/responsive.md +139 -0
- package/docs/steps/rest.md +140 -0
- package/docs/steps/screenshot.md +211 -0
- package/docs/steps/scroll.md +266 -0
- package/docs/steps/selectors.md +848 -0
- package/docs/steps/storage.md +254 -0
- package/docs/steps/table.md +216 -0
- package/docs/steps/varbase.md +391 -0
- package/docs/steps/video.md +111 -0
- package/docs/steps/wait.md +553 -0
- package/docs/steps/web-first.md +289 -0
- package/docs/steps/xml.md +505 -0
- package/docs/steps/yaml.md +951 -0
- package/examples/a11y.html +31 -0
- package/examples/about-us.html +11 -0
- package/examples/account.html +32 -0
- package/examples/ajax-wait-examples.html +147 -0
- package/examples/contact-us.html +10 -0
- package/examples/cookies.html +10 -0
- package/examples/date.html +12 -0
- package/examples/dynamic-examples.html +498 -0
- package/examples/element.html +11 -0
- package/examples/example-api.json +28 -0
- package/examples/existing-page.html +11 -0
- package/examples/field.html +24 -0
- package/examples/index.html +37 -0
- package/examples/keyboard.html +11 -0
- package/examples/links.html +9 -0
- package/examples/modal.html +14 -0
- package/examples/path.html +3 -0
- package/examples/table.html +13 -0
- package/examples/test--modal-dialogs.html +252 -0
- package/examples/test--then--i-should--not--see-text-in-element.html +48 -0
- package/examples/test--then--i-should--see-text-in-element.html +48 -0
- package/examples/test--then--i-should--see-text-matching-pattern.html +31 -0
- package/examples/test--then--i-should-see-text-in-table-row.html +232 -0
- package/examples/test--then--the-checkbox-checked.html +68 -0
- package/examples/test--then--the-element-should_not-contain-cssproperty.html +47 -0
- package/examples/test--then--the-link-should-contain.html +21 -0
- package/examples/test--when--i-additionally-select.html +27 -0
- package/examples/test--when--i-attach-file-to-feild.html +50 -0
- package/examples/test--when--i-check-uncheck-checkbox.html +47 -0
- package/examples/test--when--i-click-link.html +18 -0
- package/examples/test--when--i-click-text-in-table-row.html +178 -0
- package/examples/test--when--i-fill-in.html +48 -0
- package/examples/test--when--i-press-button.html +31 -0
- package/examples/test--when--i-reload-page.html +27 -0
- package/examples/test--when--i-scroll-functionality.html +177 -0
- package/examples/test--when--i-scroll-left-right-functionality.html +149 -0
- package/examples/test--when--i-select-option-from-dropdownlist.html +35 -0
- package/examples/test--when--i-select-radio-button.html +95 -0
- package/examples/test--when-i-wait-max-of-time.html +39 -0
- package/examples/test--when-i-wait-page-until-is-loaded.html +47 -0
- package/examples/test--when-i-wait-specific-time.html +39 -0
- package/examples/test-acceptable-url-path.html +11 -0
- package/examples/video-demo.html +43 -0
- package/package.json +56 -0
- package/playwright.config.ts +39 -0
- package/tests/assets/test-document.pdf +14 -0
- package/tests/assets/vardot.png +0 -0
- package/tests/features/a11y.feature +39 -0
- package/tests/features/ajax-wait-examples.feature +24 -0
- package/tests/features/api-step-definitions-individual.feature +185 -0
- package/tests/features/complete-api-testing-examples.feature +205 -0
- package/tests/features/cookie.feature +13 -0
- package/tests/features/date.feature +11 -0
- package/tests/features/dynamic-content-examples.feature +156 -0
- package/tests/features/element.feature +16 -0
- package/tests/features/field.feature +25 -0
- package/tests/features/keyboard.feature +10 -0
- package/tests/features/link.feature +11 -0
- package/tests/features/modal-advanced-example.feature +54 -0
- package/tests/features/modal-basic-example.feature +42 -0
- package/tests/features/modal-error-handling-example.feature +37 -0
- package/tests/features/modal.feature +11 -0
- package/tests/features/path.feature +16 -0
- package/tests/features/response.feature +8 -0
- package/tests/features/responsive.feature +10 -0
- package/tests/features/table.feature +18 -0
- package/tests/features/test--given--i-am-an-anonymous-user.feature +10 -0
- package/tests/features/test--given--i-am-on-homepage.feature +16 -0
- package/tests/features/test--then--i-save-screenshot.feature +33 -0
- package/tests/features/test--then--i-see-locator.feature +320 -0
- package/tests/features/test--then--i-should--not--see-text-in-element.feature +13 -0
- package/tests/features/test--then--i-should--see-text-in-element-by-attr.feature +10 -0
- package/tests/features/test--then--i-should--see-text-in-element.feature +10 -0
- package/tests/features/test--then--i-should--see-text-matching-pattern-in-element.feature +13 -0
- package/tests/features/test--then--i-should--see-text-matching-pattern.feature +18 -0
- package/tests/features/test--then--i-should-be-on-page.feature +10 -0
- package/tests/features/test--then--i-should-be-on-the-homepage.feature +10 -0
- package/tests/features/test--then--i-should-not-see-an-element-by-attr.feature +8 -0
- package/tests/features/test--then--i-should-not-see-an-element.feature +8 -0
- package/tests/features/test--then--i-should-see-an-element-by-attr.feature +8 -0
- package/tests/features/test--then--i-should-see-an-element.feature +8 -0
- package/tests/features/test--then--i-should-see-n-elements.feature +24 -0
- package/tests/features/test--then--i-should-see-text-in-table-row.feature +96 -0
- package/tests/features/test--then--print-current-url-and-response.feature +21 -0
- package/tests/features/test--then--the-checkbox-is-checked.feature +18 -0
- package/tests/features/test--then--the-checkbox-should-be-checked.feature +16 -0
- package/tests/features/test--then--the-element-should-contain-cssproperty.feature +9 -0
- package/tests/features/test--then--the-element-should-not-contain-cssproperty.feature +10 -0
- package/tests/features/test--then--the-field-should-contain-value.feature +11 -0
- package/tests/features/test--then--the-response-should-contain.feature +11 -0
- package/tests/features/test--then--the-response-status-code-should-be.feature +31 -0
- package/tests/features/test--then--the-url-should-match.feature +7 -0
- package/tests/features/test--then-the-link-should-contain-by-attribute.feature +18 -0
- package/tests/features/test--then-the-link-should-contain.feature +7 -0
- package/tests/features/test--when--i-additionally-select.feature +30 -0
- package/tests/features/test--when--i-attach-file-to-feild.feature +9 -0
- package/tests/features/test--when--i-check-checkbox.feature +21 -0
- package/tests/features/test--when--i-click-link-by-attribute.feature +21 -0
- package/tests/features/test--when--i-click-link.feature +9 -0
- package/tests/features/test--when--i-click-text-in-table-row.feature +37 -0
- package/tests/features/test--when--i-fill-in-by-attr.feature +31 -0
- package/tests/features/test--when--i-fill-in-table-by-attr.feature +19 -0
- package/tests/features/test--when--i-fill-in.feature +32 -0
- package/tests/features/test--when--i-follow.feature +22 -0
- package/tests/features/test--when--i-go-to-homepage.feature +9 -0
- package/tests/features/test--when--i-move-forward-backward-one-page.feature +14 -0
- package/tests/features/test--when--i-press-button-by-attribute.feature +18 -0
- package/tests/features/test--when--i-press-button.feature +13 -0
- package/tests/features/test--when--i-reload-page.feature +11 -0
- package/tests/features/test--when--i-scroll-left-right.feature +48 -0
- package/tests/features/test--when--i-scroll.feature +48 -0
- package/tests/features/test--when--i-select-option-from-dropdownlist.feature +21 -0
- package/tests/features/test--when--i-select-radio-button.feature +37 -0
- package/tests/features/test--when--i-wait-page-is-loaded.feature +8 -0
- package/tests/features/test--when--i-wait-time.feature +21 -0
- package/tests/features/video.feature +18 -0
- package/tests/features/wait.feature +7 -0
- package/tests/features/yaml.feature +102 -0
- package/tests/selectors/_canonical-keys.json +113 -0
- package/tests/selectors/back-end-selectors.json +19 -0
- package/tests/selectors/cms-contentful-admin.json +35 -0
- package/tests/selectors/cms-craft-admin.json +39 -0
- package/tests/selectors/cms-drupal-cms-gin.json +56 -0
- package/tests/selectors/cms-drupal-core-claro.json +50 -0
- package/tests/selectors/cms-generic-admin.json +34 -0
- package/tests/selectors/cms-ghost-admin.json +34 -0
- package/tests/selectors/cms-joomla-admin.json +41 -0
- package/tests/selectors/cms-magento2-admin.json +32 -0
- package/tests/selectors/cms-prestashop-admin.json +38 -0
- package/tests/selectors/cms-shopify-admin.json +25 -0
- package/tests/selectors/cms-strapi-admin.json +42 -0
- package/tests/selectors/cms-typo3-admin.json +41 -0
- package/tests/selectors/cms-woocommerce-front.json +50 -0
- package/tests/selectors/cms-wordpress-admin.json +31 -0
- package/tests/selectors/framework-ant-design.json +80 -0
- package/tests/selectors/framework-bootstrap.json +86 -0
- package/tests/selectors/framework-bulma.json +74 -0
- package/tests/selectors/framework-chakra.json +58 -0
- package/tests/selectors/framework-foundation.json +51 -0
- package/tests/selectors/framework-material-ui.json +72 -0
- package/tests/selectors/framework-shadcn.json +51 -0
- package/tests/selectors/framework-tailwind.json +40 -0
- package/tests/selectors/framework-vuetify.json +61 -0
- package/tests/selectors/front-end-selectors.json +16 -0
- package/tests/selectors/homepage-selectors.json +13 -0
- package/tests/step-definitions/a11y.steps.js +800 -0
- package/tests/step-definitions/action.steps.js +167 -0
- package/tests/step-definitions/api.steps.js +732 -0
- package/tests/step-definitions/assertion.steps.js +352 -0
- package/tests/step-definitions/auth.steps.js +126 -0
- package/tests/step-definitions/clock.steps.js +128 -0
- package/tests/step-definitions/cookie.steps.js +216 -0
- package/tests/step-definitions/debug.steps.js +39 -0
- package/tests/step-definitions/dialog.steps.js +193 -0
- package/tests/step-definitions/drupal-canvas.steps.js +764 -0
- package/tests/step-definitions/drupal-ckeditor.steps.js +108 -0
- package/tests/step-definitions/drupal-core.steps.js +665 -0
- package/tests/step-definitions/drupal-helpers.js +371 -0
- package/tests/step-definitions/drupal-layout-builder.steps.js +466 -0
- package/tests/step-definitions/drupal-media.steps.js +99 -0
- package/tests/step-definitions/drupal-moderation.steps.js +71 -0
- package/tests/step-definitions/drupal-paragraphs.steps.js +50 -0
- package/tests/step-definitions/element.steps.js +356 -0
- package/tests/step-definitions/field.steps.js +653 -0
- package/tests/step-definitions/file-download.steps.js +211 -0
- package/tests/step-definitions/form.steps.js +333 -0
- package/tests/step-definitions/iframe.steps.js +228 -0
- package/tests/step-definitions/input.steps.js +202 -0
- package/tests/step-definitions/javascript.steps.js +232 -0
- package/tests/step-definitions/keyboard.steps.js +112 -0
- package/tests/step-definitions/link.steps.js +142 -0
- package/tests/step-definitions/metatag.steps.js +91 -0
- package/tests/step-definitions/modal.steps.js +244 -0
- package/tests/step-definitions/navigation.steps.js +218 -0
- package/tests/step-definitions/network.steps.js +280 -0
- package/tests/step-definitions/path.steps.js +141 -0
- package/tests/step-definitions/response.steps.js +98 -0
- package/tests/step-definitions/responsive.steps.js +125 -0
- package/tests/step-definitions/rest.steps.js +111 -0
- package/tests/step-definitions/screenshot.steps.js +423 -0
- package/tests/step-definitions/scroll.steps.js +189 -0
- package/tests/step-definitions/selectors.steps.js +1003 -0
- package/tests/step-definitions/storage.steps.js +194 -0
- package/tests/step-definitions/table.steps.js +181 -0
- package/tests/step-definitions/varbase-e2e.js +897 -0
- package/tests/step-definitions/varbase.steps.js +458 -0
- package/tests/step-definitions/video.steps.js +178 -0
- package/tests/step-definitions/wait.steps.js +400 -0
- package/tests/step-definitions/web-first.steps.js +298 -0
- package/tests/step-definitions/xml.steps.js +411 -0
- package/tests/step-definitions/yaml.steps.js +913 -0
- package/tsconfig.json +26 -0
|
@@ -0,0 +1,951 @@
|
|
|
1
|
+
# YAML responses steps
|
|
2
|
+
|
|
3
|
+
38 steps, defined in `tests/step-definitions/yaml.steps.js`.
|
|
4
|
+
|
|
5
|
+
Cucumber-js loads every `*.steps.js` in that directory automatically — you never `require()` a step file from a feature.
|
|
6
|
+
|
|
7
|
+
| # | Step |
|
|
8
|
+
| --- | --- |
|
|
9
|
+
| 1 | `Given the YAML response content from the file "config.yml"` |
|
|
10
|
+
| 2 | `Given the YAML response content is the following:` |
|
|
11
|
+
| 3 | `Given the active YAML document is 1` |
|
|
12
|
+
| 4 | `Then the YAML response should have 1 document` |
|
|
13
|
+
| 5 | `Then the response should be in YAML format` |
|
|
14
|
+
| 6 | `Then the response should not be in YAML format` |
|
|
15
|
+
| 7 | `Then the YAML should have no duplicate keys` |
|
|
16
|
+
| 8 | `Then the YAML element "/name" should exist` |
|
|
17
|
+
| 9 | `Then the YAML element "/missing" should not exist` |
|
|
18
|
+
| 10 | `Then the YAML element "/name" should be equal to "example"` |
|
|
19
|
+
| 11 | `Then the YAML element "/name" should not be equal to "Other"` |
|
|
20
|
+
| 12 | `Then the YAML element "/name" should contain "Web"` |
|
|
21
|
+
| 13 | `Then the YAML element "/name" should not contain "Error"` |
|
|
22
|
+
| 14 | `Then the YAML attribute "id" on element "/items/0" should exist` |
|
|
23
|
+
| 15 | `Then the YAML attribute "deprecated" on element "/items/0" should not exist` |
|
|
24
|
+
| 16 | `Then the YAML attribute "id" on element "/items/0" should be equal to "1"` |
|
|
25
|
+
| 17 | `Then the YAML attribute "id" on element "/items/0" should not be equal to "0"` |
|
|
26
|
+
| 18 | `Then the YAML attribute "id" on element "/items/0" should contain "abc"` |
|
|
27
|
+
| 19 | `Then the YAML attribute "id" on element "/items/0" should not contain "old"` |
|
|
28
|
+
| 20 | `Then the YAML element "/items" should have 5 elements` |
|
|
29
|
+
| 21 | `Then the YAML value at "/spec/replicas" should be of type "integer"` |
|
|
30
|
+
| 22 | `Then the YAML value at "/labels" should be empty` |
|
|
31
|
+
| 23 | `Then the YAML value at "/items" should not be empty` |
|
|
32
|
+
| 24 | `Then the YAML value at "/spec/replicas" should be greater than 0` |
|
|
33
|
+
| 25 | `Then the YAML value at "/spec/replicas" should be greater than or equal to 1` |
|
|
34
|
+
| 26 | `Then the YAML value at "/spec/replicas" should be less than 100` |
|
|
35
|
+
| 27 | `Then the YAML value at "/spec/replicas" should be less than or equal to 10` |
|
|
36
|
+
| 28 | `Then the YAML value at "/spec/replicas" should be between 1 and 10` |
|
|
37
|
+
| 29 | `Then the YAML array at "/spec/containers" should contain an item where "/name" is "nginx"` |
|
|
38
|
+
| 30 | `Then the YAML array at "/spec/containers" should contain no item where "/image" is "alpine:latest"` |
|
|
39
|
+
| 31 | `Then every item in "/spec/containers" should have key "image"` |
|
|
40
|
+
| 32 | `Then the YAML keys at "/metadata" should be exactly "name, namespace, labels"` |
|
|
41
|
+
| 33 | `Then the YAML at "/metadata" should have keys "name, namespace"` |
|
|
42
|
+
| 34 | `Then the YAML should match JSON Schema "schemas/deployment.json"` |
|
|
43
|
+
| 35 | `Then the YAML should equal the file "expected.yaml" ignoring keys "/metadata/resourceVersion"` |
|
|
44
|
+
| 36 | `Then the YAML should use the namespace "v1"` |
|
|
45
|
+
| 37 | `Then the YAML should not use the namespace "v0"` |
|
|
46
|
+
| 38 | `When I print last YAML response` |
|
|
47
|
+
|
|
48
|
+
---
|
|
49
|
+
|
|
50
|
+
## 1. Given the YAML response content from the file "config.yml"
|
|
51
|
+
|
|
52
|
+
Load YAML response content from a file under `tests/assets/`.
|
|
53
|
+
|
|
54
|
+
Multi-document streams (`---`) are parsed via `loadAll`. The first document
|
|
55
|
+
becomes the default; switch with `Given the active YAML document is N`.
|
|
56
|
+
|
|
57
|
+
**Keyword**: `Given`
|
|
58
|
+
|
|
59
|
+
**Pattern**
|
|
60
|
+
|
|
61
|
+
```js
|
|
62
|
+
'the YAML response content from the file {string}'
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
**Examples**
|
|
66
|
+
|
|
67
|
+
```gherkin
|
|
68
|
+
Given the YAML response content from the file "config.yml"
|
|
69
|
+
Given the YAML response content from the file "openapi.yaml"
|
|
70
|
+
And the YAML response content from the file "users.yml"
|
|
71
|
+
Given the YAML response content from the file "k8s-deployment.yaml"
|
|
72
|
+
Given the YAML response content from the file "/tmp/sample.yml"
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
## 2. Given the YAML response content is the following:
|
|
76
|
+
|
|
77
|
+
Set YAML response content inline from a Gherkin doc string. Supports
|
|
78
|
+
multi-document streams.
|
|
79
|
+
|
|
80
|
+
**Keyword**: `Given`
|
|
81
|
+
|
|
82
|
+
**Pattern**
|
|
83
|
+
|
|
84
|
+
```js
|
|
85
|
+
'the YAML response content is the following:'
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
**Examples**
|
|
89
|
+
|
|
90
|
+
```gherkin
|
|
91
|
+
Given the YAML response content is the following:
|
|
92
|
+
"""
|
|
93
|
+
name: example
|
|
94
|
+
version: 1.0.0
|
|
95
|
+
"""
|
|
96
|
+
Given the YAML response content is the following:
|
|
97
|
+
"""
|
|
98
|
+
items:
|
|
99
|
+
- id: 1
|
|
100
|
+
title: Hello
|
|
101
|
+
"""
|
|
102
|
+
And the YAML response content is the following:
|
|
103
|
+
"""
|
|
104
|
+
status: ok
|
|
105
|
+
count: 5
|
|
106
|
+
"""
|
|
107
|
+
Given the YAML response content is the following:
|
|
108
|
+
"""
|
|
109
|
+
apiVersion: v1
|
|
110
|
+
kind: ConfigMap
|
|
111
|
+
---
|
|
112
|
+
apiVersion: v1
|
|
113
|
+
kind: Service
|
|
114
|
+
"""
|
|
115
|
+
Given the YAML response content is the following:
|
|
116
|
+
"""
|
|
117
|
+
error:
|
|
118
|
+
code: 404
|
|
119
|
+
message: Not found
|
|
120
|
+
"""
|
|
121
|
+
```
|
|
122
|
+
|
|
123
|
+
## 3. Given the active YAML document is 1
|
|
124
|
+
|
|
125
|
+
Switch the active document for subsequent assertions. Index is 1-based to
|
|
126
|
+
match how Helm / `kubectl get -o yaml` users describe documents.
|
|
127
|
+
|
|
128
|
+
**Keyword**: `Given`
|
|
129
|
+
|
|
130
|
+
**Pattern**
|
|
131
|
+
|
|
132
|
+
```js
|
|
133
|
+
'the active YAML document is {int}'
|
|
134
|
+
```
|
|
135
|
+
|
|
136
|
+
**Examples**
|
|
137
|
+
|
|
138
|
+
```gherkin
|
|
139
|
+
Given the active YAML document is 1
|
|
140
|
+
Given the active YAML document is 2
|
|
141
|
+
And the active YAML document is 3
|
|
142
|
+
Given the active YAML document is 1
|
|
143
|
+
Then the YAML element "/kind" should be equal to "ConfigMap"
|
|
144
|
+
Given the active YAML document is 2
|
|
145
|
+
Then the YAML element "/kind" should be equal to "Service"
|
|
146
|
+
```
|
|
147
|
+
|
|
148
|
+
## 4. Then the YAML response should have 1 document
|
|
149
|
+
|
|
150
|
+
Assert the multi-document stream has exactly N documents.
|
|
151
|
+
|
|
152
|
+
**Keyword**: `Then`
|
|
153
|
+
|
|
154
|
+
**Pattern**
|
|
155
|
+
|
|
156
|
+
```js
|
|
157
|
+
'the YAML response should have {int} document(s)'
|
|
158
|
+
```
|
|
159
|
+
|
|
160
|
+
**Examples**
|
|
161
|
+
|
|
162
|
+
```gherkin
|
|
163
|
+
Then the YAML response should have 1 document
|
|
164
|
+
Then the YAML response should have 2 documents
|
|
165
|
+
And the YAML response should have 5 documents
|
|
166
|
+
Then the YAML response should have 0 documents
|
|
167
|
+
Then the YAML response should have 10 documents
|
|
168
|
+
```
|
|
169
|
+
|
|
170
|
+
## 5. Then the response should be in YAML format
|
|
171
|
+
|
|
172
|
+
Assert the loaded response parses as YAML.
|
|
173
|
+
|
|
174
|
+
**Keyword**: `Then`
|
|
175
|
+
|
|
176
|
+
**Pattern**
|
|
177
|
+
|
|
178
|
+
```js
|
|
179
|
+
'the response should be in YAML format'
|
|
180
|
+
```
|
|
181
|
+
|
|
182
|
+
**Examples**
|
|
183
|
+
|
|
184
|
+
```gherkin
|
|
185
|
+
Then the response should be in YAML format
|
|
186
|
+
Given the YAML response content from the file "openapi.yaml"
|
|
187
|
+
Then the response should be in YAML format
|
|
188
|
+
And the response should be in YAML format
|
|
189
|
+
Given the YAML response content is the following:
|
|
190
|
+
"""
|
|
191
|
+
key: value
|
|
192
|
+
"""
|
|
193
|
+
Then the response should be in YAML format
|
|
194
|
+
Then the response should be in YAML format
|
|
195
|
+
And the YAML element "/key" should exist
|
|
196
|
+
```
|
|
197
|
+
|
|
198
|
+
## 6. Then the response should not be in YAML format
|
|
199
|
+
|
|
200
|
+
Assert the loaded response is NOT valid YAML.
|
|
201
|
+
|
|
202
|
+
**Keyword**: `Then`
|
|
203
|
+
|
|
204
|
+
**Pattern**
|
|
205
|
+
|
|
206
|
+
```js
|
|
207
|
+
'the response should not be in YAML format'
|
|
208
|
+
```
|
|
209
|
+
|
|
210
|
+
**Examples**
|
|
211
|
+
|
|
212
|
+
```gherkin
|
|
213
|
+
Then the response should not be in YAML format
|
|
214
|
+
Given the YAML response content is the following:
|
|
215
|
+
"""
|
|
216
|
+
<not> yaml </not>
|
|
217
|
+
"""
|
|
218
|
+
Then the response should not be in YAML format
|
|
219
|
+
And the response should not be in YAML format
|
|
220
|
+
Given the YAML response content is the following:
|
|
221
|
+
"""
|
|
222
|
+
key: : :
|
|
223
|
+
"""
|
|
224
|
+
Then the response should not be in YAML format
|
|
225
|
+
Then the response should not be in YAML format
|
|
226
|
+
And I print last YAML response
|
|
227
|
+
```
|
|
228
|
+
|
|
229
|
+
## 7. Then the YAML should have no duplicate keys
|
|
230
|
+
|
|
231
|
+
Assert the YAML has no duplicate keys at any level. Uses js-yaml's
|
|
232
|
+
`onWarning` hook (duplicates raise warnings under default schema).
|
|
233
|
+
|
|
234
|
+
**Keyword**: `Then`
|
|
235
|
+
|
|
236
|
+
**Pattern**
|
|
237
|
+
|
|
238
|
+
```js
|
|
239
|
+
'the YAML should have no duplicate keys'
|
|
240
|
+
```
|
|
241
|
+
|
|
242
|
+
**Examples**
|
|
243
|
+
|
|
244
|
+
```gherkin
|
|
245
|
+
Then the YAML should have no duplicate keys
|
|
246
|
+
Given the YAML response content is the following:
|
|
247
|
+
"""
|
|
248
|
+
name: A
|
|
249
|
+
version: 1
|
|
250
|
+
"""
|
|
251
|
+
Then the YAML should have no duplicate keys
|
|
252
|
+
And the YAML should have no duplicate keys
|
|
253
|
+
Then the YAML should have no duplicate keys
|
|
254
|
+
And the YAML element "/name" should be equal to "A"
|
|
255
|
+
Then the YAML should have no duplicate keys
|
|
256
|
+
```
|
|
257
|
+
|
|
258
|
+
## 8. Then the YAML element "/name" should exist
|
|
259
|
+
|
|
260
|
+
Assert at least one YAML node matches a path.
|
|
261
|
+
|
|
262
|
+
**Keyword**: `Then`
|
|
263
|
+
|
|
264
|
+
**Pattern**
|
|
265
|
+
|
|
266
|
+
```js
|
|
267
|
+
'the YAML element {string} should exist'
|
|
268
|
+
```
|
|
269
|
+
|
|
270
|
+
**Examples**
|
|
271
|
+
|
|
272
|
+
```gherkin
|
|
273
|
+
Then the YAML element "/name" should exist
|
|
274
|
+
Then the YAML element "/items/0/title" should exist
|
|
275
|
+
And the YAML element "/error/code" should exist
|
|
276
|
+
Then the YAML element "/spec/replicas" should exist
|
|
277
|
+
Then the YAML element "/users/2/email" should exist
|
|
278
|
+
```
|
|
279
|
+
|
|
280
|
+
## 9. Then the YAML element "/missing" should not exist
|
|
281
|
+
|
|
282
|
+
Assert NO YAML node matches a path.
|
|
283
|
+
|
|
284
|
+
**Keyword**: `Then`
|
|
285
|
+
|
|
286
|
+
**Pattern**
|
|
287
|
+
|
|
288
|
+
```js
|
|
289
|
+
'the YAML element {string} should not exist'
|
|
290
|
+
```
|
|
291
|
+
|
|
292
|
+
**Examples**
|
|
293
|
+
|
|
294
|
+
```gherkin
|
|
295
|
+
Then the YAML element "/missing" should not exist
|
|
296
|
+
Then the YAML element "/items/100" should not exist
|
|
297
|
+
And the YAML element "/legacy/field" should not exist
|
|
298
|
+
Then the YAML element "/spec/internal" should not exist
|
|
299
|
+
Then the YAML element "/error/refund" should not exist
|
|
300
|
+
```
|
|
301
|
+
|
|
302
|
+
## 10. Then the YAML element "/name" should be equal to "example"
|
|
303
|
+
|
|
304
|
+
Assert a YAML node's scalar value equals an expected value.
|
|
305
|
+
|
|
306
|
+
**Keyword**: `Then`
|
|
307
|
+
|
|
308
|
+
**Pattern**
|
|
309
|
+
|
|
310
|
+
```js
|
|
311
|
+
'the YAML element {string} should be equal to {string}'
|
|
312
|
+
```
|
|
313
|
+
|
|
314
|
+
**Examples**
|
|
315
|
+
|
|
316
|
+
```gherkin
|
|
317
|
+
Then the YAML element "/name" should be equal to "example"
|
|
318
|
+
Then the YAML element "/version" should be equal to "2.5.2"
|
|
319
|
+
And the YAML element "/items/0/title" should be equal to "Hello"
|
|
320
|
+
Then the YAML element "/error/code" should be equal to "404"
|
|
321
|
+
Then the YAML element "/status" should be equal to "ok"
|
|
322
|
+
```
|
|
323
|
+
|
|
324
|
+
## 11. Then the YAML element "/name" should not be equal to "Other"
|
|
325
|
+
|
|
326
|
+
Assert a YAML node's scalar value is NOT equal to an expected value.
|
|
327
|
+
|
|
328
|
+
**Keyword**: `Then`
|
|
329
|
+
|
|
330
|
+
**Pattern**
|
|
331
|
+
|
|
332
|
+
```js
|
|
333
|
+
'the YAML element {string} should not be equal to {string}'
|
|
334
|
+
```
|
|
335
|
+
|
|
336
|
+
**Examples**
|
|
337
|
+
|
|
338
|
+
```gherkin
|
|
339
|
+
Then the YAML element "/name" should not be equal to "Other"
|
|
340
|
+
Then the YAML element "/version" should not be equal to "1.0.0"
|
|
341
|
+
And the YAML element "/items/0/title" should not be equal to "Bye"
|
|
342
|
+
Then the YAML element "/error/code" should not be equal to "200"
|
|
343
|
+
Then the YAML element "/status" should not be equal to "fail"
|
|
344
|
+
```
|
|
345
|
+
|
|
346
|
+
## 12. Then the YAML element "/name" should contain "Web"
|
|
347
|
+
|
|
348
|
+
Assert a YAML node's serialised value contains a substring.
|
|
349
|
+
|
|
350
|
+
**Keyword**: `Then`
|
|
351
|
+
|
|
352
|
+
**Pattern**
|
|
353
|
+
|
|
354
|
+
```js
|
|
355
|
+
'the YAML element {string} should contain {string}'
|
|
356
|
+
```
|
|
357
|
+
|
|
358
|
+
**Examples**
|
|
359
|
+
|
|
360
|
+
```gherkin
|
|
361
|
+
Then the YAML element "/name" should contain "Web"
|
|
362
|
+
Then the YAML element "/items/0/title" should contain "Hello"
|
|
363
|
+
And the YAML element "/spec" should contain "replicas"
|
|
364
|
+
Then the YAML element "/error/message" should contain "Not"
|
|
365
|
+
Then the YAML element "/status" should contain "ok"
|
|
366
|
+
```
|
|
367
|
+
|
|
368
|
+
## 13. Then the YAML element "/name" should not contain "Error"
|
|
369
|
+
|
|
370
|
+
Assert a YAML node's serialised value does NOT contain a substring.
|
|
371
|
+
|
|
372
|
+
**Keyword**: `Then`
|
|
373
|
+
|
|
374
|
+
**Pattern**
|
|
375
|
+
|
|
376
|
+
```js
|
|
377
|
+
'the YAML element {string} should not contain {string}'
|
|
378
|
+
```
|
|
379
|
+
|
|
380
|
+
**Examples**
|
|
381
|
+
|
|
382
|
+
```gherkin
|
|
383
|
+
Then the YAML element "/name" should not contain "Error"
|
|
384
|
+
Then the YAML element "/items/0/title" should not contain "fail"
|
|
385
|
+
And the YAML element "/spec" should not contain "deprecated"
|
|
386
|
+
Then the YAML element "/error/message" should not contain "OK"
|
|
387
|
+
Then the YAML element "/status" should not contain "fatal"
|
|
388
|
+
```
|
|
389
|
+
|
|
390
|
+
## 14. Then the YAML attribute "id" on element "/items/0" should exist
|
|
391
|
+
|
|
392
|
+
Assert a YAML node has a direct child key.
|
|
393
|
+
|
|
394
|
+
**Keyword**: `Then`
|
|
395
|
+
|
|
396
|
+
**Pattern**
|
|
397
|
+
|
|
398
|
+
```js
|
|
399
|
+
'the YAML attribute {string} on element {string} should exist'
|
|
400
|
+
```
|
|
401
|
+
|
|
402
|
+
**Examples**
|
|
403
|
+
|
|
404
|
+
```gherkin
|
|
405
|
+
Then the YAML attribute "id" on element "/items/0" should exist
|
|
406
|
+
Then the YAML attribute "kind" on element "/" should exist
|
|
407
|
+
And the YAML attribute "code" on element "/error" should exist
|
|
408
|
+
Then the YAML attribute "replicas" on element "/spec" should exist
|
|
409
|
+
Then the YAML attribute "email" on element "/users/0" should exist
|
|
410
|
+
```
|
|
411
|
+
|
|
412
|
+
## 15. Then the YAML attribute "deprecated" on element "/items/0" should not exist
|
|
413
|
+
|
|
414
|
+
Assert a YAML node does NOT have a direct child key.
|
|
415
|
+
|
|
416
|
+
**Keyword**: `Then`
|
|
417
|
+
|
|
418
|
+
**Pattern**
|
|
419
|
+
|
|
420
|
+
```js
|
|
421
|
+
'the YAML attribute {string} on element {string} should not exist'
|
|
422
|
+
```
|
|
423
|
+
|
|
424
|
+
**Examples**
|
|
425
|
+
|
|
426
|
+
```gherkin
|
|
427
|
+
Then the YAML attribute "deprecated" on element "/items/0" should not exist
|
|
428
|
+
Then the YAML attribute "secret" on element "/" should not exist
|
|
429
|
+
And the YAML attribute "internal" on element "/spec" should not exist
|
|
430
|
+
Then the YAML attribute "private" on element "/error" should not exist
|
|
431
|
+
Then the YAML attribute "_legacy" on element "/users/0" should not exist
|
|
432
|
+
```
|
|
433
|
+
|
|
434
|
+
## 16. Then the YAML attribute "id" on element "/items/0" should be equal to "1"
|
|
435
|
+
|
|
436
|
+
Assert a YAML child key's value equals an expected value.
|
|
437
|
+
|
|
438
|
+
**Keyword**: `Then`
|
|
439
|
+
|
|
440
|
+
**Pattern**
|
|
441
|
+
|
|
442
|
+
```js
|
|
443
|
+
'the YAML attribute {string} on element {string} should be equal to {string}'
|
|
444
|
+
```
|
|
445
|
+
|
|
446
|
+
**Examples**
|
|
447
|
+
|
|
448
|
+
```gherkin
|
|
449
|
+
Then the YAML attribute "id" on element "/items/0" should be equal to "1"
|
|
450
|
+
Then the YAML attribute "kind" on element "/" should be equal to "ConfigMap"
|
|
451
|
+
And the YAML attribute "code" on element "/error" should be equal to "404"
|
|
452
|
+
Then the YAML attribute "replicas" on element "/spec" should be equal to "3"
|
|
453
|
+
Then the YAML attribute "version" on element "/" should be equal to "v1"
|
|
454
|
+
```
|
|
455
|
+
|
|
456
|
+
## 17. Then the YAML attribute "id" on element "/items/0" should not be equal to "0"
|
|
457
|
+
|
|
458
|
+
Assert a YAML child key's value is NOT equal to an expected value.
|
|
459
|
+
|
|
460
|
+
**Keyword**: `Then`
|
|
461
|
+
|
|
462
|
+
**Pattern**
|
|
463
|
+
|
|
464
|
+
```js
|
|
465
|
+
'the YAML attribute {string} on element {string} should not be equal to {string}'
|
|
466
|
+
```
|
|
467
|
+
|
|
468
|
+
**Examples**
|
|
469
|
+
|
|
470
|
+
```gherkin
|
|
471
|
+
Then the YAML attribute "id" on element "/items/0" should not be equal to "0"
|
|
472
|
+
Then the YAML attribute "kind" on element "/" should not be equal to "Secret"
|
|
473
|
+
And the YAML attribute "code" on element "/error" should not be equal to "200"
|
|
474
|
+
Then the YAML attribute "replicas" on element "/spec" should not be equal to "0"
|
|
475
|
+
Then the YAML attribute "version" on element "/" should not be equal to "v0"
|
|
476
|
+
```
|
|
477
|
+
|
|
478
|
+
## 18. Then the YAML attribute "id" on element "/items/0" should contain "abc"
|
|
479
|
+
|
|
480
|
+
Assert a YAML child key's serialised value contains a substring.
|
|
481
|
+
|
|
482
|
+
**Keyword**: `Then`
|
|
483
|
+
|
|
484
|
+
**Pattern**
|
|
485
|
+
|
|
486
|
+
```js
|
|
487
|
+
'the YAML attribute {string} on element {string} should contain {string}'
|
|
488
|
+
```
|
|
489
|
+
|
|
490
|
+
**Examples**
|
|
491
|
+
|
|
492
|
+
```gherkin
|
|
493
|
+
Then the YAML attribute "id" on element "/items/0" should contain "abc"
|
|
494
|
+
Then the YAML attribute "image" on element "/spec" should contain "nginx"
|
|
495
|
+
And the YAML attribute "kind" on element "/" should contain "Map"
|
|
496
|
+
Then the YAML attribute "version" on element "/" should contain "v"
|
|
497
|
+
Then the YAML attribute "code" on element "/error" should contain "4"
|
|
498
|
+
```
|
|
499
|
+
|
|
500
|
+
## 19. Then the YAML attribute "id" on element "/items/0" should not contain "old"
|
|
501
|
+
|
|
502
|
+
Assert a YAML child key's serialised value does NOT contain a substring.
|
|
503
|
+
|
|
504
|
+
**Keyword**: `Then`
|
|
505
|
+
|
|
506
|
+
**Pattern**
|
|
507
|
+
|
|
508
|
+
```js
|
|
509
|
+
'the YAML attribute {string} on element {string} should not contain {string}'
|
|
510
|
+
```
|
|
511
|
+
|
|
512
|
+
**Examples**
|
|
513
|
+
|
|
514
|
+
```gherkin
|
|
515
|
+
Then the YAML attribute "id" on element "/items/0" should not contain "old"
|
|
516
|
+
Then the YAML attribute "image" on element "/spec" should not contain "alpine"
|
|
517
|
+
And the YAML attribute "kind" on element "/" should not contain "Secret"
|
|
518
|
+
Then the YAML attribute "version" on element "/" should not contain "alpha"
|
|
519
|
+
Then the YAML attribute "code" on element "/error" should not contain "5"
|
|
520
|
+
```
|
|
521
|
+
|
|
522
|
+
## 20. Then the YAML element "/items" should have 5 elements
|
|
523
|
+
|
|
524
|
+
Assert a YAML sequence / mapping at a path has exactly N entries.
|
|
525
|
+
|
|
526
|
+
**Keyword**: `Then`
|
|
527
|
+
|
|
528
|
+
**Pattern**
|
|
529
|
+
|
|
530
|
+
```js
|
|
531
|
+
'the YAML element {string} should have {int} element(s)'
|
|
532
|
+
```
|
|
533
|
+
|
|
534
|
+
**Examples**
|
|
535
|
+
|
|
536
|
+
```gherkin
|
|
537
|
+
Then the YAML element "/items" should have 5 elements
|
|
538
|
+
Then the YAML element "/users" should have 3 elements
|
|
539
|
+
And the YAML element "/spec/containers" should have 1 element
|
|
540
|
+
Then the YAML element "/errors" should have 0 elements
|
|
541
|
+
Then the YAML element "/feed/entries" should have 10 elements
|
|
542
|
+
```
|
|
543
|
+
|
|
544
|
+
## 21. Then the YAML value at "/spec/replicas" should be of type "integer"
|
|
545
|
+
|
|
546
|
+
Assert a YAML node's type. Accepts: string, integer, number, boolean,
|
|
547
|
+
array, object, null.
|
|
548
|
+
|
|
549
|
+
**Keyword**: `Then`
|
|
550
|
+
|
|
551
|
+
**Pattern**
|
|
552
|
+
|
|
553
|
+
```js
|
|
554
|
+
'the YAML value at {string} should be of type {string}'
|
|
555
|
+
```
|
|
556
|
+
|
|
557
|
+
**Examples**
|
|
558
|
+
|
|
559
|
+
```gherkin
|
|
560
|
+
Then the YAML value at "/spec/replicas" should be of type "integer"
|
|
561
|
+
Then the YAML value at "/metadata/name" should be of type "string"
|
|
562
|
+
And the YAML value at "/spec/containers" should be of type "array"
|
|
563
|
+
Then the YAML value at "/spec" should be of type "object"
|
|
564
|
+
Then the YAML value at "/spec/paused" should be of type "boolean"
|
|
565
|
+
```
|
|
566
|
+
|
|
567
|
+
## 22. Then the YAML value at "/labels" should be empty
|
|
568
|
+
|
|
569
|
+
Assert a YAML node is empty: empty string, empty array, empty object, or null.
|
|
570
|
+
|
|
571
|
+
**Keyword**: `Then`
|
|
572
|
+
|
|
573
|
+
**Pattern**
|
|
574
|
+
|
|
575
|
+
```js
|
|
576
|
+
'the YAML value at {string} should be empty'
|
|
577
|
+
```
|
|
578
|
+
|
|
579
|
+
**Examples**
|
|
580
|
+
|
|
581
|
+
```gherkin
|
|
582
|
+
Then the YAML value at "/labels" should be empty
|
|
583
|
+
Then the YAML value at "/items" should be empty
|
|
584
|
+
And the YAML value at "/error" should be empty
|
|
585
|
+
Then the YAML value at "/notes" should be empty
|
|
586
|
+
Then the YAML value at "/status/conditions" should be empty
|
|
587
|
+
```
|
|
588
|
+
|
|
589
|
+
## 23. Then the YAML value at "/items" should not be empty
|
|
590
|
+
|
|
591
|
+
Assert a YAML node is non-empty.
|
|
592
|
+
|
|
593
|
+
**Keyword**: `Then`
|
|
594
|
+
|
|
595
|
+
**Pattern**
|
|
596
|
+
|
|
597
|
+
```js
|
|
598
|
+
'the YAML value at {string} should not be empty'
|
|
599
|
+
```
|
|
600
|
+
|
|
601
|
+
**Examples**
|
|
602
|
+
|
|
603
|
+
```gherkin
|
|
604
|
+
Then the YAML value at "/items" should not be empty
|
|
605
|
+
Then the YAML value at "/spec/containers" should not be empty
|
|
606
|
+
And the YAML value at "/metadata/name" should not be empty
|
|
607
|
+
Then the YAML value at "/users" should not be empty
|
|
608
|
+
Then the YAML value at "/spec/replicas" should not be empty
|
|
609
|
+
```
|
|
610
|
+
|
|
611
|
+
## 24. Then the YAML value at "/spec/replicas" should be greater than 0
|
|
612
|
+
|
|
613
|
+
Assert a numeric YAML node is greater than a value.
|
|
614
|
+
|
|
615
|
+
**Keyword**: `Then`
|
|
616
|
+
|
|
617
|
+
**Pattern**
|
|
618
|
+
|
|
619
|
+
```js
|
|
620
|
+
'the YAML value at {string} should be greater than {float}'
|
|
621
|
+
```
|
|
622
|
+
|
|
623
|
+
**Examples**
|
|
624
|
+
|
|
625
|
+
```gherkin
|
|
626
|
+
Then the YAML value at "/spec/replicas" should be greater than 0
|
|
627
|
+
Then the YAML value at "/timeout" should be greater than 5
|
|
628
|
+
And the YAML value at "/spec/minReadySeconds" should be greater than 0
|
|
629
|
+
Then the YAML value at "/limits/cpu" should be greater than 100
|
|
630
|
+
Then the YAML value at "/version/major" should be greater than 1
|
|
631
|
+
```
|
|
632
|
+
|
|
633
|
+
## 25. Then the YAML value at "/spec/replicas" should be greater than or equal to 1
|
|
634
|
+
|
|
635
|
+
Assert a numeric YAML node is greater than or equal to a value.
|
|
636
|
+
|
|
637
|
+
**Keyword**: `Then`
|
|
638
|
+
|
|
639
|
+
**Pattern**
|
|
640
|
+
|
|
641
|
+
```js
|
|
642
|
+
'the YAML value at {string} should be greater than or equal to {float}'
|
|
643
|
+
```
|
|
644
|
+
|
|
645
|
+
**Examples**
|
|
646
|
+
|
|
647
|
+
```gherkin
|
|
648
|
+
Then the YAML value at "/spec/replicas" should be greater than or equal to 1
|
|
649
|
+
Then the YAML value at "/retries" should be greater than or equal to 0
|
|
650
|
+
And the YAML value at "/timeout" should be greater than or equal to 30
|
|
651
|
+
Then the YAML value at "/version/major" should be greater than or equal to 2
|
|
652
|
+
Then the YAML value at "/limits/cpu" should be greater than or equal to 250
|
|
653
|
+
```
|
|
654
|
+
|
|
655
|
+
## 26. Then the YAML value at "/spec/replicas" should be less than 100
|
|
656
|
+
|
|
657
|
+
Assert a numeric YAML node is less than a value.
|
|
658
|
+
|
|
659
|
+
**Keyword**: `Then`
|
|
660
|
+
|
|
661
|
+
**Pattern**
|
|
662
|
+
|
|
663
|
+
```js
|
|
664
|
+
'the YAML value at {string} should be less than {float}'
|
|
665
|
+
```
|
|
666
|
+
|
|
667
|
+
**Examples**
|
|
668
|
+
|
|
669
|
+
```gherkin
|
|
670
|
+
Then the YAML value at "/spec/replicas" should be less than 100
|
|
671
|
+
Then the YAML value at "/error/code" should be less than 500
|
|
672
|
+
And the YAML value at "/timeout" should be less than 60
|
|
673
|
+
Then the YAML value at "/version/minor" should be less than 10
|
|
674
|
+
Then the YAML value at "/cost" should be less than 1000
|
|
675
|
+
```
|
|
676
|
+
|
|
677
|
+
## 27. Then the YAML value at "/spec/replicas" should be less than or equal to 10
|
|
678
|
+
|
|
679
|
+
Assert a numeric YAML node is less than or equal to a value.
|
|
680
|
+
|
|
681
|
+
**Keyword**: `Then`
|
|
682
|
+
|
|
683
|
+
**Pattern**
|
|
684
|
+
|
|
685
|
+
```js
|
|
686
|
+
'the YAML value at {string} should be less than or equal to {float}'
|
|
687
|
+
```
|
|
688
|
+
|
|
689
|
+
**Examples**
|
|
690
|
+
|
|
691
|
+
```gherkin
|
|
692
|
+
Then the YAML value at "/spec/replicas" should be less than or equal to 10
|
|
693
|
+
Then the YAML value at "/retries" should be less than or equal to 5
|
|
694
|
+
And the YAML value at "/timeout" should be less than or equal to 60
|
|
695
|
+
Then the YAML value at "/error/code" should be less than or equal to 599
|
|
696
|
+
Then the YAML value at "/version/major" should be less than or equal to 3
|
|
697
|
+
```
|
|
698
|
+
|
|
699
|
+
## 28. Then the YAML value at "/spec/replicas" should be between 1 and 10
|
|
700
|
+
|
|
701
|
+
Assert a numeric YAML node falls within an inclusive range.
|
|
702
|
+
|
|
703
|
+
**Keyword**: `Then`
|
|
704
|
+
|
|
705
|
+
**Pattern**
|
|
706
|
+
|
|
707
|
+
```js
|
|
708
|
+
'the YAML value at {string} should be between {float} and {float}'
|
|
709
|
+
```
|
|
710
|
+
|
|
711
|
+
**Examples**
|
|
712
|
+
|
|
713
|
+
```gherkin
|
|
714
|
+
Then the YAML value at "/spec/replicas" should be between 1 and 10
|
|
715
|
+
Then the YAML value at "/timeout" should be between 5 and 60
|
|
716
|
+
And the YAML value at "/error/code" should be between 400 and 499
|
|
717
|
+
Then the YAML value at "/cpu" should be between 100 and 1000
|
|
718
|
+
Then the YAML value at "/version/major" should be between 2 and 5
|
|
719
|
+
```
|
|
720
|
+
|
|
721
|
+
## 29. Then the YAML array at "/spec/containers" should contain an item where "/name" is "nginx"
|
|
722
|
+
|
|
723
|
+
Assert an array contains an item where a sub-key has the expected value.
|
|
724
|
+
Sub-key path is relative to each item; supports the same `/a/b[0]` syntax.
|
|
725
|
+
|
|
726
|
+
**Keyword**: `Then`
|
|
727
|
+
|
|
728
|
+
**Pattern**
|
|
729
|
+
|
|
730
|
+
```js
|
|
731
|
+
'the YAML array at {string} should contain an item where {string} is {string}'
|
|
732
|
+
```
|
|
733
|
+
|
|
734
|
+
**Examples**
|
|
735
|
+
|
|
736
|
+
```gherkin
|
|
737
|
+
Then the YAML array at "/spec/containers" should contain an item where "/name" is "nginx"
|
|
738
|
+
Then the YAML array at "/items" should contain an item where "/kind" is "Service"
|
|
739
|
+
And the YAML array at "/users" should contain an item where "/email" is "alice@example.com"
|
|
740
|
+
Then the YAML array at "/rules" should contain an item where "/host" is "example.com"
|
|
741
|
+
Then the YAML array at "/spec/ports" should contain an item where "/port" is "443"
|
|
742
|
+
```
|
|
743
|
+
|
|
744
|
+
## 30. Then the YAML array at "/spec/containers" should contain no item where "/image" is "alpine:latest"
|
|
745
|
+
|
|
746
|
+
Assert NO item in an array has a sub-key matching a value.
|
|
747
|
+
|
|
748
|
+
**Keyword**: `Then`
|
|
749
|
+
|
|
750
|
+
**Pattern**
|
|
751
|
+
|
|
752
|
+
```js
|
|
753
|
+
'the YAML array at {string} should contain no item where {string} is {string}'
|
|
754
|
+
```
|
|
755
|
+
|
|
756
|
+
**Examples**
|
|
757
|
+
|
|
758
|
+
```gherkin
|
|
759
|
+
Then the YAML array at "/spec/containers" should contain no item where "/image" is "alpine:latest"
|
|
760
|
+
Then the YAML array at "/users" should contain no item where "/role" is "anonymous"
|
|
761
|
+
And the YAML array at "/rules" should contain no item where "/host" is "deprecated.example.com"
|
|
762
|
+
Then the YAML array at "/spec/env" should contain no item where "/name" is "DEBUG"
|
|
763
|
+
Then the YAML array at "/items" should contain no item where "/status" is "failed"
|
|
764
|
+
```
|
|
765
|
+
|
|
766
|
+
## 31. Then every item in "/spec/containers" should have key "image"
|
|
767
|
+
|
|
768
|
+
Assert every item in an array has a non-null sub-key.
|
|
769
|
+
|
|
770
|
+
**Keyword**: `Then`
|
|
771
|
+
|
|
772
|
+
**Pattern**
|
|
773
|
+
|
|
774
|
+
```js
|
|
775
|
+
'every item in {string} should have key {string}'
|
|
776
|
+
```
|
|
777
|
+
|
|
778
|
+
**Examples**
|
|
779
|
+
|
|
780
|
+
```gherkin
|
|
781
|
+
Then every item in "/spec/containers" should have key "image"
|
|
782
|
+
Then every item in "/users" should have key "email"
|
|
783
|
+
And every item in "/spec/ports" should have key "port"
|
|
784
|
+
Then every item in "/items" should have key "kind"
|
|
785
|
+
Then every item in "/spec/rules" should have key "host"
|
|
786
|
+
```
|
|
787
|
+
|
|
788
|
+
## 32. Then the YAML keys at "/metadata" should be exactly "name, namespace, labels"
|
|
789
|
+
|
|
790
|
+
Assert the keys at a path exactly match a comma-separated list (no extras).
|
|
791
|
+
|
|
792
|
+
**Keyword**: `Then`
|
|
793
|
+
|
|
794
|
+
**Pattern**
|
|
795
|
+
|
|
796
|
+
```js
|
|
797
|
+
'the YAML keys at {string} should be exactly {string}'
|
|
798
|
+
```
|
|
799
|
+
|
|
800
|
+
**Examples**
|
|
801
|
+
|
|
802
|
+
```gherkin
|
|
803
|
+
Then the YAML keys at "/metadata" should be exactly "name, namespace, labels"
|
|
804
|
+
Then the YAML keys at "/spec" should be exactly "replicas, selector, template"
|
|
805
|
+
And the YAML keys at "/error" should be exactly "code, message"
|
|
806
|
+
Then the YAML keys at "/" should be exactly "apiVersion, kind, metadata, spec"
|
|
807
|
+
Then the YAML keys at "/users/0" should be exactly "id, name, email"
|
|
808
|
+
```
|
|
809
|
+
|
|
810
|
+
## 33. Then the YAML at "/metadata" should have keys "name, namespace"
|
|
811
|
+
|
|
812
|
+
Assert every required key is present at a path (extras allowed).
|
|
813
|
+
|
|
814
|
+
**Keyword**: `Then`
|
|
815
|
+
|
|
816
|
+
**Pattern**
|
|
817
|
+
|
|
818
|
+
```js
|
|
819
|
+
'the YAML at {string} should have keys {string}'
|
|
820
|
+
```
|
|
821
|
+
|
|
822
|
+
**Examples**
|
|
823
|
+
|
|
824
|
+
```gherkin
|
|
825
|
+
Then the YAML at "/metadata" should have keys "name, namespace"
|
|
826
|
+
Then the YAML at "/spec" should have keys "replicas, selector"
|
|
827
|
+
And the YAML at "/" should have keys "apiVersion, kind"
|
|
828
|
+
Then the YAML at "/error" should have keys "code, message"
|
|
829
|
+
Then the YAML at "/users/0" should have keys "id, email"
|
|
830
|
+
```
|
|
831
|
+
|
|
832
|
+
## 34. Then the YAML should match JSON Schema "schemas/deployment.json"
|
|
833
|
+
|
|
834
|
+
Validate the active YAML document against a JSON Schema file. Bundles
|
|
835
|
+
`ajv-formats` so schemas using `format: date-time`, `email`, `uri`, etc.
|
|
836
|
+
work out of the box.
|
|
837
|
+
|
|
838
|
+
**Keyword**: `Then`
|
|
839
|
+
|
|
840
|
+
**Pattern**
|
|
841
|
+
|
|
842
|
+
```js
|
|
843
|
+
'the YAML should match JSON Schema {string}'
|
|
844
|
+
```
|
|
845
|
+
|
|
846
|
+
**Examples**
|
|
847
|
+
|
|
848
|
+
```gherkin
|
|
849
|
+
Then the YAML should match JSON Schema "schemas/deployment.json"
|
|
850
|
+
Then the YAML should match JSON Schema "tests/schemas/openapi-3.1.json"
|
|
851
|
+
And the YAML should match JSON Schema "schemas/configmap.json"
|
|
852
|
+
Then the YAML should match JSON Schema "schemas/github-workflow.json"
|
|
853
|
+
Then the YAML should match JSON Schema "/abs/path/to/schema.json"
|
|
854
|
+
```
|
|
855
|
+
|
|
856
|
+
## 35. Then the YAML should equal the file "expected.yaml" ignoring keys "/metadata/resourceVersion"
|
|
857
|
+
|
|
858
|
+
Assert the active YAML document equals the contents of an expected file,
|
|
859
|
+
after removing the listed JSON Pointer paths from both sides. Common
|
|
860
|
+
use: ignoring volatile fields like `metadata.resourceVersion` or
|
|
861
|
+
`status` when diffing Kubernetes manifests.
|
|
862
|
+
|
|
863
|
+
**Keyword**: `Then`
|
|
864
|
+
|
|
865
|
+
**Pattern**
|
|
866
|
+
|
|
867
|
+
```js
|
|
868
|
+
'the YAML should equal the file {string} ignoring keys {string}'
|
|
869
|
+
```
|
|
870
|
+
|
|
871
|
+
**Examples**
|
|
872
|
+
|
|
873
|
+
```gherkin
|
|
874
|
+
Then the YAML should equal the file "expected.yaml" ignoring keys "/metadata/resourceVersion"
|
|
875
|
+
Then the YAML should equal the file "expected.yaml" ignoring keys "/status, /metadata/uid"
|
|
876
|
+
And the YAML should equal the file "golden.yaml" ignoring keys "/metadata/creationTimestamp"
|
|
877
|
+
Then the YAML should equal the file "expected.yml" ignoring keys ""
|
|
878
|
+
Then the YAML should equal the file "tests/golden/deploy.yaml" ignoring keys "/status, /metadata/uid, /metadata/resourceVersion"
|
|
879
|
+
```
|
|
880
|
+
|
|
881
|
+
## 36. Then the YAML should use the namespace "v1"
|
|
882
|
+
|
|
883
|
+
Assert the YAML document declares a namespace value (mirrors xml.steps.js).
|
|
884
|
+
Checks top-level scalar values and falls back to a raw-text scan.
|
|
885
|
+
|
|
886
|
+
**Keyword**: `Then`
|
|
887
|
+
|
|
888
|
+
**Pattern**
|
|
889
|
+
|
|
890
|
+
```js
|
|
891
|
+
'the YAML should use the namespace {string}'
|
|
892
|
+
```
|
|
893
|
+
|
|
894
|
+
**Examples**
|
|
895
|
+
|
|
896
|
+
```gherkin
|
|
897
|
+
Then the YAML should use the namespace "v1"
|
|
898
|
+
Then the YAML should use the namespace "apps/v1"
|
|
899
|
+
And the YAML should use the namespace "kustomize.config.k8s.io/v1beta1"
|
|
900
|
+
Then the YAML should use the namespace "argoproj.io/v1alpha1"
|
|
901
|
+
Then the YAML should use the namespace "openapi: 3.0.3"
|
|
902
|
+
```
|
|
903
|
+
|
|
904
|
+
## 37. Then the YAML should not use the namespace "v0"
|
|
905
|
+
|
|
906
|
+
Assert the YAML document does NOT declare a namespace value.
|
|
907
|
+
|
|
908
|
+
**Keyword**: `Then`
|
|
909
|
+
|
|
910
|
+
**Pattern**
|
|
911
|
+
|
|
912
|
+
```js
|
|
913
|
+
'the YAML should not use the namespace {string}'
|
|
914
|
+
```
|
|
915
|
+
|
|
916
|
+
**Examples**
|
|
917
|
+
|
|
918
|
+
```gherkin
|
|
919
|
+
Then the YAML should not use the namespace "v0"
|
|
920
|
+
Then the YAML should not use the namespace "internal/v1"
|
|
921
|
+
And the YAML should not use the namespace "legacy"
|
|
922
|
+
Then the YAML should not use the namespace "v0alpha"
|
|
923
|
+
Then the YAML should not use the namespace "deprecated"
|
|
924
|
+
```
|
|
925
|
+
|
|
926
|
+
## 38. When I print last YAML response
|
|
927
|
+
|
|
928
|
+
Print the most recently set raw YAML response to stdout (debug aid).
|
|
929
|
+
|
|
930
|
+
**Keyword**: `When`
|
|
931
|
+
|
|
932
|
+
**Pattern**
|
|
933
|
+
|
|
934
|
+
```js
|
|
935
|
+
/^(I |we )*print last YAML response$/
|
|
936
|
+
```
|
|
937
|
+
|
|
938
|
+
**Examples**
|
|
939
|
+
|
|
940
|
+
```gherkin
|
|
941
|
+
When I print last YAML response
|
|
942
|
+
When we print last YAML response
|
|
943
|
+
And I print last YAML response
|
|
944
|
+
Given the YAML response content is the following:
|
|
945
|
+
"""
|
|
946
|
+
key: value
|
|
947
|
+
"""
|
|
948
|
+
When I print last YAML response
|
|
949
|
+
When we send a REST "GET" request to "/api/config"
|
|
950
|
+
And we print last YAML response
|
|
951
|
+
```
|