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,83 @@
1
+ Feature: Iframe step definitions
2
+ As a tester,
3
+ I want to switch to an iframe, act inside it and read its text,
4
+ so that embedded forms and widgets can be tested like the rest of the page.
5
+
6
+ Scenario: Switch to an iframe by CSS selector
7
+ Given I am on "/iframe.html"
8
+ When I switch to iframe "#order-frame"
9
+ Then I should see "Order form inside the iframe" inside the iframe
10
+ And I should not see "Newsletter form inside the iframe" inside the iframe
11
+
12
+ Scenario: Switch to the iframe by CSS selector, with the article
13
+ Given I am on "/iframe.html"
14
+ When I switch to the iframe ".newsletter-widget"
15
+ Then I should see "Newsletter form inside the iframe" inside the iframe
16
+ And I should not see "Order form inside the iframe" inside the iframe
17
+
18
+ Scenario: Switch to an iframe with a locator
19
+ Given I am on "/iframe.html"
20
+ When I switch to iframe with locator "iframe[src*=newsletter]"
21
+ Then I should see "Newsletter form inside the iframe" inside the iframe
22
+ And I should not see "Order form inside the iframe" inside the iframe
23
+
24
+ Scenario: Switch to the iframe with a title
25
+ Given I am on "/iframe.html"
26
+ When I switch to the iframe with title "Order form"
27
+ Then I should see "Order form inside the iframe" inside the iframe
28
+ And I should not see "Newsletter form inside the iframe" inside the iframe
29
+
30
+ Scenario: Switch to the iframe with a name
31
+ Given I am on "/iframe.html"
32
+ When I switch to the iframe with name "newsletter"
33
+ Then I should see "Newsletter form inside the iframe" inside the iframe
34
+ And I should not see "Order form inside the iframe" inside the iframe
35
+
36
+ Scenario: Switch from one iframe to another
37
+ Given I am on "/iframe.html"
38
+ When I switch to the iframe with name "order"
39
+ Then I should see "Order form inside the iframe" inside the iframe
40
+ When I switch to the iframe with title "Newsletter form"
41
+ Then I should see "Newsletter form inside the iframe" inside the iframe
42
+ And I should not see "Order form inside the iframe" inside the iframe
43
+
44
+ Scenario: The text of the root document is not inside the iframe
45
+ Given I am on "/iframe.html"
46
+ When I switch to iframe "#order-frame"
47
+ Then I should not see "This text is in the root document" inside the iframe
48
+ When I switch to the root document
49
+ Then I should see "This text is in the root document"
50
+
51
+ Scenario: Click a text inside the iframe
52
+ Given I am on "/iframe.html"
53
+ When I switch to iframe "#order-frame"
54
+ Then I should not see "Order confirmed" inside the iframe
55
+ When I click "Confirm" inside the iframe
56
+ Then I should see "Order confirmed" inside the iframe
57
+
58
+ Scenario: Click an element by its id inside the iframe
59
+ Given I am on "/iframe.html"
60
+ When I switch to iframe "#order-frame"
61
+ And I click "cancel-btn" by attr inside the iframe
62
+ Then I should see "Order cancelled" inside the iframe
63
+ And I should not see "Order confirmed" inside the iframe
64
+
65
+ Scenario: Click an element by its test id inside the iframe
66
+ Given I am on "/iframe.html"
67
+ When I switch to iframe "#order-frame"
68
+ And I click "Confirm" inside the iframe
69
+ And I click "cancel-order" by attr inside the iframe
70
+ Then I should see "Order cancelled" inside the iframe
71
+
72
+ Scenario: Fill in a field by its name inside the iframe
73
+ Given I am on "/iframe.html"
74
+ When I switch to the iframe with name "newsletter"
75
+ Then I should not see "Hello Webship" inside the iframe
76
+ When I fill in "subscriber_name" with "Webship" inside the iframe
77
+ Then I should see "Hello Webship" inside the iframe
78
+
79
+ Scenario: Fill in a field by its id inside the iframe
80
+ Given I am on "/iframe.html"
81
+ When I switch to the iframe with name "newsletter"
82
+ And I fill in "city" with "Amman" inside the iframe
83
+ Then I should see "City set to Amman" inside the iframe
@@ -0,0 +1,20 @@
1
+ Feature: JavaScript errors a scenario tolerates
2
+ As a tester,
3
+ I want to tolerate the errors of a noisy page while one pattern must never appear,
4
+ so that a run in "fail" mode fails only on what the scenario does not accept.
5
+
6
+ # "@js-fail" fails a scenario on any JavaScript error it does not handle.
7
+ # "JavaScript errors should not match" handles the errors it checked.
8
+ @js-fail
9
+ Scenario: Errors that do not match the pattern do not fail the scenario
10
+ Given I am on "/javascript-errors.html"
11
+ When I press "Throw an error"
12
+ Then I should see "An error was thrown"
13
+ And JavaScript errors should not match "TypeError"
14
+
15
+ @js-fail
16
+ Scenario: A logged error that does not match the pattern does not fail the scenario
17
+ Given I am on "/javascript-errors.html"
18
+ When I press "Log an error"
19
+ Then I should see "An error was logged"
20
+ And JavaScript errors should not match "is not defined"
@@ -0,0 +1,47 @@
1
+ Feature: JavaScript errors of the page
2
+ As a tester,
3
+ I want to know when the page throws or logs an error,
4
+ so that a broken script does not hide behind a page that still looks right.
5
+
6
+ Scenario: A quiet page has no JavaScript errors and no warnings
7
+ Given I am on "/javascript-errors.html"
8
+ Then I should see "Nothing has happened yet"
9
+ And there should be no JavaScript errors
10
+ And there should be no JavaScript warnings
11
+ And JavaScript errors should not match "Demo"
12
+ And print JavaScript errors
13
+
14
+ Scenario: A warning is not an error
15
+ Given I am on "/javascript-errors.html"
16
+ When I press "Log a warning"
17
+ Then I should see "A warning was logged"
18
+ And there should be no JavaScript errors
19
+
20
+ # The page throws on purpose here. "@js-warn" keeps this scenario in the
21
+ # reporting mode whatever WEBSHIP_JS_ERROR_MODE the run uses, so a run in
22
+ # "fail" mode does not fail on the error this scenario asks for.
23
+ @js-warn
24
+ Scenario: An error the page throws is collected and can be matched
25
+ Given I am on "/javascript-errors.html"
26
+ When I press "Throw an error"
27
+ Then I should see "An error was thrown"
28
+ And JavaScript errors should not match "TypeError"
29
+ And JavaScript errors should not match "is not defined"
30
+ And print JavaScript errors
31
+
32
+ @js-warn
33
+ Scenario: An error the page logs is collected and can be matched
34
+ Given I am on "/javascript-errors.html"
35
+ When I press "Log an error"
36
+ Then I should see "An error was logged"
37
+ And JavaScript errors should not match "^Demo failure"
38
+ And print JavaScript errors
39
+
40
+ # With "@js-off" nothing is collected, so the hard check passes even on a
41
+ # page that throws.
42
+ @js-off
43
+ Scenario: Nothing is collected when the collector is off
44
+ Given I am on "/javascript-errors.html"
45
+ When I press "Throw an error"
46
+ Then I should see "An error was thrown"
47
+ And there should be no JavaScript errors
@@ -9,3 +9,14 @@ Feature: Link step definitions
9
9
  And the link with the title "Nonexistent" should not exist
