webship-js 2.0.10 → 2.0.12

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 (248) hide show
  1. package/.circleci/config.yml +10 -1
  2. package/.drone.yml +7 -7
  3. package/.github/ISSUE_TEMPLATE/issue.md +37 -0
  4. package/.github/PULL_REQUEST_TEMPLATE.md +24 -0
  5. package/.github/workflows/github-actions.yml +101 -4
  6. package/.gitlab-ci.yml +9 -4
  7. package/.harness/webship-js-pipeline.yml +5 -6
  8. package/.semaphore/semaphore.yml +6 -9
  9. package/.teamcity/settings.kts +7 -6
  10. package/.travis.yml +6 -1
  11. package/AGENTS.md +1 -1
  12. package/CLAUDE.md +69 -24
  13. package/Jenkinsfile +5 -3
  14. package/README.md +13 -1
  15. package/azure-pipelines.yml +17 -8
  16. package/bamboo-specs/bamboo.yml +9 -15
  17. package/bin/generate-reports.js +51 -7
  18. package/bin/init-webship.js +127 -23
  19. package/bitbucket-pipelines.yml +5 -1
  20. package/buildspec.yml +6 -7
  21. package/cloudbuild.yaml +28 -12
  22. package/codefresh.yml +6 -6
  23. package/cucumber.js +46 -11
  24. package/docs/00-quick-start.md +38 -7
  25. package/docs/02-bbr-smart-waits.md +21 -10
  26. package/docs/03-selector-registry.md +24 -0
  27. package/docs/04-step-reference.md +53 -27
  28. package/docs/05-web-first-assertions.md +6 -0
  29. package/docs/07-auth-state.md +1 -1
  30. package/docs/08-clock-mocking.md +21 -2
  31. package/docs/09-api-testing.md +40 -2
  32. package/docs/10-accessibility.md +2 -0
  33. package/docs/11-debugging.md +24 -1
  34. package/docs/12-ai-agent-guide.md +8 -1
  35. package/docs/13-faq.md +75 -1
  36. package/docs/14-recipes-cookbook.md +2 -0
  37. package/docs/15-tag-conventions.md +5 -1
  38. package/docs/16-ci-cd.md +161 -124
  39. package/docs/README.md +5 -5
  40. package/docs/advanced-screenshots.md +3 -1
  41. package/docs/api-step-definitions.md +16 -2
  42. package/docs/global-settings.md +70 -18
  43. package/docs/install-webship-js/ddev-webship-js.md +3 -0
  44. package/docs/install-webship-js.md +16 -2
  45. package/docs/step-definitions/then-i-should-see.md +14 -1
  46. package/docs/step-definitions/then-item-checkbox.md +2 -0
  47. package/docs/step-definitions/when-i-fill.md +4 -0
  48. package/docs/step-definitions/when-i-select-option-select-list.md +2 -0
  49. package/examples/a11y-legacy-widget.html +34 -0
  50. package/examples/auth-state.html +42 -0
  51. package/examples/choice-controls.html +29 -0
  52. package/examples/clock.html +33 -0
  53. package/examples/datetime-fields.html +52 -0
  54. package/examples/downloads/webship-archive.zip +0 -0
  55. package/examples/downloads/webship-notes.txt +4 -0
  56. package/examples/downloads/webship-report.csv +4 -0
  57. package/examples/downloads.html +16 -0
  58. package/examples/element-selector-hint.html +16 -0
  59. package/examples/element-viewport.html +42 -0
  60. package/examples/field-states.html +27 -0
  61. package/examples/field-types.html +98 -0
  62. package/examples/fill-in-empty.html +26 -0
  63. package/examples/fill-unreachable.html +27 -0
  64. package/examples/iframe-inner.html +20 -0
  65. package/examples/iframe-nested.html +16 -0
  66. package/examples/iframe-newsletter.html +29 -0
  67. package/examples/iframe-order.html +26 -0
  68. package/examples/iframe-outer.html +15 -0
  69. package/examples/iframe.html +21 -0
  70. package/examples/javascript-errors.html +35 -0
  71. package/examples/links.html +1 -0
  72. package/examples/metatags.html +18 -0
  73. package/examples/mouse-and-pointer.html +83 -0
  74. package/examples/multi-value-fields.html +54 -0
  75. package/examples/native-dialogs.html +8 -0
  76. package/examples/network.html +83 -0
  77. package/examples/registered-names.html +15 -0
  78. package/examples/scroll-horizontal.html +50 -0
  79. package/examples/select-by-label.html +33 -0
  80. package/examples/selectors-position.html +29 -0
  81. package/examples/settle-budget.html +21 -0
  82. package/examples/sorted-tables.html +38 -0
  83. package/examples/storage.html +57 -0
  84. package/examples/text-matching.html +48 -0
  85. package/examples/text-order.html +25 -0
  86. package/examples/touch.html +22 -0
  87. package/examples/viewport-size.html +24 -0
  88. package/examples/viewport-top.html +36 -0
  89. package/examples/wait-conditions.html +69 -0
  90. package/examples/web-first.html +99 -0
  91. package/package.json +24 -2
  92. package/playwright.config.ts +3 -1
  93. package/tests/assets/catalog.xml +19 -0
  94. package/tests/assets/feed-namespaced.xml +13 -0
  95. package/tests/assets/sitemap.xml +14 -0
  96. package/tests/assets/webship-site-expected.yaml +21 -0
  97. package/tests/assets/webship-site.schema.json +46 -0
  98. package/tests/assets/webship-site.yaml +21 -0
  99. package/tests/check-api-launch-url.js +106 -0
  100. package/tests/check-assets.js +103 -0
  101. package/tests/check-attachments.js +105 -0
  102. package/tests/check-breakpoints.js +117 -0
  103. package/tests/check-clock.js +143 -0
  104. package/tests/check-config.js +90 -0
  105. package/tests/check-context.js +215 -0
  106. package/tests/check-dry-run.js +104 -0
  107. package/tests/check-examples.js +241 -0
  108. package/tests/check-exit-report.js +141 -0
  109. package/tests/check-javascript-errors.js +105 -0
  110. package/tests/check-must-fail.js +85 -0
  111. package/tests/check-paths.js +82 -0
  112. package/tests/check-report.js +119 -0
  113. package/tests/check-scaffold.js +246 -0
  114. package/tests/check-screenshots.js +117 -0
  115. package/tests/check-settle-verbs.js +137 -0
  116. package/tests/check-time-limit.js +104 -0
  117. package/tests/check-video.js +156 -0
  118. package/tests/check-world.js +167 -0
  119. package/tests/features/a11y.feature +18 -0
  120. package/tests/features/api-base-url.feature +25 -0
  121. package/tests/features/api-form-data.feature +18 -0
  122. package/tests/features/api-json-paths.feature +24 -0
  123. package/tests/features/api-response-contains.feature +21 -0
  124. package/tests/features/api-response-header-presence.feature +17 -0
  125. package/tests/features/api-response-header.feature +17 -0
  126. package/tests/features/api-saved-placeholders.feature +37 -0
  127. package/tests/features/api-step-definitions-individual.feature +1 -1
  128. package/tests/features/api-tables.feature +40 -0
  129. package/tests/features/auth-state.feature +32 -0
  130. package/tests/features/breakpoints.feature +25 -0
  131. package/tests/features/choice-controls.feature +35 -0
  132. package/tests/features/clock.feature +27 -0
  133. package/tests/features/complete-api-testing-examples.feature +1 -1
  134. package/tests/features/cookie.feature +9 -0
  135. package/tests/features/datetime-field-lookup.feature +29 -0
  136. package/tests/features/dialog.feature +27 -0
  137. package/tests/features/element-selector-hint.feature +14 -0
  138. package/tests/features/element.feature +47 -0
  139. package/tests/features/field-state.feature +21 -0
  140. package/tests/features/field.feature +104 -0
  141. package/tests/features/file-download.feature +64 -0
  142. package/tests/features/fill-in-empty-value.feature +41 -0
  143. package/tests/features/fill-reachable.feature +13 -0
  144. package/tests/features/iframe-nested.feature +43 -0
  145. package/tests/features/iframe.feature +83 -0
  146. package/tests/features/javascript-tolerated-errors.feature +20 -0
  147. package/tests/features/javascript.feature +47 -0
  148. package/tests/features/link.feature +11 -0
  149. package/tests/features/metatag.feature +38 -0
  150. package/tests/features/modal-open.feature +13 -0
  151. package/tests/features/mouse-and-pointer.feature +86 -0
  152. package/tests/features/multi-value-field-lookup.feature +30 -0
  153. package/tests/features/network-mocking.feature +80 -0
  154. package/tests/features/registered-names.feature +14 -0
  155. package/tests/features/responsive.feature +27 -0
  156. package/tests/features/scroll-horizontal.feature +55 -0
  157. package/tests/features/select-by-label.feature +31 -0
  158. package/tests/features/selector-files.feature +14 -0
  159. package/tests/features/selectors-position.feature +41 -0
  160. package/tests/features/selectors-table-header.feature +35 -0
  161. package/tests/features/settle-budget.feature +11 -0
  162. package/tests/features/sorted-tables.feature +19 -0
  163. package/tests/features/storage-quoted-values.feature +26 -0
  164. package/tests/features/storage.feature +98 -0
  165. package/tests/features/test--then--i-see-locator.feature +13 -0
  166. package/tests/features/test--then--i-should--see-text-in-element.feature +9 -1
  167. package/tests/features/test--then--the-field-should-contain-value.feature +8 -0
  168. package/tests/features/text-matching.feature +38 -0
  169. package/tests/features/text-order.feature +14 -0
  170. package/tests/features/touch.feature +21 -0
  171. package/tests/features/video.feature +1 -0
  172. package/tests/features/viewport-top.feature +13 -0
  173. package/tests/features/wait.feature +89 -0
  174. package/tests/features/web-first.feature +100 -0
  175. package/tests/features/xml-namespaces.feature +34 -0
  176. package/tests/features/xml.feature +96 -0
  177. package/tests/features/yaml.feature +75 -0
  178. package/tests/must-fail/api-json-paths.feature +21 -0
  179. package/tests/must-fail/api-response-contains.feature +23 -0
  180. package/tests/must-fail/api-response-header-presence.feature +17 -0
  181. package/tests/must-fail/api-response-header.feature +21 -0
  182. package/tests/must-fail/api-without-base-url.feature +11 -0
  183. package/tests/must-fail/assertions.feature +96 -0
  184. package/tests/must-fail/breakpoints.feature +15 -0
  185. package/tests/must-fail/choice-controls.feature +25 -0
  186. package/tests/must-fail/clock.feature +11 -0
  187. package/tests/must-fail/datetime-field.feature +10 -0
  188. package/tests/must-fail/element-selector-hint.feature +17 -0
  189. package/tests/must-fail/field-state.feature +20 -0
  190. package/tests/must-fail/fill-field.feature +30 -0
  191. package/tests/must-fail/iframe-text.feature +17 -0
  192. package/tests/must-fail/modal-open.feature +26 -0
  193. package/tests/must-fail/multi-value-field.feature +18 -0
  194. package/tests/must-fail/registered-names.feature +25 -0
  195. package/tests/must-fail/select-list.feature +15 -0
  196. package/tests/must-fail/selector-files.feature +10 -0
  197. package/tests/must-fail/sorted-tables.feature +20 -0
  198. package/tests/must-fail/storage-before-a-page.feature +13 -0
  199. package/tests/must-fail/text-matching.feature +16 -0
  200. package/tests/must-fail/text-order.feature +15 -0
  201. package/tests/must-fail/viewport-top.feature +20 -0
  202. package/tests/must-fail/waits.feature +51 -0
  203. package/tests/must-fail/yaml-numbers.feature +48 -0
  204. package/tests/reports/README.md +2 -2
  205. package/tests/step-definitions/a11y.steps.js +36 -23
  206. package/tests/step-definitions/action.steps.js +22 -8
  207. package/tests/step-definitions/api.steps.js +349 -67
  208. package/tests/step-definitions/assertion.steps.js +327 -63
  209. package/tests/step-definitions/auth.steps.js +15 -18
  210. package/tests/step-definitions/clock.steps.js +22 -0
  211. package/tests/step-definitions/debug.steps.js +8 -0
  212. package/tests/step-definitions/dialog.steps.js +9 -2
  213. package/tests/step-definitions/element.steps.js +135 -18
  214. package/tests/step-definitions/field.steps.js +523 -80
  215. package/tests/step-definitions/file-download.steps.js +74 -10
  216. package/tests/step-definitions/form.steps.js +76 -29
  217. package/tests/step-definitions/iframe.steps.js +89 -29
  218. package/tests/step-definitions/input.steps.js +26 -7
  219. package/tests/step-definitions/javascript.steps.js +64 -22
  220. package/tests/step-definitions/modal.steps.js +79 -13
  221. package/tests/step-definitions/navigation.steps.js +14 -0
  222. package/tests/step-definitions/network.steps.js +15 -5
  223. package/tests/step-definitions/response.steps.js +6 -4
  224. package/tests/step-definitions/responsive.steps.js +26 -33
  225. package/tests/step-definitions/screenshot.steps.js +26 -9
  226. package/tests/step-definitions/scroll.steps.js +20 -0
  227. package/tests/step-definitions/selectors.steps.js +104 -51
  228. package/tests/step-definitions/storage.steps.js +41 -16
  229. package/tests/step-definitions/table.steps.js +81 -6
  230. package/tests/step-definitions/video.steps.js +52 -55
  231. package/tests/step-definitions/wait.steps.js +209 -54
  232. package/tests/step-definitions/web-first.steps.js +69 -35
  233. package/tests/step-definitions/webship.js +807 -128
  234. package/tests/step-definitions/xml.steps.js +124 -28
  235. package/tests/step-definitions/yaml.steps.js +90 -46
  236. package/.scratch/commit.txt +0 -14
  237. package/.scratch/docs.py +0 -42
  238. package/.scratch/echo-server.js +0 -8
  239. package/.scratch/echo.js +0 -35
  240. package/.scratch/echo.pid +0 -1
  241. package/.scratch/features/cookies.feature +0 -22
  242. package/.scratch/http.pid +0 -1
  243. package/.scratch/https.pid +0 -1
  244. package/.scratch/issue.md +0 -49
  245. package/.scratch/one.js +0 -2
  246. package/.scratch/one.json +0 -280
  247. package/.scratch/patch.py +0 -163
  248. package/.scratch/pr.md +0 -30
