webship-js 2.0.3 → 2.0.5
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/.circleci/config.yml +7 -31
- package/.drone.yml +68 -0
- package/.harness/webship-js-pipeline.yml +101 -0
- package/.semaphore/semaphore.yml +58 -0
- package/.teamcity/pom.xml +52 -0
- package/.teamcity/settings.kts +92 -0
- package/.travis.yml +24 -3
- package/AGENTS.md +53 -17
- package/CLAUDE.md +327 -105
- package/Jenkinsfile +54 -0
- package/azure-pipelines.yml +82 -0
- package/bamboo-specs/bamboo.yml +131 -0
- package/bin/init-webship.js +0 -13
- package/bin/postinstall.js +0 -0
- package/buildspec.yml +56 -0
- package/cloudbuild.yaml +49 -0
- package/codefresh.yml +77 -0
- package/cucumber.js +39 -14
- package/docs/00-quick-start.md +0 -0
- package/docs/01-getting-started.md +0 -0
- package/docs/02-bbr-smart-waits.md +0 -0
- package/docs/03-selector-registry.md +0 -0
- package/docs/04-step-reference.md +74 -3
- 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 +0 -0
- 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 +879 -0
- package/docs/README.md +116 -0
- 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 +45 -22
- 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 +0 -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/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 +43 -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 +0 -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/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 +18 -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 +3 -1
- package/tests/step-definitions/action.steps.js +2 -2
- package/tests/step-definitions/api.steps.js +17 -16
- package/tests/step-definitions/assertion.steps.js +2 -2
- package/tests/step-definitions/auth.steps.js +3 -1
- package/tests/step-definitions/clock.steps.js +38 -38
- package/tests/step-definitions/cookie.steps.js +0 -0
- package/tests/step-definitions/debug.steps.js +13 -5
- package/tests/step-definitions/dialog.steps.js +0 -0
- package/tests/step-definitions/element.steps.js +47 -5
- package/tests/step-definitions/field.steps.js +0 -0
- package/tests/step-definitions/file-download.steps.js +38 -20
- package/tests/step-definitions/form.steps.js +6 -6
- package/tests/step-definitions/iframe.steps.js +65 -15
- package/tests/step-definitions/input.steps.js +47 -8
- package/tests/step-definitions/javascript.steps.js +195 -34
- package/tests/step-definitions/keyboard.steps.js +38 -4
- 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 +39 -14
- package/tests/step-definitions/navigation.steps.js +0 -0
- package/tests/step-definitions/network.steps.js +61 -19
- 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 +3 -1
- 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 +19 -17
- 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 +178 -0
- package/tests/step-definitions/wait.steps.js +0 -0
- package/tests/step-definitions/web-first.steps.js +3 -1
- package/tests/step-definitions/webship.js +234 -15
- package/tests/step-definitions/xml.steps.js +4 -2
- package/tests/step-definitions/yaml.steps.js +13 -11
- package/tsconfig.json +0 -0
- package/videos/README.md +32 -0
- package/.travis-ci.yml +0 -16
- 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/docs/index.md +0 -104
- 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/docs/README.md
ADDED
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
# Webship-js Documentation
|
|
2
|
+
|
|
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
|
+
|
|
5
|
+
**411 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
|
+
|
|
7
|
+
## Reading order
|
|
8
|
+
|
|
9
|
+
### Webship-js essentials (custom)
|
|
10
|
+
|
|
11
|
+
| Doc | Topic |
|
|
12
|
+
| --- | --- |
|
|
13
|
+
| [00 Quick start](00-quick-start.md) | 5-minute path for newcomers |
|
|
14
|
+
| [01 Getting started](01-getting-started.md) | Install, project layout, run modes |
|
|
15
|
+
| [02 BBR smart waits](02-bbr-smart-waits.md) | Why we never `sleep N seconds` |
|
|
16
|
+
| [03 Selector registry](03-selector-registry.md) | Named selectors + CMS / framework presets |
|
|
17
|
+
| [04 Step reference](04-step-reference.md) | Every built-in step, by topic |
|
|
18
|
+
| [05 Web-first assertions](05-web-first-assertions.md) | Auto-retrying matchers |
|
|
19
|
+
| [06 Networking & dialogs](06-network-and-dialogs.md) | Request mocking, alerts, prompts |
|
|
20
|
+
| [07 Auth state](07-auth-state.md) | Save / restore login |
|
|
21
|
+
| [08 Clock mocking](08-clock-mocking.md) | Control time |
|
|
22
|
+
| [09 API testing](09-api-testing.md) | Direct HTTP from BDD |
|
|
23
|
+
| [10 Accessibility](10-accessibility.md) | POUR smoke checks |
|
|
24
|
+
| [11 Debugging](11-debugging.md) | Screenshots, headed, traces, reports |
|
|
25
|
+
| [12 AI agent guide](12-ai-agent-guide.md) | Wisdom + recipes from the Recipes book v1.0.30 (TDD AI / SPDD / Three Amigos / golden rules) |
|
|
26
|
+
| [13 FAQ](13-faq.md) | Common questions for newcomers |
|
|
27
|
+
| [14 Recipes cookbook](14-recipes-cookbook.md) | 20 paste-and-go scenarios |
|
|
28
|
+
| [15 Tag conventions](15-tag-conventions.md) | Standard tags + CI lane patterns |
|
|
29
|
+
| [16 CI / CD setup](16-ci-cd.md) | Per-provider setup steps and config notes |
|
|
30
|
+
|
|
31
|
+
### Reference (mirrored from webship.co/docs/webship-js/2.0.x)
|
|
32
|
+
|
|
33
|
+
| Doc | Topic |
|
|
34
|
+
| --- | --- |
|
|
35
|
+
| [Overview](overview.md) | Webship-js v2.0.x at a glance |
|
|
36
|
+
| [Install](install-webship-js.md) | Install Webship-js |
|
|
37
|
+
| [Install — DDEV](install-webship-js/ddev-webship-js.md) | DDEV-Webship-js variant |
|
|
38
|
+
| [Global settings](global-settings.md) | `cucumber.js` `worldParameters` reference |
|
|
39
|
+
| [Commands](commands.md) | CLI commands |
|
|
40
|
+
| [Assertions](assertions.md) | Built-in assertions |
|
|
41
|
+
| [Step definitions](step-definitions.md) | Step-definition catalogue (28 sub-pages under `step-definitions/`) |
|
|
42
|
+
| [API step definitions](api-step-definitions.md) | REST step definitions |
|
|
43
|
+
| [Advanced screenshots](advanced-screenshots.md) | Per-size, full-page, named (3 sub-pages under `advanced-screenshots/`) |
|
|
44
|
+
| [Advanced selectors](advanced-selectors.md) | Named selector registry, position assertions |
|
|
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`.
|
|
49
|
+
|
|
50
|
+
## At a glance
|
|
51
|
+
|
|
52
|
+
```gherkin
|
|
53
|
+
Feature: Smoke
|
|
54
|
+
|
|
55
|
+
Background:
|
|
56
|
+
Given I restore the auth state from "tests/auth/admin.json"
|
|
57
|
+
|
|
58
|
+
@javascript
|
|
59
|
+
Scenario: Dashboard renders without JS errors
|
|
60
|
+
Given I am on "/dashboard"
|
|
61
|
+
And I wait until the network is idle
|
|
62
|
+
Then the page should have a main landmark
|
|
63
|
+
And "<#user-list>" should have a count of 5 within 5 seconds
|
|
64
|
+
And "<.notification>" should not be visible
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
## Source layout
|
|
68
|
+
|
|
69
|
+
```
|
|
70
|
+
webship-js/
|
|
71
|
+
├── docs/ <— You are here
|
|
72
|
+
├── tests/
|
|
73
|
+
│ ├── features/ <— Your *.feature files
|
|
74
|
+
│ ├── selectors/ <— CMS / framework JSON presets
|
|
75
|
+
│ └── step-definitions/ <— Built-in steps (auto-loaded)
|
|
76
|
+
│ ├── webship.js # World setup, hooks, shared helpers (smartSettle, modal, selectors, date tokens)
|
|
77
|
+
│ ├── a11y.steps.js (26) # axe-core audits + WCAG hygiene probes
|
|
78
|
+
│ ├── action.steps.js (7) # press / click / follow / attach
|
|
79
|
+
│ ├── api.steps.js (22) # REST long form (base URL, headers, query, body, JSON Pointer)
|
|
80
|
+
│ ├── assertion.steps.js (14) # see / not see, in row, in element, response, count
|
|
81
|
+
│ ├── auth.steps.js (3) # save / restore / clear storageState
|
|
82
|
+
│ ├── clock.steps.js (7) # install / advance / pause / set system time
|
|
83
|
+
│ ├── cookie.steps.js (12) # cookie exists / equals / contains
|
|
84
|
+
│ ├── debug.steps.js (2) # print URL / last response (diagnostic)
|
|
85
|
+
│ ├── dialog.steps.js (8) # native alert / confirm / prompt
|
|
86
|
+
│ ├── element.steps.js (19) # focus / scroll-to / dispatch / count / position
|
|
87
|
+
│ ├── field.steps.js (27) # field state, checkbox, radio, select-list
|
|
88
|
+
│ ├── file-download.steps.js (8) # capture + assert filename / mime / path
|
|
89
|
+
│ ├── form.steps.js (13) # fill / select / check / uncheck / radio
|
|
90
|
+
│ ├── iframe.steps.js (10) # frameLocator switch + scoped click / fill / assert
|
|
91
|
+
│ ├── input.steps.js (9) # hover / drag / dbl / right-click / tap / viewport
|
|
92
|
+
│ ├── javascript.steps.js (4) # JS error tracker + assertion (warn / fail / off)
|
|
93
|
+
│ ├── keyboard.steps.js (4) # single key + combos with alias normalisation
|
|
94
|
+
│ ├── link.steps.js (9) # href / title / target / rel
|
|
95
|
+
│ ├── metatag.steps.js (3) # description / keywords / OG / Twitter
|
|
96
|
+
│ ├── modal.steps.js (9) # HTML modal visibility / content / interactions
|
|
97
|
+
│ ├── navigation.steps.js (11) # homepage / paths / history / URL assertions
|
|
98
|
+
│ ├── network.steps.js (10) # route stubs / mocks / delays / offline
|
|
99
|
+
│ ├── path.steps.js (8) # URL path / query / fragment
|
|
100
|
+
│ ├── response.steps.js (4) # response header inspection
|
|
101
|
+
│ ├── responsive.steps.js (5) # named breakpoints + explicit viewport
|
|
102
|
+
│ ├── rest.steps.js (5) # REST short form
|
|
103
|
+
│ ├── screenshot.steps.js (6) # manual + auto-on-failure + per-step capture
|
|
104
|
+
│ ├── scroll.steps.js (12) # page + scoped element scroll
|
|
105
|
+
│ ├── selectors.steps.js (22) # named CSS / XPath registry + 22 CMS / framework presets
|
|
106
|
+
│ ├── storage.steps.js (9) # local / session storage
|
|
107
|
+
│ ├── table.steps.js (8) # data-table row / column assertions
|
|
108
|
+
│ ├── video.steps.js (4) # start / stop / save webm recording
|
|
109
|
+
│ ├── wait.steps.js (21) # every wait phrasing — all BBR-backed
|
|
110
|
+
│ ├── web-first.steps.js (12) # auto-retrying matchers (`within N seconds`)
|
|
111
|
+
│ ├── xml.steps.js (20) # XPath equals / contains / count / attr
|
|
112
|
+
│ └── yaml.steps.js (38) # multi-doc + types + numerics + JSON Schema + diff
|
|
113
|
+
├── examples/ <— Static HTML fixtures
|
|
114
|
+
├── cucumber.js <— Profiles + worldParameters
|
|
115
|
+
└── playwright.config.ts <— Browser launch + context options
|
|
116
|
+
```
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
package/docs/global-settings.md
CHANGED
|
@@ -136,33 +136,56 @@ Filename pattern tokens: `{datetime}`, `{date}`, `{time}`, `{feature_file}`,
|
|
|
136
136
|
`{feature}`, `{scenario}`, `{step_line}`, `{ext}`, `{failed_prefix}`,
|
|
137
137
|
`{url}`, `{host}`, `{path}`.
|
|
138
138
|
|
|
139
|
-
### `
|
|
139
|
+
### `video` — Playwright video recording
|
|
140
140
|
|
|
141
141
|
```js
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
screenshotsDir: '',
|
|
148
|
-
baseUrl: 'http://127.0.0.1:3099/',
|
|
149
|
-
maxWait: 30,
|
|
150
|
-
env1Url: '',
|
|
151
|
-
env2Url: '',
|
|
142
|
+
video: {
|
|
143
|
+
mode: 'off', // WEBSHIP_VIDEO — 'off' | 'on' | 'on-failure' | 'tag'
|
|
144
|
+
dir: './videos', // WEBSHIP_VIDEO_DIR
|
|
145
|
+
size: { width: 1280, height: 720 }, // recording viewport
|
|
146
|
+
filenamePattern: '{datetime}.{feature_file}.{scenario}.{status}.{ext}',
|
|
152
147
|
}
|
|
153
148
|
```
|
|
154
149
|
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
|
158
|
-
|
|
|
159
|
-
| `
|
|
160
|
-
| `
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
|
165
|
-
|
|
|
150
|
+
Tag overrides per scenario:
|
|
151
|
+
|
|
152
|
+
| Tag | Effect |
|
|
153
|
+
| --- | --- |
|
|
154
|
+
| `@video` | Force recording on. |
|
|
155
|
+
| `@no-video` | Suppress recording. |
|
|
156
|
+
|
|
157
|
+
Modes:
|
|
158
|
+
|
|
159
|
+
| Mode | Behaviour |
|
|
160
|
+
| --- | --- |
|
|
161
|
+
| `off` (default) | No recording. |
|
|
162
|
+
| `on` | Record every scenario. |
|
|
163
|
+
| `on-failure` | Record every scenario, keep only failures. |
|
|
164
|
+
| `tag` | Record only scenarios tagged `@video`. |
|
|
165
|
+
|
|
166
|
+
Mid-scenario start / stop steps live in `video.steps.js`. Recording starts at context creation only — `When I start video recording` closes + reopens the context, losing page state. Call before any navigation.
|
|
167
|
+
|
|
168
|
+
### `javascript` — page-error / console capture
|
|
169
|
+
|
|
170
|
+
```js
|
|
171
|
+
javascript: {
|
|
172
|
+
mode: 'warn', // WEBSHIP_JS_ERROR_MODE — 'warn' | 'fail' | 'off'
|
|
173
|
+
levels: ['error'], // WEBSHIP_JS_ERROR_LEVELS (csv) — console levels to capture
|
|
174
|
+
ignore: '', // WEBSHIP_JS_ERROR_IGNORE — regex of messages to drop
|
|
175
|
+
beforeScenario: false, // WEBSHIP_JS_ERROR_BEFORE — snapshot pre-existing errors
|
|
176
|
+
afterScenario: true, // WEBSHIP_JS_ERROR_AFTER — report at scenario end
|
|
177
|
+
}
|
|
178
|
+
```
|
|
179
|
+
|
|
180
|
+
Tags override `mode` per scenario:
|
|
181
|
+
|
|
182
|
+
| Tag | Effect |
|
|
183
|
+
| --- | --- |
|
|
184
|
+
| `@js-fail` / `@javascript` (legacy) | force `fail` |
|
|
185
|
+
| `@js-warn` | force `warn` |
|
|
186
|
+
| `@js-off` / `@js-errors` (legacy) | force `off` |
|
|
187
|
+
|
|
188
|
+
The explicit step `Then there should be no JavaScript errors` always asserts (independent of mode).
|
|
166
189
|
|
|
167
190
|
---
|
|
168
191
|
|
|
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
|
File without changes
|
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
|
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
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
<!DOCTYPE html>
|
|
2
|
+
<html lang="en">
|
|
3
|
+
<head>
|
|
4
|
+
<meta charset="UTF-8">
|
|
5
|
+
<title>🎬 Video Demo</title>
|
|
6
|
+
<style>
|
|
7
|
+
body { font-family: system-ui, sans-serif; max-width: 720px; margin: 2rem auto; padding: 1rem; background: linear-gradient(180deg, #fdf6e3 0%, #eee8d5 100%); color: #073642; }
|
|
8
|
+
h1 { font-size: 2rem; }
|
|
9
|
+
main { background: #fff; border-radius: 12px; padding: 2rem; box-shadow: 0 4px 20px rgba(0,0,0,0.08); }
|
|
10
|
+
button { font-size: 1.1rem; padding: 0.6rem 1.2rem; background: #268bd2; color: #fff; border: 0; border-radius: 8px; cursor: pointer; margin-right: 0.5rem; }
|
|
11
|
+
button:hover { background: #2aa198; }
|
|
12
|
+
.status { font-size: 1.4rem; padding: 1rem; margin-top: 1rem; border-radius: 8px; background: #fdf6e3; min-height: 2rem; }
|
|
13
|
+
.smile { font-size: 3rem; }
|
|
14
|
+
</style>
|
|
15
|
+
</head>
|
|
16
|
+
<body>
|
|
17
|
+
<h1>🎬 Webship-js Video Demo</h1>
|
|
18
|
+
<main role="main">
|
|
19
|
+
<p>Click a button below — the recording captures the page state change.</p>
|
|
20
|
+
<button id="wave">👋 Wave</button>
|
|
21
|
+
<button id="rocket">🚀 Launch</button>
|
|
22
|
+
<button id="party">🎉 Celebrate</button>
|
|
23
|
+
<div class="status" id="status">Ready to record ⏺️</div>
|
|
24
|
+
<div class="smile" id="smile"></div>
|
|
25
|
+
</main>
|
|
26
|
+
<script>
|
|
27
|
+
const status = document.getElementById('status');
|
|
28
|
+
const smile = document.getElementById('smile');
|
|
29
|
+
document.getElementById('wave').addEventListener('click', () => {
|
|
30
|
+
status.textContent = 'Hello, world 👋';
|
|
31
|
+
smile.textContent = '😀';
|
|
32
|
+
});
|
|
33
|
+
document.getElementById('rocket').addEventListener('click', () => {
|
|
34
|
+
status.textContent = 'Liftoff! 🚀';
|
|
35
|
+
smile.textContent = '🌕';
|
|
36
|
+
});
|
|
37
|
+
document.getElementById('party').addEventListener('click', () => {
|
|
38
|
+
status.textContent = 'Party time 🎉';
|
|
39
|
+
smile.textContent = '🥳';
|
|
40
|
+
});
|
|
41
|
+
</script>
|
|
42
|
+
</body>
|
|
43
|
+
</html>
|
package/package.json
CHANGED
package/playwright.config.ts
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
|
|
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,18 @@
|
|
|
1
|
+
@video
|
|
2
|
+
Feature: 🎬 Video recording
|
|
3
|
+
|
|
4
|
+
As a tester, I want to record a short browser video so that I can attach it
|
|
5
|
+
to a bug report and let reviewers replay what happened.
|
|
6
|
+
|
|
7
|
+
Scenario: 🎥 Record a tiny click flow with emojis
|
|
8
|
+
When I start video recording
|
|
9
|
+
Given I am on "/video-demo.html"
|
|
10
|
+
Then I should see "Webship-js Video Demo"
|
|
11
|
+
When I press "👋 Wave"
|
|
12
|
+
Then I should see "Hello, world"
|
|
13
|
+
When I press "🚀 Launch"
|
|
14
|
+
Then I should see "Liftoff!"
|
|
15
|
+
When I press "🎉 Celebrate"
|
|
16
|
+
Then I should see "Party time"
|
|
17
|
+
When I save the current video as "demo.webm"
|
|
18
|
+
When I stop video recording
|
|
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
|
|
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
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
+
const { friendly } = require('./webship');
|
|
4
|
+
|
|
3
5
|
// Accessibility (a11y) step definitions.
|
|
4
6
|
//
|
|
5
7
|
// Two layers:
|
|
@@ -51,7 +53,7 @@ function summariseViolations(violations) {
|
|
|
51
53
|
|
|
52
54
|
async function runAxe(world, opts = {}) {
|
|
53
55
|
if (!AxeBuilder) {
|
|
54
|
-
throw
|
|
56
|
+
throw friendly('axe-core a11y steps require @axe-core/playwright. Install: npm i @axe-core/playwright axe-core');
|
|
55
57
|
}
|
|
56
58
|
let builder = new AxeBuilder({ page: world.page });
|
|
57
59
|
if (opts.tags) builder = builder.withTags(opts.tags);
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
|
|
6
6
|
const { When } = require('@cucumber/cucumber');
|
|
7
7
|
const path = require('path');
|
|
8
|
-
const { buildSelector } = require('./webship');
|
|
8
|
+
const { buildSelector, friendly } = require('./webship');
|
|
9
9
|
|
|
10
10
|
// Wrap a Playwright action with a friendlier error pointing at the
|
|
11
11
|
// failing locator + Gherkin step. Pass `label` describing the step
|
|
@@ -15,7 +15,7 @@ async function actOrExplain(label, target, fn) {
|
|
|
15
15
|
await fn();
|
|
16
16
|
} catch (e) {
|
|
17
17
|
const msg = (e.message || '').split('\n')[0];
|
|
18
|
-
throw
|
|
18
|
+
throw friendly(
|
|
19
19
|
`Failed to ${label} "${target}".\n` +
|
|
20
20
|
` ${msg}\n` +
|
|
21
21
|
` Hints:\n` +
|