@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.
Files changed (301) hide show
  1. package/AGENTS.md +148 -0
  2. package/CLAUDE.md +544 -0
  3. package/README.md +22 -0
  4. package/bin/generate-reports.js +363 -0
  5. package/bin/init-varbase-e2e.js +330 -0
  6. package/bin/postinstall.js +26 -0
  7. package/cucumber.js +125 -0
  8. package/docs/00-quick-start.md +102 -0
  9. package/docs/01-getting-started.md +102 -0
  10. package/docs/02-bbr-smart-waits.md +77 -0
  11. package/docs/03-selector-registry.md +95 -0
  12. package/docs/04-step-reference.md +801 -0
  13. package/docs/05-web-first-assertions.md +91 -0
  14. package/docs/06-network-and-dialogs.md +83 -0
  15. package/docs/07-auth-state.md +75 -0
  16. package/docs/08-clock-mocking.md +59 -0
  17. package/docs/09-api-testing.md +114 -0
  18. package/docs/10-accessibility.md +167 -0
  19. package/docs/11-debugging.md +129 -0
  20. package/docs/12-ai-agent-guide.md +338 -0
  21. package/docs/13-faq.md +236 -0
  22. package/docs/14-recipes-cookbook.md +255 -0
  23. package/docs/15-tag-conventions.md +76 -0
  24. package/docs/16-ci-cd.md +90 -0
  25. package/docs/README.md +125 -0
  26. package/docs/advanced-screenshots/then-i-save-fullscreen-screenshot.md +36 -0
  27. package/docs/advanced-screenshots/then-i-save-width-x-height-screenshot.md +34 -0
  28. package/docs/advanced-screenshots/when-i-save-screenshot-name-filename.md +45 -0
  29. package/docs/advanced-screenshots.md +52 -0
  30. package/docs/advanced-selectors.md +18 -0
  31. package/docs/api-step-definitions.md +45 -0
  32. package/docs/global-settings.md +267 -0
  33. package/docs/install-varbase-e2e/ddev-varbase-e2e.md +52 -0
  34. package/docs/install-varbase-e2e.md +34 -0
  35. package/docs/overview.md +40 -0
  36. package/docs/step-definitions/given-i-am-anonymous-user.md +67 -0
  37. package/docs/step-definitions/given-i-am-homepage.md +68 -0
  38. package/docs/step-definitions/given-i-am-specific-page.md +72 -0
  39. package/docs/step-definitions/then-i-should-be.md +56 -0
  40. package/docs/step-definitions/then-i-should-see.md +62 -0
  41. package/docs/step-definitions/then-item-checkbox.md +54 -0
  42. package/docs/step-definitions/then-item-link-should-contain-url.md +84 -0
  43. package/docs/step-definitions/then-item-should-contain.md +67 -0
  44. package/docs/step-definitions/then-radio-button-value-should-be-selected.md +68 -0
  45. package/docs/step-definitions/then-response-status-code-should-be-number.md +69 -0
  46. package/docs/step-definitions/then-value-radio-button-selected.md +62 -0
  47. package/docs/step-definitions/when-i-attach-file-file-name-element.md +71 -0
  48. package/docs/step-definitions/when-i-check-checkbox.md +60 -0
  49. package/docs/step-definitions/when-i-click-link.md +51 -0
  50. package/docs/step-definitions/when-i-click-operation-text-row.md +71 -0
  51. package/docs/step-definitions/when-i-fill.md +59 -0
  52. package/docs/step-definitions/when-i-go-homepage.md +60 -0
  53. package/docs/step-definitions/when-i-go-specific-page.md +67 -0
  54. package/docs/step-definitions/when-i-move-backward-one-page.md +49 -0
  55. package/docs/step-definitions/when-i-move-forward-one-page.md +58 -0
  56. package/docs/step-definitions/when-i-press-button.md +58 -0
  57. package/docs/step-definitions/when-i-reload-page.md +51 -0
  58. package/docs/step-definitions/when-i-scroll.md +73 -0
  59. package/docs/step-definitions/when-i-select-option-select-list.md +53 -0
  60. package/docs/step-definitions/when-i-select-radio-button-value.md +62 -0
  61. package/docs/step-definitions/when-i-uncheck-checkbox.md +57 -0
  62. package/docs/step-definitions/when-i-wait-ajax-finish.md +64 -0
  63. package/docs/step-definitions/when-i-wait.md +62 -0
  64. package/docs/step-definitions.md +82 -0
  65. package/docs/steps/README.md +137 -0
  66. package/docs/steps/a11y.md +731 -0
  67. package/docs/steps/action.md +181 -0
  68. package/docs/steps/api.md +679 -0
  69. package/docs/steps/assertion.md +328 -0
  70. package/docs/steps/auth.md +108 -0
  71. package/docs/steps/clock.md +171 -0
  72. package/docs/steps/cookie.md +293 -0
  73. package/docs/steps/debug.md +52 -0
  74. package/docs/steps/dialog.md +226 -0
  75. package/docs/steps/drupal-canvas.md +414 -0
  76. package/docs/steps/drupal-ckeditor.md +118 -0
  77. package/docs/steps/drupal-core.md +688 -0
  78. package/docs/steps/drupal-layout-builder.md +437 -0
  79. package/docs/steps/drupal-media.md +107 -0
  80. package/docs/steps/drupal-moderation.md +81 -0
  81. package/docs/steps/drupal-paragraphs.md +36 -0
  82. package/docs/steps/element.md +455 -0
  83. package/docs/steps/field.md +648 -0
  84. package/docs/steps/file-download.md +235 -0
  85. package/docs/steps/form.md +344 -0
  86. package/docs/steps/iframe.md +248 -0
  87. package/docs/steps/input.md +220 -0
  88. package/docs/steps/javascript.md +111 -0
  89. package/docs/steps/keyboard.md +107 -0
  90. package/docs/steps/link.md +217 -0
  91. package/docs/steps/metatag.md +99 -0
  92. package/docs/steps/modal.md +232 -0
  93. package/docs/steps/navigation.md +275 -0
  94. package/docs/steps/network.md +284 -0
  95. package/docs/steps/path.md +203 -0
  96. package/docs/steps/response.md +102 -0
  97. package/docs/steps/responsive.md +139 -0
  98. package/docs/steps/rest.md +140 -0
  99. package/docs/steps/screenshot.md +211 -0
  100. package/docs/steps/scroll.md +266 -0
  101. package/docs/steps/selectors.md +848 -0
  102. package/docs/steps/storage.md +254 -0
  103. package/docs/steps/table.md +216 -0
  104. package/docs/steps/varbase.md +391 -0
  105. package/docs/steps/video.md +111 -0
  106. package/docs/steps/wait.md +553 -0
  107. package/docs/steps/web-first.md +289 -0
  108. package/docs/steps/xml.md +505 -0
  109. package/docs/steps/yaml.md +951 -0
  110. package/examples/a11y.html +31 -0
  111. package/examples/about-us.html +11 -0
  112. package/examples/account.html +32 -0
  113. package/examples/ajax-wait-examples.html +147 -0
  114. package/examples/contact-us.html +10 -0
  115. package/examples/cookies.html +10 -0
  116. package/examples/date.html +12 -0
  117. package/examples/dynamic-examples.html +498 -0
  118. package/examples/element.html +11 -0
  119. package/examples/example-api.json +28 -0
  120. package/examples/existing-page.html +11 -0
  121. package/examples/field.html +24 -0
  122. package/examples/index.html +37 -0
  123. package/examples/keyboard.html +11 -0
  124. package/examples/links.html +9 -0
  125. package/examples/modal.html +14 -0
  126. package/examples/path.html +3 -0
  127. package/examples/table.html +13 -0
  128. package/examples/test--modal-dialogs.html +252 -0
  129. package/examples/test--then--i-should--not--see-text-in-element.html +48 -0
  130. package/examples/test--then--i-should--see-text-in-element.html +48 -0
  131. package/examples/test--then--i-should--see-text-matching-pattern.html +31 -0
  132. package/examples/test--then--i-should-see-text-in-table-row.html +232 -0
  133. package/examples/test--then--the-checkbox-checked.html +68 -0
  134. package/examples/test--then--the-element-should_not-contain-cssproperty.html +47 -0
  135. package/examples/test--then--the-link-should-contain.html +21 -0
  136. package/examples/test--when--i-additionally-select.html +27 -0
  137. package/examples/test--when--i-attach-file-to-feild.html +50 -0
  138. package/examples/test--when--i-check-uncheck-checkbox.html +47 -0
  139. package/examples/test--when--i-click-link.html +18 -0
  140. package/examples/test--when--i-click-text-in-table-row.html +178 -0
  141. package/examples/test--when--i-fill-in.html +48 -0
  142. package/examples/test--when--i-press-button.html +31 -0
  143. package/examples/test--when--i-reload-page.html +27 -0
  144. package/examples/test--when--i-scroll-functionality.html +177 -0
  145. package/examples/test--when--i-scroll-left-right-functionality.html +149 -0
  146. package/examples/test--when--i-select-option-from-dropdownlist.html +35 -0
  147. package/examples/test--when--i-select-radio-button.html +95 -0
  148. package/examples/test--when-i-wait-max-of-time.html +39 -0
  149. package/examples/test--when-i-wait-page-until-is-loaded.html +47 -0
  150. package/examples/test--when-i-wait-specific-time.html +39 -0
  151. package/examples/test-acceptable-url-path.html +11 -0
  152. package/examples/video-demo.html +43 -0
  153. package/package.json +56 -0
  154. package/playwright.config.ts +39 -0
  155. package/tests/assets/test-document.pdf +14 -0
  156. package/tests/assets/vardot.png +0 -0
  157. package/tests/features/a11y.feature +39 -0
  158. package/tests/features/ajax-wait-examples.feature +24 -0
  159. package/tests/features/api-step-definitions-individual.feature +185 -0
  160. package/tests/features/complete-api-testing-examples.feature +205 -0
  161. package/tests/features/cookie.feature +13 -0
  162. package/tests/features/date.feature +11 -0
  163. package/tests/features/dynamic-content-examples.feature +156 -0
  164. package/tests/features/element.feature +16 -0
  165. package/tests/features/field.feature +25 -0
  166. package/tests/features/keyboard.feature +10 -0
  167. package/tests/features/link.feature +11 -0
  168. package/tests/features/modal-advanced-example.feature +54 -0
  169. package/tests/features/modal-basic-example.feature +42 -0
  170. package/tests/features/modal-error-handling-example.feature +37 -0
  171. package/tests/features/modal.feature +11 -0
  172. package/tests/features/path.feature +16 -0
  173. package/tests/features/response.feature +8 -0
  174. package/tests/features/responsive.feature +10 -0
  175. package/tests/features/table.feature +18 -0
  176. package/tests/features/test--given--i-am-an-anonymous-user.feature +10 -0
  177. package/tests/features/test--given--i-am-on-homepage.feature +16 -0
  178. package/tests/features/test--then--i-save-screenshot.feature +33 -0
  179. package/tests/features/test--then--i-see-locator.feature +320 -0
  180. package/tests/features/test--then--i-should--not--see-text-in-element.feature +13 -0
  181. package/tests/features/test--then--i-should--see-text-in-element-by-attr.feature +10 -0
  182. package/tests/features/test--then--i-should--see-text-in-element.feature +10 -0
  183. package/tests/features/test--then--i-should--see-text-matching-pattern-in-element.feature +13 -0
  184. package/tests/features/test--then--i-should--see-text-matching-pattern.feature +18 -0
  185. package/tests/features/test--then--i-should-be-on-page.feature +10 -0
  186. package/tests/features/test--then--i-should-be-on-the-homepage.feature +10 -0
  187. package/tests/features/test--then--i-should-not-see-an-element-by-attr.feature +8 -0
  188. package/tests/features/test--then--i-should-not-see-an-element.feature +8 -0
  189. package/tests/features/test--then--i-should-see-an-element-by-attr.feature +8 -0
  190. package/tests/features/test--then--i-should-see-an-element.feature +8 -0
  191. package/tests/features/test--then--i-should-see-n-elements.feature +24 -0
  192. package/tests/features/test--then--i-should-see-text-in-table-row.feature +96 -0
  193. package/tests/features/test--then--print-current-url-and-response.feature +21 -0
  194. package/tests/features/test--then--the-checkbox-is-checked.feature +18 -0
  195. package/tests/features/test--then--the-checkbox-should-be-checked.feature +16 -0
  196. package/tests/features/test--then--the-element-should-contain-cssproperty.feature +9 -0
  197. package/tests/features/test--then--the-element-should-not-contain-cssproperty.feature +10 -0
  198. package/tests/features/test--then--the-field-should-contain-value.feature +11 -0
  199. package/tests/features/test--then--the-response-should-contain.feature +11 -0
  200. package/tests/features/test--then--the-response-status-code-should-be.feature +31 -0
  201. package/tests/features/test--then--the-url-should-match.feature +7 -0
  202. package/tests/features/test--then-the-link-should-contain-by-attribute.feature +18 -0
  203. package/tests/features/test--then-the-link-should-contain.feature +7 -0
  204. package/tests/features/test--when--i-additionally-select.feature +30 -0
  205. package/tests/features/test--when--i-attach-file-to-feild.feature +9 -0
  206. package/tests/features/test--when--i-check-checkbox.feature +21 -0
  207. package/tests/features/test--when--i-click-link-by-attribute.feature +21 -0
  208. package/tests/features/test--when--i-click-link.feature +9 -0
  209. package/tests/features/test--when--i-click-text-in-table-row.feature +37 -0
  210. package/tests/features/test--when--i-fill-in-by-attr.feature +31 -0
  211. package/tests/features/test--when--i-fill-in-table-by-attr.feature +19 -0
  212. package/tests/features/test--when--i-fill-in.feature +32 -0
  213. package/tests/features/test--when--i-follow.feature +22 -0
  214. package/tests/features/test--when--i-go-to-homepage.feature +9 -0
  215. package/tests/features/test--when--i-move-forward-backward-one-page.feature +14 -0
  216. package/tests/features/test--when--i-press-button-by-attribute.feature +18 -0
  217. package/tests/features/test--when--i-press-button.feature +13 -0
  218. package/tests/features/test--when--i-reload-page.feature +11 -0
  219. package/tests/features/test--when--i-scroll-left-right.feature +48 -0
  220. package/tests/features/test--when--i-scroll.feature +48 -0
  221. package/tests/features/test--when--i-select-option-from-dropdownlist.feature +21 -0
  222. package/tests/features/test--when--i-select-radio-button.feature +37 -0
  223. package/tests/features/test--when--i-wait-page-is-loaded.feature +8 -0
  224. package/tests/features/test--when--i-wait-time.feature +21 -0
  225. package/tests/features/video.feature +18 -0
  226. package/tests/features/wait.feature +7 -0
  227. package/tests/features/yaml.feature +102 -0
  228. package/tests/selectors/_canonical-keys.json +113 -0
  229. package/tests/selectors/back-end-selectors.json +19 -0
  230. package/tests/selectors/cms-contentful-admin.json +35 -0
  231. package/tests/selectors/cms-craft-admin.json +39 -0
  232. package/tests/selectors/cms-drupal-cms-gin.json +56 -0
  233. package/tests/selectors/cms-drupal-core-claro.json +50 -0
  234. package/tests/selectors/cms-generic-admin.json +34 -0
  235. package/tests/selectors/cms-ghost-admin.json +34 -0
  236. package/tests/selectors/cms-joomla-admin.json +41 -0
  237. package/tests/selectors/cms-magento2-admin.json +32 -0
  238. package/tests/selectors/cms-prestashop-admin.json +38 -0
  239. package/tests/selectors/cms-shopify-admin.json +25 -0
  240. package/tests/selectors/cms-strapi-admin.json +42 -0
  241. package/tests/selectors/cms-typo3-admin.json +41 -0
  242. package/tests/selectors/cms-woocommerce-front.json +50 -0
  243. package/tests/selectors/cms-wordpress-admin.json +31 -0
  244. package/tests/selectors/framework-ant-design.json +80 -0
  245. package/tests/selectors/framework-bootstrap.json +86 -0
  246. package/tests/selectors/framework-bulma.json +74 -0
  247. package/tests/selectors/framework-chakra.json +58 -0
  248. package/tests/selectors/framework-foundation.json +51 -0
  249. package/tests/selectors/framework-material-ui.json +72 -0
  250. package/tests/selectors/framework-shadcn.json +51 -0
  251. package/tests/selectors/framework-tailwind.json +40 -0
  252. package/tests/selectors/framework-vuetify.json +61 -0
  253. package/tests/selectors/front-end-selectors.json +16 -0
  254. package/tests/selectors/homepage-selectors.json +13 -0
  255. package/tests/step-definitions/a11y.steps.js +800 -0
  256. package/tests/step-definitions/action.steps.js +167 -0
  257. package/tests/step-definitions/api.steps.js +732 -0
  258. package/tests/step-definitions/assertion.steps.js +352 -0
  259. package/tests/step-definitions/auth.steps.js +126 -0
  260. package/tests/step-definitions/clock.steps.js +128 -0
  261. package/tests/step-definitions/cookie.steps.js +216 -0
  262. package/tests/step-definitions/debug.steps.js +39 -0
  263. package/tests/step-definitions/dialog.steps.js +193 -0
  264. package/tests/step-definitions/drupal-canvas.steps.js +764 -0
  265. package/tests/step-definitions/drupal-ckeditor.steps.js +108 -0
  266. package/tests/step-definitions/drupal-core.steps.js +665 -0
  267. package/tests/step-definitions/drupal-helpers.js +371 -0
  268. package/tests/step-definitions/drupal-layout-builder.steps.js +466 -0
  269. package/tests/step-definitions/drupal-media.steps.js +99 -0
  270. package/tests/step-definitions/drupal-moderation.steps.js +71 -0
  271. package/tests/step-definitions/drupal-paragraphs.steps.js +50 -0
  272. package/tests/step-definitions/element.steps.js +356 -0
  273. package/tests/step-definitions/field.steps.js +653 -0
  274. package/tests/step-definitions/file-download.steps.js +211 -0
  275. package/tests/step-definitions/form.steps.js +333 -0
  276. package/tests/step-definitions/iframe.steps.js +228 -0
  277. package/tests/step-definitions/input.steps.js +202 -0
  278. package/tests/step-definitions/javascript.steps.js +232 -0
  279. package/tests/step-definitions/keyboard.steps.js +112 -0
  280. package/tests/step-definitions/link.steps.js +142 -0
  281. package/tests/step-definitions/metatag.steps.js +91 -0
  282. package/tests/step-definitions/modal.steps.js +244 -0
  283. package/tests/step-definitions/navigation.steps.js +218 -0
  284. package/tests/step-definitions/network.steps.js +280 -0
  285. package/tests/step-definitions/path.steps.js +141 -0
  286. package/tests/step-definitions/response.steps.js +98 -0
  287. package/tests/step-definitions/responsive.steps.js +125 -0
  288. package/tests/step-definitions/rest.steps.js +111 -0
  289. package/tests/step-definitions/screenshot.steps.js +423 -0
  290. package/tests/step-definitions/scroll.steps.js +189 -0
  291. package/tests/step-definitions/selectors.steps.js +1003 -0
  292. package/tests/step-definitions/storage.steps.js +194 -0
  293. package/tests/step-definitions/table.steps.js +181 -0
  294. package/tests/step-definitions/varbase-e2e.js +897 -0
  295. package/tests/step-definitions/varbase.steps.js +458 -0
  296. package/tests/step-definitions/video.steps.js +178 -0
  297. package/tests/step-definitions/wait.steps.js +400 -0
  298. package/tests/step-definitions/web-first.steps.js +298 -0
  299. package/tests/step-definitions/xml.steps.js +411 -0
  300. package/tests/step-definitions/yaml.steps.js +913 -0
  301. package/tsconfig.json +26 -0