@@ -0,0 +1,11 @@
1
+ Feature: The settle after a step waits for the page as long as its budget allows
2
+ After a step that changes the page, webship-js waits for the page to settle
3
+ for up to 1.5 seconds. The last phase of that wait (the requests, the
4
+ timers and the DOM falling quiet) may use every millisecond the earlier
5
+ phases left, so a page that answers one second after a press is settled
6
+ before the next step reads it.
7
+
8
+ Scenario: A press whose answer comes one second later
9
+ Given I am on "/settle-budget.html"
10
+ When I press "Load"
11
+ Then I should see "Loaded" in the "#status" element
@@ -0,0 +1,19 @@
1
+ Feature: A sorted table column is read the way a reader orders it
2
+ The cells are compared as numbers when every cell reads as a number, as
3
+ dates when every cell reads as a date, else as text with letter case
4
+ ignored and the numbers inside the text in number order.
5
+
6
+ Scenario: Prices, quantities and dates in ascending order
7
+ Given I am on "/sorted-tables.html"
8
+ Then the table "#prices" should be sorted by "Price" in "ascending" order
9
+ And the table "#prices" should be sorted by "Stock" in "asc" order
10
+ And the table "#prices" should be sorted by "Released" in "ascending" order
11
+
12
+ Scenario: Text with letter case ignored
13
+ Given I am on "/sorted-tables.html"
14
+ Then the table "#prices" should be sorted by "Product" in "ascending" order
15
+
16
+ Scenario: Numbers inside a text, descending, and equal cells
17
+ Given I am on "/sorted-tables.html"
18
+ Then the table "#items" should be sorted by "Item" in "descending" order
19
+ And the table "#items" should be sorted by "Discount" in "asc" order
@@ -0,0 +1,26 @@
1
+ Feature: Storage and cookie values with a double quote
2
+ As a tester,
3
+ I want to set a value that holds a double quote, such as JSON,
4
+ so that a page can start with the state it reads from local storage, session storage or a cookie.
5
+
6
+ Scenario: A local storage value that holds JSON
7
+ Given I am on "/storage.html"
8
+ When the local storage "prefs" is set to "{\"theme\":\"dark\"}"
9
+ And I reload the page
10
+ Then I should see text matching "prefs = \{\x22theme\x22:\x22dark\x22\}"
11
+
12
+ Scenario: A session storage key and value with double quotes
13
+ Given I am on "/storage.html"
14
+ When the session storage "the \"last\" note" is set to "say \"hi\""
15
+ And I reload the page
16
+ Then I should see text matching "the \x22last\x22 note = say \x22hi\x22"
17
+ When the session storage "the \"last\" note" is removed
18
+ And I reload the page
19
+ Then "#session-storage" should have text "Session storage is empty"
20
+
21
+ Scenario: A cookie value wrapped in double quotes
22
+ Given I am on "/storage.html"
23
+ When the cookie "wrapped" is set to "\"dark\""
24
+ Then a cookie with the name "wrapped" and the value "\"dark\"" should exist
25
+ When the cookie "wrapped" is removed
26
+ Then a cookie with the name "wrapped" should not exist
@@ -0,0 +1,98 @@
1
+ Feature: Cookie, local storage and session storage steps
2
+ As a tester,
3
+ I want to set, remove and clear cookies, local storage and session storage from a scenario,
4
+ so that a page starts in the state the scenario needs without clicking through the site.
5
+
6
+ Scenario: A cookie set before the first page is sent with that page
7
+ Given the cookie "theme" is set to "dark"
8
+ When I am on "/storage.html"
9
+ Then "#cookies" should have text "theme = dark"
10
+ And a cookie with the name "theme" and the value "dark" should exist
11
+
12
+ Scenario: A cookie set on a loaded page shows after a reload
13
+ Given I am on "/storage.html"
14
+ Then "#cookies" should have text "No cookies"
15
+ When cookie "ab_bucket" is set to "variant-b"
16
+ And I reload the page
17
+ Then "#cookies" should have text "ab_bucket = variant-b"
18
+
19
+ Scenario: Removing one cookie keeps the other cookies
20
+ Given I am on "/storage.html"
21
+ And the cookie "theme" is set to "dark"
22
+ And the cookie "lang" is set to "en"
23
+ When I reload the page
24
+ Then "#cookies" should contain text "theme = dark"
25
+ And "#cookies" should contain text "lang = en"
26
+ When the cookie "theme" is removed
27
+ And I reload the page
28
+ Then "#cookies" should have text "lang = en"
29
+ And a cookie with the name "theme" should not exist
30
+ And a cookie with the name "lang" and the value "en" should exist
31
+
32
+ Scenario: Clearing all cookies leaves none
33
+ Given I am on "/storage.html"
34
+ And the cookie "theme" is set to "dark"
35
+ And the cookie "lang" is set to "en"
36
+ When I reload the page
37
+ And "#cookies li" should have a count of 2
38
+ When all cookies are cleared
39
+ And I reload the page
40
+ Then "#cookies" should have text "No cookies"
41
+ And a cookie with the name "theme" should not exist
42
+ And a cookie with the name "lang" should not exist
43
+
44
+ Scenario: Local storage entries are set, removed one by one, then gone
45
+ Given I am on "/storage.html"
46
+ Then "#local-storage" should have text "Local storage is empty"
47
+ When the local storage "theme" is set to "dark"
48
+ And local storage "lang" is set to "fr"
49
+ And I reload the page
50
+ Then "#local-storage li" should have a count of 2
51
+ And "#local-storage" should contain text "theme = dark"
52
+ And "#local-storage" should contain text "lang = fr"
53
+ When the local storage "theme" is removed
54
+ And I reload the page
55
+ Then "#local-storage" should have text "lang = fr"
56
+ When local storage "lang" is removed
57
+ And I reload the page
58
+ Then "#local-storage" should have text "Local storage is empty"
59
+
60
+ Scenario: Clearing local storage leaves the session storage alone
61
+ Given I am on "/storage.html"
62
+ And the local storage "theme" is set to "dark"
63
+ And the local storage "onboarding_complete" is set to "true"
64
+ And the session storage "wizard progress" is set to "3/5"
65
+ When I reload the page
66
+ Then "#local-storage li" should have a count of 2
67
+ When local storage is cleared
68
+ And I reload the page
69
+ Then "#local-storage" should have text "Local storage is empty"
70
+ And "#session-storage" should have text "wizard progress = 3/5"
71
+
72
+ Scenario: Session storage entries are set, removed one by one, then gone
73
+ Given I am on "/storage.html"
74
+ Then "#session-storage" should have text "Session storage is empty"
75
+ When the session storage "checkout step" is set to "2"
76
+ And session storage "tab id" is set to "tab-1"
77
+ And I reload the page
78
+ Then "#session-storage li" should have a count of 2
79
+ And "#session-storage" should contain text "checkout step = 2"
80
+ And "#session-storage" should contain text "tab id = tab-1"
81
+ When the session storage "checkout step" is removed
82
+ And I reload the page
83
+ Then "#session-storage" should have text "tab id = tab-1"
84
+ When session storage "tab id" is removed
85
+ And I reload the page
86
+ Then "#session-storage" should have text "Session storage is empty"
87
+
88
+ Scenario: Clearing session storage leaves the local storage alone
89
+ Given I am on "/storage.html"
90
+ And the session storage "checkout step" is set to "2"
91
+ And the session storage "from checkout" is set to "true"
92
+ And the local storage "theme" is set to "dark"
93
+ When I reload the page
94
+ Then "#session-storage li" should have a count of 2
95
+ When session storage is cleared
96
+ And I reload the page
97
+ Then "#session-storage" should have text "Session storage is empty"
98
+ And "#local-storage" should have text "theme = dark"
@@ -273,6 +273,19 @@ Feature: Relative element positioning assertions and advanced selector system.
273
273
  Then I see heading, list inside of body