10
10
  And the link "Example" should be an absolute link
11
11
  And the link "About" should not be an absolute link
12
+
13
+ Scenario: No link with the text and the href within an element
14
+ Given I am on "/links.html"
15
+ Then the link "Contact" with the href "/contact" within the element "#nav" should exist
16
+ And the link "About" with the href "/about" within the element "#nav" should not exist
17
+ And the link "Contact" with the href "/missing" within the element "#nav" should not exist
18
+
19
+ Scenario: Click on the link with a title
20
+ Given I am on "/links.html"
21
+ When I click on the link with the title "Meet the team"
22
+ Then I should be on "/about-us.html"
@@ -0,0 +1,38 @@
1
+ Feature: Meta tag steps
2
+ As a tester,
3
+ I want to check the meta tags in the head of a page,
4
+ so that search engines and link previews get what the page promises.
5
+
6
+ Scenario: A meta tag with the given attributes exists
7
+ Given I am on "/metatags.html"
8
+ Then the meta tag should exist with the following attributes:
9
+ | name | description |
10
+ | content | A plain page with meta tags for the Webship-js meta tag steps. |
11
+ And the meta tag should exist with the following attributes:
12
+ | property | og:title |
13
+ | content | Meta tags - Webship Testing |
14
+ And the meta tag should exist with the following attributes:
15
+ | name | robots |
16
+ | content | index,follow |
17
+ And the meta tag should exist with the following attributes:
18
+ | charset | utf-8 |
19
+
20
+ Scenario: A meta tag with the given attributes does not exist
21
+ Given I am on "/metatags.html"
22
+ Then the meta tag should not exist with the following attributes:
23
+ | name | robots |
24
+ | content | noindex,nofollow |
25
+ And the meta tag should not exist with the following attributes:
26
+ | name | description |
27
+ | content | Coming soon |
28
+ And the meta tag should not exist with the following attributes:
29
+ | http-equiv | refresh |
30
+ And the meta tag should not exist with the following attributes:
31
+ | property | og:title |
32
+ | content | Placeholder |
33
+
34
+ Scenario: The content of a meta tag is plain text
35
+ Given I am on "/metatags.html"
36
+ Then the "description" meta tag should not contain any HTML tags
37
+ And the "keywords" meta tag should not contain any HTML tags
38
+ And the "og:title" meta tag should not contain any HTML tags
@@ -0,0 +1,13 @@
1
+ Feature: Act in an open modal
2
+ As a tester,
3
+ I want the steps that act in a modal to work on the modal that is open,
4
+ so that a scenario can click and close it as before.
5
+
6
+ Scenario: Click a button of the open modal by its text, then close it
7
+ Given I am on "/modal.html"
8
+ When I click on the element "#open"
9
+ And I click "X" in the modal
10
+ Then I should not see the modal
11
+ When I click on the element "#open"
12
+ And I close the modal
13
+ Then I should not see the modal
@@ -0,0 +1,86 @@
1
+ Feature: Mouse and pointer step definitions
2
+ As a tester,
3
+ I want to hover, double-click, right-click, middle-click, click with a key held,
4
+ drag, tap and resize the viewport,
5
+ so that pages reacting to the pointer can be tested.
6
+
7
+ Scenario: Hover over an element
8
+ Given I am on "/mouse-and-pointer.html"
9
+ Then "#result" should have text "Nothing happened yet"
10
+ When I hover over "#hover-card"
11
+ Then "#result" should have text "Hovered over the hover card"
12
+
13
+ Scenario: Move the pointer to an element
14
+ Given I am on "/mouse-and-pointer.html"
15
+ When I move the pointer to "#pointer-card"
16
+ Then "#result" should have text "Pointer moved to the pointer card"
17
+
18
+ Scenario: Move the pointer from one element to another
19
+ Given I am on "/mouse-and-pointer.html"
20
+ When I hover over "#hover-card"
21
+ And I move the pointer to "#pointer-card"
22
+ Then "#result" should have text "Pointer moved to the pointer card"
23
+
24
+ Scenario: Double-click on an element
25
+ Given I am on "/mouse-and-pointer.html"
26
+ When I double-click on "#double-click-card"
27
+ Then "#result" should have text "Double-clicked the card"
28
+
29
+ Scenario: Double click on an element, written without the hyphen
30
+ Given I am on "/mouse-and-pointer.html"
31
+ When I double click on "#double-click-card"
32
+ Then "#result" should have text "Double-clicked the card"
33
+
34
+ Scenario: Right-click on an element
35
+ Given I am on "/mouse-and-pointer.html"
36
+ When I right-click on "#right-click-card"
37
+ Then "#result" should have text "Right-clicked the card"
38
+
39
+ Scenario: Right click on an element, written without the hyphen
40
+ Given I am on "/mouse-and-pointer.html"
41
+ When I right click on "#right-click-card"
42
+ Then "#result" should have text "Right-clicked the card"
43
+
44
+ Scenario: Middle-click on an element
45
+ Given I am on "/mouse-and-pointer.html"
46
+ When I middle-click on "#middle-click-card"
47
+ Then "#result" should have text "Middle-clicked the card"
48
+
49
+ Scenario: Middle click on an element, written without the hyphen
50
+ Given I am on "/mouse-and-pointer.html"
51
+ When I middle click on "#middle-click-card"
52
+ Then "#result" should have text "Middle-clicked the card"
53
+
54
+ Scenario: Click on an element while holding Shift
55
+ Given I am on "/mouse-and-pointer.html"
56
+ When I click on "#modifier-card" while holding "Shift"
57
+ Then "#result" should have text "Clicked while holding Shift"
58
+
59
+ Scenario: Click on an element while holding Control
60
+ Given I am on "/mouse-and-pointer.html"
61
+ When I click on "#modifier-card" while holding "Control"
62
+ Then "#result" should have text "Clicked while holding Control"
63
+
64
+ Scenario: Click on an element while holding Alt
65
+ Given I am on "/mouse-and-pointer.html"
66
+ When I click on "#modifier-card" while holding "Alt"
67
+ Then "#result" should have text "Clicked while holding Alt"
68
+
69
+ Scenario: Drag an element to another element
70
+ Given I am on "/mouse-and-pointer.html"
71
+ Then "#result" should have text "Nothing happened yet"
72
+ When I drag "#drag-card" to "#drop-zone"
73
+ Then "#result" should have text "Dropped the drag card in the drop zone"
74
+ And I should see "Drag card" in the "#drop-zone" element
75
+
76
+ Scenario: Tap on an element
77
+ Given I am on "/mouse-and-pointer.html"
78
+ When I tap on "#tap-card"
79
+ Then "#result" should have text "Tapped the card"
80
+
81
+ Scenario: Set the viewport size
82
+ Given I am on "/viewport-size.html"
83
+ When I set the viewport size to 375x667
84
+ Then "#viewport-size" should have text "Viewport is 375 by 667"
85
+ When I set the viewport size to 1280x720
86
+ Then "#viewport-size" should have text "Viewport is 1280 by 720"
@@ -0,0 +1,30 @@
1
+ Feature: Fill a multi-value field named by its inputs, its label or its legend
2
+ As a tester,
3
+ I want to fill the inputs of a multi-value field however the form names them,
4
+ so that a scenario can fill a list of values in one step.
5
+
6
+ Scenario: A multi-value field named by the legend of its fieldset
7
+ Given I am on "/multi-value-fields.html"
8
+ When I fill in the multi-value field "Phone numbers" with the following values:
9
+ | 0790000000 |
10
+ | 0791111111 |
11
+ Then "#phone-a" should have value "0790000000"
12
+ And "#phone-b" should have value "0791111111"
13
+
14
+ Scenario: A multi-value field named by its label
15
+ Given I am on "/multi-value-fields.html"
16
+ When I fill in the multi-value field "Skills" with the following values:
17
+ | testing |
18
+ | design |
19
+ Then "#skill-1" should have value "testing"
20
+ And "#skill-2" should have value "design"
21
+ And "#skill-3" should have value ""
22
+ And "#website-1" should have value ""
23
+
24
+ Scenario: A multi-value field whose inputs are named field[0][value]
25
+ Given I am on "/multi-value-fields.html"
26
+ When I fill in the multi-value field "field_topics" with the following values:
27
+ | news |
28
+ | events |
29
+ Then "#topics-0" should have value "news"
30
+ And "#topics-1" should have value "events"
@@ -0,0 +1,80 @@
1
+ Feature: Network mocking, blocking, delaying, offline mode and request assertions
2
+ As a tester,
3
+ I want to decide what a URL answers, to block it, to slow it down and to cut the network,
4
+ so that I can check what the page shows in each case and which requests it sent.
5
+
6
+ Scenario: Without mocking the page shows what the site answers
7
+ Given I am on "/network.html"
8
+ When I press "Load article"
9
+ Then "#article-status" should have text "Article loaded" within 10 seconds
10
+ And "#article-title" should have text "JSON:API paints my bikeshed!"
11
+ And "#article-author" should have text "Written by John"
12
+ And "#article-timing" should have text "Answered in under 2 seconds"
13
+
14
+ Scenario: A URL answers with the JSON of the scenario
15
+ Given the URL "**/example-api.json" returns the JSON:
16
+ """
17
+ {
18
+ "data": [{"attributes": {"title": "A mocked article"}}],
19
+ "included": [{"attributes": {"name": "Webship"}}]
20
+ }
21
+ """
22
+ And I am on "/network.html"
23
+ When I press "Load article"
24
+ Then "#article-status" should have text "Article loaded" within 10 seconds
25
+ And "#article-title" should have text "A mocked article"
26
+ And "#article-author" should have text "Written by Webship"
27
+ And I should not see "JSON:API paints my bikeshed!"
28
+
29
+ @js-off
30
+ Scenario: A blocked URL fails in the page
31
+ Given I am on "/network.html"
32
+ And the URL "**/example-api.json" is blocked
33
+ When I press "Load article"
34
+ Then "#article-status" should have text "The article request failed" within 10 seconds
35
+ And "#article-title" should have text ""
36
+
37
+ Scenario: A delayed URL answers late, with the answer of the site
38
+ Given I am on "/network.html"
39
+ And the URL "**/example-api.json" is delayed by 2500 ms
40
+ When I press "Load article"
41
+ Then "#article-status" should have text "Article loaded" within 15 seconds
42
+ And "#article-timing" should have text "Answered after 2 seconds or more"
43
+ And "#article-title" should have text "JSON:API paints my bikeshed!"
44
+
45
+ Scenario: The delay is also written without a space before ms
46
+ Given I am on "/network.html"
47
+ And the URL "**/example-api.json" is delayed by 2500ms
48
+ When I press "Load article"
49
+ Then "#article-status" should have text "Article loaded" within 15 seconds
50
+ And "#article-timing" should have text "Answered after 2 seconds or more"
51
+
52
+ @js-off
53
+ Scenario: Requests fail while the network is offline and work again once it is online
54
+ Given I am on "/network.html"
55
+ Then "#connection" should have text "The browser is online"
56
+ When the network is offline
57
+ And I press "Load article"
58
+ Then "#article-status" should have text "The article request failed" within 10 seconds
59
+ And "#connection" should have text "The browser is offline"
60
+ When the network is online
61
+ And I press "Load article"
62
+ Then "#article-status" should have text "Article loaded" within 10 seconds
63
+ And "#article-title" should have text "JSON:API paints my bikeshed!"
64
+ And "#connection" should have text "The browser is online"
65
+
66
+ Scenario: The requests the page sent are recorded with their method
67
+ Given I am on "/network.html"
68
+ And the URL "**/api/feedback" returns the JSON:
69
+ """
70
+ {"message": "Thank you from Webship"}
71
+ """
72
+ And I start recording network requests
73
+ When I press "Load article"
74
+ Then "#article-status" should have text "Article loaded" within 10 seconds
75
+ When I press "Send feedback"
76
+ Then "#feedback-status" should have text "Feedback answer: Thank you from Webship" within 10 seconds
77
+ And a GET request to "**/example-api.json" should have been made
78
+ And a POST request to "**/api/feedback" should have been made
79
+ And a request to "**/api/feedback" should have been made
80
+ And no request to "**/api/tracking" should have been made
@@ -0,0 +1,14 @@
1
+ Feature: Names of the selector registry are read by the bare-name steps
2
+ A name added to the selector registry is read by the bare-name steps of the
3
+ selector family (`I see visible <name>`, `I click <name>`). The steps that
4
+ take a text, a label or a CSS selector in quotes read their argument as it
5
+ is written, so they are given the selector itself.
6
+
7
+ Scenario: The bare-name steps and the selector itself
8
+ Given I am on "/registered-names.html"
9
+ When I add "premium-banner" selector for ".promo-banner" css selector
10
+ And I add "search box" selector for ".search-box input" css selector
11
+ Then I see visible premium-banner
12
+ And ".promo-banner" should be visible
13
+ When I fill in the field ".search-box input" with "laptops"
14
+ Then ".search-box input" should have value "laptops"
@@ -8,3 +8,30 @@ Feature: Responsive step definitions
8
8
  And I set the viewport width to 800
