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,52 @@
|
|
|
1
|
+
<!DOCTYPE html>
|
|
2
|
+
<html lang="en">
|
|
3
|
+
<head>
|
|
4
|
+
<meta charset="utf-8" />
|
|
5
|
+
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
|
6
|
+
<title>Diffy examples — Webship-JS</title>
|
|
7
|
+
<style>
|
|
8
|
+
body { font-family: system-ui, sans-serif; margin: 0; color: #222; }
|
|
9
|
+
header { background: #0f172a; color: #fff; padding: 24px 32px; }
|
|
10
|
+
header h1 { margin: 0; font-size: 26px; }
|
|
11
|
+
main { padding: 32px; max-width: 820px; margin: 0 auto; }
|
|
12
|
+
.pair { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
|
|
13
|
+
.pair a {
|
|
14
|
+
display: block; padding: 20px; border-radius: 8px;
|
|
15
|
+
text-decoration: none; color: #fff;
|
|
16
|
+
}
|
|
17
|
+
.pair a.base { background: #1e40af; }
|
|
18
|
+
.pair a.changed { background: #b91c1c; }
|
|
19
|
+
.pair h2 { margin: 0 0 8px 0; }
|
|
20
|
+
.pair small { opacity: 0.85; }
|
|
21
|
+
p { line-height: 1.5; }
|
|
22
|
+
code { background: #f3f4f6; padding: 2px 6px; border-radius: 4px; }
|
|
23
|
+
footer { background: #f3f4f6; padding: 14px 32px; color: #6b7280; font-size: 14px; }
|
|
24
|
+
a.back { color: #1e40af; }
|
|
25
|
+
</style>
|
|
26
|
+
</head>
|
|
27
|
+
<body>
|
|
28
|
+
<header>
|
|
29
|
+
<h1>Webship-JS — Diffy visual-regression examples</h1>
|
|
30
|
+
</header>
|
|
31
|
+
<main>
|
|
32
|
+
<p><a class="back" href="/">← Back to examples index</a></p>
|
|
33
|
+
<p>
|
|
34
|
+
Two deliberately different pages. Run
|
|
35
|
+
<code>npx cucumber-js --config cucumber.js -p diffy</code>
|
|
36
|
+
(against a mock or real Diffy API) to capture screenshots of both pages
|
|
37
|
+
at each breakpoint and request a comparison.
|
|
38
|
+
</p>
|
|
39
|
+
<div class="pair">
|
|
40
|
+
<a class="base" href="baseline.html">
|
|
41
|
+
<h2>Baseline</h2>
|
|
42
|
+
<small>Reference snapshot — blue palette, rect CTA, $19/mo</small>
|
|
43
|
+
</a>
|
|
44
|
+
<a class="changed" href="changed.html">
|
|
45
|
+
<h2>Changed</h2>
|
|
46
|
+
<small>Visible regressions — red palette, NEW badge, pill CTA, $29/mo, added Testimonials</small>
|
|
47
|
+
</a>
|
|
48
|
+
</div>
|
|
49
|
+
</main>
|
|
50
|
+
<footer>© 2026 Webship-JS Diffy examples</footer>
|
|
51
|
+
</body>
|
|
52
|
+
</html>
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
<!DOCTYPE html>
|
|
2
|
+
<html><head><title>Element Demo</title></head>
|
|
3
|
+
<body>
|
|
4
|
+
<h1 id="title" data-test="hero">Welcome</h1>
|
|
5
|
+
<p class="lead" data-role="intro">First paragraph</p>
|
|
6
|
+
<p class="lead" data-role="outro">Second paragraph</p>
|
|
7
|
+
<div id="hidden" style="display:none">hidden text</div>
|
|
8
|
+
<div id="centered" style="margin:0 auto;width:200px">center</div>
|
|
9
|
+
<button id="btn" onclick="document.getElementById('msg').textContent='clicked'">Click Me</button>
|
|
10
|
+
<span id="msg"></span>
|
|
11
|
+
</body></html>
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
<!DOCTYPE html>
|
|
2
|
+
<html><head><title>Field Demo</title></head>
|
|
3
|
+
<body>
|
|
4
|
+
<form id="f">
|
|
5
|
+
<label for="username">Username</label>
|
|
6
|
+
<input id="username" name="username" type="text" required />
|
|
7
|
+
|
|
8
|
+
<label for="bio">Bio</label>
|
|
9
|
+
<textarea id="bio" name="bio"></textarea>
|
|
10
|
+
|
|
11
|
+
<label for="role">Role</label>
|
|
12
|
+
<select id="role" name="role">
|
|
13
|
+
<option value="">--</option>
|
|
14
|
+
<option value="admin">Admin</option>
|
|
15
|
+
<option value="user">User</option>
|
|
16
|
+
</select>
|
|
17
|
+
|
|
18
|
+
<label><input type="checkbox" id="agree" name="agree" /> Agree</label>
|
|
19
|
+
<label><input type="radio" name="color" value="red" id="r-red"/> Red</label>
|
|
20
|
+
<label><input type="radio" name="color" value="blue" id="r-blue"/> Blue</label>
|
|
21
|
+
|
|
22
|
+
<input type="color" id="fav" name="fav" value="#000000" />
|
|
23
|
+
</form>
|
|
24
|
+
</body></html>
|
package/examples/index.html
CHANGED
|
@@ -27,5 +27,11 @@
|
|
|
27
27
|
<li><a href="test--when-i-wait-max-of-time.html">When I Wait a Maximum of Time</a></li>
|
|
28
28
|
<li><a href="test--modal-dialogs.html">Modal Dialog Interactions</a></li>
|
|
29
29
|
</ul>
|
|
30
|
+
<h3>Diffy visual-regression examples</h3>
|
|
31
|
+
<ul>
|
|
32
|
+
<li><a href="diffy/index.html">Diffy — examples index</a></li>
|
|
33
|
+
<li><a href="diffy/baseline.html">Diffy — Baseline page</a></li>
|
|
34
|
+
<li><a href="diffy/changed.html">Diffy — Changed page (visible regressions)</a></li>
|
|
35
|
+
</ul>
|
|
30
36
|
</body>
|
|
31
37
|
</html>
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
<!DOCTYPE html>
|
|
2
|
+
<html><head><title>Keyboard</title></head>
|
|
3
|
+
<body>
|
|
4
|
+
<input id="inp" />
|
|
5
|
+
<span id="last"></span>
|
|
6
|
+
<script>
|
|
7
|
+
document.getElementById('inp').addEventListener('keydown', (e) => {
|
|
8
|
+
document.getElementById('last').textContent = e.key;
|
|
9
|
+
});
|
|
10
|
+
</script>
|
|
11
|
+
</body></html>
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
<!DOCTYPE html>
|
|
2
|
+
<html><head><title>Modal Demo</title>
|
|
3
|
+
<style>
|
|
4
|
+
.modal { display: none; position: fixed; top: 20%; left: 30%; padding: 20px; background: #fff; border: 1px solid #ccc; }
|
|
5
|
+
.modal.show { display: block; }
|
|
6
|
+
</style>
|
|
7
|
+
</head>
|
|
8
|
+
<body>
|
|
9
|
+
<button id="open" onclick="document.getElementById('m').classList.add('show')">Open</button>
|
|
10
|
+
<div id="m" class="modal" role="dialog" aria-label="Welcome dialog">
|
|
11
|
+
<p>Welcome modal text</p>
|
|
12
|
+
<button id="close-btn" class="close" aria-label="Close" onclick="document.getElementById('m').classList.remove('show')">X</button>
|
|
13
|
+
</div>
|
|
14
|
+
</body></html>
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
<!DOCTYPE html>
|
|
2
|
+
<html><head><title>Tables</title></head>
|
|
3
|
+
<body>
|
|
4
|
+
<table id="users">
|
|
5
|
+
<thead><tr><th>Name</th><th>Role</th><th>Status</th></tr></thead>
|
|
6
|
+
<tbody>
|
|
7
|
+
<tr><td>Alice</td><td>Admin</td><td>Active</td></tr>
|
|
8
|
+
<tr><td>Bob</td><td>User</td><td>Active</td></tr>
|
|
9
|
+
<tr><td>Carol</td><td>User</td><td>Pending</td></tr>
|
|
10
|
+
</tbody>
|
|
11
|
+
</table>
|
|
12
|
+
<table id="empty"><thead><tr><th>X</th></tr></thead><tbody></tbody></table>
|
|
13
|
+
</body></html>
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
<!DOCTYPE html>
|
|
2
|
+
<html>
|
|
3
|
+
<head>
|
|
4
|
+
<meta charset='utf-8'>
|
|
5
|
+
<title>Multi Select</title>
|
|
6
|
+
</head>
|
|
7
|
+
<body>
|
|
8
|
+
<h1>Multi Select</h1>
|
|
9
|
+
|
|
10
|
+
<label for="Colors">Colors:</label>
|
|
11
|
+
<select name="Colors" id="Colors" multiple size="5">
|
|
12
|
+
<option value="red">Red</option>
|
|
13
|
+
<option value="blue">Blue</option>
|
|
14
|
+
<option value="green">Green</option>
|
|
15
|
+
<option value="yellow">Yellow</option>
|
|
16
|
+
<option value="black">Black</option>
|
|
17
|
+
</select>
|
|
18
|
+
|
|
19
|
+
<label for="Roles">Roles:</label>
|
|
20
|
+
<select name="Roles" id="Roles" multiple size="4">
|
|
21
|
+
<option value="admin">Admin</option>
|
|
22
|
+
<option value="editor">Editor</option>
|
|
23
|
+
<option value="viewer">Viewer</option>
|
|
24
|
+
<option value="guest">Guest</option>
|
|
25
|
+
</select>
|
|
26
|
+
</body>
|
|
27
|
+
</html>
|
package/package.json
CHANGED
|
@@ -1,8 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "webship-js",
|
|
3
|
-
"version": "2.0.
|
|
3
|
+
"version": "2.0.3",
|
|
4
4
|
"description": "Webship JS automated functional testing.",
|
|
5
5
|
"main": "index.js",
|
|
6
|
+
"bin": {
|
|
7
|
+
"init-webship-js": "./bin/init-webship.js",
|
|
8
|
+
"generate-reports": "./bin/generate-reports.js"
|
|
9
|
+
},
|
|
6
10
|
"directories": {
|
|
7
11
|
"test": "test"
|
|
8
12
|
},
|
|
@@ -11,9 +15,13 @@
|
|
|
11
15
|
},
|
|
12
16
|
"scripts": {
|
|
13
17
|
"postinstall": "node ./bin/postinstall.js",
|
|
14
|
-
"test": "cucumber-js --config cucumber.js
|
|
15
|
-
"test:
|
|
16
|
-
"test:
|
|
18
|
+
"test": "cucumber-js --config cucumber.js",
|
|
19
|
+
"test:chromium": "BROWSER=chromium cucumber-js --config cucumber.js",
|
|
20
|
+
"test:firefox": "BROWSER=firefox cucumber-js --config cucumber.js",
|
|
21
|
+
"test:webkit": "BROWSER=webkit cucumber-js --config cucumber.js",
|
|
22
|
+
"test:headed": "HEADLESS=false cucumber-js --config cucumber.js",
|
|
23
|
+
"test:fast": "SLOW_MO=0 cucumber-js --config cucumber.js",
|
|
24
|
+
"generate-reports": "node ./bin/generate-reports.js",
|
|
17
25
|
"start": "http-server examples -p 8080 -s"
|
|
18
26
|
},
|
|
19
27
|
"repository": {
|
|
@@ -27,14 +35,19 @@
|
|
|
27
35
|
},
|
|
28
36
|
"homepage": "https://github.com/webship/webship-js",
|
|
29
37
|
"dependencies": {
|
|
38
|
+
"@axe-core/playwright": "^4.11.3",
|
|
30
39
|
"@cucumber/cucumber": "*",
|
|
31
40
|
"@cucumber/pretty-formatter": "~1",
|
|
41
|
+
"@types/node": "~20",
|
|
42
|
+
"ajv": "^8.20.0",
|
|
43
|
+
"ajv-formats": "^3.0.1",
|
|
44
|
+
"axe-core": "^4.11.4",
|
|
32
45
|
"axios": "~1",
|
|
33
46
|
"cucumber-html-reporter": "^6.0.0",
|
|
34
47
|
"http-server": "^14.1.1",
|
|
48
|
+
"js-yaml": "^4.1.1",
|
|
35
49
|
"playwright": "^1.58.2",
|
|
36
|
-
"
|
|
37
|
-
"ts-node": "~10",
|
|
50
|
+
"tsx": "^4.19.2",
|
|
38
51
|
"typescript": "~5"
|
|
39
52
|
}
|
|
40
53
|
}
|
package/playwright.config.ts
CHANGED
|
@@ -25,8 +25,9 @@ interface PlaywrightConfig {
|
|
|
25
25
|
const config: PlaywrightConfig = {
|
|
26
26
|
browser,
|
|
27
27
|
launchOptions: {
|
|
28
|
-
headless:
|
|
29
|
-
|
|
28
|
+
headless: process.env.HEADLESS !== 'false',
|
|
29
|
+
// SLOW_MO env var: 0 in CI for speed, 800ms when watching headed runs.
|
|
30
|
+
slowMo: parseInt(process.env.SLOW_MO || (process.env.HEADLESS === 'false' ? '800' : '300'), 10),
|
|
30
31
|
args: browser === 'chromium' ? chromiumArgs : [],
|
|
31
32
|
},
|
|
32
33
|
contextOptions: {
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
Feature: Accessibility (a11y) smoke checks
|
|
2
|
+
|
|
3
|
+
Scenario: Page-level landmarks and language
|
|
4
|
+
Given I am on "/a11y.html"
|
|
5
|
+
Then the page should declare a language
|
|
6
|
+
And the page language should be "en"
|
|
7
|
+
And the page should have a main landmark
|
|
8
|
+
And the page should have a navigation landmark
|
|
9
|
+
And the page should have exactly one h1
|
|
10
|
+
|
|
11
|
+
Scenario: Image alt text and form labels
|
|
12
|
+
Given I am on "/a11y.html"
|
|
13
|
+
Then every image should have an alt attribute
|
|
14
|
+
And every form field should have an accessible label
|
|
15
|
+
|
|
16
|
+
Scenario: Focused element assertions
|
|
17
|
+
Given I am on "/a11y.html"
|
|
18
|
+
When I focus on the element "#email"
|
|
19
|
+
Then the focused element should match "#email"
|
|
20
|
+
And the focused element should be labeled "Email"
|
|
21
|
+
|
|
22
|
+
Scenario: WCAG hygiene checks (custom probes)
|
|
23
|
+
Given I am on "/a11y.html"
|
|
24
|
+
Then the page should have a title
|
|
25
|
+
And user zoom should be allowed
|
|
26
|
+
And the heading hierarchy should be valid
|
|
27
|
+
And every button should have an accessible name
|
|
28
|
+
And every link should have an accessible name
|
|
29
|
+
And no element should have a positive tabindex
|
|
30
|
+
And every ARIA reference should resolve
|
|
31
|
+
And every ARIA role should be valid
|
|
32
|
+
And required fields should be consistently marked
|
|
33
|
+
|
|
34
|
+
Scenario: axe-core full WCAG audit
|
|
35
|
+
Given I am on "/a11y.html"
|
|
36
|
+
Then the page should have no critical accessibility violations
|
|
37
|
+
And the page should not violate the accessibility rule "image-alt"
|
|
38
|
+
And the page should not violate the accessibility rule "label"
|
|
39
|
+
And the page should pass the accessibility rules "image-alt, label, button-name"
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
Feature: Cookie step definitions
|
|
2
|
+
|
|
3
|
+
Scenario: Cookie existence and value matching
|
|
4
|
+
Given I am on "/cookies.html"
|
|
5
|
+
Then a cookie with the name "session_id" should exist
|
|
6
|
+
And a cookie with the name "session_id" and the value "abc123" should exist
|
|
7
|
+
And a cookie with the name "preferences" and a value containing "darkmode" should exist
|
|
8
|
+
And a cookie with a name containing "session" should exist
|
|
9
|
+
And a cookie with a name containing "pref" and a value containing "darkmode" should exist
|
|
10
|
+
And a cookie with the name "missing" should not exist
|
|
11
|
+
And a cookie with the name "language" and the value "fr" should not exist
|
|
12
|
+
And a cookie with the name "preferences" and a value containing "lightmode" should not exist
|
|
13
|
+
And a cookie with a name containing "old" should not exist
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
Feature: Relative date token resolution
|
|
2
|
+
|
|
3
|
+
Tokens of the form [relative:OFFSET] and [relative:OFFSET#FORMAT]
|
|
4
|
+
are resolved before the step runs. OFFSET supports "+N unit", "-N unit",
|
|
5
|
+
"now", and "next/last <weekday>". Without FORMAT the value is a Unix
|
|
6
|
+
timestamp; with FORMAT it is rendered using YYYY/MM/DD/HH/mm/ss tokens.
|
|
7
|
+
|
|
8
|
+
Scenario: Resolve relative date tokens in step text
|
|
9
|
+
Given I am on "/date.html"
|
|
10
|
+
Then I should see "[relative:now#YYYY]"
|
|
11
|
+
And I should see "[relative:now#MM]"
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
Feature: Diffy — example pages demo
|
|
2
|
+
Drive the bundled /diffy/baseline.html and /diffy/changed.html example
|
|
3
|
+
pages through the Diffy capture + comparison flow. Safe to run against
|
|
4
|
+
the mock Diffy API for local development.
|
|
5
|
+
|
|
6
|
+
Config resolution (per-scenario):
|
|
7
|
+
1. process.env.DIFFY_*
|
|
8
|
+
2. cucumber.js worldParameters.diffy.*
|
|
9
|
+
3. built-in defaults
|
|
10
|
+
|
|
11
|
+
@diffy @example
|
|
12
|
+
Scenario: Capture baseline and changed, send to diffy, compare
|
|
13
|
+
Given I am on "/diffy/baseline.html"
|
|
14
|
+
Then I take screenshots for all breakpoints
|
|
15
|
+
Then send screenshots to diffy with name "example-baseline"
|
|
16
|
+
|
|
17
|
+
Given I am on "/diffy/changed.html"
|
|
18
|
+
Then I take screenshots for all breakpoints
|
|
19
|
+
Then send screenshots to diffy with name "example-changed"
|
|
20
|
+
|
|
21
|
+
Then create diffy comparison with name "example-demo"
|
|
22
|
+
Then wait for diffy comparison to complete
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
Feature: Diffy — all step definitions smoke test
|
|
2
|
+
Exercise every Diffy step at least once against the example pages.
|
|
3
|
+
Intended for mock-Diffy runs (some steps require specific Diffy plan
|
|
4
|
+
features and may fail against production with a valid key).
|
|
5
|
+
|
|
6
|
+
@diffy @smoke
|
|
7
|
+
Scenario: Resize, take screenshot, breakpoints loop, send
|
|
8
|
+
Given I am on "/diffy/baseline.html"
|
|
9
|
+
When I resize window to "640"
|
|
10
|
+
Then I take screenshot
|
|
11
|
+
Given I am on "/diffy/changed.html"
|
|
12
|
+
Then I take screenshots for all breakpoints
|
|
13
|
+
Then send screenshots to diffy with name "smoke-set-1"
|
|
14
|
+
|
|
15
|
+
Given I am on "/diffy/baseline.html"
|
|
16
|
+
Then I take screenshots for all breakpoints
|
|
17
|
+
Then send screenshots to diffy with name "smoke-set-2"
|
|
18
|
+
|
|
19
|
+
Then create diffy comparison
|
|
20
|
+
Then wait for diffy comparison to complete
|
|
21
|
+
|
|
22
|
+
@diffy @smoke @named-compare
|
|
23
|
+
Scenario: Named comparison variant
|
|
24
|
+
Given I am on "/diffy/baseline.html"
|
|
25
|
+
Then I take screenshots for all breakpoints
|
|
26
|
+
Then send screenshots to diffy with name "smoke-named-a"
|
|
27
|
+
|
|
28
|
+
Given I am on "/diffy/changed.html"
|
|
29
|
+
Then I take screenshots for all breakpoints
|
|
30
|
+
Then send screenshots to diffy with name "smoke-named-b"
|
|
31
|
+
|
|
32
|
+
Then create diffy comparison with name "PR-smoke"
|
|
33
|
+
Then wait for diffy comparison to complete
|
|
34
|
+
|
|
35
|
+
@diffy @smoke @env-compare
|
|
36
|
+
Scenario: Server-side environment compare
|
|
37
|
+
Then compare diffy "prod" with "stage"
|
|
38
|
+
Then wait for diffy comparison to complete
|
|
39
|
+
|
|
40
|
+
@diffy @smoke @env-screenshot
|
|
41
|
+
Scenario: Trigger Diffy-side screenshot run per environment
|
|
42
|
+
Then create diffy screenshot from "production" environment
|
|
43
|
+
Then create diffy screenshot from "staging" environment
|
|
44
|
+
Then create diffy comparison with name "env-pair"
|
|
45
|
+
Then wait for diffy comparison to complete
|
|
46
|
+
|
|
47
|
+
@diffy @smoke @folder-upload
|
|
48
|
+
Scenario: Upload PNG folders to Diffy
|
|
49
|
+
Then upload folder "/tmp/diffy-test-screenshots/baseline" to diffy as "folder-baseline"
|
|
50
|
+
Then upload folder "/tmp/diffy-test-screenshots/feature" to diffy as "folder-feature"
|
|
51
|
+
Then create diffy comparison with name "folder-pair"
|
|
52
|
+
Then wait for diffy comparison to complete
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
Feature: Diffy — real API smoke
|
|
2
|
+
Run the minimum set against the production Diffy API. Requires valid
|
|
3
|
+
DIFFY_API_KEY and DIFFY_PROJECT_ID for a project whose allowed URLs
|
|
4
|
+
match LAUNCH_URL (e.g. http://localhost:8080 via ngrok, or a hosted
|
|
5
|
+
copy of /examples).
|
|
6
|
+
|
|
7
|
+
Do NOT run without a live key. Scoped behind @real-api so mock runs
|
|
8
|
+
skip it automatically (cucumber-js --tags "not @real-api").
|
|
9
|
+
|
|
10
|
+
@diffy @real-api
|
|
11
|
+
Scenario: Real API baseline + changed comparison
|
|
12
|
+
Given I am on "/diffy/baseline.html"
|
|
13
|
+
Then I take screenshots for all breakpoints
|
|
14
|
+
Then send screenshots to diffy with name "real-baseline"
|
|
15
|
+
|
|
16
|
+
Given I am on "/diffy/changed.html"
|
|
17
|
+
Then I take screenshots for all breakpoints
|
|
18
|
+
Then send screenshots to diffy with name "real-changed"
|
|
19
|
+
|
|
20
|
+
Then create diffy comparison with name "real-api-demo"
|
|
21
|
+
Then wait for diffy comparison to complete
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
Feature: Element step definitions
|
|
2
|
+
|
|
3
|
+
Scenario: Element existence and attribute matching
|
|
4
|
+
Given I am on "/element.html"
|
|
5
|
+
Then the element "h1" with the attribute "data-test" and the value "hero" should exist
|
|
6
|
+
And the element "h1" with the attribute "data-test" and the value containing "her" should exist
|
|
7
|
+
And the element "h1" with the attribute "data-test" and the value "missing" should not exist
|
|
8
|
+
And the element "h1" should be displayed
|
|
9
|
+
And the element "#hidden" should not be displayed
|
|
10
|
+
And the element ".lead[data-role='outro']" should appear after the element ".lead[data-role='intro']"
|
|
11
|
+
And the text "Second paragraph" should appear after the text "First paragraph"
|
|
12
|
+
|
|
13
|
+
Scenario: Click and hover via element steps
|
|
14
|
+
Given I am on "/element.html"
|
|
15
|
+
When I click on the element "#btn"
|
|
16
|
+
Then I should see "clicked"
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
Feature: Field step definitions
|
|
2
|
+
|
|
3
|
+
Scenario: Field state assertions
|
|
4
|
+
Given I am on "/field.html"
|
|
5
|
+
Then the field "username" should exist
|
|
6
|
+
And the field "username" should be empty
|
|
7
|
+
And the field "username" should be required
|
|
8
|
+
And the field "bio" should not be required
|
|
9
|
+
And the field "missing-field" should not exist
|
|
10
|
+
And the option "Admin" should exist within the select element "#role"
|
|
11
|
+
And the option "Manager" should not exist within the select element "#role"
|
|
12
|
+
And the option "Admin" should not be selected within the select element "#role"
|
|
13
|
+
|
|
14
|
+
Scenario: Field interactions
|
|
15
|
+
Given I am on "/field.html"
|
|
16
|
+
When I fill in the field "#username" with "alice"
|
|
17
|
+
And I check the checkbox "#agree"
|
|
18
|
+
And I choose the radio button "#r-red"
|
|
19
|
+
And I fill in the color field "fav" with the value "#ff0000"
|
|
20
|
+
Then the field "username" should not be empty
|
|
21
|
+
And the color field "fav" should have the value "#ff0000"
|
|
22
|
+
|
|
23
|
+
Scenario: Disable browser validation
|
|
24
|
+
Given I am on "/field.html"
|
|
25
|
+
And browser validation for the form "#f" is disabled
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
Feature: Keyboard step definitions
|
|
2
|
+
|
|
3
|
+
Scenario: Keyboard input
|
|
4
|
+
Given I am on "/keyboard.html"
|
|
5
|
+
When I focus on the element "#inp"
|
|
6
|
+
And I press the key "Enter"
|
|
7
|
+
Then I should see "Enter"
|
|
8
|
+
When I press the key "tab" on the element "#inp"
|
|
9
|
+
And I press the keys "Control+a"
|
|
10
|
+
And I press the keys "Control+a" on the element "#inp"
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
Feature: Link step definitions
|
|
2
|
+
|
|
3
|
+
Scenario: Link href + title assertions
|
|
4
|
+
Given I am on "/links.html"
|
|
5
|
+
Then the link "About" with the href "/about" should exist
|
|
6
|
+
And the link "Contact" with the href "/contact" within the element "#nav" should exist
|
|
7
|
+
And the link "About" with the href "/missing" should not exist
|
|
8
|
+
And the link with the title "About us" should exist
|
|
9
|
+
And the link with the title "Nonexistent" should not exist
|
|
10
|
+
And the link "Example" should be an absolute link
|
|
11
|
+
And the link "About" should not be an absolute link
|
|
@@ -50,5 +50,5 @@ Feature: Modal Dialog - Advanced Scenarios
|
|
|
50
50
|
And I click "Submit" button in the modal
|
|
51
51
|
And I wait 1 second
|
|
52
52
|
Then I should see "Message sent successfully" in the modal
|
|
53
|
-
And I wait
|
|
53
|
+
And I wait for the modal to disappear
|
|
54
54
|
Then I should not see the modal
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
Feature: Modal step definitions
|
|
2
|
+
|
|
3
|
+
Scenario: Open and inspect modal
|
|
4
|
+
Given I am on "/modal.html"
|
|
5
|
+
Then I should not see the modal
|
|
6
|
+
When I click on the element "#open"
|
|
7
|
+
And I wait for the modal to appear
|
|
8
|
+
Then I should see the modal
|
|
9
|
+
And the modal should contain "Welcome modal text"
|
|
10
|
+
And the modal should not contain "Goodbye"
|
|
11
|
+
When I click on "#close-btn" in the modal
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
Feature: Path step definitions
|
|
2
|
+
|
|
3
|
+
Scenario: Path and query parameter assertions
|
|
4
|
+
Given I am on "/path.html?lang=en&debug=1"
|
|
5
|
+
Then the path should be "/path.html"
|
|
6
|
+
And the path should not be "/wrong"
|
|
7
|
+
And current url should have the "lang" parameter
|
|
8
|
+
And current url should have the "lang" parameter with the "en" value
|
|
9
|
+
And current url should not have the "missing" parameter
|
|
10
|
+
And current url should not have the "lang" parameter with the "fr" value
|
|
11
|
+
|
|
12
|
+
Scenario: History navigation
|
|
13
|
+
Given I am on "/path.html"
|
|
14
|
+
When I go to "/element.html"
|
|
15
|
+
And I go back
|
|
16
|
+
Then the path should be "/path.html"
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
Feature: Response step definitions
|
|
2
|
+
|
|
3
|
+
Scenario: Inspect response headers from main navigation
|
|
4
|
+
Given I am on the homepage
|
|
5
|
+
Then the response should contain the header "content-type"
|
|
6
|
+
And the response header "content-type" should contain the value "html"
|
|
7
|
+
And the response should not contain the header "x-fake-header"
|
|
8
|
+
And the response header "content-type" should not contain the value "application/json"
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
Feature: Responsive step definitions
|
|
2
|
+
|
|
3
|
+
Scenario: Set viewport via breakpoints
|
|
4
|
+
Given I am on the homepage
|
|
5
|
+
When I set the viewport to the "mobile" breakpoint
|
|
6
|
+
And I set the viewport to the "tablet" breakpoint
|
|
7
|
+
And I set the viewport to the "desktop" breakpoint
|
|
8
|
+
And I set the viewport width to 800
|
|
9
|
+
And I set the viewport height to 600
|
|
10
|
+
And I set the viewport to 1024 by 768
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
Feature: Table step definitions
|
|
2
|
+
|
|
3
|
+
Scenario: Inspect table content
|
|
4
|
+
Given I am on "/table.html"
|
|
5
|
+
Then the table "#users" should have 3 rows
|
|
6
|
+
And the table "#users" should have 3 columns
|
|
7
|
+
And the table "#users" should not be empty
|
|
8
|
+
And the table "#empty" should be empty
|
|
9
|
+
And the table "#users" should contain the following columns:
|
|
10
|
+
| Name |
|
|
11
|
+
| Role |
|
|
12
|
+
| Status |
|
|
13
|
+
And the table "#users" should be sorted by "Name" in "ascending" order
|
|
14
|
+
And the table "#users" should contain the following rows:
|
|
15
|
+
| Alice | Admin |
|
|
16
|
+
And the "Bob" row should contain the following:
|
|
17
|
+
| User |
|
|
18
|
+
| Active |
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
Feature: Save screenshots to disk.
|
|
2
|
+
As a tester,
|
|
3
|
+
I want to capture screenshots at arbitrary points in my scenarios
|
|
4
|
+
so that I can review rendered pages and debug failures.
|
|
5
|
+
|
|
6
|
+
Background:
|
|
7
|
+
Given I am on homepage
|
|
8
|
+
|
|
9
|
+
Scenario: Save a screenshot at the current viewport size.
|
|
10
|
+
Then I save screenshot
|
|
11
|
+
|
|
12
|
+
Scenario: Save a full-page screenshot.
|
|
13
|
+
Then I save fullscreen screenshot
|
|
14
|
+
|
|
15
|
+
Scenario: Save a screenshot after resizing the viewport.
|
|
16
|
+
Then I save 1440 x 900 screenshot
|
|
17
|
+
|
|
18
|
+
Scenario: Save a full-page screenshot at a fixed viewport.
|
|
19
|
+
Then I save fullscreen 1200 x 800 screenshot
|
|
20
|
+
|
|
21
|
+
Scenario: Save a screenshot with an explicit filename.
|
|
22
|
+
Then I save screenshot with name "webship-home.png"
|
|
23
|
+
|
|
24
|
+
Scenario: Save a full-page screenshot with an explicit filename.
|
|
25
|
+
Then I save fullscreen screenshot with name "webship-home-full.png"
|
|
26
|
+
|
|
27
|
+
Scenario: Save a screenshot with filename tokens.
|
|
28
|
+
Then I save screenshot with name "{feature_file}_{step_line}_{datetime}.png"
|
|
29
|
+
|
|
30
|
+
@screenshots
|
|
31
|
+
Scenario: Auto-capture a screenshot after every step in a tagged scenario.
|
|
32
|
+
Given I am on "/about-us.html"
|
|
33
|
+
Then I should see "About Us"
|