274
274
  And I see body outside of heading, list
275
275
 
276
+ # ---------------------------------------------------------------------------
277
+ # Advanced — selector names that contain the letters "and".
278
+ # ---------------------------------------------------------------------------
279
+ Scenario: A selector name may contain the letters "and".
280
+ Given I define css selectors:
281
+ | brand heading | h1 |
282
+ | landing subline | h3 |
283
+ | standard list | ul |
284
+ Then I see brand heading above landing subline
285
+ And I see brand heading above landing subline and standard list
286
+ And I see brand heading, landing subline above standard list
287
+ And I see standard list below brand heading, and landing subline
288
+
276
289
  # ---------------------------------------------------------------------------
277
290
  # Advanced — "not over" negation (non-overlap).
278
291
  # ---------------------------------------------------------------------------
@@ -7,4 +7,12 @@ Feature: An example to ensure that the input text contain a specific value based
7
7
  When I fill in "Username" with "user1"
8
8
  And I fill in "Password" with "1234"
9
9
  Then I should see "user1" in the "Username" element
10
- And I should see "1234" in the "Password" element
10
+ And I should see "1234" in the "Password" element
11
+
12
+ Scenario: Ensuring that an element named by a CSS selector contains a specific text.
13
+ Given I am on "/test--then--i-should--not--see-text-in-element.html"
14
+ When I fill in "Username" with "user1"
15
+ Then I should see "Login" in the "h1" element
16
+ And I should see "user1" in the "#uname" element
17
+ And I should see "user1" in the "[name=username]" element
18
+ And I should not see "user2" in the "input.unamecss" element
@@ -9,3 +9,11 @@ Feature: An example to verify whether the field contains a specific value identi
9
9
  When I press "Reset" by attr
