webship-js 2.0.2 → 2.0.4

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 (181) hide show
  1. package/.circleci/config.yml +7 -31
  2. package/.drone.yml +68 -0
  3. package/.harness/webship-js-pipeline.yml +101 -0
  4. package/.semaphore/semaphore.yml +58 -0
  5. package/.teamcity/pom.xml +52 -0
  6. package/.teamcity/settings.kts +92 -0
  7. package/.travis.yml +24 -3
  8. package/AGENTS.md +109 -0
  9. package/CLAUDE.md +317 -0
  10. package/Jenkinsfile +54 -0
  11. package/azure-pipelines.yml +82 -0
  12. package/bamboo-specs/bamboo.yml +131 -0
  13. package/bin/generate-reports.js +181 -9
  14. package/buildspec.yml +56 -0
  15. package/cloudbuild.yaml +49 -0
  16. package/codefresh.yml +77 -0
  17. package/cucumber.js +48 -5
  18. package/docs/00-quick-start.md +102 -0
  19. package/docs/01-getting-started.md +102 -0
  20. package/docs/02-bbr-smart-waits.md +77 -0
  21. package/docs/03-selector-registry.md +95 -0
  22. package/docs/04-step-reference.md +799 -0
  23. package/docs/05-web-first-assertions.md +91 -0
  24. package/docs/06-network-and-dialogs.md +83 -0
  25. package/docs/07-auth-state.md +75 -0
  26. package/docs/08-clock-mocking.md +59 -0
  27. package/docs/09-api-testing.md +114 -0
  28. package/docs/10-accessibility.md +167 -0
  29. package/docs/11-debugging.md +129 -0
  30. package/docs/12-ai-agent-guide.md +338 -0
  31. package/docs/13-faq.md +236 -0
  32. package/docs/14-recipes-cookbook.md +255 -0
  33. package/docs/15-tag-conventions.md +76 -0
  34. package/docs/16-ci-cd.md +879 -0
  35. package/docs/README.md +113 -0
  36. package/docs/advanced-screenshots/then-i-save-fullscreen-screenshot.md +36 -0
  37. package/docs/advanced-screenshots/then-i-save-width-x-height-screenshot.md +34 -0
  38. package/docs/advanced-screenshots/when-i-save-screenshot-name-filename.md +45 -0
  39. package/docs/advanced-screenshots.md +52 -0
  40. package/docs/advanced-selectors.md +18 -0
  41. package/docs/api-step-definitions.md +45 -0
  42. package/docs/diffy-step-definitions/then-compare-diffy-env1-env2.md +30 -0
  43. package/docs/diffy-step-definitions/then-create-diffy-comparison-name-value.md +21 -0
  44. package/docs/diffy-step-definitions/then-create-diffy-comparison.md +25 -0
  45. package/docs/diffy-step-definitions/then-create-diffy-screenshot-environment-name.md +35 -0
  46. package/docs/diffy-step-definitions/then-i-take-screenshot.md +21 -0
  47. package/docs/diffy-step-definitions/then-i-take-screenshots-all-breakpoints.md +27 -0
  48. package/docs/diffy-step-definitions/then-send-screenshots-diffy-name-value.md +27 -0
  49. package/docs/diffy-step-definitions/then-upload-folder-url-diffy-snapshotname.md +28 -0
  50. package/docs/diffy-step-definitions/then-wait-diffy-comparison-complete.md +21 -0
  51. package/docs/diffy-step-definitions/when-i-resize-window-number.md +29 -0
  52. package/docs/diffy-step-definitions.md +21 -0
  53. package/docs/global-settings.md +295 -0
  54. package/docs/install-webship-js/ddev-webship-js.md +52 -0
  55. package/docs/install-webship-js.md +35 -0
  56. package/docs/overview.md +41 -0
  57. package/docs/step-definitions/given-i-am-anonymous-user.md +67 -0
  58. package/docs/step-definitions/given-i-am-homepage.md +68 -0
  59. package/docs/step-definitions/given-i-am-specific-page.md +72 -0
  60. package/docs/step-definitions/then-i-should-be.md +56 -0
  61. package/docs/step-definitions/then-i-should-see.md +62 -0
  62. package/docs/step-definitions/then-item-checkbox.md +54 -0
  63. package/docs/step-definitions/then-item-link-should-contain-url.md +84 -0
  64. package/docs/step-definitions/then-item-should-contain.md +67 -0
  65. package/docs/step-definitions/then-radio-button-value-should-be-selected.md +68 -0
  66. package/docs/step-definitions/then-response-status-code-should-be-number.md +69 -0
  67. package/docs/step-definitions/then-value-radio-button-selected.md +62 -0
  68. package/docs/step-definitions/when-i-attach-file-file-name-element.md +71 -0
  69. package/docs/step-definitions/when-i-check-checkbox.md +60 -0
  70. package/docs/step-definitions/when-i-click-link.md +51 -0
  71. package/docs/step-definitions/when-i-click-operation-text-row.md +71 -0
  72. package/docs/step-definitions/when-i-fill.md +59 -0
  73. package/docs/step-definitions/when-i-go-homepage.md +60 -0
  74. package/docs/step-definitions/when-i-go-specific-page.md +67 -0
  75. package/docs/step-definitions/when-i-move-backward-one-page.md +49 -0
  76. package/docs/step-definitions/when-i-move-forward-one-page.md +58 -0
  77. package/docs/step-definitions/when-i-press-button.md +58 -0
  78. package/docs/step-definitions/when-i-reload-page.md +51 -0
  79. package/docs/step-definitions/when-i-scroll.md +73 -0
  80. package/docs/step-definitions/when-i-select-option-select-list.md +53 -0
  81. package/docs/step-definitions/when-i-select-radio-button-value.md +62 -0
  82. package/docs/step-definitions/when-i-uncheck-checkbox.md +57 -0
  83. package/docs/step-definitions/when-i-wait-ajax-finish.md +64 -0
  84. package/docs/step-definitions/when-i-wait.md +62 -0
  85. package/docs/step-definitions.md +50 -0
  86. package/examples/a11y.html +31 -0
  87. package/examples/cookies.html +10 -0
  88. package/examples/date.html +12 -0
  89. package/examples/element.html +11 -0
  90. package/examples/field.html +24 -0
  91. package/examples/keyboard.html +11 -0
  92. package/examples/links.html +9 -0
  93. package/examples/modal.html +14 -0
  94. package/examples/path.html +3 -0
  95. package/examples/table.html +13 -0
  96. package/examples/video-demo.html +43 -0
  97. package/package.json +10 -3
  98. package/playwright.config.ts +3 -2
  99. package/tests/features/a11y.feature +39 -0
  100. package/tests/features/cookie.feature +13 -0
  101. package/tests/features/date.feature +11 -0
  102. package/tests/features/element.feature +16 -0
  103. package/tests/features/field.feature +25 -0
  104. package/tests/features/keyboard.feature +10 -0
  105. package/tests/features/link.feature +11 -0
  106. package/tests/features/modal-advanced-example.feature +1 -1
  107. package/tests/features/modal.feature +11 -0
  108. package/tests/features/path.feature +16 -0
  109. package/tests/features/response.feature +8 -0
  110. package/tests/features/responsive.feature +10 -0
  111. package/tests/features/table.feature +18 -0
  112. package/tests/features/video.feature +18 -0
  113. package/tests/features/wait.feature +7 -0
  114. package/tests/features/yaml.feature +102 -0
  115. package/tests/reports/README.md +55 -0
  116. package/tests/selectors/_canonical-keys.json +113 -0
  117. package/tests/selectors/back-end-selectors.json +7 -1
  118. package/tests/selectors/cms-contentful-admin.json +35 -0
  119. package/tests/selectors/cms-craft-admin.json +39 -0
  120. package/tests/selectors/cms-drupal-cms-gin.json +56 -0
  121. package/tests/selectors/cms-drupal-core-claro.json +50 -0
  122. package/tests/selectors/cms-generic-admin.json +34 -0
  123. package/tests/selectors/cms-ghost-admin.json +34 -0
  124. package/tests/selectors/cms-joomla-admin.json +41 -0
  125. package/tests/selectors/cms-magento2-admin.json +32 -0
  126. package/tests/selectors/cms-prestashop-admin.json +38 -0
  127. package/tests/selectors/cms-shopify-admin.json +25 -0
  128. package/tests/selectors/cms-strapi-admin.json +42 -0
  129. package/tests/selectors/cms-typo3-admin.json +41 -0
  130. package/tests/selectors/cms-woocommerce-front.json +50 -0
  131. package/tests/selectors/cms-wordpress-admin.json +31 -0
  132. package/tests/selectors/framework-ant-design.json +80 -0
  133. package/tests/selectors/framework-bootstrap.json +86 -0
  134. package/tests/selectors/framework-bulma.json +74 -0
  135. package/tests/selectors/framework-chakra.json +58 -0
  136. package/tests/selectors/framework-foundation.json +51 -0
  137. package/tests/selectors/framework-material-ui.json +72 -0
  138. package/tests/selectors/framework-shadcn.json +51 -0
  139. package/tests/selectors/framework-tailwind.json +40 -0
  140. package/tests/selectors/framework-vuetify.json +61 -0
  141. package/tests/step-definitions/a11y.steps.js +800 -0
  142. package/tests/step-definitions/action.steps.js +167 -0
  143. package/tests/step-definitions/{webship-api.js → api.steps.js} +41 -23
  144. package/tests/step-definitions/assertion.steps.js +352 -0
  145. package/tests/step-definitions/auth.steps.js +126 -0
  146. package/tests/step-definitions/clock.steps.js +128 -0
  147. package/tests/step-definitions/cookie.steps.js +216 -0
  148. package/tests/step-definitions/debug.steps.js +39 -0
  149. package/tests/step-definitions/dialog.steps.js +193 -0
  150. package/tests/step-definitions/element.steps.js +356 -0
  151. package/tests/step-definitions/field.steps.js +653 -0
  152. package/tests/step-definitions/file-download.steps.js +211 -0
  153. package/tests/step-definitions/form.steps.js +333 -0
  154. package/tests/step-definitions/iframe.steps.js +228 -0
  155. package/tests/step-definitions/input.steps.js +202 -0
  156. package/tests/step-definitions/javascript.steps.js +232 -0
  157. package/tests/step-definitions/keyboard.steps.js +112 -0
  158. package/tests/step-definitions/link.steps.js +142 -0
  159. package/tests/step-definitions/metatag.steps.js +91 -0
  160. package/tests/step-definitions/modal.steps.js +244 -0
  161. package/tests/step-definitions/navigation.steps.js +218 -0
  162. package/tests/step-definitions/network.steps.js +280 -0
  163. package/tests/step-definitions/path.steps.js +141 -0
  164. package/tests/step-definitions/response.steps.js +98 -0
  165. package/tests/step-definitions/responsive.steps.js +125 -0
  166. package/tests/step-definitions/rest.steps.js +111 -0
  167. package/tests/step-definitions/{webship-screenshot.js → screenshot.steps.js} +1 -5
  168. package/tests/step-definitions/scroll.steps.js +189 -0
  169. package/tests/step-definitions/{webship-selectors.js → selectors.steps.js} +64 -27
  170. package/tests/step-definitions/storage.steps.js +194 -0
  171. package/tests/step-definitions/table.steps.js +181 -0
  172. package/tests/step-definitions/video.steps.js +178 -0
  173. package/tests/step-definitions/wait.steps.js +400 -0
  174. package/tests/step-definitions/web-first.steps.js +298 -0
  175. package/tests/step-definitions/webship.js +741 -1477
  176. package/tests/step-definitions/xml.steps.js +411 -0
  177. package/tests/step-definitions/yaml.steps.js +913 -0
  178. package/tests/step-definitions-diffy/webship-diffy.js +0 -13
  179. package/tsconfig.json +19 -3
  180. package/videos/README.md +32 -0
  181. package/.travis-ci.yml +0 -16
