webship-js 2.0.1 → 2.0.3
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/AGENTS.md +109 -0
- package/CLAUDE.md +317 -0
- package/bin/generate-reports.js +363 -0
- package/bin/init-webship.js +343 -0
- package/bin/postinstall.js +8 -74
- package/cucumber.js +66 -2
- package/docs/00-quick-start.md +102 -0
- package/docs/01-getting-started.md +102 -0
- package/docs/02-bbr-smart-waits.md +77 -0
- package/docs/03-selector-registry.md +95 -0
- package/docs/04-step-reference.md +728 -0
- package/docs/05-web-first-assertions.md +91 -0
- package/docs/06-network-and-dialogs.md +83 -0
- package/docs/07-auth-state.md +75 -0
- package/docs/08-clock-mocking.md +59 -0
- package/docs/09-api-testing.md +114 -0
- package/docs/10-accessibility.md +167 -0
- package/docs/11-debugging.md +129 -0
- package/docs/12-ai-agent-guide.md +338 -0
- package/docs/13-faq.md +236 -0
- package/docs/14-recipes-cookbook.md +255 -0
- package/docs/15-tag-conventions.md +76 -0
- package/docs/advanced-screenshots/then-i-save-fullscreen-screenshot.md +36 -0
- package/docs/advanced-screenshots/then-i-save-width-x-height-screenshot.md +34 -0
- package/docs/advanced-screenshots/when-i-save-screenshot-name-filename.md +45 -0
- package/docs/advanced-screenshots.md +52 -0
- package/docs/advanced-selectors.md +18 -0
- package/docs/api-step-definitions.md +45 -0
- package/docs/diffy-step-definitions/then-compare-diffy-env1-env2.md +30 -0
- package/docs/diffy-step-definitions/then-create-diffy-comparison-name-value.md +21 -0
- package/docs/diffy-step-definitions/then-create-diffy-comparison.md +25 -0
- package/docs/diffy-step-definitions/then-create-diffy-screenshot-environment-name.md +35 -0
- package/docs/diffy-step-definitions/then-i-take-screenshot.md +21 -0
- package/docs/diffy-step-definitions/then-i-take-screenshots-all-breakpoints.md +27 -0
- package/docs/diffy-step-definitions/then-send-screenshots-diffy-name-value.md +27 -0
- package/docs/diffy-step-definitions/then-upload-folder-url-diffy-snapshotname.md +28 -0
- package/docs/diffy-step-definitions/then-wait-diffy-comparison-complete.md +21 -0
- package/docs/diffy-step-definitions/when-i-resize-window-number.md +29 -0
- package/docs/diffy-step-definitions.md +21 -0
- package/docs/global-settings.md +244 -0
- package/docs/index.md +104 -0
- package/docs/install-webship-js/ddev-webship-js.md +52 -0
- package/docs/install-webship-js.md +35 -0
- package/docs/overview.md +41 -0
- package/docs/step-definitions/given-i-am-anonymous-user.md +67 -0
- package/docs/step-definitions/given-i-am-homepage.md +68 -0
- package/docs/step-definitions/given-i-am-specific-page.md +72 -0
- package/docs/step-definitions/then-i-should-be.md +56 -0
- package/docs/step-definitions/then-i-should-see.md +62 -0
- package/docs/step-definitions/then-item-checkbox.md +54 -0
- package/docs/step-definitions/then-item-link-should-contain-url.md +84 -0
- package/docs/step-definitions/then-item-should-contain.md +67 -0
- package/docs/step-definitions/then-radio-button-value-should-be-selected.md +68 -0
- package/docs/step-definitions/then-response-status-code-should-be-number.md +69 -0
- package/docs/step-definitions/then-value-radio-button-selected.md +62 -0
- package/docs/step-definitions/when-i-attach-file-file-name-element.md +71 -0
- package/docs/step-definitions/when-i-check-checkbox.md +60 -0
- package/docs/step-definitions/when-i-click-link.md +51 -0
- package/docs/step-definitions/when-i-click-operation-text-row.md +71 -0
- package/docs/step-definitions/when-i-fill.md +59 -0
- package/docs/step-definitions/when-i-go-homepage.md +60 -0
- package/docs/step-definitions/when-i-go-specific-page.md +67 -0
- package/docs/step-definitions/when-i-move-backward-one-page.md +49 -0
- package/docs/step-definitions/when-i-move-forward-one-page.md +58 -0
- package/docs/step-definitions/when-i-press-button.md +58 -0
- package/docs/step-definitions/when-i-reload-page.md +51 -0
- package/docs/step-definitions/when-i-scroll.md +73 -0
- package/docs/step-definitions/when-i-select-option-select-list.md +53 -0
- package/docs/step-definitions/when-i-select-radio-button-value.md +62 -0
- package/docs/step-definitions/when-i-uncheck-checkbox.md +57 -0
- package/docs/step-definitions/when-i-wait-ajax-finish.md +64 -0
- package/docs/step-definitions/when-i-wait.md +62 -0
- package/docs/step-definitions.md +50 -0
- package/examples/a11y.html +31 -0
- package/examples/cookies.html +10 -0
- package/examples/date.html +12 -0
- package/examples/diffy/baseline.html +54 -0
- package/examples/diffy/changed.html +63 -0
- package/examples/diffy/index.html +52 -0
- package/examples/element.html +11 -0
- package/examples/field.html +24 -0
- package/examples/index.html +6 -0
- package/examples/keyboard.html +11 -0
- package/examples/links.html +9 -0
- package/examples/modal.html +14 -0
- package/examples/path.html +3 -0
- package/examples/table.html +13 -0
- package/examples/test--when--i-additionally-select.html +27 -0
- package/package.json +19 -6
- package/playwright.config.ts +3 -2
- package/tests/features/a11y.feature +39 -0
- package/tests/features/cookie.feature +13 -0
- package/tests/features/date.feature +11 -0
- package/tests/features/diffy/test--diffy-01-example-demo.feature +22 -0
- package/tests/features/diffy/test--diffy-02-all-steps.feature +52 -0
- package/tests/features/diffy/test--diffy-03-real-api.feature +21 -0
- package/tests/features/element.feature +16 -0
- package/tests/features/field.feature +25 -0
- package/tests/features/keyboard.feature +10 -0
- package/tests/features/link.feature +11 -0
- package/tests/features/modal-advanced-example.feature +1 -1
- package/tests/features/modal.feature +11 -0
- package/tests/features/path.feature +16 -0
- package/tests/features/response.feature +8 -0
- package/tests/features/responsive.feature +10 -0
- package/tests/features/table.feature +18 -0
- package/tests/features/test--then--i-save-screenshot.feature +33 -0
- package/tests/features/test--then--i-see-locator.feature +320 -0
- package/tests/features/test--then--i-should-see-n-elements.feature +24 -0
- package/tests/features/test--then--print-current-url-and-response.feature +21 -0
- package/tests/features/test--when--i-additionally-select.feature +30 -0
- package/tests/features/test--when--i-follow.feature +22 -0
- package/tests/features/wait.feature +7 -0
- package/tests/features/yaml.feature +102 -0
- package/tests/reports/README.md +55 -0
- package/tests/selectors/_canonical-keys.json +113 -0
- package/tests/selectors/back-end-selectors.json +19 -0
- package/tests/selectors/cms-contentful-admin.json +35 -0
- package/tests/selectors/cms-craft-admin.json +39 -0
- package/tests/selectors/cms-drupal-cms-gin.json +56 -0
- package/tests/selectors/cms-drupal-core-claro.json +50 -0
- package/tests/selectors/cms-generic-admin.json +34 -0
- package/tests/selectors/cms-ghost-admin.json +34 -0
- package/tests/selectors/cms-joomla-admin.json +41 -0
- package/tests/selectors/cms-magento2-admin.json +32 -0
- package/tests/selectors/cms-prestashop-admin.json +38 -0
- package/tests/selectors/cms-shopify-admin.json +25 -0
- package/tests/selectors/cms-strapi-admin.json +42 -0
- package/tests/selectors/cms-typo3-admin.json +41 -0
- package/tests/selectors/cms-woocommerce-front.json +50 -0
- package/tests/selectors/cms-wordpress-admin.json +31 -0
- package/tests/selectors/framework-ant-design.json +80 -0
- package/tests/selectors/framework-bootstrap.json +86 -0
- package/tests/selectors/framework-bulma.json +74 -0
- package/tests/selectors/framework-chakra.json +58 -0
- package/tests/selectors/framework-foundation.json +51 -0
- package/tests/selectors/framework-material-ui.json +72 -0
- package/tests/selectors/framework-shadcn.json +51 -0
- package/tests/selectors/framework-tailwind.json +40 -0
- package/tests/selectors/framework-vuetify.json +61 -0
- package/tests/selectors/front-end-selectors.json +16 -0
- package/tests/selectors/homepage-selectors.json +13 -0
- package/tests/step-definitions/a11y.steps.js +798 -0
- package/tests/step-definitions/action.steps.js +167 -0
- package/tests/step-definitions/{webship-api.js → api.steps.js} +254 -44
- package/tests/step-definitions/assertion.steps.js +352 -0
- package/tests/step-definitions/auth.steps.js +124 -0
- package/tests/step-definitions/clock.steps.js +128 -0
- package/tests/step-definitions/cookie.steps.js +216 -0
- package/tests/step-definitions/debug.steps.js +31 -0
- package/tests/step-definitions/dialog.steps.js +193 -0
- package/tests/step-definitions/element.steps.js +314 -0
- package/tests/step-definitions/field.steps.js +653 -0
- package/tests/step-definitions/file-download.steps.js +193 -0
- package/tests/step-definitions/form.steps.js +333 -0
- package/tests/step-definitions/iframe.steps.js +178 -0
- package/tests/step-definitions/input.steps.js +163 -0
- package/tests/step-definitions/javascript.steps.js +71 -0
- package/tests/step-definitions/keyboard.steps.js +78 -0
- package/tests/step-definitions/link.steps.js +142 -0
- package/tests/step-definitions/metatag.steps.js +91 -0
- package/tests/step-definitions/modal.steps.js +219 -0
- package/tests/step-definitions/navigation.steps.js +218 -0
- package/tests/step-definitions/network.steps.js +238 -0
- package/tests/step-definitions/path.steps.js +141 -0
- package/tests/step-definitions/response.steps.js +98 -0
- package/tests/step-definitions/responsive.steps.js +123 -0
- package/tests/step-definitions/rest.steps.js +111 -0
- package/tests/step-definitions/screenshot.steps.js +423 -0
- package/tests/step-definitions/scroll.steps.js +189 -0
- package/tests/step-definitions/selectors.steps.js +996 -0
- package/tests/step-definitions/storage.steps.js +194 -0
- package/tests/step-definitions/table.steps.js +181 -0
- package/tests/step-definitions/wait.steps.js +400 -0
- package/tests/step-definitions/web-first.steps.js +296 -0
- package/tests/step-definitions/webship.js +567 -923
- package/tests/step-definitions/xml.steps.js +409 -0
- package/tests/step-definitions/yaml.steps.js +911 -0
- package/tests/step-definitions-diffy/README.md +329 -0
- package/tests/step-definitions-diffy/mock-diffy-api/server.js +84 -0
- package/tests/step-definitions-diffy/webship-diffy-mock.js +31 -0
- package/tests/step-definitions-diffy/webship-diffy.js +459 -0
- package/tsconfig.json +19 -3
- package/generate-reports.js +0 -22
- package/required/cucumber.js +0 -37
- package/required/generate-reports.js +0 -22
- package/required/package.json +0 -18
- package/required/playwright.config.ts +0 -37
- package/required/tests/features/README.md +0 -1
- package/required/tests/features/check-homepage.feature +0 -8
- package/required/tests/reports/README.md +0 -1
- package/required/tests/step-definitions/README.md +0 -1
- package/required/tests/step-definitions/custom.js +0 -4
- package/required/tsconfig.json +0 -12
|
@@ -0,0 +1,320 @@
|
|
|
1
|
+
Feature: Relative element positioning assertions and advanced selector system.
|
|
2
|
+
As a tester,
|
|
3
|
+
I want to assert that page components are positioned correctly relative to each other
|
|
4
|
+
and resolve elements via a named CSS/XPath selector registry
|
|
5
|
+
so that I can catch layout regressions without brittle pixel comparisons.
|
|
6
|
+
|
|
7
|
+
Background:
|
|
8
|
+
Given I am on homepage
|
|
9
|
+
And I define css selectors:
|
|
10
|
+
| heading | h1 |
|
|
11
|
+
| subline | h3 |
|
|
12
|
+
| list | ul |
|
|
13
|
+
|
|
14
|
+
# ---------------------------------------------------------------------------
|
|
15
|
+
# Breakpoints — cover all 7 configured sizes (pronoun variants too).
|
|
16
|
+
# ---------------------------------------------------------------------------
|
|
17
|
+
Scenario: Resize to xs breakpoint.
|
|
18
|
+
Given I am viewing the site on a xs screen
|
|
19
|
+
Then I see visible heading
|
|
20
|
+
|
|
21
|
+
Scenario: Resize to sm breakpoint.
|
|
22
|
+
Given I am viewing the site on a sm screen
|
|
23
|
+
Then I see visible heading
|
|
24
|
+
|
|
25
|
+
Scenario: Resize to md breakpoint.
|
|
26
|
+
Given I am viewing the site on a md device
|
|
27
|
+
Then I see visible heading
|
|
28
|
+
|
|
29
|
+
Scenario: Resize to lg breakpoint.
|
|
30
|
+
Given I am viewing the site on a lg screen
|
|
31
|
+
Then I see visible heading
|
|
32
|
+
|
|
33
|
+
Scenario: Resize to xl breakpoint (default).
|
|
34
|
+
Given I am viewing the site on a xl screen
|
|
35
|
+
Then I see visible heading
|
|
36
|
+
|
|
37
|
+
Scenario: Resize to xxl breakpoint.
|
|
38
|
+
Given I am viewing the site on a xxl screen
|
|
39
|
+
Then I see visible heading
|
|
40
|
+
|
|
41
|
+
Scenario: Resize to xxxl breakpoint using quoted name.
|
|
42
|
+
Given I am viewing the site on a "xxxl" screen
|
|
43
|
+
Then I see visible heading
|
|
44
|
+
|
|
45
|
+
Scenario: Resize using the "we are" pronoun variant.
|
|
46
|
+
Given we are viewing the site on a md screen
|
|
47
|
+
Then we see visible heading
|
|
48
|
+
|
|
49
|
+
Scenario: Resize using no pronoun at all.
|
|
50
|
+
Given viewing the site on a lg screen
|
|
51
|
+
Then I see visible heading
|
|
52
|
+
|
|
53
|
+
# ---------------------------------------------------------------------------
|
|
54
|
+
# Position assertions — above / below / left / right / inside / outside.
|
|
55
|
+
# ---------------------------------------------------------------------------
|
|
56
|
+
Scenario: Assert heading is above list.
|
|
57
|
+
Then I see heading above list
|
|
58
|
+
|
|
59
|
+
Scenario: Assert heading is above multiple targets.
|
|
60
|
+
Then I see heading above subline, list
|
|
61
|
+
|
|
62
|
+
Scenario: Assert list is below heading.
|
|
63
|
+
Then I see list below heading
|
|
64
|
+
|
|
65
|
+
Scenario: Assert chained above relations.
|
|
66
|
+
Then I see heading above subline
|
|
67
|
+
Then I see subline above list
|
|
68
|
+
|
|
69
|
+
Scenario: Assert heading is inside of body component.
|
|
70
|
+
Given I define css selectors:
|
|
71
|
+
| body | body |
|
|
72
|
+
Then I see heading inside of body
|
|
73
|
+
|
|
74
|
+
Scenario: Assert body outside of heading.
|
|
75
|
+
Given I define css selectors:
|
|
76
|
+
| body | body |
|
|
77
|
+
Then I see body outside of heading
|
|
78
|
+
|
|
79
|
+
Scenario: Pronoun variants on position assertions.
|
|
80
|
+
Then we see heading above list
|
|
81
|
+
Then see heading above list
|
|
82
|
+
|
|
83
|
+
# ---------------------------------------------------------------------------
|
|
84
|
+
# Visibility + hidden.
|
|
85
|
+
# ---------------------------------------------------------------------------
|
|
86
|
+
Scenario: Assert single component visible.
|
|
87
|
+
Then I see visible heading
|
|
88
|
+
|
|
89
|
+
Scenario: Assert multiple components visible.
|
|
90
|
+
Then I see visible heading, subline and list
|
|
91
|
+
|
|
92
|
+
Scenario: Assert hidden (don't see) with missing components.
|
|
93
|
+
Given I define css selectors:
|
|
94
|
+
| missing | #does-not-exist |
|
|
95
|
+
Then I don't see missing
|
|
96
|
+
|
|
97
|
+
Scenario: Pronoun variants on visibility.
|
|
98
|
+
Then we see visible heading
|
|
99
|
+
Then see visible heading
|
|
100
|
+
|
|
101
|
+
# ---------------------------------------------------------------------------
|
|
102
|
+
# Advanced selector registry — CSS + XPath.
|
|
103
|
+
# ---------------------------------------------------------------------------
|
|
104
|
+
Scenario: Register a named CSS selector at runtime.
|
|
105
|
+
When I add "page heading" selector for "h1" css selector
|
|
106
|
+
Then I see visible page heading
|
|
107
|
+
|
|
108
|
+
Scenario: Register a named XPath selector at runtime.
|
|
109
|
+
When I add "first heading" selector for "//h1[1]" xpath selector
|
|
110
|
+
Then I see visible first heading
|
|
111
|
+
|
|
112
|
+
Scenario: Register multiple selectors and use mix of components, css, xpath.
|
|
113
|
+
When I add "page heading" selector for "h1" css selector
|
|
114
|
+
And I add "third level" selector for "//h3[1]" xpath selector
|
|
115
|
+
Then I see visible page heading
|
|
116
|
+
And I see visible third level
|
|
117
|
+
And I see page heading above list
|
|
118
|
+
|
|
119
|
+
Scenario: Print registered CSS selectors.
|
|
120
|
+
When I add "page heading" selector for "h1" css selector
|
|
121
|
+
Then I print css selectors
|
|
122
|
+
|
|
123
|
+
Scenario: Print registered XPath selectors.
|
|
124
|
+
When I add "first heading" selector for "//h1[1]" xpath selector
|
|
125
|
+
Then I print xpath selectors
|
|
126
|
+
|
|
127
|
+
Scenario: Pronoun variants on selector registration.
|
|
128
|
+
When we add "nav item" selector for "nav a" css selector
|
|
129
|
+
And add "first para" selector for "//p[1]" xpath selector
|
|
130
|
+
Then we print css selectors
|
|
131
|
+
And we print xpath selectors
|
|
132
|
+
|
|
133
|
+
Scenario: Bulk define CSS selectors via data table.
|
|
134
|
+
Given I define css selectors:
|
|
135
|
+
| bulk heading | h1 |
|
|
136
|
+
| bulk subline | h3 |
|
|
137
|
+
| bulk list | ul |
|
|
138
|
+
Then I see visible bulk heading, bulk subline, bulk list
|
|
139
|
+
And I see bulk heading above bulk list
|
|
140
|
+
|
|
141
|
+
Scenario: Bulk define XPath selectors via data table.
|
|
142
|
+
Given I define xpath selectors:
|
|
143
|
+
| xp heading | //h1[1] |
|
|
144
|
+
| xp subline | //h3[1] |
|
|
145
|
+
| xp list | //ul[1] |
|
|
146
|
+
Then I see visible xp heading, xp subline, xp list
|
|
147
|
+
And I see xp heading above xp list
|
|
148
|
+
|
|
149
|
+
Scenario: Mix bulk CSS + bulk XPath in one scenario.
|
|
150
|
+
Given I define css selectors:
|
|
151
|
+
| mixed heading | h1 |
|
|
152
|
+
And I define xpath selectors:
|
|
153
|
+
| mixed first list | //ul[1] |
|
|
154
|
+
Then I see mixed heading above mixed first list
|
|
155
|
+
|
|
156
|
+
# ---------------------------------------------------------------------------
|
|
157
|
+
# Focus and text selection on input fields.
|
|
158
|
+
# ---------------------------------------------------------------------------
|
|
159
|
+
Scenario: Move focus to a field and assert focus.
|
|
160
|
+
Given I am on "/test--when--i-fill-in.html"
|
|
161
|
+
And I add "username" selector for "[name='username']" css selector
|
|
162
|
+
When I move focus to "username" field
|
|
163
|
+
Then I see username has focus
|
|
164
|
+
|
|
165
|
+
Scenario: Select all text in a field.
|
|
166
|
+
Given I am on "/test--when--i-fill-in.html"
|
|
167
|
+
And I add "username" selector for "[name='username']" css selector
|
|
168
|
+
And I fill in "username" with "webship-tester"
|
|
169
|
+
When I select all text in "username" field
|
|
170
|
+
Then I see username has focus
|
|
171
|
+
|
|
172
|
+
Scenario: Select a character range in a field.
|
|
173
|
+
Given I am on "/test--when--i-fill-in.html"
|
|
174
|
+
And I fill in "username" with "webship-tester"
|
|
175
|
+
When I select from 0 to 7 text in "username" field
|
|
176
|
+
|
|
177
|
+
Scenario: Select a substring inside a field.
|
|
178
|
+
Given I am on "/test--when--i-fill-in.html"
|
|
179
|
+
And I fill in "username" with "webship-tester"
|
|
180
|
+
When I select "tester" text in "username" field
|
|
181
|
+
|
|
182
|
+
Scenario: Pronoun variants on focus + selection.
|
|
183
|
+
Given I am on "/test--when--i-fill-in.html"
|
|
184
|
+
And I fill in "username" with "webship-tester"
|
|
185
|
+
When we move focus to "username" field
|
|
186
|
+
And we select all text in "username" field
|
|
187
|
+
|
|
188
|
+
# ---------------------------------------------------------------------------
|
|
189
|
+
# Click by named component.
|
|
190
|
+
# ---------------------------------------------------------------------------
|
|
191
|
+
Scenario: Click a registered component.
|
|
192
|
+
Given I define css selectors:
|
|
193
|
+
| first heading | h1 |
|
|
194
|
+
When I click first heading
|
|
195
|
+
|
|
196
|
+
Scenario: Click using "on" phrasing.
|
|
197
|
+
Given I define css selectors:
|
|
198
|
+
| first heading | h1 |
|
|
199
|
+
When I click on first heading
|
|
200
|
+
|
|
201
|
+
Scenario: Click pronoun variants.
|
|
202
|
+
Given I define css selectors:
|
|
203
|
+
| first heading | h1 |
|
|
204
|
+
When we click first heading
|
|
205
|
+
And click on first heading
|
|
206
|
+
|
|
207
|
+
# ---------------------------------------------------------------------------
|
|
208
|
+
# Advanced — selector file loading (JSON).
|
|
209
|
+
# ---------------------------------------------------------------------------
|
|
210
|
+
Scenario: Load selectors from a single JSON file.
|
|
211
|
+
When I add selectors from "homepage-selectors.json" file
|
|
212
|
+
Then I see visible homepage heading
|
|
213
|
+
And I see visible homepage first heading
|
|
214
|
+
And I print css selectors
|
|
215
|
+
And I print xpath selectors
|
|
216
|
+
|
|
217
|
+
Scenario: Load selectors from two JSON files (front-end + back-end).
|
|
218
|
+
When I add selectors from "front-end-selectors.json" file
|
|
219
|
+
And I add selectors from "back-end-selectors.json" file
|
|
220
|
+
Then I see visible page heading, admin heading
|
|
221
|
+
And I see visible first heading, admin first heading
|
|
222
|
+
|
|
223
|
+
Scenario: Loaded file selectors mix with components and inline registrations.
|
|
224
|
+
When I add selectors from "homepage-selectors.json" file
|
|
225
|
+
And I add "inline heading" selector for "h1" css selector
|
|
226
|
+
And I add "inline first heading" selector for "//h1[1]" xpath selector
|
|
227
|
+
Then I see visible homepage heading
|
|
228
|
+
And I see visible inline heading
|
|
229
|
+
And I see visible inline first heading
|
|
230
|
+
And I see heading above list
|
|
231
|
+
And I see homepage heading above list
|
|
232
|
+
|
|
233
|
+
# ---------------------------------------------------------------------------
|
|
234
|
+
# Advanced — resolver priority (components → css → xpath) with overrides.
|
|
235
|
+
# ---------------------------------------------------------------------------
|
|
236
|
+
Scenario: Component overrides a CSS registration of the same name.
|
|
237
|
+
When I add "shared" selector for "ul" css selector
|
|
238
|
+
And I define css selectors:
|
|
239
|
+
| shared | h1 |
|
|
240
|
+
Then I see visible shared
|
|
241
|
+
And I see shared above list
|
|
242
|
+
|
|
243
|
+
Scenario: CSS registration overrides a prior CSS registration of same name.
|
|
244
|
+
When I add "dynamic" selector for "h1" css selector
|
|
245
|
+
And I add "dynamic" selector for "ul" css selector
|
|
246
|
+
Then I see visible dynamic
|
|
247
|
+
And I see heading above dynamic
|
|
248
|
+
|
|
249
|
+
Scenario: XPath-only registration resolves via xpath= prefix.
|
|
250
|
+
When I add "first subline xp" selector for "//h3[1]" xpath selector
|
|
251
|
+
Then I see visible first subline xp
|
|
252
|
+
|
|
253
|
+
# ---------------------------------------------------------------------------
|
|
254
|
+
# Advanced — multi-subject, multi-target position dispatch.
|
|
255
|
+
# ---------------------------------------------------------------------------
|
|
256
|
+
Scenario: Multiple subjects, single target (above).
|
|
257
|
+
Then I see heading, subline above list
|
|
258
|
+
|
|
259
|
+
Scenario: Single subject, multiple targets with "and" + comma.
|
|
260
|
+
Then I see heading above subline, list
|
|
261
|
+
|
|
262
|
+
Scenario: Chain of position assertions covers layout order.
|
|
263
|
+
Then I see heading above subline, list
|
|
264
|
+
And I see subline above list
|
|
265
|
+
And I see list below subline, heading
|
|
266
|
+
|
|
267
|
+
# ---------------------------------------------------------------------------
|
|
268
|
+
# Advanced — inside / outside containment.
|
|
269
|
+
# ---------------------------------------------------------------------------
|
|
270
|
+
Scenario: Heading and list both inside body.
|
|
271
|
+
Given I define css selectors:
|
|
272
|
+
| body | body |
|
|
273
|
+
Then I see heading, list inside of body
|
|
274
|
+
And I see body outside of heading, list
|
|
275
|
+
|
|
276
|
+
# ---------------------------------------------------------------------------
|
|
277
|
+
# Advanced — "not over" negation (non-overlap).
|
|
278
|
+
# ---------------------------------------------------------------------------
|
|
279
|
+
Scenario: Block-level neighbours do not overlap.
|
|
280
|
+
Then I see heading not over list
|
|
281
|
+
|
|
282
|
+
# ---------------------------------------------------------------------------
|
|
283
|
+
# Advanced — breakpoint resize then layout reassert.
|
|
284
|
+
# ---------------------------------------------------------------------------
|
|
285
|
+
Scenario: After switching to xs, layout order still holds.
|
|
286
|
+
Given I am viewing the site on a xs screen
|
|
287
|
+
Then I see visible heading, subline, list
|
|
288
|
+
And I see heading above list
|
|
289
|
+
|
|
290
|
+
Scenario: Switch through multiple breakpoints in one scenario.
|
|
291
|
+
Given I am viewing the site on a xs screen
|
|
292
|
+
Then I see visible heading
|
|
293
|
+
Given I am viewing the site on a md screen
|
|
294
|
+
Then I see visible heading
|
|
295
|
+
Given I am viewing the site on a xl screen
|
|
296
|
+
Then I see visible heading
|
|
297
|
+
And I see heading above list
|
|
298
|
+
Given I am viewing the site on a xxxl screen
|
|
299
|
+
Then I see visible heading
|
|
300
|
+
|
|
301
|
+
# ---------------------------------------------------------------------------
|
|
302
|
+
# Advanced — click via xpath-registered selector.
|
|
303
|
+
# ---------------------------------------------------------------------------
|
|
304
|
+
Scenario: Click via an XPath-registered selector.
|
|
305
|
+
When I add "first heading xp" selector for "//h1[1]" xpath selector
|
|
306
|
+
And I click first heading xp
|
|
307
|
+
|
|
308
|
+
# ---------------------------------------------------------------------------
|
|
309
|
+
# Advanced — full input-field workflow (focus → select → re-fill).
|
|
310
|
+
# ---------------------------------------------------------------------------
|
|
311
|
+
Scenario: End-to-end field workflow — focus, select all, refill, partial select.
|
|
312
|
+
Given I am on "/test--when--i-fill-in.html"
|
|
313
|
+
And I add "username" selector for "[name='username']" css selector
|
|
314
|
+
And I fill in "username" with "webship-initial"
|
|
315
|
+
When I move focus to "username" field
|
|
316
|
+
Then I see username has focus
|
|
317
|
+
When I select all text in "username" field
|
|
318
|
+
And I fill in "username" with "webship-replacement-value"
|
|
319
|
+
And I select from 0 to 7 text in "username" field
|
|
320
|
+
And I select "replacement" text in "username" field
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
Feature: Assert the exact number of elements matching a selector
|
|
2
|
+
As a tester,
|
|
3
|
+
I want to assert how many elements match a CSS selector
|
|
4
|
+
so that I can catch regressions in list lengths, card counts, and nav items.
|
|
5
|
+
|
|
6
|
+
Scenario: Count h1 headings on the homepage
|
|
7
|
+
Given I am on homepage
|
|
8
|
+
Then I should see 1 "h1" element
|
|
9
|
+
|
|
10
|
+
Scenario: Count list items inside the first list on the homepage
|
|
11
|
+
Given I am on homepage
|
|
12
|
+
Then I should see 13 "ul:first-of-type li" elements
|
|
13
|
+
|
|
14
|
+
Scenario: Expect zero matches for a missing selector
|
|
15
|
+
Given I am on homepage
|
|
16
|
+
Then I should see 0 ".does-not-exist" elements
|
|
17
|
+
|
|
18
|
+
Scenario: Pronoun variant — "we"
|
|
19
|
+
Given I am on homepage
|
|
20
|
+
Then we should see 1 "h1" element
|
|
21
|
+
|
|
22
|
+
Scenario: No pronoun
|
|
23
|
+
Given I am on homepage
|
|
24
|
+
Then should see 1 "h1" element
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
Feature: Debug helpers — print current URL and last response HTML
|
|
2
|
+
As a tester,
|
|
3
|
+
I want to dump the current URL and page HTML to the console
|
|
4
|
+
so that I can diagnose failures without attaching a debugger.
|
|
5
|
+
|
|
6
|
+
Scenario: Print current URL
|
|
7
|
+
Given I am on homepage
|
|
8
|
+
Then print current URL
|
|
9
|
+
|
|
10
|
+
Scenario: Print last response HTML
|
|
11
|
+
Given I am on homepage
|
|
12
|
+
Then print last response
|
|
13
|
+
|
|
14
|
+
Scenario: Print both in the same scenario
|
|
15
|
+
Given I am on homepage
|
|
16
|
+
Then print current URL
|
|
17
|
+
And print last response
|
|
18
|
+
|
|
19
|
+
Scenario: Print current URL after navigating
|
|
20
|
+
Given I am on "/about-us.html"
|
|
21
|
+
Then print current URL
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
Feature: Add an option to a multi-select without clearing existing selection
|
|
2
|
+
As a tester,
|
|
3
|
+
I want to build up a multi-select selection across multiple steps
|
|
4
|
+
so that I can test <select multiple> workflows one option at a time.
|
|
5
|
+
|
|
6
|
+
Scenario: Add two colors to an empty Colors multi-select
|
|
7
|
+
Given I am on "/test--when--i-additionally-select.html"
|
|
8
|
+
When I additionally select "Red" from "Colors"
|
|
9
|
+
And I additionally select "Blue" from "Colors"
|
|
10
|
+
|
|
11
|
+
Scenario: Start with one, then add two more
|
|
12
|
+
Given I am on "/test--when--i-additionally-select.html"
|
|
13
|
+
When I select "Red" from "Colors"
|
|
14
|
+
And I additionally select "Blue" from "Colors"
|
|
15
|
+
And I additionally select "Green" from "Colors"
|
|
16
|
+
|
|
17
|
+
Scenario: Pronoun variant — "we"
|
|
18
|
+
Given I am on "/test--when--i-additionally-select.html"
|
|
19
|
+
When we additionally select "Red" from "Colors"
|
|
20
|
+
And we additionally select "Yellow" from "Colors"
|
|
21
|
+
|
|
22
|
+
Scenario: No pronoun
|
|
23
|
+
Given I am on "/test--when--i-additionally-select.html"
|
|
24
|
+
When additionally select "Admin" from "Roles"
|
|
25
|
+
And additionally select "Editor" from "Roles"
|
|
26
|
+
|
|
27
|
+
Scenario: Multi-select on a second select on the same page
|
|
28
|
+
Given I am on "/test--when--i-additionally-select.html"
|
|
29
|
+
When I additionally select "Admin" from "Roles"
|
|
30
|
+
And I additionally select "Viewer" from "Roles"
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
Feature: Follow a link by its visible text
|
|
2
|
+
As a tester,
|
|
3
|
+
I want to follow a link by its visible anchor text
|
|
4
|
+
so that scenarios read like a user journey.
|
|
5
|
+
|
|
6
|
+
Scenario: Follow a link by its visible text
|
|
7
|
+
Given I am on "/test--when--i-click-link.html"
|
|
8
|
+
When I follow "About us link"
|
|
9
|
+
And I wait max of 2 seconds
|
|
10
|
+
Then I should see "About Us"
|
|
11
|
+
|
|
12
|
+
Scenario: Follow a link using the "we" pronoun
|
|
13
|
+
Given I am on "/test--when--i-click-link.html"
|
|
14
|
+
When we follow "About us link"
|
|
15
|
+
And I wait max of 2 seconds
|
|
16
|
+
Then I should see "About Us"
|
|
17
|
+
|
|
18
|
+
Scenario: Follow a link with no pronoun
|
|
19
|
+
Given I am on "/test--when--i-click-link.html"
|
|
20
|
+
When follow "About us link"
|
|
21
|
+
And I wait max of 2 seconds
|
|
22
|
+
Then I should see "About Us"
|
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
Feature: YAML response assertions
|
|
2
|
+
|
|
3
|
+
Scenario: Existence, equality, contains, count
|
|
4
|
+
Given the YAML response content is the following:
|
|
5
|
+
"""
|
|
6
|
+
apiVersion: apps/v1
|
|
7
|
+
kind: Deployment
|
|
8
|
+
metadata:
|
|
9
|
+
name: web
|
|
10
|
+
labels:
|
|
11
|
+
app: web
|
|
12
|
+
team: platform
|
|
13
|
+
spec:
|
|
14
|
+
replicas: 3
|
|
15
|
+
containers:
|
|
16
|
+
- name: nginx
|
|
17
|
+
image: nginx:1.25
|
|
18
|
+
- name: api
|
|
19
|
+
image: myapp:1.0
|
|
20
|
+
"""
|
|
21
|
+
Then the response should be in YAML format
|
|
22
|
+
And the YAML should have no duplicate keys
|
|
23
|
+
And the YAML element "/kind" should exist
|
|
24
|
+
And the YAML element "/spec/replicas" should be equal to "3"
|
|
25
|
+
And the YAML element "/metadata/name" should contain "we"
|
|
26
|
+
And the YAML element "/spec/containers" should have 2 elements
|
|
27
|
+
And the YAML attribute "kind" on element "/" should exist
|
|
28
|
+
And the YAML attribute "kind" on element "/" should be equal to "Deployment"
|
|
29
|
+
|
|
30
|
+
Scenario: Type and emptiness assertions
|
|
31
|
+
Given the YAML response content is the following:
|
|
32
|
+
"""
|
|
33
|
+
replicas: 3
|
|
34
|
+
name: web
|
|
35
|
+
paused: false
|
|
36
|
+
tags: []
|
|
37
|
+
meta: {}
|
|
38
|
+
notes: null
|
|
39
|
+
"""
|
|
40
|
+
Then the YAML value at "/replicas" should be of type "integer"
|
|
41
|
+
And the YAML value at "/name" should be of type "string"
|
|
42
|
+
And the YAML value at "/paused" should be of type "boolean"
|
|
43
|
+
And the YAML value at "/tags" should be of type "array"
|
|
44
|
+
And the YAML value at "/meta" should be of type "object"
|
|
45
|
+
And the YAML value at "/notes" should be of type "null"
|
|
46
|
+
And the YAML value at "/tags" should be empty
|
|
47
|
+
And the YAML value at "/meta" should be empty
|
|
48
|
+
And the YAML value at "/name" should not be empty
|
|
49
|
+
|
|
50
|
+
Scenario: Numeric comparisons
|
|
51
|
+
Given the YAML response content is the following:
|
|
52
|
+
"""
|
|
53
|
+
spec:
|
|
54
|
+
replicas: 5
|
|
55
|
+
timeout: 30
|
|
56
|
+
"""
|
|
57
|
+
Then the YAML value at "/spec/replicas" should be greater than 0
|
|
58
|
+
And the YAML value at "/spec/replicas" should be greater than or equal to 5
|
|
59
|
+
And the YAML value at "/spec/replicas" should be less than 10
|
|
60
|
+
And the YAML value at "/spec/replicas" should be less than or equal to 5
|
|
61
|
+
And the YAML value at "/timeout" should be between 5 and 60
|
|
62
|
+
|
|
63
|
+
Scenario: Array operations
|
|
64
|
+
Given the YAML response content is the following:
|
|
65
|
+
"""
|
|
66
|
+
spec:
|
|
67
|
+
containers:
|
|
68
|
+
- name: nginx
|
|
69
|
+
image: nginx:1.25
|
|
70
|
+
- name: api
|
|
71
|
+
image: myapp:1.0
|
|
72
|
+
"""
|
|
73
|
+
Then the YAML array at "/spec/containers" should contain an item where "/name" is "nginx"
|
|
74
|
+
And the YAML array at "/spec/containers" should contain no item where "/image" is "alpine:latest"
|
|
75
|
+
And every item in "/spec/containers" should have key "image"
|
|
76
|
+
|
|
77
|
+
Scenario: Key-set assertions
|
|
78
|
+
Given the YAML response content is the following:
|
|
79
|
+
"""
|
|
80
|
+
metadata:
|
|
81
|
+
name: web
|
|
82
|
+
namespace: default
|
|
83
|
+
labels:
|
|
84
|
+
app: web
|
|
85
|
+
"""
|
|
86
|
+
Then the YAML keys at "/metadata" should be exactly "name, namespace, labels"
|
|
87
|
+
And the YAML at "/metadata" should have keys "name, namespace"
|
|
88
|
+
|
|
89
|
+
Scenario: Multi-document streams
|
|
90
|
+
Given the YAML response content is the following:
|
|
91
|
+
"""
|
|
92
|
+
apiVersion: v1
|
|
93
|
+
kind: ConfigMap
|
|
94
|
+
---
|
|
95
|
+
apiVersion: v1
|
|
96
|
+
kind: Service
|
|
97
|
+
"""
|
|
98
|
+
Then the YAML response should have 2 documents
|
|
99
|
+
And the YAML element "/kind" should be equal to "ConfigMap"
|
|
100
|
+
Given the active YAML document is 2
|
|
101
|
+
Then the YAML element "/kind" should be equal to "Service"
|
|
102
|
+
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
# tests/reports
|
|
2
|
+
|
|
3
|
+
Generated test artefacts land here. Everything in this directory **except this
|
|
4
|
+
README** is gitignored — these files are produced fresh on every run.
|
|
5
|
+
|
|
6
|
+
## What gets written
|
|
7
|
+
|
|
8
|
+
| File | Producer | When |
|
|
9
|
+
| --- | --- | --- |
|
|
10
|
+
| `cucumber_report.json` | `cucumber-js` (default `format` in `cucumber.js`) | Every run |
|
|
11
|
+
| `cucumber_report.html` | `cucumber-html-reporter` (auto-invoked at run end) | Every run |
|
|
12
|
+
| `cucumber_report.pdf` | `bin/generate-reports.js --format pdf` | On demand |
|
|
13
|
+
|
|
14
|
+
Override paths with env vars:
|
|
15
|
+
|
|
16
|
+
| Variable | Default | Effect |
|
|
17
|
+
| --- | --- | --- |
|
|
18
|
+
| `WEBSHIP_REPORT_JSON` | `tests/reports/cucumber_report.json` | JSON output path |
|
|
19
|
+
| `WEBSHIP_REPORT_OUT` | `tests/reports/cucumber_report.html` | HTML output path |
|
|
20
|
+
| `WEBSHIP_REPORT_DISABLE` | _unset_ | `1` to skip HTML generation |
|
|
21
|
+
| `WEBSHIP_REPORT_THEME` | `bootstrap` | `bootstrap` / `hierarchy` / `foundation` / `simple` |
|
|
22
|
+
| `WEBSHIP_REPORT_TITLE` | `Test Report` | Brand title in the HTML header |
|
|
23
|
+
| `WEBSHIP_REPORT_APP_VERSION` | `2.0.0` | Metadata field |
|
|
24
|
+
| `WEBSHIP_REPORT_ENV` | `development` | Test-environment metadata |
|
|
25
|
+
| `WEBSHIP_REPORT_EXECUTED` | `Remote` | Execution location metadata |
|
|
26
|
+
|
|
27
|
+
## Regenerate manually
|
|
28
|
+
|
|
29
|
+
```bash
|
|
30
|
+
# HTML only (re-uses the JSON from the last run)
|
|
31
|
+
npx generate-reports
|
|
32
|
+
|
|
33
|
+
# HTML + PDF in one shot
|
|
34
|
+
npx generate-reports --format all
|
|
35
|
+
|
|
36
|
+
# PDF only — Letter, landscape, slim margin
|
|
37
|
+
npx generate-reports --format pdf --pdf-format Letter --pdf-landscape --pdf-margin 10mm
|
|
38
|
+
|
|
39
|
+
# Branded PDF with header / footer
|
|
40
|
+
npx generate-reports --format pdf \
|
|
41
|
+
--pdf-header '<div style="font-size:10px;width:100%;text-align:center;">Q3 Regression</div>' \
|
|
42
|
+
--pdf-footer '<div style="font-size:10px;width:100%;text-align:center;"><span class="pageNumber"></span>/<span class="totalPages"></span></div>'
|
|
43
|
+
|
|
44
|
+
# Full help
|
|
45
|
+
npx generate-reports --help
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
## Why these files are ignored
|
|
49
|
+
|
|
50
|
+
* They change on every run — committing them creates noise and merge conflicts.
|
|
51
|
+
* They are large (HTML ~3 MB, PDF ~5 MB on the full suite).
|
|
52
|
+
* They contain timestamps and per-machine metadata that vary by author.
|
|
53
|
+
|
|
54
|
+
If you need to share a report, attach the file to a PR / issue or upload to
|
|
55
|
+
your CI artefact store rather than committing it.
|