webship-js 2.0.9 → 2.0.11

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (102) hide show
  1. package/.github/ISSUE_TEMPLATE/issue.md +37 -0
  2. package/.github/PULL_REQUEST_TEMPLATE.md +24 -0
  3. package/.github/workflows/github-actions.yml +56 -4
  4. package/CLAUDE.md +5 -2
  5. package/README.md +13 -1
  6. package/bin/generate-reports.js +51 -7
  7. package/bin/init-webship.js +85 -17
  8. package/cucumber.js +29 -1
  9. package/docs/00-quick-start.md +30 -7
  10. package/docs/02-bbr-smart-waits.md +6 -0
  11. package/docs/04-step-reference.md +2 -2
  12. package/docs/09-api-testing.md +9 -2
  13. package/docs/11-debugging.md +21 -0
  14. package/docs/12-ai-agent-guide.md +3 -1
  15. package/docs/13-faq.md +3 -0
  16. package/docs/15-tag-conventions.md +4 -1
  17. package/docs/16-ci-cd.md +29 -13
  18. package/docs/api-step-definitions.md +13 -2
  19. package/docs/global-settings.md +2 -2
  20. package/docs/install-webship-js/ddev-webship-js.md +3 -0
  21. package/docs/install-webship-js.md +14 -2
  22. package/examples/a11y-legacy-widget.html +34 -0
  23. package/examples/auth-state.html +42 -0
  24. package/examples/clock.html +33 -0
  25. package/examples/downloads/webship-archive.zip +0 -0
  26. package/examples/downloads/webship-notes.txt +4 -0
  27. package/examples/downloads/webship-report.csv +4 -0
  28. package/examples/downloads.html +16 -0
  29. package/examples/element-viewport.html +42 -0
  30. package/examples/field-types.html +98 -0
  31. package/examples/iframe-newsletter.html +29 -0
  32. package/examples/iframe-order.html +26 -0
  33. package/examples/iframe.html +21 -0
  34. package/examples/javascript-errors.html +35 -0
  35. package/examples/links.html +1 -0
  36. package/examples/metatags.html +18 -0
  37. package/examples/mouse-and-pointer.html +83 -0
  38. package/examples/native-dialogs.html +8 -0
  39. package/examples/network.html +83 -0
  40. package/examples/scroll-horizontal.html +50 -0
  41. package/examples/selectors-position.html +29 -0
  42. package/examples/storage.html +57 -0
  43. package/examples/viewport-size.html +24 -0
  44. package/examples/wait-conditions.html +69 -0
  45. package/examples/web-first.html +99 -0
  46. package/package.json +9 -2
  47. package/tests/assets/catalog.xml +19 -0
  48. package/tests/assets/feed-namespaced.xml +13 -0
  49. package/tests/assets/sitemap.xml +14 -0
  50. package/tests/assets/webship-site-expected.yaml +21 -0
  51. package/tests/assets/webship-site.schema.json +46 -0
  52. package/tests/assets/webship-site.yaml +21 -0
  53. package/tests/check-examples.js +235 -0
  54. package/tests/check-must-fail.js +84 -0
  55. package/tests/check-paths.js +82 -0
  56. package/tests/check-report.js +119 -0
  57. package/tests/check-scaffold.js +211 -0
  58. package/tests/features/a11y.feature +18 -0
  59. package/tests/features/auth-state.feature +32 -0
  60. package/tests/features/clock.feature +27 -0
  61. package/tests/features/cookie.feature +9 -0
  62. package/tests/features/dialog.feature +27 -0
  63. package/tests/features/element.feature +47 -0
  64. package/tests/features/field.feature +104 -0
  65. package/tests/features/file-download.feature +64 -0
  66. package/tests/features/iframe.feature +83 -0
  67. package/tests/features/javascript.feature +47 -0
  68. package/tests/features/link.feature +11 -0
  69. package/tests/features/metatag.feature +38 -0
  70. package/tests/features/mouse-and-pointer.feature +86 -0
  71. package/tests/features/network-mocking.feature +80 -0
  72. package/tests/features/responsive.feature +27 -0
  73. package/tests/features/rest-and-api-requests.feature +120 -0
  74. package/tests/features/scroll-horizontal.feature +55 -0
  75. package/tests/features/selectors-position.feature +41 -0
  76. package/tests/features/storage.feature +98 -0
  77. package/tests/features/test--then--i-see-locator.feature +13 -0
  78. package/tests/features/test--then--i-should--see-text-in-element.feature +9 -1
  79. package/tests/features/test--then--the-field-should-contain-value.feature +8 -0
  80. package/tests/features/video.feature +1 -0
  81. package/tests/features/wait.feature +89 -0
  82. package/tests/features/web-first.feature +100 -0
  83. package/tests/features/xml.feature +96 -0
  84. package/tests/features/yaml.feature +75 -0
  85. package/tests/must-fail/assertions.feature +96 -0
  86. package/tests/must-fail/waits.feature +51 -0
  87. package/tests/reports/README.md +2 -2
  88. package/tests/step-definitions/a11y.steps.js +12 -8
  89. package/tests/step-definitions/api.steps.js +18 -45
  90. package/tests/step-definitions/assertion.steps.js +235 -61
  91. package/tests/step-definitions/dialog.steps.js +2 -2
  92. package/tests/step-definitions/element.steps.js +3 -1
  93. package/tests/step-definitions/field.steps.js +152 -22
  94. package/tests/step-definitions/file-download.steps.js +74 -10
  95. package/tests/step-definitions/rest.steps.js +23 -12
  96. package/tests/step-definitions/screenshot.steps.js +1 -1
  97. package/tests/step-definitions/selectors.steps.js +9 -3
  98. package/tests/step-definitions/storage.steps.js +3 -3
  99. package/tests/step-definitions/wait.steps.js +129 -39
  100. package/tests/step-definitions/webship.js +211 -3
  101. package/tests/step-definitions/xml.steps.js +76 -14
  102. package/tests/step-definitions/yaml.steps.js +46 -27