@@ -0,0 +1,255 @@
1
+ # Recipes Cookbook
2
+
3
+ 20 paste-and-go scenarios covering the most common testing needs. Drop
4
+ them straight into a `.feature` file, swap selectors / text for your
5
+ app, run.
6
+
7
+ ---
8
+
9
+ ## 1. Sign in (happy path)
10
+
11
+ ```gherkin
12
+ Scenario: Sign in with valid credentials
13
+ Given I am on "/login"
14
+ When I fill in "Email" with "alice@example.com"
15
+ And I fill in "Password" with "s3cret"
16
+ And I press "Sign in"
17
+ Then I should see "Dashboard"
18
+ ```
19
+
20
+ ## 2. Sign in (validation error)
21
+
22
+ ```gherkin
23
+ Scenario: Sign in fails with empty password
24
+ Given I am on "/login"
25
+ When I fill in "Email" with "alice@example.com"
26
+ And I press "Sign in"
27
+ Then I should see "Password is required"
28
+ And I should be on "/login"
29
+ ```
30
+
31
+ ## 3. Sign up with required fields
32
+
33
+ ```gherkin
34
+ Scenario: Sign up
35
+ Given I am on "/signup"
36
+ When I fill in the following:
37
+ | Name | Alice |
38
+ | Email | alice@example.com |
39
+ | Password | s3cret |
40
+ And I check "I agree to terms"
41
+ And I press "Create account"
42
+ Then I should see "Welcome, Alice"
43
+ ```
44
+
45
+ ## 4. Search
46
+
47
+ ```gherkin
48
+ Scenario: Find a product by keyword
49
+ Given I am on the homepage
50
+ When I fill in "Search" with "laptop"
51
+ And I press the key "Enter"
52
+ Then ".product-card" should have a count of 12 within 5 seconds
53
+ And I should see "Results for \"laptop\""
54
+ ```
55
+
56
+ ## 5. Logout
57
+
58
+ ```gherkin
59
+ Scenario: Logout returns to homepage
60
+ Given I restore the auth state from "tests/auth/admin.json"
61
+ And I am on "/dashboard"
62
+ When I click "Sign out"
63
+ Then I should be on the homepage
64
+ And I should see "Sign in"
65
+ ```
66
+
67
+ ## 6. Add to cart
68
+
69
+ ```gherkin
70
+ Scenario: Add a product to cart
71
+ Given I am on "/products/laptop-pro"
72
+ When I press "Add to cart"
73
+ And I follow "View cart"
74
+ Then I should see "Laptop Pro" in the "Cart" element
75
+ And the URL should match "/cart"
76
+ ```
77
+
78
+ ## 7. Modal open + close
79
+
80
+ ```gherkin
81
+ Scenario: Open and close the help modal
82
+ Given I am on the homepage
83
+ When I click "Help"
84
+ And I wait for the modal to appear
85
+ Then I should see "How can we help?" in the modal
86
+ When I close the modal
87
+ Then I should not see the modal
88
+ ```
89
+
90
+ ## 8. Native confirm dialog
91
+
92
+ ```gherkin
93
+ Scenario: Confirm deletion
94
+ Given I am on "/admin/users"
95
+ And I will accept the next dialog
96
+ When I click "Delete" in the "alice@example.com" row
97
+ Then the last dialog message should contain "delete"
98
+ And I should see "User removed"
99
+ ```
100
+
101
+ ## 9. Pagination
102
+
103
+ ```gherkin
104
+ Scenario: Navigate to second page of results
105
+ Given I am on "/blog"
106
+ When I follow "Next"
107
+ Then current url should have the "page" parameter with the "2" value
108
+ And ".post" should have a count of 10
109
+ ```
110
+
111
+ ## 10. Sortable table
112
+
113
+ ```gherkin
114
+ Scenario: Sort orders by total descending
115
+ Given I restore the auth state from "tests/auth/admin.json"
116
+ And I am on "/admin/orders"
117
+ When I click "Total"
118
+ And I click "Total"
119
+ Then the table "#orders" should be sorted by "Total" in "descending" order
120
+ ```
121
+
122
+ ## 11. Form file upload
123
+
124
+ ```gherkin
125
+ Scenario: Upload a profile photo
126
+ Given I restore the auth state from "tests/auth/customer.json"
127
+ And I am on "/account"
128
+ When I attach the file "avatar.png" to "#avatar"
129
+ And I press "Save"
130
+ Then I should see "Avatar updated"
131
+ ```
132
+
133
+ ## 12. API mock + UI assertion
134
+
135
+ ```gherkin
136
+ Scenario: Dashboard renders mocked user list
137
+ Given the URL "**/api/users" returns the JSON:
138
+ """
139
+ {"users": [{"id": 1, "name": "Alice"}, {"id": 2, "name": "Bob"}]}
140
+ """
141
+ When I am on "/users"
142
+ Then ".user" should have a count of 2 within 5 seconds
143
+ And I should see "Alice"
144
+ And I should see "Bob"
145
+ ```
146
+
147
+ ## 13. Block third-party tracking
148
+
149
+ ```gherkin
150
+ Scenario: Page renders without tracking scripts
151
+ Given the URL "**/google-analytics.com/**" is blocked
152
+ And I start recording network requests
153
+ When I am on the homepage
154
+ Then no request to "**/google-analytics.com/**" should have been made
155
+ ```
156
+
157
+ ## 14. Mobile viewport smoke
158
+
159
+ ```gherkin
160
+ Scenario: Mobile menu collapses
161
+ Given I am on the homepage
162
+ When I set the viewport to the "mobile" breakpoint
163
+ Then "<nav .mobile-toggle>" should be visible
164
+ And "<nav .desktop-menu>" should not be visible
165
+ ```
166
+
167
+ ## 15. Accessibility AA gate
168
+
169
+ ```gherkin
170
+ @a11y
171
+ Scenario: Page meets WCAG 2.1 AA
172
+ Given I am on "/checkout"
173
+ Then the page should pass an accessibility audit at level "AA"
174
+ And the page should have a title
175
+ And user zoom should be allowed
176
+ ```
177
+
178
+ ## 16. Keyboard navigation
179
+
180
+ ```gherkin
181
+ Scenario: Tab order is correct on the login form
182
+ Given I am on "/login"
183
+ And I focus on the element "body"
184
+ When I press the key "Tab"
185
+ Then the focused element should match "#email"
186
+ When I press the key "Tab"
187
+ Then the focused element should match "#password"
188
+ When I press the key "Tab"
189
+ Then the focused element should match "button[type=submit]"
190
+ ```
191
+
192
+ ## 17. SPA navigation without full reload
193
+
194
+ ```gherkin
195
+ Scenario: SPA route changes without full page load
196
+ Given I am on the homepage
197
+ When I follow "Pricing"
198
+ And I wait until the URL contains "/pricing"
199
+ Then I should see "Plans"
200
+ And the page should have exactly one h1
201
+ ```
202
+
203
+ ## 18. Wait for AJAX-loaded content
204
+
205
+ ```gherkin
206
+ Scenario: Live search returns results
207
+ Given I am on "/search"
208
+ When I fill in "Search" with "laptops"
209
+ Then I wait until at least 1 element matches ".result"
210
+ And I should see "results"
211
+ ```
212
+
213
+ ## 19. JSON-API response check
214
+
215
+ ```gherkin
216
+ Scenario: Health endpoint returns OK
217
+ When I send a GET request to "/api/health"
218
+ Then the API response code should be 200
219
+ And the JSON property "status" should be "ok"
220
+ ```
221
+
222
+ ## 20. End-to-end checkout (composite)
223
+
224
+ ```gherkin
225
+ Scenario: Customer completes checkout
226
+ Given I restore the auth state from "tests/auth/customer.json"
227
+ And I am on "/products/laptop-pro"
228
+ When I press "Add to cart"
229
+ And I follow "Checkout"
230
+ And I fill in the following:
231
+ | Card number | 4242 4242 4242 4242 |
232
+ | Expiry | 12/30 |
233
+ | CVV | 123 |
234
+ And I press "Place order"
235
+ And I wait until the URL contains "/orders/"
236
+ Then I should see "Order confirmed"
237
+ And I send a GET request to "/api/orders?latest=1"
238
+ And the API response code should be 200
239
+ And the JSON property "orders.0.status" should be "Pending"
240
+ ```
241
+
242
+ ---
243
+
244
+ ## How to adapt these
245
+
246
+ 1. Find the scenario closest to your goal.
247
+ 2. Swap selectors (`#email`, `.product-card`, …) for your real ones.
248
+ 3. Swap text labels (`"Sign in"`, `"Add to cart"`) for your real copy.
249
+ 4. Run. Fix any red. Iterate.
250
+
251
+ If you find yourself rewriting the same setup three times, extract it
252
+ into a `Background:` block. If you find yourself rewriting the same
253
+ selector three times, register it in `tests/selectors/your-app.json`.
254
+
255
+ That's the entire cookbook.
@@ -0,0 +1,76 @@
1
+ # Tag Conventions
2
+
3
+ Tags drive what runs in CI, what gets retried, what's currently broken.
4
+ Keep them consistent across the suite.
5
+
6
+ ## Standard tags
7
+
8
+ | Tag | Meaning |
9
+ | --- | --- |
10
+ | `@critical` | Must pass on every PR. Smoke set. Run with `--tags "@critical"` first in CI. |
11
+ | `@smoke` | Synonym for `@critical` when feature owners prefer it. Pick one and stick with it. |
12
+ | `@auth` | Touches authentication / sessions. |
13
+ | `@security` | Asserts a Safeguard (CSRF, rate limit, token expiry). |
14
+ | `@a11y` | Accessibility check (axe-core, focus order, ARIA). Run with `--tags "@a11y"` to gate the a11y suite. |
15
+ | `@i18n` | Multi-locale check (Arabic / RTL / French / etc). |
16
+ | `@perf` | Performance budget (page load, request count). |
17
+ | `@flaky` | Known-unstable. CI retries it once via `--retry` + `--retryTagFilter "@flaky"`. **Never** ship long-term `@flaky` — fix the root cause. |
18
+ | `@wip` | Work in progress. CI excludes with `--tags "not @wip"`. |
19
+ | `@desktop` / `@mobile` | Viewport-locked variants. |
20
+ | `@external` | Hits a third-party service. Skip in offline test runs. |
21
+ | `@auth-setup` | One-shot scenarios that produce auth state files. Run manually after credential rotation. |
22
+
23
+ ## How to apply
24
+
25
+ Tags go on `Feature:` (apply to every scenario) or on a single
26
+ `Scenario:`.
27
+
28
+ ```gherkin
29
+ @auth
30
+ Feature: Sign in
31
+
32
+ @critical
33
+ Scenario: Successful login
34
+ Given I am on "/login"
35
+ ...
36
+
37
+ @flaky
38
+ Scenario: Concurrent login from two devices
39
+ ...
40
+
41
+ @wip
42
+ Scenario: Sign in with Apple
43
+ ...
44
+ ```
45
+
46
+ ## Recommended CI lanes
47
+
48
+ ```bash
49
+ # Smoke gate — every PR.
50
+ npx cucumber-js --tags "@critical and not @wip"
51
+
52
+ # Full suite — main branch / nightly.
53
+ npx cucumber-js --tags "not @wip and not @auth-setup"
54
+
55
+ # Accessibility lane.
56
+ npx cucumber-js --tags "@a11y"
57
+
58
+ # Flaky lane — separate report, allowed to fail without blocking.
59
+ npx cucumber-js --tags "@flaky" --retry 2
60
+
61
+ # Pre-release security gate.
62
+ npx cucumber-js --tags "@security or @auth"
63
+ ```
64
+
65
+ ## Tag hygiene rules
66
+
67
+ 1. **No `@skip`.** If a scenario should not run, fix it or delete it.
68
+ `@wip` is a temporary excuse, not a bin.
69
+ 2. **`@flaky` is a debt marker.** Each `@flaky` should have an open
70
+ issue. Removing the tag is part of the fix.
71
+ 3. **Don't tag what's obvious.** Every scenario in `auth.feature`
72
+ doesn't need `@auth` — tag the file.
73
+ 4. **One source of truth.** Don't invent project-specific synonyms
74
+ (`@blocker`, `@must-pass`, `@p0`). Pick `@critical` and stick with it.
75
+ 5. **Document custom tags.** If your project needs a tag not in this
76
+ list, add a row to this page.