@@ -0,0 +1,679 @@
1
+ # API (long form) steps
2
+
3
+ 22 steps, defined in `tests/step-definitions/api.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 I am authenticating as "admin" with "password123" password` |
10
+ | 2 | `Given I set header "Content-Type" with value "application/json"` |
11
+ | 3 | `Given the API base URL is "https://jsonplaceholder.typicode.com"` |
12
+ | 4 | `Given I set the header "Content-Type" to "application/json"` |
13
+ | 5 | `Given I set the following headers:` |
14
+ | 6 | `Given I set the request body to '{"name": "John", "email": "john@example.com"}'` |
15
+ | 7 | `Given I set the request body with:` |
16
+ | 8 | `When I send a GET request to "/users"` |
17
+ | 9 | `When I send a POST request to "/users" with values:` |
18
+ | 10 | `When I send a POST request to "/users" with body:` |
19
+ | 11 | `When I send a POST request to "/login" with form data:` |
20
+ | 12 | `Then the API response code should be 200` |
21
+ | 13 | `Then the API response should contain "success"` |
22
+ | 14 | `Then the API response should not contain "error"` |
23
+ | 15 | `Then the API response should contain json:` |
24
+ | 16 | `Then the JSON response should have "name" equal to "John Doe"` |
25
+ | 17 | `Then the JSON response should have property "id"` |
26
+ | 18 | `Then the JSON response should not have property "password"` |
27
+ | 19 | `Then the response should be valid JSON` |
28
+ | 20 | `Then the response header "Content-Type" should be "application/json"` |
29
+ | 21 | `Then print API response` |
30
+ | 22 | `Given I set placeholder "{{userId}}" to "123"` |
31
+
32
+ ---
33
+
34
+ ## 1. Given I am authenticating as "admin" with "password123" password
35
+
36
+ Adds Basic Authentication header to the next request.
37
+
38
+ **Keyword**: `Given`
39
+
40
+ **Pattern**
41
+
42
+ ```js
43
+ /^(?:I am|we are) authenticating as "([^"]*)" with "([^"]*)" password$/
44
+ ```
45
+
46
+ **Examples**
47
+
48
+ ```gherkin
49
+ Given I am authenticating as "admin" with "password123" password
50
+ Given we are authenticating as "user@example.com" with "secret" password
51
+ Given I am authenticating as "api-user" with "pass!word" password
52
+ Given we are authenticating as "reader" with "readonly" password
53
+ ```
54
+
55
+ ## 2. Given I set header "Content-Type" with value "application/json"
56
+
57
+ Sets a single HTTP request header.
58
+
59
+ **Keyword**: `Given`
60
+
61
+ **Pattern**
62
+
63
+ ```js
64
+ /^(?:I |we )?set header "([^"]*)" with value "([^"]*)"$/
65
+ ```
66
+
67
+ **Examples**
68
+
69
+ ```gherkin
70
+ Given I set header "Content-Type" with value "application/json"
71
+ Given I set header "Authorization" with value "Bearer token123"
72
+ Given I set header "Accept" with value "application/xml"
73
+ Given I set header "Accept" with value "application/json"
74
+ Given we set header "X-Api-Key" with value "abcd-1234"
75
+ Given I set header "User-Agent" with value "test-runner"
76
+ Given we set header "Accept-Language" with value "en-US"
77
+ Given I set header "If-None-Match" with value "etag-xyz"
78
+ ```
79
+
80
+ ## 3. Given the API base URL is "https://jsonplaceholder.typicode.com"
81
+
82
+ Set the base URL for API calls. Accepts full URLs or paths relative to LAUNCH_URL.
83
+
84
+ **Keyword**: `Given`
85
+
86
+ **Pattern**
87
+
88
+ ```js
89
+ /^(?:the API base URL is|I set the API base URL to|the base URL is) "([^"]*)"$/
90
+ ```
91
+
92
+ **Examples**
93
+
94
+ ```gherkin
95
+ Given the API base URL is "https://jsonplaceholder.typicode.com"
96
+ Given I set the API base URL to "https://api.example.com/v1"
97
+ Given the base URL is "http://localhost:3000/api"
98
+ Given the API base URL is "https://un.org/api"
99
+ Given I set the API base URL to "/api/v2"
100
+ Given the base URL is "https://staging.example.com/api"
101
+ Given the API base URL is "http://127.0.0.1:8080"
102
+ ```
103
+
104
+ ## 4. Given I set the header "Content-Type" to "application/json"
105
+
106
+ Set a request header. Alternative syntax.
107
+
108
+ **Keyword**: `Given`
109
+
110
+ **Pattern**
111
+
112
+ ```js
113
+ /^(?:I set the header|we set the header|the header) "([^"]*)" (?:to|is) "([^"]*)"$/
114
+ ```
115
+
116
+ **Examples**
117
+
118
+ ```gherkin
119
+ Given I set the header "Content-Type" to "application/json"
120
+ Given I set the header "Authorization" to "Bearer token123"
121
+ Given the header "Accept" is "application/json"
122
+ Given we set the header "X-Api-Key" to "abcd-1234"
123
+ Given I set the header "If-Match" to "etag-123"
124
+ Given the header "User-Agent" is "test-runner"
125
+ Given we set the header "Accept-Language" to "en-US"
126
+ Given I set the header "Cache-Control" to "no-cache"
127
+ ```
128
+
129
+ ## 5. Given I set the following headers:
130
+
131
+ Set multiple headers using a table.
132
+
133
+ **Keyword**: `Given`
134
+
135
+ **Pattern**
136
+
137
+ ```js
138
+ /^(?:I|we) set the following headers:$/
139
+ ```
140
+
141
+ **Examples**
142
+
143
+ ```gherkin
144
+ Given I set the following headers:
145
+ | Content-Type | application/json |
146
+ | Authorization | Bearer token123 |
147
+ | Accept | application/json |
148
+
149
+ Given we set the following headers:
150
+ | Content-Type | application/json |
151
+ | X-Api-Key | abcd-1234 |
152
+ | Accept-Language | en-US |
153
+
154
+ Given I set the following headers:
155
+ | User-Agent | test-runner |
156
+ | Cache-Control | no-cache |
157
+ | If-None-Match | etag-xyz |
158
+
159
+ Given we set the following headers:
160
+ | Authorization | Bearer {{token}} |
161
+ | Accept | application/json |
162
+ | X-Request-ID | req-001 |
163
+ ```
164
+
165
+ ## 6. Given I set the request body to '{"name": "John", "email": "john@example.com"}'
166
+
167
+ Set request body data for POST/PUT requests.
168
+
169
+ **Keyword**: `Given`
170
+
171
+ **Pattern**
172
+
173
+ ```js
174
+ /^(?:I set the request body to|we set the request body to|the request body is) '([^']*)'$/
175
+ ```
176
+
177
+ **Examples**
178
+
179
+ ```gherkin
180
+ Given I set the request body to '{"name": "John", "email": "john@example.com"}'
181
+ Given the request body is '{"title": "Test Post", "body": "This is a test"}'
182
+ Given we set the request body to '{"org": "Vardot", "active": true}'
183
+ Given I set the request body to '{"id": 1, "tags": ["qa","api"]}'
184
+ Given the request body is '{"username": "admin", "password": "secret"}'
185
+ Given we set the request body to '{"email": "hello@un.org"}'
186
+ Given I set the request body to '{"status": "published"}'
187
+ ```
188
+
189
+ ## 7. Given I set the request body with:
190
+
191
+ Set request body using a table.
192
+
193
+ **Keyword**: `Given`
194
+
195
+ **Pattern**
196
+
197
+ ```js
198
+ /^(?:I|we) set the request body with:$/
199
+ ```
200
+
201
+ **Examples**
202
+
203
+ ```gherkin
204
+ Given I set the request body with:
205
+ | name | John Doe |
206
+ | email | john@example.com |
207
+ | age | 30 |
208
+
209
+ Given we set the request body with:
210
+ | org | Vardot |
211
+ | country | UN |
212
+ | active | true |
213
+
214
+ Given I set the request body with:
215
+ | title | Hello World |
216
+ | body | First post |
217
+ | userId | 1 |
218
+
219
+ Given we set the request body with:
220
+ | status | published |
221
+ | priority | 5 |
222
+ | featured | false |
223
+ ```
224
+
225
+ ## 8. When I send a GET request to "/users"
226
+
227
+ Sends HTTP request to specific relative URL.
228
+
229
+ **Keyword**: `When`
230
+
231
+ **Pattern**
232
+
233
+ ```js
234
+ /^(?:I |we )?send a ([A-Z]+) request to "([^"]+)"$/
235
+ ```
236
+
237
+ **Examples**
238
+
239
+ ```gherkin
240
+ When I send a GET request to "/users"
241
+ When we send a POST request to "/posts"
242
+ When I send a PUT request to "/users/1"
243
+ When we send a DELETE request to "/posts/1"
244
+ When I send a GET request to "/posts?userId=1"
245
+ When we send a PATCH request to "/users/42"
246
+ When I send a GET request to "/health"
247
+ When we send a HEAD request to "/users"
248
+ When I send a OPTIONS request to "/api"
249
+ When we send a GET request to "/posts/{{postId}}"
250
+ ```
251
+
252
+ ## 9. When I send a POST request to "/users" with values:
253
+
254
+ Sends HTTP request to specific URL with field values from Table.
255
+
256
+ **Keyword**: `When`
257
+
258
+ **Pattern**
259
+
260
+ ```js
261
+ /^(?:I |we )?send a ([A-Z]+) request to "([^"]+)" with values:$/
262
+ ```
263
+
264
+ **Examples**
265
+
266
+ ```gherkin
267
+ When I send a POST request to "/users" with values:
268
+ | name | John Doe |
269
+ | email | john@example.com |
270
+ | age | 30 |
271
+
272
+ When we send a POST request to "/users" with values:
273
+ | name | Alice |
274
+ | email | alice@un.org |
275
+ | role | editor |
276
+
277
+ When I send a PUT request to "/users/1" with values:
278
+ | name | Updated Name |
279
+ | active | true |
280
+
281
+ When we send a POST request to "/posts" with values:
282
+ | title | Welcome |
283
+ | body | Hello Vardot|
284
+ | userId | 1 |
285
+ ```
286
+
287
+ ## 10. When I send a POST request to "/users" with body:
288
+
289
+ Sends HTTP request to specific URL with raw body from PyString.
290
+
291
+ **Keyword**: `When`
292
+
293
+ **Pattern**
294
+
295
+ ```js
296
+ /^(?:I |we )?send a ([A-Z]+) request to "([^"]+)" with body:$/
297
+ ```
298
+
299
+ **Examples**
300
+
301
+ ```gherkin
302
+ When I send a POST request to "/users" with body:
303
+ """
304
+ {
305
+ "name": "John Doe",
306
+ "email": "john@example.com"
307
+ }
308
+ """
309
+
310
+ When we send a POST request to "/posts" with body:
311
+ """
312
+ {
313
+ "title": "Hello",
314
+ "body": "World",
315
+ "userId": 1
316
+ }
317
+ """
318
+
319
+ When I send a PUT request to "/users/1" with body:
320
+ """
321
+ {
322
+ "name": "Updated",
323
+ "org": "Vardot"
324
+ }
325
+ """
326
+
327
+ When we send a POST request to "/contacts" with body:
328
+ """
329
+ {
330
+ "email": "info@un.org",
331
+ "subscribe": true
332
+ }
333
+ """
334
+ ```
335
+
336
+ ## 11. When I send a POST request to "/login" with form data:
337
+
338
+ Sends HTTP request to specific URL with form data.
339
+
340
+ **Keyword**: `When`
341
+
342
+ **Pattern**
343
+
344
+ ```js
345
+ /^(?:I |we )?send a ([A-Z]+) request to "([^"]+)" with form data:$/
346
+ ```
347
+
348
+ **Examples**
349
+
350
+ ```gherkin
351
+ When I send a POST request to "/login" with form data:
352
+ """
353
+ username=admin
354
+ password=secret
355
+ remember=true
356
+ """
357
+
358
+ When we send a POST request to "/subscribe" with form data:
359
+ """
360
+ email=hello@un.org
361
+ list=newsletter
362
+ """
363
+
364
+ When I send a POST request to "/contact" with form data:
365
+ """
366
+ name=Alice
367
+ org=Vardot
368
+ message=Hello
369
+ """
370
+
371
+ When we send a PUT request to "/profile" with form data:
372
+ """
373
+ name=Updated
374
+ country=UN
375
+ """
376
+ ```
377
+
378
+ ## 12. Then the API response code should be 200
379
+
380
+ Checks that API response has specific status code.
381
+
382
+ **Keyword**: `Then`
383
+
384
+ **Pattern**
385
+
386
+ ```js
387
+ /^(?:the )?API response code should be (\d+)$/
388
+ ```
389
+
390
+ **Examples**
391
+
392
+ ```gherkin
393
+ Then the API response code should be 200
394
+ Then API response code should be 404
395
+ Then the API response code should be 201
396
+ Then API response code should be 204
397
+ Then the API response code should be 400
398
+ Then API response code should be 401
399
+ Then the API response code should be 403
400
+ Then API response code should be 500
401
+ Then the API response code should be 301
402
+ Then API response code should be 302
403
+ ```
404
+
405
+ ## 13. Then the API response should contain "success"
406
+
407
+ Checks that API response body contains specific text.
408
+
409
+ **Keyword**: `Then`
410
+
411
+ **Pattern**
412
+
413
+ ```js
414
+ /^(?:the )?API response should contain "([^"]*)"$/
415
+ ```
416
+
417
+ **Examples**
418
+
419
+ ```gherkin
420
+ Then the API response should contain "success"
421
+ Then API response should contain "John Doe"
422
+ Then the API response should contain "Vardot"
423
+ Then API response should contain "UN"
424
+ Then the API response should contain "published"
425
+ Then API response should contain "id"
426
+ Then the API response should contain "email"
427
+ Then API response should contain "hello@un.org"
428
+ ```
429
+
430
+ ## 14. Then the API response should not contain "error"
431
+
432
+ Checks that API response body doesn't contain specific text.
433
+
434
+ **Keyword**: `Then`
435
+
436
+ **Pattern**
437
+
438
+ ```js
439
+ /^(?:the )?API response should not contain "([^"]*)"$/
440
+ ```
441
+
442
+ **Examples**
443
+
444
+ ```gherkin
445
+ Then the API response should not contain "error"
446
+ Then API response should not contain "failed"
447
+ Then the API response should not contain "forbidden"
448
+ Then API response should not contain "unauthorized"
449
+ Then the API response should not contain "password"
450
+ Then API response should not contain "secret"
451
+ Then the API response should not contain "exception"
452
+ Then API response should not contain "stack trace"
453
+ ```
454
+
455
+ ## 15. Then the API response should contain json:
456
+
457
+ Checks that API response body contains JSON from PyString.
458
+
459
+ **Keyword**: `Then`
460
+
461
+ **Pattern**
462
+
463
+ ```js
464
+ /^(?:the )?API response should contain json:$/
465
+ ```
466
+
467
+ **Examples**
468
+
469
+ ```gherkin
470
+ Then the API response should contain json:
471
+ """
472
+ {
473
+ "name": "John Doe",
474
+ "email": "john@example.com"
475
+ }
476
+ """
477
+
478
+ Then API response should contain json:
479
+ """
480
+ {
481
+ "org": "Vardot",
482
+ "active": true
483
+ }
484
+ """
485
+
486
+ Then the API response should contain json:
487
+ """
488
+ {
489
+ "id": 1,
490
+ "title": "Hello"
491
+ }
492
+ """
493
+
494
+ Then API response should contain json:
495
+ """
496
+ {
497
+ "email": "hello@un.org"
498
+ }
499
+ """
500
+ ```
501
+
502
+ ## 16. Then the JSON response should have "name" equal to "John Doe"
503
+
504
+ Alternative syntax for JSON property verification.
505
+
506
+ **Keyword**: `Then`
507
+
508
+ **Pattern**
509
+
510
+ ```js
511
+ /^(?:the JSON response should have|the API response should have|the JSON property) "([^"]*)" (?:equal to|should be) (.+)$/
512
+ ```
513
+
514
+ **Examples**
515
+
516
+ ```gherkin
517
+ Then the JSON response should have "name" equal to "John Doe"
518
+ Then the API response should have "id" equal to 1
519
+ Then the JSON property "active" should be true
520
+ Then the JSON response should have "org" equal to "Vardot"
521
+ Then the API response should have "email" equal to "hello@un.org"
522
+ Then the JSON property "count" should be 42
523
+ Then the JSON response should have "user.role" equal to "admin"
524
+ Then the JSON property "published" should be false
525
+ ```
526
+
527
+ ## 17. Then the JSON response should have property "id"
528
+
529
+ Verify a JSON property exists.
530
+
531
+ **Keyword**: `Then`
532
+
533
+ **Pattern**
534
+
535
+ ```js
536
+ /^(?:the JSON response should have property|the API response should contain property) "([^"]*)"$/
537
+ ```
538
+
539
+ **Examples**
540
+
541
+ ```gherkin
542
+ Then the JSON response should have property "id"
543
+ Then the API response should contain property "user.email"
544
+ Then the JSON response should have property "title"
545
+ Then the API response should contain property "data"
546
+ Then the JSON response should have property "user.org"
547
+ Then the API response should contain property "meta.total"
548
+ Then the JSON response should have property "createdAt"
549
+ Then the API response should contain property "links.self"
550
+ ```
551
+
552
+ ## 18. Then the JSON response should not have property "password"
553
+
554
+ Verify a JSON property does not exist.
555
+
556
+ **Keyword**: `Then`
557
+
558
+ **Pattern**
559
+
560
+ ```js
561
+ /^(?:the JSON response should not have property|the API response should not contain property) "([^"]*)"$/
562
+ ```
563
+
564
+ **Examples**
565
+
566
+ ```gherkin
567
+ Then the JSON response should not have property "password"
568
+ Then the API response should not contain property "secret"
569
+ Then the JSON response should not have property "token"
570
+ Then the API response should not contain property "apiKey"
571
+ Then the JSON response should not have property "user.password"
572
+ Then the API response should not contain property "internal"
573
+ Then the JSON response should not have property "debug"
574
+ Then the API response should not contain property "stack"
575
+ ```
576
+
577
+ ## 19. Then the response should be valid JSON
578
+
579
+ Verify the response is valid JSON.
580
+
581
+ Two equivalent phrasings.
582
+
583
+ **Keyword**: `Then`
584
+
585
+ **Pattern**
586
+
587
+ ```js
588
+ /^(?:the response should be valid JSON|the API response should be valid JSON)$/
589
+ ```
590
+
591
+ **Examples**
592
+
593
+ ```gherkin
594
+ Then the response should be valid JSON
595
+ Then the API response should be valid JSON
596
+ And the response should be valid JSON
597
+ When I send a GET request to "/api/users"
598
+ Then the API response should be valid JSON
599
+ When I send a POST request to "/api/orders"
600
+ Then the response should be valid JSON
601
+ ```
602
+
603
+ ## 20. Then the response header "Content-Type" should be "application/json"
604
+
605
+ Verify response header value.
606
+
607
+ **Keyword**: `Then`
608
+
609
+ **Pattern**
610
+
611
+ ```js
612
+ /^(?:the response header|the header) "([^"]*)" should (?:be|contain) "([^"]*)"$/
613
+ ```
614
+
615
+ **Examples**
616
+
617
+ ```gherkin
618
+ Then the response header "Content-Type" should be "application/json"
619
+ Then the header "Cache-Control" should contain "no-cache"
620
+ Then the response header "Content-Type" should contain "charset=utf-8"
621
+ Then the header "X-Powered-By" should be "Vardot"
622
+ Then the response header "ETag" should contain "etag"
623
+ Then the header "Location" should contain "/users/1"
624
+ Then the response header "Access-Control-Allow-Origin" should be "*"
625
+ Then the header "Content-Length" should contain "0"
626
+ ```
627
+
628
+ ## 21. Then print API response
629
+
630
+ Prints the most recent API response body to stdout for debugging.
631
+
632
+ Strip before merging — this is a developer aid only.
633
+
634
+ **Keyword**: `Then`
635
+
636
+ **Pattern**
637
+
638
+ ```js
639
+ /^print API response$/
640
+ ```
641
+
642
+ **Examples**
643
+
644
+ ```gherkin
645
+ Then print API response
646
+ When I send a GET request to "/api/users"
647
+ Then print API response
648
+ And print API response
649
+ When I send a POST request to "/api/login"
650
+ Then the API response code should be 200
651
+ And print API response
652
+ When I send a DELETE request to "/api/orders/1"
653
+ Then print API response
654
+ ```
655
+
656
+ ## 22. Given I set placeholder "{{userId}}" to "123"
657
+
658
+ Sets placeholder for replacement in URLs, requests, and responses.
659
+
660
+ **Keyword**: `Given`
661
+
662
+ **Pattern**
663
+
664
+ ```js
665
+ /^(?:I|we) set placeholder "([^"]*)" to "([^"]*)"$/
666
+ ```
667
+
668
+ **Examples**
669
+
670
+ ```gherkin
671
+ Given I set placeholder "{{userId}}" to "123"
672
+ Given we set placeholder "{{token}}" to "abcd-1234"
673
+ Given I set placeholder "{{postId}}" to "42"
674
+ Given we set placeholder "{{org}}" to "Vardot"
675
+ Given I set placeholder "{{email}}" to "hello@un.org"
676
+ Given we set placeholder "{{apiKey}}" to "secret-xyz"
677
+ Given I set placeholder "{{version}}" to "v2"
678
+ Given we set placeholder "{{locale}}" to "en-US"
679
+ ```