10
10
  And I fill in "Username" with "user2"
11
11
  Then the "Username" field should contain "user2"
12
+
13
+
14
+ Scenario: Verify that a field named by a CSS selector has a particular value
15
+ Given I am on "/test--then--i-should--not--see-text-in-element.html"
16
+ And I fill in "Username" with "user1"
17
+ Then the "#uname" field should contain "user1"
18
+ And the "[name=username]" field should contain "user1"
19
+ And the "input.unamecss" field should not contain "user2"
@@ -0,0 +1,38 @@
1
+ Feature: The page-text steps read the page the same way
2
+ `I should see`, `I should not see` and `eventually I should see` read the
3
+ text of the page with one matcher: letter case ignored, white space
4
+ collapsed, the text of hidden elements included, the text of <script> and
5
+ <style> left out. On the page, "Saving draft" goes away and "Draft saved"
6
+ arrives about two seconds after it opens, on a timer the smart waits do not
7
+ wait for.
8
+
9
+ Scenario: Letter case does not matter, in either polarity
10
+ Given I am on "/text-matching.html"
11
+ Then I should see "next page"
12
+ And I should see "NEXT PAGE"
13
+ And I should not see "previous page"
14
+
15
+ Scenario: The text of a hidden element is page text
16
+ Given I am on "/text-matching.html"
17
+ Then I should see "Members save 10 percent"
18
+ And I should see "members save 10 percent"
19
+
20
+ Scenario: The text of a script or a style is not page text
21
+ Given I am on "/text-matching.html"
22
+ Then I should not see "inlineScriptMarker"
23
+ And I should not see "only a script reads this"
24
+ And I should not see "styleRuleMarker"
25
+
26
+ Scenario: White space is collapsed
27
+ Given I am on "/text-matching.html"
28
+ Then I should see "Order total: 42 items"
29
+
30
+ Scenario: The negative waits for a text that goes away
31
+ Given I am on "/text-matching.html"
32
+ Then I should not see "Saving draft"
33
+
34
+ Scenario: Eventually reads the page text the same way
35
+ Given I am on "/text-matching.html"
36
+ Then eventually I should see "draft saved" within 5 seconds
37
+ And eventually I should see "saved as version 2"
38
+ And eventually we should see "NEXT PAGE"
@@ -0,0 +1,14 @@
1
+ Feature: One text after another, on the page or inside one element
2
+ `the text "A" should appear after the text "B"` compares the first place
3
+ each text appears in the visible text of the whole page; adding
4
+ `in the "<selector>" element` compares them inside that element.
5
+
6
+ Scenario: The whole page: the menu holds the first "Products"
7
+ Given I am on "/text-order.html"
8
+ Then the text "Total" should appear after the text "Subtotal"
9
+ And the text "Home" should appear after the text "Products"
10
+
11
+ Scenario: Inside the breadcrumb
12
+ Given I am on "/text-order.html"
13
+ Then the text "Products" should appear after the text "Home" in the "nav.breadcrumb" element
14
+ And the text "Laptops" should appear after the text "Products" in the "nav.breadcrumb" element
@@ -0,0 +1,21 @@
1
+ Feature: Taps in a browser context with touch
2
+ A scenario tagged @touch opens with touch on, so "I tap on" fires the
3
+ touch events a mobile control listens to. Without the tag the browser
4
+ context has no touch, and a tap is a click.
5
+
6
+ @touch
7
+ Scenario: A tap with touch on reaches a control that listens to touch only
8
+ Given I am on "/touch.html"
9
+ When I tap on "#touch-card"
10
+ Then "#result" should have text "Touched the card"
11
+
12
+ @mobile @touch
13
+ Scenario: A phone with touch
14
+ Given I am on "/touch.html"
15
+ When I tap on "#touch-card"
16
+ Then "#result" should have text "Touched the card"
17
+
18
+ Scenario: Without touch a tap is a click
19
+ Given I am on "/touch.html"
20
+ When I tap on "#click-card"
21
+ Then "#result" should have text "Clicked the card"
@@ -15,4 +15,5 @@ Feature: 🎬 Video recording
15
15
  When I press "🎉 Celebrate"