@@ -0,0 +1,83 @@
1
+ <!DOCTYPE html>
2
+ <html lang="en">
3
+ <head>
4
+ <meta charset="utf-8">
5
+ <title>Mouse and pointer</title>
6
+ <style>
7
+ body { margin: 0; padding: 20px; font-family: Arial, sans-serif; }
8
+ .targets { display: flex; flex-wrap: wrap; gap: 12px; }
9
+ .target { width: 170px; padding: 16px 8px; border: 2px solid #333; background: #f0f4f8; text-align: center; user-select: none; }
10
+ #drop-zone { width: 360px; min-height: 60px; padding: 16px 8px; border: 2px dashed #007bff; margin-top: 12px; text-align: center; }
11
+ #result { font-size: 20px; font-weight: bold; color: #007bff; min-height: 28px; }
12
+ </style>
13
+ </head>
14
+ <body>
15
+ <h1>Mouse and pointer</h1>
16
+ <p id="result">Nothing happened yet</p>
17
+
18
+ <div class="targets">
19
+ <div class="target" id="hover-card">Hover card</div>
20
+ <div class="target" id="pointer-card">Pointer card</div>
21
+ <div class="target" id="double-click-card">Double-click card</div>
22
+ <div class="target" id="right-click-card">Right-click card</div>
23
+ <div class="target" id="middle-click-card">Middle-click card</div>
24
+ <div class="target" id="modifier-card">Modifier card</div>
25
+ <div class="target" id="tap-card">Tap card</div>
26
+ <div class="target" id="drag-card" draggable="true">Drag card</div>
27
+ </div>
28
+
29
+ <div id="drop-zone">Drop zone</div>
30
+
31
+ <script>
32
+ var result = document.getElementById('result');
33
+ function show(text) { result.textContent = text; }
34
+
35
+ document.getElementById('hover-card').addEventListener('mouseenter', function () {
36
+ show('Hovered over the hover card');
37
+ });
38
+ document.getElementById('pointer-card').addEventListener('mouseenter', function () {
39
+ show('Pointer moved to the pointer card');
40
+ });
41
+ document.getElementById('double-click-card').addEventListener('dblclick', function () {
42
+ show('Double-clicked the card');
43
+ });
44
+ document.getElementById('right-click-card').addEventListener('contextmenu', function (event) {
45
+ event.preventDefault();
46
+ show('Right-clicked the card');
47
+ });
48
+ document.getElementById('middle-click-card').addEventListener('auxclick', function (event) {
49
+ if (event.button === 1) {
50
+ event.preventDefault();
51
+ show('Middle-clicked the card');
52
+ }
53
+ });
54
+ document.getElementById('modifier-card').addEventListener('click', function (event) {
55
+ var keys = [];
56
+ if (event.shiftKey) keys.push('Shift');
57
+ if (event.ctrlKey) keys.push('Control');
58
+ if (event.altKey) keys.push('Alt');
59
+ if (event.metaKey) keys.push('Meta');
60
+ show(keys.length ? 'Clicked while holding ' + keys.join(' and ') : 'Clicked with no key held');
61
+ });
62
+ document.getElementById('tap-card').addEventListener('click', function () {
63
+ show('Tapped the card');
64
+ });
65
+
66
+ var dragCard = document.getElementById('drag-card');
67
+ var dropZone = document.getElementById('drop-zone');
68
+ dragCard.addEventListener('dragstart', function (event) {
69
+ event.dataTransfer.setData('text/plain', 'drag-card');
70
+ });
71
+ dropZone.addEventListener('dragover', function (event) {
72
+ event.preventDefault();
73
+ });
74
+ dropZone.addEventListener('drop', function (event) {
75
+ event.preventDefault();
76
+ if (event.dataTransfer.getData('text/plain') === 'drag-card') {
77
+ dropZone.appendChild(dragCard);
78
+ show('Dropped the drag card in the drop zone');
79
+ }
80
+ });
81
+ </script>
82
+ </body>
83
+ </html>
@@ -10,6 +10,9 @@
10
10
  <p><button id="delete" type="button">Delete item</button></p>
11
11
  <p id="result">Waiting</p>
12
12
 
13
+ <p><button id="rename" type="button">Rename item</button></p>
14
+ <p id="name">Name: Untitled</p>
15
+
13
16
  <script>
14
17
  var clicks = 0;
15
18
  document.getElementById('delete').addEventListener('click', function () {
@@ -17,6 +20,11 @@
17
20
  var answer = window.confirm('Delete this item?') ? 'Item deleted' : 'Deletion cancelled';
18
21
  document.getElementById('result').textContent = answer + ' #' + clicks;
19
22
  });
23
+
24
+ document.getElementById('rename').addEventListener('click', function () {
25
+ var name = window.prompt('Enter the new name of the item', 'Untitled');
26
+ document.getElementById('name').textContent = name === null ? 'Rename cancelled' : 'Name: ' + name;
27
+ });
20
28
  </script>
21
29
  </body>
22
30
  </html>
@@ -0,0 +1,83 @@
1
+ <!DOCTYPE html>
2
+ <html lang="en">
3
+ <head>
4
+ <meta charset="utf-8">
5
+ <title>Network requests - Webship Testing</title>
6
+ </head>
7
+ <body>
8
+ <h1>Network requests</h1>
9
+ <p>The buttons below send a request from the page and show what came back, or that nothing came back.</p>
10
+
11
+ <h2>Article</h2>
12
+ <button type="button" id="load-article">Load article</button>
13
+ <p id="article-status">Not loaded yet</p>
14
+ <p id="article-title"></p>
15
+ <p id="article-author"></p>
16
+ <p id="article-timing"></p>
17
+
18
+ <h2>Feedback</h2>
19
+ <button type="button" id="send-feedback">Send feedback</button>
20
+ <p id="feedback-status">Not sent yet</p>
21
+
22
+ <h2>Connection</h2>
23
+ <p id="connection"></p>
24
+
25
+ <script>
26
+ function show(id, text) {
27
+ document.getElementById(id).textContent = text;
28
+ }
29
+
30
+ function showConnection() {
31
+ show('connection', window.navigator.onLine ? 'The browser is online' : 'The browser is offline');
32
+ }
33
+
34
+ document.getElementById('load-article').addEventListener('click', function () {
35
+ var started = Date.now();
36
+ show('article-status', 'Loading the article');
37
+ show('article-title', '');
38
+ show('article-author', '');
39
+ show('article-timing', '');
40
+ showConnection();
41
+ window.fetch('example-api.json', { cache: 'no-store' })
42
+ .then(function (response) {
43
+ if (!response.ok) throw new Error('HTTP ' + response.status);
44
+ return response.json();
45
+ })
46
+ .then(function (json) {
47
+ show('article-title', json.data[0].attributes.title);
48
+ show('article-author', 'Written by ' + json.included[0].attributes.name);
49
+ show('article-timing', (Date.now() - started) < 2000
50
+ ? 'Answered in under 2 seconds'
51
+ : 'Answered after 2 seconds or more');
52
+ show('article-status', 'Article loaded');
53
+ })
54
+ .catch(function () {
55
+ show('article-status', 'The article request failed');
56
+ });
57
+ });
58
+
59
+ document.getElementById('send-feedback').addEventListener('click', function () {
60
+ show('feedback-status', 'Sending the feedback');
61
+ window.fetch('api/feedback', {
62
+ method: 'POST',
63
+ headers: { 'Content-Type': 'application/json' },
64
+ body: JSON.stringify({ message: 'Webship-js is great' })
65
+ })
66
+ .then(function (response) {
67
+ if (!response.ok) throw new Error('HTTP ' + response.status);
68
+ return response.json();
69
+ })
70
+ .then(function (json) {
71
+ show('feedback-status', 'Feedback answer: ' + json.message);
72
+ })
73
+ .catch(function () {
74
+ show('feedback-status', 'The feedback request failed');
75
+ });
76
+ });
77
+
78
+ window.addEventListener('online', showConnection);
79
+ window.addEventListener('offline', showConnection);
80
+ showConnection();
81
+ </script>
82
+ </body>
83
+ </html>
@@ -0,0 +1,50 @@
1
+ <!DOCTYPE html>
2
+ <html lang="en">
3
+ <head>
4
+ <meta charset="utf-8">
5
+ <title>Horizontal scrolling</title>
6
+ <style>
7
+ body { margin: 0; padding: 20px; font-family: Arial, sans-serif; }
8
+ #status { position: fixed; top: 0; left: 0; margin: 0; padding: 10px 20px; background: #e7f3ff; border: 2px solid #007bff; font-weight: bold; }
9
+ #status p { margin: 2px 0; }
10
+ #wide-track { width: 4000px; height: 120px; margin-top: 110px; background: linear-gradient(to right, #ff9999, #99ff99, #9999ff); }
11
+ #strip { width: 400px; height: 100px; overflow-x: scroll; border: 2px solid #333; margin-top: 20px; }
12
+ #strip-inner { width: 2000px; height: 60px; background: linear-gradient(to right, #ffe08a, #8ad4ff); }
13
+ </style>
14
+ </head>
15
+ <body>
16
+ <div id="status">
17
+ <p id="page-position">Page scrolled 0 pixels to the right</p>
18
+ <p id="page-edge">Page is at the start</p>
19
+ <p id="strip-edge">Strip is at the start</p>
20
+ </div>
21
+
22
+ <div id="wide-track">A track much wider than the window</div>
23
+
24
+ <h2>Scrollable strip</h2>
25
+ <div id="strip">
26
+ <div id="strip-inner">A strip wider than its box</div>
27
+ </div>
28
+
29
+ <script>
30
+ function edge(position, maximum) {
31
+ if (position <= 0) return 'at the start';
32
+ if (position >= maximum - 1) return 'at the end';
33
+ return 'in the middle';
34
+ }
35
+ function showPage() {
36
+ var x = Math.round(window.scrollX);
37
+ var max = document.documentElement.scrollWidth - document.documentElement.clientWidth;
38
+ document.getElementById('page-position').textContent = 'Page scrolled ' + x + ' pixels to the right';
39
+ document.getElementById('page-edge').textContent = 'Page is ' + edge(x, max);
40
+ }
41
+ function showStrip() {
42
+ var strip = document.getElementById('strip');
43
+ document.getElementById('strip-edge').textContent =
44
+ 'Strip is ' + edge(Math.round(strip.scrollLeft), strip.scrollWidth - strip.clientWidth);
45
+ }
46
+ window.addEventListener('scroll', showPage);
47
+ document.getElementById('strip').addEventListener('scroll', showStrip);
48
+ </script>
49
+ </body>
50
+ </html>
@@ -0,0 +1,29 @@
1
+ <!DOCTYPE html>
2
+ <html lang="en">
3
+ <head>
4
+ <meta charset="utf-8">
5
+ <title>Selector positions</title>
6
+ <style>
7
+ body { margin: 0; padding: 20px; font-family: Arial, sans-serif; }
8
+ #toolbar { display: flex; gap: 20px; align-items: center; }
9
+ #logo, #menu, #search { width: 160px; padding: 12px; border: 2px solid #333; text-align: center; }
10
+ #stage { position: relative; width: 600px; height: 260px; margin-top: 30px; }
11
+ #article { position: absolute; top: 0; left: 0; width: 500px; height: 200px; padding: 10px; background: #f0f4f8; border: 2px solid #333; z-index: 1; }
12
+ #popup { position: absolute; top: 60px; left: 120px; width: 260px; padding: 16px; background: #fff3cd; border: 2px solid #b58900; z-index: 10; }
13
+ </style>
14
+ </head>
15
+ <body>
16
+ <h1>Selector positions</h1>
17
+
18
+ <div id="toolbar">
19
+ <div id="logo">Logo</div>
20
+ <div id="menu">Menu</div>
21
+ <div id="search">Search</div>
22
+ </div>
23
+
24
+ <div id="stage">
25
+ <div id="article">Article text under the popup</div>
26
+ <div id="popup">Popup shown over the article</div>
27
+ </div>
28
+ </body>
29
+ </html>
@@ -0,0 +1,57 @@
1
+ <!DOCTYPE html>
2
+ <html lang="en">
3
+ <head>
4
+ <meta charset="utf-8">
5
+ <title>Browser storage - Webship Testing</title>
6
+ </head>
7
+ <body>
8
+ <h1>Browser storage</h1>
9
+ <p>This page lists what the browser holds for this site when it loads. It sets nothing itself.</p>
10
+
11
+ <h2>Cookies</h2>
12
+ <ul id="cookies"></ul>
13
+
14
+ <h2>Local storage</h2>
15
+ <ul id="local-storage"></ul>
16
+
17
+ <h2>Session storage</h2>
18
+ <ul id="session-storage"></ul>
19
+
20
+ <script>
21
+ function fill(id, entries, emptyText) {
22
+ var list = document.getElementById(id);
23
+ list.textContent = '';
24
+ if (!entries.length) {
25
+ var none = document.createElement('li');
26
+ none.className = 'empty';
27
+ none.textContent = emptyText;
28
+ list.appendChild(none);
29
+ return;
30
+ }
31
+ entries.sort().forEach(function (entry) {
32
+ var item = document.createElement('li');
33
+ item.textContent = entry;
34
+ list.appendChild(item);
35
+ });
36
+ }
37
+
38
+ function storageEntries(storage) {
39
+ var entries = [];
40
+ for (var i = 0; i < storage.length; i++) {
41
+ var key = storage.key(i);
42
+ entries.push(key + ' = ' + storage.getItem(key));
43
+ }
44
+ return entries;
45
+ }
46
+
47
+ var cookies = document.cookie ? document.cookie.split('; ').map(function (pair) {
48
+ var at = pair.indexOf('=');
49
+ return pair.slice(0, at) + ' = ' + pair.slice(at + 1);
50
+ }) : [];
51
+
52
+ fill('cookies', cookies, 'No cookies');
53
+ fill('local-storage', storageEntries(window.localStorage), 'Local storage is empty');
54
+ fill('session-storage', storageEntries(window.sessionStorage), 'Session storage is empty');
55
+ </script>
56
+ </body>
57
+ </html>
@@ -0,0 +1,24 @@
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>Viewport size</title>
7
+ <style>
8
+ body { margin: 0; padding: 20px; font-family: Arial, sans-serif; }
9
+ #viewport-size { font-size: 20px; font-weight: bold; color: #007bff; }
10
+ </style>
11
+ </head>
12
+ <body>
13
+ <h1>Viewport size</h1>
14
+ <p id="viewport-size"></p>
15
+ <script>
16
+ function showViewportSize() {
17
+ document.getElementById('viewport-size').textContent =
18
+ 'Viewport is ' + window.innerWidth + ' by ' + window.innerHeight;
19
+ }
20
+ window.addEventListener('resize', showViewportSize);
21
+ showViewportSize();
22
+ </script>
23
+ </body>
24
+ </html>
@@ -0,0 +1,69 @@
1
+ <!DOCTYPE html>
2
+ <html lang="en">
3
+ <head>
4
+ <meta charset="utf-8">
5
+ <title>Wait conditions</title>
6
+ </head>
7
+ <body>
8
+ <h1>Wait conditions</h1>
9
+ <p>Every button below changes the page two and a half seconds after it is pressed.</p>
10
+
11
+ <h2>An element that appears</h2>
12
+ <p><button id="show-notice" type="button">Show notice</button></p>
13
+ <p id="notice" hidden>Notice ready</p>
14
+
15
+ <h2>An element that disappears</h2>
16
+ <p><button id="finish-loading" type="button">Finish loading</button></p>
17
+ <p id="spinner">Loading data</p>
18
+
19
+ <h2>A step that changes the address and the title</h2>
20
+ <p><button id="next-step" type="button">Go to step 2</button></p>
21
+ <p id="step">Step 1</p>
22
+
23
+ <h2>A list that fills up</h2>
24
+ <p>
25
+ <button id="load-results" type="button">Load results</button>
26
+ <button id="load-more" type="button">Load more</button>
27
+ </p>
28
+ <ul id="results"></ul>
29
+
30
+ <script>
31
+ var DELAY = 2500;
32
+
33
+ document.getElementById('show-notice').addEventListener('click', function () {
34
+ setTimeout(function () {
35
+ document.getElementById('notice').hidden = false;
36
+ }, DELAY);
37
+ });
38
+
39
+ document.getElementById('finish-loading').addEventListener('click', function () {
40
+ setTimeout(function () {
41
+ var spinner = document.getElementById('spinner');
42
+ spinner.parentNode.removeChild(spinner);
43
+ }, DELAY);
44
+ });
45
+
46
+ document.getElementById('next-step').addEventListener('click', function () {
47
+ setTimeout(function () {
48
+ history.pushState({ step: 2 }, '', '?step=2');
49
+ document.title = 'Step 2 - Wait conditions';
50
+ document.getElementById('step').textContent = 'Step 2';
51
+ }, DELAY);
52
+ });
53
+
54
+ function addResults(count) {
55
+ setTimeout(function () {
56
+ var list = document.getElementById('results');
57
+ for (var i = 0; i < count; i++) {
58
+ var li = document.createElement('li');
59
+ li.className = 'result';
60
+ li.textContent = 'Result ' + (list.children.length + 1);
61
+ list.appendChild(li);
62
+ }
63
+ }, DELAY);
64
+ }
65
+ document.getElementById('load-results').addEventListener('click', function () { addResults(3); });
66
+ document.getElementById('load-more').addEventListener('click', function () { addResults(2); });
67
+ </script>
68
+ </body>
69
+ </html>
@@ -0,0 +1,99 @@
1
+ <!DOCTYPE html>
2
+ <html lang="en">
3
+ <head>
4
+ <meta charset="utf-8">
5
+ <title>Web-first assertions</title>
6
+ <style>
7
+ .is-hidden { display: none; }
8
+ .tab.is-active { font-weight: bold; }
9
+ .spacer { height: 3000px; }
10
+ </style>
11
+ </head>
12
+ <body>
13
+ <h1>Web-first assertions</h1>
14
+
15
+ <p id="status">Ready</p>
16
+ <p id="banner">Welcome banner</p>
17
+ <p id="secret" class="is-hidden">Hidden note</p>
18
+
19
+ <p>
20
+ <label for="nickname">Nickname</label>
21
+ <input id="nickname" name="nickname" type="text" value="webship">
22
+ </p>
23
+ <p>
24
+ <label for="locked">Locked</label>
25
+ <input id="locked" name="locked" type="text" value="read only" readonly>
26
+ </p>
27
+
28
+ <p>
29
+ <button id="save" type="button" disabled>Save changes</button>
30
+ <button id="unlock" type="button">Unlock saving</button>
31
+ </p>
32
+
33
+ <ul id="items">
34
+ <li class="item">One</li>
35
+ <li class="item">Two</li>
36
+ <li class="item">Three</li>
37
+ </ul>
38
+ <p><button id="add-item" type="button">Add item</button></p>
39
+
40
+ <div role="tablist" aria-label="Sections">
41
+ <button type="button" role="tab" id="tab-overview" class="tab is-active" aria-selected="true" aria-controls="panel">Overview</button>
42
+ <button type="button" role="tab" id="tab-details" class="tab" aria-selected="false" aria-controls="panel">Details</button>
43
+ </div>
44
+ <div id="panel" role="tabpanel">Overview panel</div>
45
+
46
+ <p><a id="about-link" href="about-us.html">About Us</a></p>
47
+
48
+ <p><label><input type="checkbox" id="subscribe" name="subscribe"> Subscribe</label></p>
49
+ <p>
50
+ <label><input type="radio" id="plan-basic" name="plan" value="basic"> Basic</label>
51
+ <label><input type="radio" id="plan-premium" name="plan" value="premium"> Premium</label>
52
+ </p>
53
+ <p id="choice">Plan: none</p>
54
+
55
+ <div class="spacer"></div>
56
+ <p id="footer-note">Footer note</p>
57
+
58
+ <script>
59
+ var save = document.getElementById('save');
60
+
61
+ // The Save button is enabled a moment after "Unlock saving" is pressed.
62
+ document.getElementById('unlock').addEventListener('click', function () {
63
+ setTimeout(function () { save.disabled = false; }, 400);
64
+ });
65
+ save.addEventListener('click', function () {
66
+ document.getElementById('status').textContent = 'Saved';
67
+ });
68
+
69
+ // A fourth item is added a moment after "Add item" is pressed.
70
+ document.getElementById('add-item').addEventListener('click', function () {
71
+ setTimeout(function () {
72
+ var li = document.createElement('li');
73
+ li.className = 'item';
74
+ li.textContent = 'Four';
75
+ document.getElementById('items').appendChild(li);
76
+ }, 400);
77
+ });
78
+
79
+ // Tabs: the pressed tab becomes the selected one.
80
+ var tabs = document.querySelectorAll('[role="tab"]');
81
+ tabs.forEach(function (tab) {
82
+ tab.addEventListener('click', function () {
83
+ tabs.forEach(function (other) {
84
+ var active = other === tab;
85
+ other.classList.toggle('is-active', active);
86
+ other.setAttribute('aria-selected', active ? 'true' : 'false');
87
+ });
88
+ document.getElementById('panel').textContent = tab.textContent + ' panel';
89
+ });
90
+ });
91
+
92
+ document.querySelectorAll('input[name="plan"]').forEach(function (radio) {
93
+ radio.addEventListener('change', function () {
94
+ document.getElementById('choice').textContent = 'Plan: ' + radio.value;
95
+ });
96
+ });
97
+ </script>
98
+ </body>
99
+ </html>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "webship-js",
3
- "version": "2.0.9",
3
+ "version": "2.0.11",
4
4
  "description": "Webship JS automated functional testing.",
5
5
  "main": "index.js",
6
6
  "bin": {
@@ -19,9 +19,14 @@
19
19
  "test:chromium": "BROWSER=chromium cucumber-js --config cucumber.js",
20
20
  "test:firefox": "BROWSER=firefox cucumber-js --config cucumber.js",
21
21
  "test:webkit": "BROWSER=webkit cucumber-js --config cucumber.js",
22
+ "test:report": "node tests/check-report.js",
22
23
  "test:headed": "HEADLESS=false cucumber-js --config cucumber.js",
24
+ "test:must-fail": "node tests/check-must-fail.js",
23
25
  "test:fast": "SLOW_MO=0 cucumber-js --config cucumber.js",
26
+ "test:examples": "node tests/check-examples.js",
27
+ "test:paths": "node tests/check-paths.js",
24
28
  "generate-reports": "node ./bin/generate-reports.js",
29
+ "test:scaffold": "node tests/check-scaffold.js",
25
30
  "start": "http-server examples -p 8080 -s"
26
31
  },
27
32
  "repository": {
@@ -39,6 +44,7 @@
39
44
  "@cucumber/cucumber": "^12",
40
45
  "@cucumber/pretty-formatter": "~1",
41
46
  "@types/node": "~20",
47
+ "@xmldom/xmldom": "^0.9.8",
42
48
  "ajv": "^8.20.0",
43
49
  "ajv-formats": "^3.0.1",
44
50
  "axe-core": "^4.11.4",
@@ -48,6 +54,7 @@
48
54
  "js-yaml": "^4.1.1",
49
55
  "playwright": "^1.58.2",
50
56
  "tsx": "^4.19.2",
51
- "typescript": "~5"
57
+ "typescript": "~5",
58
+ "xpath": "~0.0.34"
52
59
  }
53
60
  }