9
9
  And I set the viewport height to 600
10
10
  And I set the viewport to 1024 by 768
11
+
12
+ Scenario: Define responsive breakpoints for the scenario
13
+ Given I am on "/viewport-size.html"
14
+ And the following responsive breakpoints:
15
+ | pocket | 320 | 480 |
16
+ | mobile | 400 | 700 |
17
+ | poster | 900 | 1200 |
18
+ When I set the viewport to the "pocket" breakpoint
19
+ Then "#viewport-size" should have text "Viewport is 320 by 480"
20
+ When I set the viewport to the "poster" breakpoint
21
+ Then "#viewport-size" should have text "Viewport is 900 by 1200"
22
+ When I set the viewport to the "mobile" breakpoint
23
+ Then "#viewport-size" should have text "Viewport is 400 by 700"
24
+ When I set the viewport to the "tablet" breakpoint
25
+ Then "#viewport-size" should have text "Viewport is 768 by 1024"
26
+
27
+ @mobile
28
+ Scenario: A scenario tagged @mobile opens at the mobile breakpoint
29
+ Given I am on "/viewport-size.html"
30
+ Then "#viewport-size" should have text "Viewport is 375 by 667"
31
+ When I set the viewport to the "tablet" breakpoint
32
+ Then "#viewport-size" should have text "Viewport is 768 by 1024"
33
+
34
+ @desktop
35
+ Scenario: A scenario tagged @desktop opens at the desktop breakpoint
36
+ Given I am on "/viewport-size.html"
37
+ Then "#viewport-size" should have text "Viewport is 1200 by 900"
@@ -0,0 +1,55 @@
1
+ Feature: Horizontal scrolling step definitions
2
+ As a tester,
3
+ I want to scroll a page and an element to the right, to the left, to the start and to the end,
4
+ so that content wider than the window can be reached.
5
+
6
+ Scenario: Scroll right by the default distance
7
+ Given I am on "/scroll-horizontal.html"
8
+ Then "#page-position" should have text "Page scrolled 0 pixels to the right"
9
+ When I scroll right
10
+ Then "#page-position" should have text "Page scrolled 350 pixels to the right"
11
+
12
+ Scenario: Scroll right by a custom distance
13
+ Given I am on "/scroll-horizontal.html"
14
+ When I scroll right 1000
15
+ Then "#page-position" should have text "Page scrolled 1000 pixels to the right"
16
+
17
+ Scenario: Scroll left by the default distance
18
+ Given I am on "/scroll-horizontal.html"
19
+ When I scroll right 1000
20
+ And I scroll left
21
+ Then "#page-position" should have text "Page scrolled 650 pixels to the right"
22
+
23
+ Scenario: Scroll left by a custom distance
24
+ Given I am on "/scroll-horizontal.html"
25
+ When I scroll right 1000
26
+ And I scroll left 300
27
+ Then "#page-position" should have text "Page scrolled 700 pixels to the right"
28
+
29
+ Scenario: Scroll to the end of the page
30
+ Given I am on "/scroll-horizontal.html"
31
+ Then "#page-edge" should have text "Page is at the start"
32
+ When I scroll to the end
33
+ Then "#page-edge" should have text "Page is at the end"
34
+
35
+ Scenario: Scroll to the start of the page
36
+ Given I am on "/scroll-horizontal.html"
37
+ When I scroll to the end of the page
38
+ Then "#page-edge" should have text "Page is at the end"
39
+ When I scroll to the start of the page
40
+ Then "#page-edge" should have text "Page is at the start"
41
+ And "#page-position" should have text "Page scrolled 0 pixels to the right"
42
+
43
+ Scenario: Scroll to the end of an element
44
+ Given I am on "/scroll-horizontal.html"
45
+ Then "#strip-edge" should have text "Strip is at the start"
46
+ When I scroll to end of "#strip"
47
+ Then "#strip-edge" should have text "Strip is at the end"
48
+ And "#page-position" should have text "Page scrolled 0 pixels to the right"
49
+
50
+ Scenario: Scroll to the start of an element
51
+ Given I am on "/scroll-horizontal.html"
52
+ When I scroll to end of "#strip"
53
+ Then "#strip-edge" should have text "Strip is at the end"
54
+ When I scroll to start of "#strip"
55
+ Then "#strip-edge" should have text "Strip is at the start"
@@ -0,0 +1,31 @@
1
+ Feature: Select an option from a select list named by its label, name or id
2
+ As a tester,
3
+ I want to name a select list by the text of its label, whatever its length,
4
+ so that a scenario reads the way the form reads.
5
+
6
+ Scenario: A select list named by a one-word label
7
+ Given I am on "/select-by-label.html"
8
+ When I select "Saab" from "Cars"
9
+ Then the option "Saab" should be selected within the select element "#vehicle-list"
10
+
11
+ Scenario: An option named by its value, in a select list named by its label
12
+ Given I am on "/select-by-label.html"
13
+ When I select "mercedes" from "Cars"
14
+ Then the option "Mercedes" should be selected within the select element "#vehicle-list"
15
+
16
+ Scenario: A select list named by a name with brackets
17
+ Given I am on "/select-by-label.html"
18
+ When I select "Red" from "filters[colour]"
19
+ Then the option "Red" should be selected within the select element "#filters-colour"
20
+
21
+ Scenario: A select list named by its id
22
+ Given I am on "/select-by-label.html"
23
+ When I select "Volvo" from "vehicle-list"
24
+ Then the option "Volvo" should be selected within the select element "#vehicle-list"
25
+
26
+ Scenario: A select list named by its label, next to another one
27
+ Given I am on "/select-by-label.html"
28
+ When I select "Blue" from "Colour"
29
+ And I select "Saab" from "Cars"
30
+ Then the option "Blue" should be selected within the select element "#filters-colour"
31
+ And the option "Saab" should be selected within the select element "#vehicle-list"
@@ -0,0 +1,14 @@
1
+ Feature: Selector files named from the project root or by their name
2
+ As a tester,
3
+ I want to name a selector file the way I see it in the project,
4
+ so that the same name works in worldParameters.selectors.files and in a step.
5
+
6
+ Scenario: A selector file named from the project root
7
+ Given I am on homepage
8
+ When I add selectors from "tests/selectors/homepage-selectors.json" file
9
+ Then I see visible homepage heading
10
+
11
+ Scenario: A selector file named by its name in the selectors folder
12
+ Given I am on homepage
13
+ When I add selectors from "homepage-selectors.json" file
14
+ Then I see visible homepage heading
@@ -0,0 +1,41 @@
1
+ Feature: Selector position step definitions, left and right
2
+ As a tester,
3
+ I want to assert that a named component sits to the left or to the right of another,
4
+ so that the layout of a row can be tested.
5
+
6
+ Background:
7
+ Given I am on "/selectors-position.html"
8
+ And I define css selectors:
9
+ | logo | #logo |
10
+ | menu | #menu |
11
+ | search | #search |
12
+
13
+ Scenario: A component is to the left of another
14
+ Then I see logo to the left of menu
15
+
16
+ Scenario: A component is to the left of several others
17
+ Then I see logo to left of menu, search
18
+
19
+ Scenario: A component is to the right of another
20
+ Then I see search to the right of menu
21
+
22
+ Scenario: A component is to the right of several others
23
+ Then I see search to right of logo, menu
24
+
25
+ Scenario: A component is over another it overlaps and is stacked on
26
+ Given I define css selectors:
27
+ | popup | #popup |
28
+ | article | #article |
29
+ Then I see popup over article
30
+
31
+ Scenario: A component is not over another it is stacked under
32
+ Given I define css selectors:
33
+ | popup | #popup |
34
+ | article | #article |
35
+ Then I see article not over popup
36
+
37
+ Scenario: A component is not over another it does not overlap
38
+ Given I define css selectors:
39
+ | popup | #popup |
40
+ Then I see popup not over logo
41
+ And I see logo not over popup
@@ -0,0 +1,35 @@
1
+ Feature: The header row of a selectors table
2
+ As a tester,
3
+ I want to write a selectors table with a header row, as the docs show it,
4
+ so that the header names the columns and is never registered as a selector.
5
+
6
+ Scenario: The header row of a CSS selectors table registers no selector
7
+ Given I am on homepage
8
+ And I add "name" selector for "h1" css selector
9
+ When I define css selectors:
10
+ | name | css selector |
11
+ | table list | ul |
12
+ Then I see visible name, table list
13
+
14
+ Scenario: The header row of an XPath selectors table registers no selector
15
+ Given I am on homepage
16
+ And I add "name" selector for "//h1[1]" xpath selector
17
+ When I define xpath selectors:
18
+ | name | xpath selector |
19
+ | table xp list | //ul[1] |
20
+ Then I see visible name, table xp list
21
+
22
+ Scenario: The short header row of the hint is a header too
23
+ Given I am on homepage
24
+ And I add "name" selector for "h1" css selector
25
+ When I define css selectors:
26
+ | name | css |
27
+ | short heading | h3 |
28
+ Then I see visible name, short heading
29
+
30
+ Scenario: A table without a header row registers every row
31
+ Given I am on homepage
32
+ When I define css selectors:
33
+ | first row heading | h1 |
34
+ | second row list | ul |
35
+ Then I see visible first row heading, second row list