16
16
  Then I should see "Party time"
17
17
  When I save the current video as "demo.webm"
18
+ Then print video path
18
19
  When I stop video recording
@@ -0,0 +1,13 @@
1
+ Feature: An element at the top of the viewport
2
+ `the element "<selector>" should be at the top of the viewport` passes when
3
+ the top of the element is between 0 and 100 pixels from the top of the
4
+ viewport, and looks again for up to 5 seconds.
5
+
6
+ Scenario: An element already at the top
7
+ Given I am on "/viewport-top.html"
8
+ Then the element "#section-1" should be at the top of the viewport
9
+
10
+ Scenario: An element that gets there a moment after the click
11
+ Given I am on "/viewport-top.html"
12
+ When I click "Go to section 3"
13
+ Then the element "#section-3" should be at the top of the viewport
@@ -5,3 +5,92 @@ Feature: Wait step definitions
5
5
  When I wait for 1 second
6
6
  And I wait for 1 seconds
7
7
  And I wait for 1 second for AJAX to finish
8
+
9
+ Scenario: Wait for an element to appear
10
+ Given I am on "/wait-conditions.html"
11
+ Then the element "#notice" should not be displayed
12
+ When I press "Show notice"
13
+ And I wait for "#notice" to appear
14
+ Then the element "#notice" should be displayed
15
+
16
+ Scenario: Wait for an element to disappear
17
+ Given I am on "/wait-conditions.html"
18
+ Then I should see 1 "#spinner" element
19
+ When I press "Finish loading"
20
+ And I wait for "#spinner" to disappear
21
+ Then I should see 0 "#spinner" elements
22
+
23
+ Scenario: Wait for text to appear
24
+ Given I am on "/wait-conditions.html"
25
+ When I press "Show notice"
26
+ And I wait for the text "Notice ready" to appear
27
+ Then the element "#notice" should be displayed
28
+
29
+ Scenario: Wait for text to disappear
30
+ Given I am on "/wait-conditions.html"
31
+ Then I should see "Loading data"
32
+ When I press "Finish loading"
33
+ And we wait for text "Loading data" to disappear
34
+ Then I should not see "Loading data"
35
+
36
+ Scenario: Wait until the URL contains a fragment
37
+ Given I am on "/wait-conditions.html"
38
+ Then the url should not match "step=2"
39
+ When I press "Go to step 2"
40
+ And I wait until the URL contains "?step=2"
41
+ Then the url should match "step=2"
42
+
43
+ Scenario: Wait until the page title is or contains a value
44
+ Given I am on "/wait-conditions.html"
45
+ When I press "Go to step 2"
46
+ And I wait until the page title contains "Step 2"
47
+ And I wait until the page title is "Step 2 - Wait conditions"
48
+ Then "#step" should have text "Step 2"
49
+
50
+ Scenario: Wait until a number of elements match
51
+ Given I am on "/wait-conditions.html"
52
+ When I wait until 0 elements match ".result"
53
+ And I press "Load results"
54
+ And I wait until 3 elements match ".result"
55
+ Then I should see 3 ".result" elements
56
+ When I press "Load more"
57
+ And I wait until at least 4 elements match ".result"
58
+ Then I should see 5 ".result" elements
59
+
60
+ Scenario: Wait until one element matches
61
+ Given I am on "/wait-conditions.html"
62
+ When I press "Show notice"
63
+ And I wait until 1 element matches "#notice:not([hidden])"
64
+ And I wait until at least 1 element matches "#notice:not([hidden])"
65
+ Then the element "#notice" should be displayed
66
+
67
+ Scenario: Eventually the text shows
68
+ Given I am on "/wait-conditions.html"
69
+ When I press "Show notice"
70
+ Then eventually I should see "Notice ready"
71
+ When I press "Go to step 2"
72
+ Then eventually we should see "Step 2" within 8 seconds
73
+
74
+ Scenario: Wait until the pending timers of the page have fired
75
+ Given I am on "/wait-conditions.html"
76
+ When I press "Show notice"
77
+ And I wait until pending timers settle
78
+ Then I should see 1 "#notice:not([hidden])" element
79
+
80
+ Scenario: A wait in minutes returns as soon as the page settles
81
+ Given I am on "/wait-conditions.html"
82
+ When I press "Show notice"
83
+ And I wait 1 minute
84
+ Then I should see 1 "#notice:not([hidden])" element
85
+ When I press "Load results"
86
+ And I wait max of 1 minute
87
+ Then I should see 3 ".result" elements
88
+
89
+ Scenario: A wait with no unit is a wait in seconds
90
+ Given I am on "/wait-conditions.html"
91
+ When I press "Show notice"
92
+ And I wait 5
93
+ Then I should see 1 "#notice:not([hidden])" element
94
+ When I press "Load results"
95
+ And we wait max of 5
96
+ Then I should see 3 ".result" elements
@@ -0,0 +1,100 @@
1
+ Feature: Web-first assertions wait for the page
2
+ As a tester,
3
+ I want an assertion that keeps looking until the page reaches the state I name,
4
+ so that I do not have to put a wait between an action and its check.
5
+
6
+ Scenario: The state of an element
7
+ Given I am on "/web-first.html"
8
+ Then "#banner" should be visible
9
+ And "#secret" should be hidden
10
+ And "#secret" should be attached
11
+ And "#save" should be disabled
12
+ And "#nickname" should be enabled
13
+ And "#nickname" should be editable
14
+
15
+ Scenario: The state an element is not in
16
+ Given I am on "/web-first.html"
17
+ Then "#secret" should not be visible
18
+ And "#banner" should not be hidden
19
+ And "#missing" should not be attached
20
+ And "#save" should not be enabled
21
+ And "#nickname" should not be disabled
22
+ And "#locked" should not be editable
23
+
24
+ Scenario: The focused element
25
+ Given I am on "/web-first.html"
26
+ Then "#nickname" should not be focused
27
+ When I focus on the element "#nickname"
28
+ Then "#nickname" should be focused
29
+ And "#locked" should not be focused
30
+
31
+ Scenario: A state that arrives a moment after the action
32
+ Given I am on "/web-first.html"
33
+ Then "#save" should be disabled
34
+ When I press "Unlock saving"
35
+ Then "#save" should be enabled within 5 seconds
36
+ And "#save" should not be disabled within 5 seconds
37
+
38
+ Scenario: An element inside and outside the viewport
39
+ Given I am on "/web-first.html"
40
+ Then "#banner" should be in the viewport
41
+ And "#footer-note" should not be in the viewport
42
+ When I scroll to the element "#footer-note"
43
+ Then "#footer-note" should be in the viewport within 3 seconds
44
+ And "#banner" should not be in the viewport within 3 seconds
45
+
46
+ Scenario: The number of elements that match
47
+ Given I am on "/web-first.html"
48
+ Then ".item" should have a count of 3
49
+ And "#missing" should have a count of 0
50
+ When I press "Add item"
51
+ Then ".item" should have a count of 4 within 5 seconds
52
+
53
+ Scenario: The value of a field
54
+ Given I am on "/web-first.html"
55
+ Then "#nickname" should have value "webship"
56
+ And "#locked" should have value "read only"
57
+ When I fill in the field "#nickname" with "automation"
58
+ Then "#nickname" should have value "automation" within 3 seconds
59
+
60
+ Scenario: An attribute and a class
61
+ Given I am on "/web-first.html"
62
+ Then "#tab-overview" should have attribute "aria-selected" with value "true"
63
+ And "#tab-overview" should have class "is-active"
64
+ And "#tab-details" should have attribute "aria-selected" with value "false"
65
+ And "#about-link" should have attribute "href" with value "about-us.html"
66
+
67
+ Scenario: Click a tab by its role and name
68
+ Given I am on "/web-first.html"
69
+ Then the "Details" tab should be visible
70
+ When I click the "Details" tab
71
+ Then "#tab-details" should have attribute "aria-selected" with value "true" within 3 seconds
72
+ And "#tab-details" should have class "is-active" within 3 seconds
73
+ And "#tab-overview" should have attribute "aria-selected" with value "false"
74
+ And "#panel" should have text "Details panel"
75
+
76
+ Scenario: Click buttons by their role and name
77
+ Given I am on "/web-first.html"
78
+ Then the "Unlock saving" button should be visible
79
+ And the "Save changes" button should be visible within 3 seconds
80
+ When I click the "Unlock saving" button
81
+ Then "#save" should be enabled
82
+ When we click the "Save changes" button
83
+ Then "#status" should have text "Saved"
84
+
85
+ Scenario: Click a link by its role and name
86
+ Given I am on "/web-first.html"
87
+ Then the "About Us" link should be visible
88
+ When I click the "About Us" link
89
+ Then I should be on "/about-us.html"
90
+
91
+ Scenario: Click a checkbox and a radio by their role and name
92
+ Given I am on "/web-first.html"
93
+ Then the "Subscribe" checkbox should be visible
94
+ And the "Premium" radio should be visible
95
+ And the "#subscribe" checkbox is not checked
96
+ When I click the "Subscribe" checkbox
97
+ Then the "#subscribe" checkbox is checked
98
+ When I click the "Premium" radio
99
+ Then "#choice" should have text "Plan: premium"
100
+ And the radio button "#plan-premium" should be selected
@@ -0,0 +1,34 @@
1
+ Feature: The namespaces of an XML document
2
+ As a tester,
3
+ I want to check the namespaces an XML response uses, wherever it declares them,
4
+ so that a SOAP body or a feed extension is checked as well as the root element.
5
+
6
+ Scenario: A namespace declared below the root element
7
+ Given the response content is the following:
8
+ """
9
+ <soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
10
+ <soap:Body>
11
+ <m:GetPriceResponse xmlns:m="https://www.example.org/stock">
12
+ <m:Price>34.5</m:Price>
13
+ </m:GetPriceResponse>
14
+ </soap:Body>
15
+ </soap:Envelope>
16
+ """
17
+ Then the XML should use the namespace "http://schemas.xmlsoap.org/soap/envelope/"
18
+ And the XML should use the namespace "https://www.example.org/stock"
19
+ And the XML should not use the namespace "http://www.w3.org/2005/Atom"
20
+
21
+ Scenario: A default namespace declared on a child element
22
+ Given the response content is the following:
23
+ """
24
+ <page><content xmlns="http://www.w3.org/1999/xhtml"><p>Hello</p></content></page>
25
+ """
26
+ Then the XML should use the namespace "http://www.w3.org/1999/xhtml"
27
+
28
+ Scenario: An attribute whose value is a URI is not a namespace
29
+ Given the response content is the following:
30
+ """
31
+ <links home="http://www.w3.org/1999/xhtml"><link href="http://www.w3.org/2005/Atom">Atom</link></links>
32
+ """
33
+ Then the XML should not use the namespace "http://www.w3.org/1999/xhtml"
34
+ And the XML should not use the namespace "http://www.w3.org/2005/Atom"
@@ -0,0 +1,96 @@
1
+ Feature: XML response assertions
2
+ As a tester,
3
+ I want to load an XML document from a file or from the scenario and check its elements, attributes and namespaces,
4
+ so that feeds, sitemaps and XML answers are covered like pages are.
5
+
6
+ Scenario: XML loaded from a file under tests/assets
7
+ Given the response content from the file "catalog.xml"
8
+ Then the response should be in XML format
9
+ And the XML element "/catalog" should exist
10
+ And the XML element "/catalog/book" should have 3 elements
11
+ And the XML element "/catalog/status" should have 1 element
12
+ And the XML element "/catalog/status" should be equal to "published"
13
+
14
+ Scenario: Elements exist, are equal and contain, and the opposite of each
15
+ Given the response content from the file "catalog.xml"
16
+ Then the XML element "//book/title" should exist
17
+ And the XML element "/catalog/book[2]/title" should exist
18
+ And the XML element "/catalog/magazine" should not exist
19
+ And the XML element "//error" should not exist
20
+ And the XML element "/catalog/book[1]/title" should be equal to "Testing with Webship-js"
21
+ And the XML element "/catalog/book[3]/title" should not be equal to "Testing with Webship-js"
22
+ And the XML element "/catalog/book[2]/title" should contain "development"
23
+ And the XML element "/catalog/book[2]/title" should not contain "Webship-js"
24
+ And the XML element "/catalog/book[@lang='fr']/price" should be equal to "19.00"
25
+
26
+ Scenario: Attributes exist, are equal and contain, and the opposite of each
27
+ Given the response content from the file "catalog.xml"
28
+ Then the XML attribute "id" on element "/catalog/book[1]" should exist
29
+ And the XML attribute "isbn" on element "/catalog/book[1]" should not exist
30
+ And the XML attribute "version" on element "/catalog" should be equal to "2.0"
31
+ And the XML attribute "lang" on element "/catalog/book[3]" should not be equal to "en"
32
+ And the XML attribute "updated" on element "/catalog" should contain "2026"
33
+ And the XML attribute "currency" on element "/catalog/book[2]/price" should not contain "USD"
34
+
35
+ Scenario: XML written in the scenario
36
+ Given the response content is the following:
37
+ """
38
+ <order id="A-100">
39
+ <customer><name>Webship Tester</name></customer>
40
+ <status>shipped</status>
41
+ </order>
42
+ """
43
+ Then the response should be in XML format
44
+ And the XML element "/order/customer/name" should be equal to "Webship Tester"
45
+ And the XML element "//status" should contain "ship"
46
+ And the XML attribute "id" on element "/order" should be equal to "A-100"
47
+
48
+ Scenario: Namespaces the root element declares
49
+ Given the response content from the file "feed-namespaced.xml"
50
+ Then the XML should use the namespace "http://www.w3.org/2005/Atom"
51
+ And the XML should use the namespace "http://purl.org/dc/elements/1.1/"
52
+ And the XML should not use the namespace "http://www.w3.org/1999/xhtml"
53
+ And the XML element "/feed/entry" should have 2 elements
54
+ And the XML element "/feed/entry[2]/title" should be equal to "Second release"
55
+
56
+ Scenario: Elements and attributes with a namespace prefix
57
+ Given the response content from the file "feed-namespaced.xml"
58
+ Then the XML element "//dc:creator" should exist
59
+ And the XML element "/feed/entry/dc:creator" should have 2 elements
60
+ And the XML element "/feed/entry[1]/dc:creator" should be equal to "Webship"
61
+ And the XML attribute "rel" on element "/feed/atom:link" should be equal to "self"
62
+ And the XML attribute "href" on element "/feed/atom:link" should contain "feed.xml"
63
+ And the XML element "//dc:publisher" should not exist
64
+
65
+ Scenario: A sitemap: names without a prefix in the default namespace
66
+ Given the response content from the file "sitemap.xml"
67
+ Then the XML should use the namespace "http://www.sitemaps.org/schemas/sitemap/0.9"
68
+ And the XML element "/urlset/url" should have 2 elements
69
+ And the XML element "/urlset/url[1]/loc" should be equal to "https://example.com/"
70
+ And the XML element "/urlset/url[2]/lastmod" should contain "2026-11"
71
+ And the XML element "//image:image/image:loc" should contain "logo.png"
72
+ And the XML element "/urlset/url[2]/image:image" should not exist
73
+ And the XML element "/urlset/url[1]/image" should not exist
74
+
75
+ Scenario: Content that is not XML
76
+ Given the response content is the following:
77
+ """
78
+ {"hello": "world"}
79
+ """
80
+ Then the response should not be in XML format
81
+ Given the response content is the following:
82
+ """
83
+ plain text
84
+ """
85
+ Then the response should not be in XML format
86
+ Given the response content is the following:
87
+ """
88
+ <order><status>shipped</order>
89
+ """
90
+ Then the response should not be in XML format
91
+ Given the response content is the following:
92
+ """
93
+ <order><status>shipped</status></order>
94
+ """
95
+ Then the response should be in XML format
96
+ And the XML element "/order/status" should be equal to "shipped"