@@ -0,0 +1,19 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <catalog version="2.0" updated="2026-01-15">
3
+ <book id="bk101" lang="en">
4
+ <title>Testing with Webship-js</title>
5
+ <author>Webship</author>
6
+ <price currency="USD">29.90</price>
7
+ </book>
8
+ <book id="bk102" lang="en">
9
+ <title>Behaviour-driven development by example</title>
10
+ <author>Webship</author>
11
+ <price currency="EUR">24.50</price>
12
+ </book>
13
+ <book id="bk103" lang="fr">
14
+ <title>Les tests automatiques</title>
15
+ <author>Webship</author>
16
+ <price currency="EUR">19.00</price>
17
+ </book>
18
+ <status>published</status>
19
+ </catalog>
@@ -0,0 +1,13 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <feed xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
3
+ <title>Webship-js releases</title>
4
+ <atom:link href="https://example.com/feed.xml" rel="self"/>
5
+ <entry>
6
+ <title>First release</title>
7
+ <dc:creator>Webship</dc:creator>
8
+ </entry>
9
+ <entry>
10
+ <title>Second release</title>
11
+ <dc:creator>Webship</dc:creator>
12
+ </entry>
13
+ </feed>
@@ -0,0 +1,14 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9" xmlns:image="http://www.google.com/schemas/sitemap-image/1.1">
3
+ <url>
4
+ <loc>https://example.com/</loc>
5
+ <lastmod>2026-11-16</lastmod>
6
+ <image:image>
7
+ <image:loc>https://example.com/logo.png</image:loc>
8
+ </image:image>
9
+ </url>
10
+ <url>
11
+ <loc>https://example.com/about-us</loc>
12
+ <lastmod>2026-11-10</lastmod>
13
+ </url>
14
+ </urlset>
@@ -0,0 +1,21 @@
1
+ # What the site description should be; the status block changes on every save.
2
+ name: webship-site
3
+ namespace: production
4
+ version: 2
5
+ owner:
6
+ team: platform
7
+ contact: team@example.com
8
+ settings:
9
+ cache: true
10
+ languages:
11
+ - en
12
+ - fr
13
+ homepage: /welcome
14
+ pages:
15
+ - title: Home
16
+ path: /
17
+ - title: About us
18
+ path: /about-us
19
+ status:
20
+ updated: "2025-06-01T08:30:00Z"
21
+ revision: 7