webship-js 2.0.4 → 2.0.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.drone.yml +0 -0
- package/.harness/webship-js-pipeline.yml +0 -0
- package/.semaphore/semaphore.yml +0 -0
- package/.teamcity/pom.xml +0 -0
- package/.teamcity/settings.kts +0 -0
- package/.travis.yml +0 -0
- package/AGENTS.md +50 -14
- package/CLAUDE.md +326 -104
- package/Jenkinsfile +0 -0
- package/azure-pipelines.yml +0 -0
- package/bamboo-specs/bamboo.yml +0 -0
- package/bin/init-webship.js +1 -14
- package/bin/postinstall.js +0 -0
- package/buildspec.yml +0 -0
- package/cloudbuild.yaml +0 -0
- package/codefresh.yml +0 -0
- package/cucumber.js +3 -13
- package/docs/00-quick-start.md +0 -0
- package/docs/01-getting-started.md +0 -0
- package/docs/02-bbr-smart-waits.md +24 -1
- package/docs/03-selector-registry.md +0 -0
- package/docs/04-step-reference.md +4 -0
- package/docs/05-web-first-assertions.md +0 -0
- package/docs/06-network-and-dialogs.md +0 -0
- package/docs/07-auth-state.md +0 -0
- package/docs/08-clock-mocking.md +0 -0
- package/docs/09-api-testing.md +0 -0
- package/docs/10-accessibility.md +24 -3
- package/docs/11-debugging.md +0 -0
- package/docs/12-ai-agent-guide.md +0 -0
- package/docs/13-faq.md +0 -0
- package/docs/14-recipes-cookbook.md +0 -0
- package/docs/15-tag-conventions.md +0 -0
- package/docs/16-ci-cd.md +0 -0
- package/docs/README.md +6 -3
- package/docs/advanced-screenshots/then-i-save-fullscreen-screenshot.md +0 -0
- package/docs/advanced-screenshots/then-i-save-width-x-height-screenshot.md +0 -0
- package/docs/advanced-screenshots/when-i-save-screenshot-name-filename.md +0 -0
- package/docs/advanced-screenshots.md +0 -0
- package/docs/advanced-selectors.md +0 -0
- package/docs/api-step-definitions.md +0 -0
- package/docs/global-settings.md +1 -28
- package/docs/install-webship-js/ddev-webship-js.md +0 -0
- package/docs/install-webship-js.md +0 -1
- package/docs/overview.md +0 -1
- package/docs/step-definitions/given-i-am-anonymous-user.md +0 -0
- package/docs/step-definitions/given-i-am-homepage.md +0 -0
- package/docs/step-definitions/given-i-am-specific-page.md +0 -0
- package/docs/step-definitions/then-i-should-be.md +0 -0
- package/docs/step-definitions/then-i-should-see.md +0 -0
- package/docs/step-definitions/then-item-checkbox.md +0 -0
- package/docs/step-definitions/then-item-link-should-contain-url.md +0 -0
- package/docs/step-definitions/then-item-should-contain.md +0 -0
- package/docs/step-definitions/then-radio-button-value-should-be-selected.md +0 -0
- package/docs/step-definitions/then-response-status-code-should-be-number.md +0 -0
- package/docs/step-definitions/then-value-radio-button-selected.md +0 -0
- package/docs/step-definitions/when-i-attach-file-file-name-element.md +0 -0
- package/docs/step-definitions/when-i-check-checkbox.md +0 -0
- package/docs/step-definitions/when-i-click-link.md +0 -0
- package/docs/step-definitions/when-i-click-operation-text-row.md +0 -0
- package/docs/step-definitions/when-i-fill.md +0 -0
- package/docs/step-definitions/when-i-go-homepage.md +0 -0
- package/docs/step-definitions/when-i-go-specific-page.md +0 -0
- package/docs/step-definitions/when-i-move-backward-one-page.md +0 -0
- package/docs/step-definitions/when-i-move-forward-one-page.md +0 -0
- package/docs/step-definitions/when-i-press-button.md +0 -0
- package/docs/step-definitions/when-i-reload-page.md +0 -0
- package/docs/step-definitions/when-i-scroll.md +0 -0
- package/docs/step-definitions/when-i-select-option-select-list.md +0 -0
- package/docs/step-definitions/when-i-select-radio-button-value.md +0 -0
- package/docs/step-definitions/when-i-uncheck-checkbox.md +0 -0
- package/docs/step-definitions/when-i-wait-ajax-finish.md +0 -0
- package/docs/step-definitions/when-i-wait.md +0 -0
- package/docs/step-definitions.md +0 -0
- package/examples/a11y.html +8 -0
- package/examples/account.html +0 -0
- package/examples/ajax-wait-examples.html +0 -0
- package/examples/cookies.html +0 -0
- package/examples/date.html +0 -0
- package/examples/dynamic-examples.html +0 -0
- package/examples/element.html +0 -0
- package/examples/field.html +0 -0
- package/examples/keyboard.html +0 -0
- package/examples/links.html +0 -0
- package/examples/modal.html +0 -0
- package/examples/never-settles.html +32 -0
- package/examples/path.html +0 -0
- package/examples/table.html +0 -0
- package/examples/test--modal-dialogs.html +0 -0
- package/examples/test--when--i-additionally-select.html +0 -0
- package/examples/test--when--i-select-radio-button.html +0 -0
- package/examples/video-demo.html +0 -0
- package/package.json +1 -1
- package/playwright.config.ts +0 -0
- package/tests/assets/test-document.pdf +0 -0
- package/tests/features/a11y.feature +22 -0
- package/tests/features/ajax-wait-examples.feature +0 -0
- package/tests/features/cookie.feature +0 -0
- package/tests/features/date.feature +0 -0
- package/tests/features/dynamic-content-examples.feature +0 -0
- package/tests/features/element.feature +0 -0
- package/tests/features/field.feature +0 -0
- package/tests/features/keyboard.feature +0 -0
- package/tests/features/link.feature +0 -0
- package/tests/features/modal-advanced-example.feature +0 -0
- package/tests/features/modal-basic-example.feature +0 -0
- package/tests/features/modal-error-handling-example.feature +0 -0
- package/tests/features/modal.feature +0 -0
- package/tests/features/path.feature +0 -0
- package/tests/features/response.feature +0 -0
- package/tests/features/responsive.feature +0 -0
- package/tests/features/smart-settle-budget.feature +12 -0
- package/tests/features/table.feature +0 -0
- package/tests/features/test--given--i-am-an-anonymous-user.feature +0 -0
- package/tests/features/test--then--i-save-screenshot.feature +0 -0
- package/tests/features/test--then--i-see-locator.feature +0 -0
- package/tests/features/test--then--i-should-see-n-elements.feature +0 -0
- package/tests/features/test--then--print-current-url-and-response.feature +0 -0
- package/tests/features/test--when--i-additionally-select.feature +0 -0
- package/tests/features/test--when--i-follow.feature +0 -0
- package/tests/features/test--when--i-select-radio-button.feature +0 -0
- package/tests/features/video.feature +0 -0
- package/tests/features/wait.feature +0 -0
- package/tests/features/yaml.feature +0 -0
- package/tests/reports/README.md +0 -0
- package/tests/selectors/_canonical-keys.json +0 -0
- package/tests/selectors/back-end-selectors.json +0 -0
- package/tests/selectors/cms-contentful-admin.json +0 -0
- package/tests/selectors/cms-craft-admin.json +0 -0
- package/tests/selectors/cms-drupal-cms-gin.json +0 -0
- package/tests/selectors/cms-drupal-core-claro.json +0 -0
- package/tests/selectors/cms-generic-admin.json +0 -0
- package/tests/selectors/cms-ghost-admin.json +0 -0
- package/tests/selectors/cms-joomla-admin.json +0 -0
- package/tests/selectors/cms-magento2-admin.json +0 -0
- package/tests/selectors/cms-prestashop-admin.json +0 -0
- package/tests/selectors/cms-shopify-admin.json +0 -0
- package/tests/selectors/cms-strapi-admin.json +0 -0
- package/tests/selectors/cms-typo3-admin.json +0 -0
- package/tests/selectors/cms-woocommerce-front.json +0 -0
- package/tests/selectors/cms-wordpress-admin.json +0 -0
- package/tests/selectors/framework-ant-design.json +0 -0
- package/tests/selectors/framework-bootstrap.json +0 -0
- package/tests/selectors/framework-bulma.json +0 -0
- package/tests/selectors/framework-chakra.json +0 -0
- package/tests/selectors/framework-foundation.json +0 -0
- package/tests/selectors/framework-material-ui.json +0 -0
- package/tests/selectors/framework-shadcn.json +0 -0
- package/tests/selectors/framework-tailwind.json +0 -0
- package/tests/selectors/framework-vuetify.json +0 -0
- package/tests/selectors/front-end-selectors.json +0 -0
- package/tests/selectors/homepage-selectors.json +0 -0
- package/tests/step-definitions/a11y.steps.js +339 -113
- package/tests/step-definitions/action.steps.js +0 -0
- package/tests/step-definitions/assertion.steps.js +0 -0
- package/tests/step-definitions/auth.steps.js +0 -0
- package/tests/step-definitions/clock.steps.js +0 -0
- package/tests/step-definitions/cookie.steps.js +0 -0
- package/tests/step-definitions/debug.steps.js +0 -0
- package/tests/step-definitions/dialog.steps.js +0 -0
- package/tests/step-definitions/element.steps.js +0 -0
- package/tests/step-definitions/field.steps.js +0 -0
- package/tests/step-definitions/file-download.steps.js +0 -0
- package/tests/step-definitions/form.steps.js +0 -0
- package/tests/step-definitions/iframe.steps.js +0 -0
- package/tests/step-definitions/input.steps.js +0 -0
- package/tests/step-definitions/javascript.steps.js +0 -0
- package/tests/step-definitions/keyboard.steps.js +0 -0
- package/tests/step-definitions/link.steps.js +0 -0
- package/tests/step-definitions/metatag.steps.js +0 -0
- package/tests/step-definitions/modal.steps.js +0 -0
- package/tests/step-definitions/navigation.steps.js +0 -0
- package/tests/step-definitions/network.steps.js +0 -0
- package/tests/step-definitions/path.steps.js +0 -0
- package/tests/step-definitions/response.steps.js +0 -0
- package/tests/step-definitions/responsive.steps.js +0 -0
- package/tests/step-definitions/rest.steps.js +0 -0
- package/tests/step-definitions/screenshot.steps.js +0 -0
- package/tests/step-definitions/scroll.steps.js +0 -0
- package/tests/step-definitions/selectors.steps.js +0 -0
- package/tests/step-definitions/storage.steps.js +0 -0
- package/tests/step-definitions/table.steps.js +0 -0
- package/tests/step-definitions/video.steps.js +0 -0
- package/tests/step-definitions/wait.steps.js +0 -0
- package/tests/step-definitions/web-first.steps.js +0 -0
- package/tests/step-definitions/webship.js +57 -20
- package/tests/step-definitions/xml.steps.js +0 -0
- package/tests/step-definitions/yaml.steps.js +0 -0
- package/tsconfig.json +0 -0
- package/videos/README.md +0 -0
- package/docs/diffy-step-definitions/then-compare-diffy-env1-env2.md +0 -30
- package/docs/diffy-step-definitions/then-create-diffy-comparison-name-value.md +0 -21
- package/docs/diffy-step-definitions/then-create-diffy-comparison.md +0 -25
- package/docs/diffy-step-definitions/then-create-diffy-screenshot-environment-name.md +0 -35
- package/docs/diffy-step-definitions/then-i-take-screenshot.md +0 -21
- package/docs/diffy-step-definitions/then-i-take-screenshots-all-breakpoints.md +0 -27
- package/docs/diffy-step-definitions/then-send-screenshots-diffy-name-value.md +0 -27
- package/docs/diffy-step-definitions/then-upload-folder-url-diffy-snapshotname.md +0 -28
- package/docs/diffy-step-definitions/then-wait-diffy-comparison-complete.md +0 -21
- package/docs/diffy-step-definitions/when-i-resize-window-number.md +0 -29
- package/docs/diffy-step-definitions.md +0 -21
- package/examples/diffy/baseline.html +0 -54
- package/examples/diffy/changed.html +0 -63
- package/examples/diffy/index.html +0 -52
- package/tests/features/diffy/test--diffy-01-example-demo.feature +0 -22
- package/tests/features/diffy/test--diffy-02-all-steps.feature +0 -52
- package/tests/features/diffy/test--diffy-03-real-api.feature +0 -21
- package/tests/step-definitions-diffy/README.md +0 -329
- package/tests/step-definitions-diffy/mock-diffy-api/server.js +0 -84
- package/tests/step-definitions-diffy/webship-diffy-mock.js +0 -31
- package/tests/step-definitions-diffy/webship-diffy.js +0 -459
package/cucumber.js
CHANGED
|
@@ -3,7 +3,9 @@ module.exports = {
|
|
|
3
3
|
// Cucumber step timeout must exceed Playwright's default 30s so the
|
|
4
4
|
// try/catch wrappers in step files always see the Playwright error
|
|
5
5
|
// first (and emit a friendly message) rather than cucumber's raw
|
|
6
|
-
// "function timed out" stack.
|
|
6
|
+
// "function timed out" stack. The step definitions call
|
|
7
|
+
// setDefaultTimeout() on load, which wins over this value — raise it
|
|
8
|
+
// with WEBSHIP_STEP_TIMEOUT instead.
|
|
7
9
|
timeout: 45000,
|
|
8
10
|
// tsx/cjs registers a require() hook so cucumber-js can load both
|
|
9
11
|
// `.js` and `.ts` step files with zero build step. If you ship only
|
|
@@ -11,7 +13,6 @@ module.exports = {
|
|
|
11
13
|
requireModule: ['tsx/cjs'],
|
|
12
14
|
require: [
|
|
13
15
|
'tests/step-definitions/**/*.js',
|
|
14
|
-
'tests/step-definitions-diffy/**/*.js',
|
|
15
16
|
],
|
|
16
17
|
paths: ['tests/features/**/*.feature'],
|
|
17
18
|
format: [
|
|
@@ -121,17 +122,6 @@ module.exports = {
|
|
|
121
122
|
// Report collected errors at scenario end (default true).
|
|
122
123
|
afterScenario: true, // WEBSHIP_JS_ERROR_AFTER
|
|
123
124
|
},
|
|
124
|
-
diffy: {
|
|
125
|
-
apiKey: 'mock-key', // DIFFY_API_KEY
|
|
126
|
-
projectId: 1, // DIFFY_PROJECT_ID
|
|
127
|
-
breakpoints: '640,1200', // DIFFY_BREAKPOINTS
|
|
128
|
-
windowHeight: 2000, // DIFFY_WINDOW_HEIGHT
|
|
129
|
-
screenshotsDir: '', // DIFFY_SCREENSHOTS_DIR
|
|
130
|
-
baseUrl: 'http://127.0.0.1:3099/', // DIFFY_API_BASE_URL (mock server)
|
|
131
|
-
maxWait: 30, // DIFFY_MAX_WAIT (seconds)
|
|
132
|
-
env1Url: '', // DIFFY_ENV1_URL (custom env)
|
|
133
|
-
env2Url: '', // DIFFY_ENV2_URL (custom env)
|
|
134
|
-
},
|
|
135
125
|
},
|
|
136
126
|
},
|
|
137
127
|
};
|
package/docs/00-quick-start.md
CHANGED
|
File without changes
|
|
File without changes
|
|
@@ -21,7 +21,30 @@ __webshipAjaxCount === 0
|
|
|
21
21
|
&& (Date.now() - __webshipLastMutation) >= 250 ms
|
|
22
22
|
```
|
|
23
23
|
|
|
24
|
-
…or when `budget` elapses, whichever comes first.
|
|
24
|
+
…or when `budget` elapses, whichever comes first.
|
|
25
|
+
|
|
26
|
+
### How the budget is shared
|
|
27
|
+
|
|
28
|
+
Each phase is best-effort — a phase that times out is not a failure — and each
|
|
29
|
+
gets a **share of the budget** rather than "whatever is left":
|
|
30
|
+
|
|
31
|
+
| Phase | Share of the budget |
|
|
32
|
+
| --- | --- |
|
|
33
|
+
| `<body>` attached | 25% |
|
|
34
|
+
| `DOMContentLoaded` | 25% |
|
|
35
|
+
| `networkidle` | 50% |
|
|
36
|
+
| AJAX + pending timers + DOM quiet | 50% |
|
|
37
|
+
|
|
38
|
+
The shares add up to more than 100% on purpose: a phase that finishes early
|
|
39
|
+
hands its unspent time to the ones after it, and no phase is ever given more
|
|
40
|
+
than what is actually left. Capping `networkidle` matters, because on a page
|
|
41
|
+
with analytics, a chat widget or a self-rescheduling timer it never arrives —
|
|
42
|
+
uncapped it would eat the whole budget and starve the AJAX / pending-timer /
|
|
43
|
+
DOM-quiet probe, which is the phase that decides the answer.
|
|
44
|
+
|
|
45
|
+
`smartSettle` returns within `budget` even when nothing on the page ever
|
|
46
|
+
settles, and never hands Playwright a zero timeout (Playwright reads `0` as
|
|
47
|
+
"no timeout at all").
|
|
25
48
|
|
|
26
49
|
## Step phrasings
|
|
27
50
|
|
|
File without changes
|
|
@@ -302,11 +302,15 @@ This index lists every public step grouped by source file, with one Gherkin exam
|
|
|
302
302
|
- *^user zoom should be allowed$* · Example: `Then user zoom should be allowed`
|
|
303
303
|
- *^the page should pass an accessibility audit(?: at level "(A|AA|AAA)")?$* · Example: `Then the page should pass an accessibility audit`
|
|
304
304
|
- *^the page should have no (critical|serious|moderate|minor) accessibility violations$* · Example: `Then the page should have no critical accessibility violations`
|
|
305
|
+
- *^the page should have no accessibility violations$* · Example: `Then the page should have no accessibility violations`
|
|
306
|
+
- *^the element "([^"]*)" should not violate the accessibility rule "([^"]*)"$* · Example: `Then the element "main" should not violate the accessibility rule "color-contrast"`
|
|
305
307
|
- *^the element "([^"]*)" should pass an accessibility audit$* · Example: `Then the element "main" should pass an accessibility audit`
|
|
306
308
|
- *^the page should pass an accessibility audit excluding "([^"]*)"$* · Example: `Then the page should pass an accessibility audit excluding "iframe.payment"`
|
|
307
309
|
- *^the page should not violate the accessibility rule "([^"]*)"$* · Example: `Then the page should not violate the accessibility rule "color-contrast"`
|
|
308
310
|
- *^(I |we )*print accessibility violations$* · Example: `Then I print accessibility violations`
|
|
309
311
|
- *^the page should pass the accessibility rules "([^"]*)"$* · Example: `Then the page should pass the accessibility rules "image-alt, label"`
|
|
312
|
+
- *^the page should pass the full accessibility check(?: at level "(A|AA|AAA)")?$* · Example: `Then the page should pass the full accessibility check`
|
|
313
|
+
- *^(?:I |we )*print the full accessibility check$* · Example: `Then I print the full accessibility check`
|
|
310
314
|
|
|
311
315
|
### action.steps.js
|
|
312
316
|
|
|
File without changes
|
|
File without changes
|
package/docs/07-auth-state.md
CHANGED
|
File without changes
|
package/docs/08-clock-mocking.md
CHANGED
|
File without changes
|
package/docs/09-api-testing.md
CHANGED
|
File without changes
|
package/docs/10-accessibility.md
CHANGED
|
@@ -38,7 +38,9 @@ Then every image should have an alt attribute
|
|
|
38
38
|
And every form field should have an accessible label
|
|
39
39
|
```
|
|
40
40
|
|
|
41
|
-
`every image` allows empty `alt=""` (decorative)
|
|
41
|
+
`every image` allows empty `alt=""` (decorative), `role="presentation"` or `role="none"`, and an `aria-label`, `aria-labelledby` or `title`. Missing alt fails.
|
|
42
|
+
|
|
43
|
+
Every probe skips what assistive technology cannot reach: anything under `aria-hidden="true"`, `inert` or `hidden`, and anything with `display: none` or `visibility: hidden`. axe does the same, so a closed menu or an overlay scrim no longer fails a probe that axe passes.
|
|
42
44
|
|
|
43
45
|
`every form field` counts as labelled when **any** of the following is true:
|
|
44
46
|
- An `aria-label` attribute is present
|
|
@@ -119,6 +121,20 @@ Then the page should have a title
|
|
|
119
121
|
| `user zoom should be allowed` | 1.4.4, 1.4.10 |
|
|
120
122
|
| `required fields should be consistently marked` | 3.3.2 |
|
|
121
123
|
|
|
124
|
+
## The full check, in one step
|
|
125
|
+
|
|
126
|
+
```gherkin
|
|
127
|
+
Then the page should pass the full accessibility check
|
|
128
|
+
And the page should pass the full accessibility check at level "A"
|
|
129
|
+
Then I print the full accessibility check
|
|
130
|
+
```
|
|
131
|
+
|
|
132
|
+
One step runs axe at the level (AA by default) and every structural probe in this file in a single pass: image alt, button and link names, field labels, iframe titles, positive tabindex, unresolved ARIA references, one h1, skipped heading levels, empty headings, main and navigation landmarks, page language, page title, zoom, and navigation landmarks sharing one name.
|
|
133
|
+
|
|
134
|
+
It reports every failure at once, not the first. A finding axe already named is not repeated by the probe that covers the same thing. The print form reports without failing, which is the way to see where a page stands before choosing a gate.
|
|
135
|
+
|
|
136
|
+
The skip link, focus, ARIA role and required-field steps are not part of it. Add them beside it when you need them.
|
|
137
|
+
|
|
122
138
|
## axe-core full audit
|
|
123
139
|
|
|
124
140
|
```gherkin
|
|
@@ -127,13 +143,17 @@ Then the page should pass an accessibility audit
|
|
|
127
143
|
And the page should pass an accessibility audit at level "AAA"
|
|
128
144
|
And the page should have no critical accessibility violations
|
|
129
145
|
And the page should have no serious accessibility violations
|
|
146
|
+
And the page should have no accessibility violations
|
|
130
147
|
And the element "main" should pass an accessibility audit
|
|
148
|
+
And the element "main" should not violate the accessibility rule "color-contrast"
|
|
131
149
|
And the page should pass an accessibility audit excluding "iframe.payment"
|
|
132
150
|
And the page should not violate the accessibility rule "color-contrast"
|
|
133
151
|
And the page should pass the accessibility rules "image-alt, label, button-name"
|
|
134
152
|
Then I print accessibility violations
|
|
135
153
|
```
|
|
136
154
|
|
|
155
|
+
The impact gate is a ladder. `no serious accessibility violations` fails on a serious **or** a critical violation, and `no minor` fails on any. Earlier releases matched each gate to its own level only, so a page with a critical violation passed the serious gate. A suite that gated on serious alone gets stricter on upgrade. `no accessibility violations` fails on any impact.
|
|
156
|
+
|
|
137
157
|
Default audit level is **AA** — required by EU Web Accessibility
|
|
138
158
|
Directive, US Section 508, UK PSBAR. Use `at level "AAA"` for stricter
|
|
139
159
|
gates.
|
|
@@ -159,9 +179,10 @@ For an admin / authenticated UI where some third-party widgets are
|
|
|
159
179
|
known-bad, gate on the impact-based step instead:
|
|
160
180
|
|
|
161
181
|
```gherkin
|
|
162
|
-
Then the page should have no
|
|
163
|
-
And the page should have no serious accessibility violations
|
|
182
|
+
Then the page should have no serious accessibility violations
|
|
164
183
|
```
|
|
165
184
|
|
|
185
|
+
One serious gate now covers critical too.
|
|
186
|
+
|
|
166
187
|
Tag scenarios `@a11y` so CI can run the accessibility suite in
|
|
167
188
|
isolation: `npx cucumber-js --tags "@a11y"`.
|
package/docs/11-debugging.md
CHANGED
|
File without changes
|
|
File without changes
|
package/docs/13-faq.md
CHANGED
|
File without changes
|
|
File without changes
|
|
File without changes
|
package/docs/16-ci-cd.md
CHANGED
|
File without changes
|
package/docs/README.md
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
Webship-js is a BDD-first browser-automation harness built on Playwright + Cucumber-js. Feature files in plain Gherkin; selectors that survive redesigns; smart waits that never sleep.
|
|
4
4
|
|
|
5
|
-
**
|
|
5
|
+
**417 built-in steps** across **36 step files**. **288 example scenarios / 1,406 step executions** in the bundled suite, all green on chromium, firefox, and webkit.
|
|
6
6
|
|
|
7
7
|
## Reading order
|
|
8
8
|
|
|
@@ -42,7 +42,10 @@ Webship-js is a BDD-first browser-automation harness built on Playwright + Cucum
|
|
|
42
42
|
| [API step definitions](api-step-definitions.md) | REST step definitions |
|
|
43
43
|
| [Advanced screenshots](advanced-screenshots.md) | Per-size, full-page, named (3 sub-pages under `advanced-screenshots/`) |
|
|
44
44
|
| [Advanced selectors](advanced-selectors.md) | Named selector registry, position assertions |
|
|
45
|
-
|
|
45
|
+
|
|
46
|
+
> **Visual regression moved out.** The Diffy step-pack now ships as its own
|
|
47
|
+
> plugin, [`diffy-steps`](https://github.com/webship/diffy-steps) — install it
|
|
48
|
+
> alongside webship-js and add its step-definition path to `cucumber.js`.
|
|
46
49
|
|
|
47
50
|
## At a glance
|
|
48
51
|
|
|
@@ -71,7 +74,7 @@ webship-js/
|
|
|
71
74
|
│ ├── selectors/ <— CMS / framework JSON presets
|
|
72
75
|
│ └── step-definitions/ <— Built-in steps (auto-loaded)
|
|
73
76
|
│ ├── webship.js # World setup, hooks, shared helpers (smartSettle, modal, selectors, date tokens)
|
|
74
|
-
│ ├── a11y.steps.js (
|
|
77
|
+
│ ├── a11y.steps.js (30) # axe-core audits + WCAG hygiene probes
|
|
75
78
|
│ ├── action.steps.js (7) # press / click / follow / attach
|
|
76
79
|
│ ├── api.steps.js (22) # REST long form (base URL, headers, query, body, JSON Pointer)
|
|
77
80
|
│ ├── assertion.steps.js (14) # see / not see, in row, in element, response, count
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
package/docs/global-settings.md
CHANGED
|
@@ -187,34 +187,6 @@ Tags override `mode` per scenario:
|
|
|
187
187
|
|
|
188
188
|
The explicit step `Then there should be no JavaScript errors` always asserts (independent of mode).
|
|
189
189
|
|
|
190
|
-
### `diffy` — visual-diff integration (optional)
|
|
191
|
-
|
|
192
|
-
```js
|
|
193
|
-
diffy: {
|
|
194
|
-
apiKey: 'mock-key',
|
|
195
|
-
projectId: 1,
|
|
196
|
-
breakpoints: '640,1200',
|
|
197
|
-
windowHeight: 2000,
|
|
198
|
-
screenshotsDir: '',
|
|
199
|
-
baseUrl: 'http://127.0.0.1:3099/',
|
|
200
|
-
maxWait: 30,
|
|
201
|
-
env1Url: '',
|
|
202
|
-
env2Url: '',
|
|
203
|
-
}
|
|
204
|
-
```
|
|
205
|
-
|
|
206
|
-
| Key | Default | Env override |
|
|
207
|
-
| --- | --- | --- |
|
|
208
|
-
| `apiKey` | `mock-key` | `DIFFY_API_KEY` |
|
|
209
|
-
| `projectId` | `1` | `DIFFY_PROJECT_ID` |
|
|
210
|
-
| `breakpoints` | `640,1200` | `DIFFY_BREAKPOINTS` |
|
|
211
|
-
| `windowHeight` | `2000` | `DIFFY_WINDOW_HEIGHT` |
|
|
212
|
-
| `screenshotsDir` | `''` | `DIFFY_SCREENSHOTS_DIR` |
|
|
213
|
-
| `baseUrl` | mock server | `DIFFY_API_BASE_URL` |
|
|
214
|
-
| `maxWait` | `30` (seconds) | `DIFFY_MAX_WAIT` |
|
|
215
|
-
| `env1Url` | `''` | `DIFFY_ENV1_URL` |
|
|
216
|
-
| `env2Url` | `''` | `DIFFY_ENV2_URL` |
|
|
217
|
-
|
|
218
190
|
---
|
|
219
191
|
|
|
220
192
|
## `playwright.config.ts` — browser launch
|
|
@@ -250,6 +222,7 @@ const config = {
|
|
|
250
222
|
| Env var | Effect |
|
|
251
223
|
| --- | --- |
|
|
252
224
|
| `WEBSHIP_AUTO_SETTLE` | Set to `off` to disable the BBR auto-settle hook (`smartSettle(page, 1500)` after every state-changing step). |
|
|
225
|
+
| `WEBSHIP_STEP_TIMEOUT` | Cucumber step timeout in milliseconds. Defaults to `45000`. webship-js calls `setDefaultTimeout()` when its step definitions load, which overrides a `timeout` set in your own `cucumber.js`, so raise it here instead. |
|
|
253
226
|
| `WEBSHIP_REPORT_DISABLE` | Set to `1` to skip auto-generating the HTML report on cucumber-js process exit. |
|
|
254
227
|
| `WEBSHIP_REPORT_ARGS` | Extra CLI flags forwarded to `bin/generate-reports.js`. e.g. `--theme hierarchy --layout 2`. |
|
|
255
228
|
|
|
File without changes
|
package/docs/overview.md
CHANGED
|
@@ -36,6 +36,5 @@ Webship-js offers "increased testing efficiency, reduced human error, improved t
|
|
|
36
36
|
- [API Step Definitions](/docs/webship-js/2.0.x/api-step-definitions)
|
|
37
37
|
- [Advanced Screenshots](/docs/webship-js/2.0.x/advanced-screenshots)
|
|
38
38
|
- [Advanced Selectors](/docs/webship-js/2.0.x/advanced-selectors)
|
|
39
|
-
- [Diffy Step Definitions](/docs/webship-js/2.0.x/diffy-step-definitions)
|
|
40
39
|
- [Assertions](/docs/webship-js/2.0.x/assertions)
|
|
41
40
|
- [Commands](/docs/webship-js/2.0.x/commands)
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
package/docs/step-definitions.md
CHANGED
|
File without changes
|
package/examples/a11y.html
CHANGED
|
@@ -26,6 +26,14 @@
|
|
|
26
26
|
<button type="submit">Submit</button>
|
|
27
27
|
</form>
|
|
28
28
|
</main>
|
|
29
|
+
<!-- Hidden from assistive technology: a closed overlay. Nothing in here is
|
|
30
|
+
reachable, so no accessibility probe should report it. -->
|
|
31
|
+
<div class="scrim" aria-hidden="true" style="display:none">
|
|
32
|
+
<button type="button" tabindex="-1"></button>
|
|
33
|
+
<a href="/closed"></a>
|
|
34
|
+
<img src="data:image/gif;base64,R0lGODlhAQABAIAAAP///wAAACH5BAEAAAAALAAAAAABAAEAAAICRAEAOw==">
|
|
35
|
+
<input type="text" name="scrim-field">
|
|
36
|
+
</div>
|
|
29
37
|
<footer><small>© 2026</small></footer>
|
|
30
38
|
</body>
|
|
31
39
|
</html>
|
package/examples/account.html
CHANGED
|
File without changes
|
|
File without changes
|
package/examples/cookies.html
CHANGED
|
File without changes
|
package/examples/date.html
CHANGED
|
File without changes
|
|
File without changes
|
package/examples/element.html
CHANGED
|
File without changes
|
package/examples/field.html
CHANGED
|
File without changes
|
package/examples/keyboard.html
CHANGED
|
File without changes
|
package/examples/links.html
CHANGED
|
File without changes
|
package/examples/modal.html
CHANGED
|
File without changes
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
<!DOCTYPE html>
|
|
2
|
+
<html lang="en">
|
|
3
|
+
<head>
|
|
4
|
+
<meta charset="utf-8">
|
|
5
|
+
<title>Never Settles</title>
|
|
6
|
+
</head>
|
|
7
|
+
<body>
|
|
8
|
+
<h1 id="page-title">Never Settles</h1>
|
|
9
|
+
|
|
10
|
+
<p id="intro">
|
|
11
|
+
This fixture never reaches network idle and never drains its timers, the way a
|
|
12
|
+
production page with analytics, a chat widget or a carousel behaves.
|
|
13
|
+
</p>
|
|
14
|
+
|
|
15
|
+
<p>Beat: <span id="beat">0</span></p>
|
|
16
|
+
|
|
17
|
+
<script>
|
|
18
|
+
// A request every 120ms: Playwright's "networkidle" needs 500ms with no
|
|
19
|
+
// in-flight network, so this page never reaches it.
|
|
20
|
+
// A self-rescheduling setTimeout: window.__webshipPendingTimers can
|
|
21
|
+
// therefore never fall back to 0 either.
|
|
22
|
+
var beat = 0;
|
|
23
|
+
function tick() {
|
|
24
|
+
beat++;
|
|
25
|
+
document.getElementById('beat').textContent = String(beat);
|
|
26
|
+
fetch('example-api.json?beat=' + beat, { cache: 'no-store' }).catch(function () {});
|
|
27
|
+
setTimeout(tick, 120);
|
|
28
|
+
}
|
|
29
|
+
setTimeout(tick, 120);
|
|
30
|
+
</script>
|
|
31
|
+
</body>
|
|
32
|
+
</html>
|
package/examples/path.html
CHANGED
|
File without changes
|
package/examples/table.html
CHANGED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
package/examples/video-demo.html
CHANGED
|
File without changes
|
package/package.json
CHANGED
package/playwright.config.ts
CHANGED
|
File without changes
|
|
File without changes
|
|
@@ -37,3 +37,25 @@ Feature: Accessibility (a11y) smoke checks
|
|
|
37
37
|
And the page should not violate the accessibility rule "image-alt"
|
|
38
38
|
And the page should not violate the accessibility rule "label"
|
|
39
39
|
And the page should pass the accessibility rules "image-alt, label, button-name"
|
|
40
|
+
|
|
41
|
+
Scenario: Elements hidden from assistive technology are out of scope
|
|
42
|
+
Given I am on "/a11y.html"
|
|
43
|
+
Then every button should have an accessible name
|
|
44
|
+
And every link should have an accessible name
|
|
45
|
+
And every image should have an alt attribute
|
|
46
|
+
And every form field should have an accessible label
|
|
47
|
+
|
|
48
|
+
Scenario: The impact gate covers everything worse than the level named
|
|
49
|
+
Given I am on "/a11y.html"
|
|
50
|
+
Then the page should have no minor accessibility violations
|
|
51
|
+
And the page should have no moderate accessibility violations
|
|
52
|
+
And the page should have no serious accessibility violations
|
|
53
|
+
And the page should have no critical accessibility violations
|
|
54
|
+
And the page should have no accessibility violations
|
|
55
|
+
|
|
56
|
+
Scenario: One step for the whole page
|
|
57
|
+
Given I am on "/a11y.html"
|
|
58
|
+
Then the page should pass the full accessibility check
|
|
59
|
+
And the page should pass the full accessibility check at level "AA"
|
|
60
|
+
And the element "main" should not violate the accessibility rule "image-alt"
|
|
61
|
+
And I print the full accessibility check
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
Feature: Smart wait stays inside its budget
|
|
2
|
+
|
|
3
|
+
A page with analytics, a chat widget or a self-rescheduling timer never
|
|
4
|
+
reaches network idle and never drains its pending timers. The smart wait has
|
|
5
|
+
to spend its budget and hand control back, rather than block until cucumber
|
|
6
|
+
kills the step.
|
|
7
|
+
|
|
8
|
+
Scenario: A page that never settles does not stall the run
|
|
9
|
+
Given I am on "/never-settles.html"
|
|
10
|
+
Then I should see "Never Settles"
|
|
11
|
+
When I wait until the page is loaded
|
|
12
|
+
Then I should see "Never Settles"
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
package/tests/reports/README.md
CHANGED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|