webship-js 2.0.2 → 2.0.4

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 (181) hide show
  1. package/.circleci/config.yml +7 -31
  2. package/.drone.yml +68 -0
  3. package/.harness/webship-js-pipeline.yml +101 -0
  4. package/.semaphore/semaphore.yml +58 -0
  5. package/.teamcity/pom.xml +52 -0
  6. package/.teamcity/settings.kts +92 -0
  7. package/.travis.yml +24 -3
  8. package/AGENTS.md +109 -0
  9. package/CLAUDE.md +317 -0
  10. package/Jenkinsfile +54 -0
  11. package/azure-pipelines.yml +82 -0
  12. package/bamboo-specs/bamboo.yml +131 -0
  13. package/bin/generate-reports.js +181 -9
  14. package/buildspec.yml +56 -0
  15. package/cloudbuild.yaml +49 -0
  16. package/codefresh.yml +77 -0
  17. package/cucumber.js +48 -5
  18. package/docs/00-quick-start.md +102 -0
  19. package/docs/01-getting-started.md +102 -0
  20. package/docs/02-bbr-smart-waits.md +77 -0
  21. package/docs/03-selector-registry.md +95 -0
  22. package/docs/04-step-reference.md +799 -0
  23. package/docs/05-web-first-assertions.md +91 -0
  24. package/docs/06-network-and-dialogs.md +83 -0
  25. package/docs/07-auth-state.md +75 -0
  26. package/docs/08-clock-mocking.md +59 -0
  27. package/docs/09-api-testing.md +114 -0
  28. package/docs/10-accessibility.md +167 -0
  29. package/docs/11-debugging.md +129 -0
  30. package/docs/12-ai-agent-guide.md +338 -0
  31. package/docs/13-faq.md +236 -0
  32. package/docs/14-recipes-cookbook.md +255 -0
  33. package/docs/15-tag-conventions.md +76 -0
  34. package/docs/16-ci-cd.md +879 -0
  35. package/docs/README.md +113 -0
  36. package/docs/advanced-screenshots/then-i-save-fullscreen-screenshot.md +36 -0
  37. package/docs/advanced-screenshots/then-i-save-width-x-height-screenshot.md +34 -0
  38. package/docs/advanced-screenshots/when-i-save-screenshot-name-filename.md +45 -0
  39. package/docs/advanced-screenshots.md +52 -0
  40. package/docs/advanced-selectors.md +18 -0
  41. package/docs/api-step-definitions.md +45 -0
  42. package/docs/diffy-step-definitions/then-compare-diffy-env1-env2.md +30 -0
  43. package/docs/diffy-step-definitions/then-create-diffy-comparison-name-value.md +21 -0
  44. package/docs/diffy-step-definitions/then-create-diffy-comparison.md +25 -0
  45. package/docs/diffy-step-definitions/then-create-diffy-screenshot-environment-name.md +35 -0
  46. package/docs/diffy-step-definitions/then-i-take-screenshot.md +21 -0
  47. package/docs/diffy-step-definitions/then-i-take-screenshots-all-breakpoints.md +27 -0
  48. package/docs/diffy-step-definitions/then-send-screenshots-diffy-name-value.md +27 -0
  49. package/docs/diffy-step-definitions/then-upload-folder-url-diffy-snapshotname.md +28 -0
  50. package/docs/diffy-step-definitions/then-wait-diffy-comparison-complete.md +21 -0
  51. package/docs/diffy-step-definitions/when-i-resize-window-number.md +29 -0
  52. package/docs/diffy-step-definitions.md +21 -0
  53. package/docs/global-settings.md +295 -0
  54. package/docs/install-webship-js/ddev-webship-js.md +52 -0
  55. package/docs/install-webship-js.md +35 -0
  56. package/docs/overview.md +41 -0
  57. package/docs/step-definitions/given-i-am-anonymous-user.md +67 -0
  58. package/docs/step-definitions/given-i-am-homepage.md +68 -0
  59. package/docs/step-definitions/given-i-am-specific-page.md +72 -0
  60. package/docs/step-definitions/then-i-should-be.md +56 -0
  61. package/docs/step-definitions/then-i-should-see.md +62 -0
  62. package/docs/step-definitions/then-item-checkbox.md +54 -0
  63. package/docs/step-definitions/then-item-link-should-contain-url.md +84 -0
  64. package/docs/step-definitions/then-item-should-contain.md +67 -0
  65. package/docs/step-definitions/then-radio-button-value-should-be-selected.md +68 -0
  66. package/docs/step-definitions/then-response-status-code-should-be-number.md +69 -0
  67. package/docs/step-definitions/then-value-radio-button-selected.md +62 -0
  68. package/docs/step-definitions/when-i-attach-file-file-name-element.md +71 -0
  69. package/docs/step-definitions/when-i-check-checkbox.md +60 -0
  70. package/docs/step-definitions/when-i-click-link.md +51 -0
  71. package/docs/step-definitions/when-i-click-operation-text-row.md +71 -0
  72. package/docs/step-definitions/when-i-fill.md +59 -0
  73. package/docs/step-definitions/when-i-go-homepage.md +60 -0
  74. package/docs/step-definitions/when-i-go-specific-page.md +67 -0
  75. package/docs/step-definitions/when-i-move-backward-one-page.md +49 -0
  76. package/docs/step-definitions/when-i-move-forward-one-page.md +58 -0
  77. package/docs/step-definitions/when-i-press-button.md +58 -0
  78. package/docs/step-definitions/when-i-reload-page.md +51 -0
  79. package/docs/step-definitions/when-i-scroll.md +73 -0
  80. package/docs/step-definitions/when-i-select-option-select-list.md +53 -0
  81. package/docs/step-definitions/when-i-select-radio-button-value.md +62 -0
  82. package/docs/step-definitions/when-i-uncheck-checkbox.md +57 -0
  83. package/docs/step-definitions/when-i-wait-ajax-finish.md +64 -0
  84. package/docs/step-definitions/when-i-wait.md +62 -0
  85. package/docs/step-definitions.md +50 -0
  86. package/examples/a11y.html +31 -0
  87. package/examples/cookies.html +10 -0
  88. package/examples/date.html +12 -0
  89. package/examples/element.html +11 -0
  90. package/examples/field.html +24 -0
  91. package/examples/keyboard.html +11 -0
  92. package/examples/links.html +9 -0
  93. package/examples/modal.html +14 -0
  94. package/examples/path.html +3 -0
  95. package/examples/table.html +13 -0
  96. package/examples/video-demo.html +43 -0
  97. package/package.json +10 -3
  98. package/playwright.config.ts +3 -2
  99. package/tests/features/a11y.feature +39 -0
  100. package/tests/features/cookie.feature +13 -0
  101. package/tests/features/date.feature +11 -0
  102. package/tests/features/element.feature +16 -0
  103. package/tests/features/field.feature +25 -0
  104. package/tests/features/keyboard.feature +10 -0
  105. package/tests/features/link.feature +11 -0
  106. package/tests/features/modal-advanced-example.feature +1 -1
  107. package/tests/features/modal.feature +11 -0
  108. package/tests/features/path.feature +16 -0
  109. package/tests/features/response.feature +8 -0
  110. package/tests/features/responsive.feature +10 -0
  111. package/tests/features/table.feature +18 -0
  112. package/tests/features/video.feature +18 -0
  113. package/tests/features/wait.feature +7 -0
  114. package/tests/features/yaml.feature +102 -0
  115. package/tests/reports/README.md +55 -0
  116. package/tests/selectors/_canonical-keys.json +113 -0
  117. package/tests/selectors/back-end-selectors.json +7 -1
  118. package/tests/selectors/cms-contentful-admin.json +35 -0
  119. package/tests/selectors/cms-craft-admin.json +39 -0
  120. package/tests/selectors/cms-drupal-cms-gin.json +56 -0
  121. package/tests/selectors/cms-drupal-core-claro.json +50 -0
  122. package/tests/selectors/cms-generic-admin.json +34 -0
  123. package/tests/selectors/cms-ghost-admin.json +34 -0
  124. package/tests/selectors/cms-joomla-admin.json +41 -0
  125. package/tests/selectors/cms-magento2-admin.json +32 -0
  126. package/tests/selectors/cms-prestashop-admin.json +38 -0
  127. package/tests/selectors/cms-shopify-admin.json +25 -0
  128. package/tests/selectors/cms-strapi-admin.json +42 -0
  129. package/tests/selectors/cms-typo3-admin.json +41 -0
  130. package/tests/selectors/cms-woocommerce-front.json +50 -0
  131. package/tests/selectors/cms-wordpress-admin.json +31 -0
  132. package/tests/selectors/framework-ant-design.json +80 -0
  133. package/tests/selectors/framework-bootstrap.json +86 -0
  134. package/tests/selectors/framework-bulma.json +74 -0
  135. package/tests/selectors/framework-chakra.json +58 -0
  136. package/tests/selectors/framework-foundation.json +51 -0
  137. package/tests/selectors/framework-material-ui.json +72 -0
  138. package/tests/selectors/framework-shadcn.json +51 -0
  139. package/tests/selectors/framework-tailwind.json +40 -0
  140. package/tests/selectors/framework-vuetify.json +61 -0
  141. package/tests/step-definitions/a11y.steps.js +800 -0
  142. package/tests/step-definitions/action.steps.js +167 -0
  143. package/tests/step-definitions/{webship-api.js → api.steps.js} +41 -23
  144. package/tests/step-definitions/assertion.steps.js +352 -0
  145. package/tests/step-definitions/auth.steps.js +126 -0
  146. package/tests/step-definitions/clock.steps.js +128 -0
  147. package/tests/step-definitions/cookie.steps.js +216 -0
  148. package/tests/step-definitions/debug.steps.js +39 -0
  149. package/tests/step-definitions/dialog.steps.js +193 -0
  150. package/tests/step-definitions/element.steps.js +356 -0
  151. package/tests/step-definitions/field.steps.js +653 -0
  152. package/tests/step-definitions/file-download.steps.js +211 -0
  153. package/tests/step-definitions/form.steps.js +333 -0
  154. package/tests/step-definitions/iframe.steps.js +228 -0
  155. package/tests/step-definitions/input.steps.js +202 -0
  156. package/tests/step-definitions/javascript.steps.js +232 -0
  157. package/tests/step-definitions/keyboard.steps.js +112 -0
  158. package/tests/step-definitions/link.steps.js +142 -0
  159. package/tests/step-definitions/metatag.steps.js +91 -0
  160. package/tests/step-definitions/modal.steps.js +244 -0
  161. package/tests/step-definitions/navigation.steps.js +218 -0
  162. package/tests/step-definitions/network.steps.js +280 -0
  163. package/tests/step-definitions/path.steps.js +141 -0
  164. package/tests/step-definitions/response.steps.js +98 -0
  165. package/tests/step-definitions/responsive.steps.js +125 -0
  166. package/tests/step-definitions/rest.steps.js +111 -0
  167. package/tests/step-definitions/{webship-screenshot.js → screenshot.steps.js} +1 -5
  168. package/tests/step-definitions/scroll.steps.js +189 -0
  169. package/tests/step-definitions/{webship-selectors.js → selectors.steps.js} +64 -27
  170. package/tests/step-definitions/storage.steps.js +194 -0
  171. package/tests/step-definitions/table.steps.js +181 -0
  172. package/tests/step-definitions/video.steps.js +178 -0
  173. package/tests/step-definitions/wait.steps.js +400 -0
  174. package/tests/step-definitions/web-first.steps.js +298 -0
  175. package/tests/step-definitions/webship.js +741 -1477
  176. package/tests/step-definitions/xml.steps.js +411 -0
  177. package/tests/step-definitions/yaml.steps.js +913 -0
  178. package/tests/step-definitions-diffy/webship-diffy.js +0 -13
  179. package/tsconfig.json +19 -3
  180. package/videos/README.md +32 -0
  181. package/.travis-ci.yml +0 -16
@@ -0,0 +1,57 @@
1
+
2
+ # When I uncheck "checkbox"
3
+
4
+ ## Overview
5
+ This step definition serves as a command to clear/deselect a checkbox element.
6
+
7
+ ## Gherkin Syntax
8
+ ```
9
+ When (I|we)* uncheck "([^"]*)?"
10
+ ```
11
+
12
+ ## Description
13
+ Define the step of unchecking the checkbox element specified by id|class|name|label.
14
+
15
+ ## Examples
16
+
17
+ **Example (1): label**
18
+ ```
19
+ When we uncheck "Remember me"
20
+ ```
21
+
22
+ **Example (2): id/class**
23
+ ```
24
+ When I uncheck "rememberme"
25
+ ```
26
+
27
+ ## More examples
28
+
29
+ <!-- generated: extended-examples -->
30
+
31
+ ### Example 1
32
+
33
+ ```gherkin
34
+ When I uncheck "Remember me"
35
+ And I press "Sign in"
36
+ ```
37
+
38
+ ### Example 2
39
+
40
+ ```gherkin
41
+ When I uncheck "#newsletter"
42
+ Then the "#newsletter" checkbox should not be checked
43
+ ```
44
+
45
+ ### Example 3
46
+
47
+ ```gherkin
48
+ When we uncheck ".terms"
49
+ ```
50
+
51
+ ### Example 4
52
+
53
+ ```gherkin
54
+ When I uncheck "Subscribe to updates"
55
+ Then the checkbox "#subscribe" is not checked
56
+ ```
57
+
@@ -0,0 +1,64 @@
1
+
2
+ # When I wait for AJAX to finish
3
+
4
+ ## Step Definition
5
+
6
+ ```gherkin
7
+ 'When (I |we )*wait for AJAX to finish'
8
+ ```
9
+
10
+ ## Description
11
+
12
+ "This step waits for an active XMLHttpRequest and Fetch API requests to complete."
13
+
14
+ ## Examples
15
+
16
+ ```gherkin
17
+ When I wait for AJAX to finish
18
+ ```
19
+
20
+ ```gherkin
21
+ And I wait for AJAX to finish
22
+ ```
23
+
24
+ ```gherkin
25
+ When we wait for AJAX to finish
26
+ ```
27
+
28
+ ```gherkin
29
+ And wait for AJAX to finish
30
+ ```
31
+
32
+ ## More examples
33
+
34
+ <!-- generated: extended-examples -->
35
+
36
+ ### Example 1
37
+
38
+ ```gherkin
39
+ When I press "Search"
40
+ And I wait for AJAX to finish
41
+ Then I should see "Results"
42
+ ```
43
+
44
+ ### Example 2
45
+
46
+ ```gherkin
47
+ When I follow "Inbox"
48
+ And I wait for AJAX to finish
49
+ Then I should see at least 1 ".message" element
50
+ ```
51
+
52
+ ### Example 3
53
+
54
+ ```gherkin
55
+ And I wait for AJAX to finish
56
+ ```
57
+
58
+ ### Example 4
59
+
60
+ ```gherkin
61
+ When we wait for AJAX to finish
62
+ Then "<.toast-success>" should be visible
63
+ ```
64
+
@@ -0,0 +1,62 @@
1
+
2
+ # When I Wait
3
+
4
+ ## Description
5
+
6
+ "This step definition indicates that the user will pause or wait for the specified number of seconds/minutes or the maximum number of seconds/minutes before moving to the next step." The functionality is designed for scenarios requiring time-based delays or expected pauses during test execution.
7
+
8
+ ## Available Step Definitions
9
+
10
+ The "When I wait" category encompasses five distinct variations:
11
+
12
+ 1. **When I wait until the page loaded** - Pauses execution until page load completion
13
+
14
+ 2. **When I wait {number} seconds** - Implements a fixed pause for the specified seconds duration
15
+
16
+ 3. **When I wait max {number} seconds** - Establishes a maximum wait period in seconds with early completion upon condition satisfaction
17
+
18
+ 4. **When I wait {number} minutes** - Creates a fixed pause measured in minutes
19
+
20
+ 5. **When I wait max {number} minutes** - Sets a maximum wait period in minutes, allowing early termination when conditions are met
21
+
22
+ ## Use Cases
23
+
24
+ These steps prove particularly useful in automated testing scenarios where applications require time-dependent behavior verification or asynchronous operations demand explicit wait periods before proceeding with subsequent test steps.
25
+
26
+ ## More examples
27
+
28
+ <!-- generated: extended-examples -->
29
+
30
+ ### Example 1
31
+
32
+ ```gherkin
33
+ When I press "Save"
34
+ And I wait 2 seconds
35
+ Then I should see "Saved"
36
+ ```
37
+
38
+ ### Example 2
39
+
40
+ ```gherkin
41
+ When I follow "Pricing"
42
+ And I wait until the page is loaded
43
+ ```
44
+
45
+ ### Example 3
46
+
47
+ ```gherkin
48
+ And I wait 1 second
49
+ ```
50
+
51
+ ### Example 4
52
+
53
+ ```gherkin
54
+ When I wait max of 5 seconds
55
+ ```
56
+
57
+ ### Example 5
58
+
59
+ ```gherkin
60
+ And I wait until pending timers settle
61
+ ```
62
+
@@ -0,0 +1,50 @@
1
+
2
+ # Step Definitions
3
+
4
+ Step definitions serve as a critical connector in automated testing frameworks employing behavior-driven development (BDD) or test-driven development (TDD) methodologies. They function as "the bridge between the test scenarios or feature files written in a human-readable format and the actual implementation code."
5
+
6
+ ## Example Feature
7
+
8
+ ```
9
+ Feature: Example test for "Then I should be on 'page'"
10
+ As a tester
11
+ I want to be sure I am on "page"
12
+
13
+ Scenario: Check "Then I should be on the 'page'" step definition
14
+ Given I am on the homepage
15
+ When I follow "About Us"
16
+ Then I should be on "about-us.html"
17
+ When I move backward one page
18
+ Then I should be on "/"
19
+ ```
20
+
21
+ ## Available Step Definition Sub-pages
22
+
23
+ - [Given I am on homepage](/docs/webship-js/2.0.x/step-definitions/given-i-am-homepage)
24
+ - [Given I am on "specific" page](/docs/webship-js/2.0.x/step-definitions/given-i-am-specific-page)
25
+ - [When I go to the homepage](/docs/webship-js/2.0.x/step-definitions/when-i-go-homepage)
26
+ - [Given I am an anonymous user](/docs/webship-js/2.0.x/step-definitions/given-i-am-anonymous-user)
27
+ - [When I go to "specific page"](/docs/webship-js/2.0.x/step-definitions/when-i-go-specific-page)
28
+ - [When I reload the page](/docs/webship-js/2.0.x/step-definitions/when-i-reload-page)
29
+ - [When I move backward one page](/docs/webship-js/2.0.x/step-definitions/when-i-move-backward-one-page)
30
+ - [When I move forward one page](/docs/webship-js/2.0.x/step-definitions/when-i-move-forward-one-page)
31
+ - [When I fill in](/docs/webship-js/2.0.x/step-definitions/when-i-fill)
32
+ - [When I press "button"](/docs/webship-js/2.0.x/step-definitions/when-i-press-button)
33
+ - [When I click "link"](/docs/webship-js/2.0.x/step-definitions/when-i-click-link)
34
+ - [When I check "checkbox"](/docs/webship-js/2.0.x/step-definitions/when-i-check-checkbox)
35
+ - [When I uncheck "checkbox"](/docs/webship-js/2.0.x/step-definitions/when-i-uncheck-checkbox)
36
+ - [When I select "option" from "select list"](/docs/webship-js/2.0.x/step-definitions/when-i-select-option-select-list)
37
+ - [When I click "operation" in "text" row](/docs/webship-js/2.0.x/step-definitions/when-i-click-operation-text-row)
38
+ - [When I wait](/docs/webship-js/2.0.x/step-definitions/when-i-wait)
39
+ - [Then I should see](/docs/webship-js/2.0.x/step-definitions/then-i-should-see)
40
+ - [Then I should be](/docs/webship-js/2.0.x/step-definitions/then-i-should-be)
41
+ - [Then the "item" checkbox](/docs/webship-js/2.0.x/step-definitions/then-item-checkbox)
42
+ - [Then the item should contain](/docs/webship-js/2.0.x/step-definitions/then-item-should-contain)
43
+ - [Then the "item" link should contain "url"](/docs/webship-js/2.0.x/step-definitions/then-item-link-should-contain-url)
44
+ - [Then the "value" radio button is selected](/docs/webship-js/2.0.x/step-definitions/then-value-radio-button-selected)
45
+ - [Then the radio button "value" should be selected](/docs/webship-js/2.0.x/step-definitions/then-radio-button-value-should-be-selected)
46
+ - [Then the response status code should be {number}](/docs/webship-js/2.0.x/step-definitions/then-response-status-code-should-be-number)
47
+ - [When I attach the file "file name" to "element"](/docs/webship-js/2.0.x/step-definitions/when-i-attach-file-file-name-element)
48
+ - [When I scroll](/docs/webship-js/2.0.x/step-definitions/when-i-scroll)
49
+ - [When I select radio button "value"](/docs/webship-js/2.0.x/step-definitions/when-i-select-radio-button-value)
50
+ - [When I wait for AJAX to finish](/docs/webship-js/2.0.x/step-definitions/when-i-wait-ajax-finish)
@@ -0,0 +1,31 @@
1
+ <!DOCTYPE html>
2
+ <html lang="en">
3
+ <head>
4
+ <meta charset="UTF-8">
5
+ <title>Accessibility Demo</title>
6
+ </head>
7
+ <body>
8
+ <header>
9
+ <nav aria-label="Primary"><ul><li><a href="/">Home</a></li></ul></nav>
10
+ </header>
11
+ <main>
12
+ <h1>Accessibility Demo</h1>
13
+ <img src="data:image/gif;base64,R0lGODlhAQABAIAAAP///wAAACH5BAEAAAAALAAAAAABAAEAAAICRAEAOw==" alt="Pixel">
14
+ <img src="data:image/gif;base64,R0lGODlhAQABAIAAAP///wAAACH5BAEAAAAALAAAAAABAAEAAAICRAEAOw==" alt="" role="presentation">
15
+ <form>
16
+ <label for="email">Email</label>
17
+ <input id="email" type="email" name="email">
18
+
19
+ <label for="message">Message</label>
20
+ <textarea id="message" name="message"></textarea>
21
+
22
+ <label>
23
+ <input type="checkbox" name="agree"> I agree
24
+ </label>
25
+
26
+ <button type="submit">Submit</button>
27
+ </form>
28
+ </main>
29
+ <footer><small>&copy; 2026</small></footer>
30
+ </body>
31
+ </html>
@@ -0,0 +1,10 @@
1
+ <!DOCTYPE html>
2
+ <html><head><title>Cookies Demo</title></head>
3
+ <body>
4
+ <script>
5
+ document.cookie = "session_id=abc123; path=/";
6
+ document.cookie = "language=en; path=/";
7
+ document.cookie = "preferences=darkmode-enabled; path=/";
8
+ </script>
9
+ <h1>Cookies set</h1>
10
+ </body></html>
@@ -0,0 +1,12 @@
1
+ <!DOCTYPE html>
2
+ <html><head><title>Date demo</title></head>
3
+ <body>
4
+ <h1>Date</h1>
5
+ <p id="year"></p>
6
+ <p id="month"></p>
7
+ <script>
8
+ var now = new Date();
9
+ document.getElementById('year').textContent = String(now.getFullYear());
10
+ document.getElementById('month').textContent = String(now.getMonth() + 1).padStart(2, '0');
11
+ </script>
12
+ </body></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>
@@ -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,9 @@
1
+ <!DOCTYPE html>
2
+ <html><head><title>Links</title></head>
3
+ <body>
4
+ <a href="/about" title="About us">About</a>
5
+ <a href="https://example.com" title="External">Example</a>
6
+ <div id="nav">
7
+ <a href="/contact">Contact</a>
8
+ </div>
9
+ </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,3 @@
1
+ <!DOCTYPE html>
2
+ <html><head><title>Path</title></head>
3
+ <body><h1 id="t">Path page</h1></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,43 @@
1
+ <!DOCTYPE html>
2
+ <html lang="en">
3
+ <head>
4
+ <meta charset="UTF-8">
5
+ <title>🎬 Video Demo</title>
6
+ <style>
7
+ body { font-family: system-ui, sans-serif; max-width: 720px; margin: 2rem auto; padding: 1rem; background: linear-gradient(180deg, #fdf6e3 0%, #eee8d5 100%); color: #073642; }
8
+ h1 { font-size: 2rem; }
9
+ main { background: #fff; border-radius: 12px; padding: 2rem; box-shadow: 0 4px 20px rgba(0,0,0,0.08); }
10
+ button { font-size: 1.1rem; padding: 0.6rem 1.2rem; background: #268bd2; color: #fff; border: 0; border-radius: 8px; cursor: pointer; margin-right: 0.5rem; }
11
+ button:hover { background: #2aa198; }
12
+ .status { font-size: 1.4rem; padding: 1rem; margin-top: 1rem; border-radius: 8px; background: #fdf6e3; min-height: 2rem; }
13
+ .smile { font-size: 3rem; }
14
+ </style>
15
+ </head>
16
+ <body>
17
+ <h1>🎬 Webship-js Video Demo</h1>
18
+ <main role="main">
19
+ <p>Click a button below — the recording captures the page state change.</p>
20
+ <button id="wave">👋 Wave</button>
21
+ <button id="rocket">🚀 Launch</button>
22
+ <button id="party">🎉 Celebrate</button>
23
+ <div class="status" id="status">Ready to record ⏺️</div>
24
+ <div class="smile" id="smile"></div>
25
+ </main>
26
+ <script>
27
+ const status = document.getElementById('status');
28
+ const smile = document.getElementById('smile');
29
+ document.getElementById('wave').addEventListener('click', () => {
30
+ status.textContent = 'Hello, world 👋';
31
+ smile.textContent = '😀';
32
+ });
33
+ document.getElementById('rocket').addEventListener('click', () => {
34
+ status.textContent = 'Liftoff! 🚀';
35
+ smile.textContent = '🌕';
36
+ });
37
+ document.getElementById('party').addEventListener('click', () => {
38
+ status.textContent = 'Party time 🎉';
39
+ smile.textContent = '🥳';
40
+ });
41
+ </script>
42
+ </body>
43
+ </html>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "webship-js",
3
- "version": "2.0.2",
3
+ "version": "2.0.4",
4
4
  "description": "Webship JS automated functional testing.",
5
5
  "main": "index.js",
6
6
  "bin": {
@@ -19,6 +19,8 @@
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:headed": "HEADLESS=false cucumber-js --config cucumber.js",
23
+ "test:fast": "SLOW_MO=0 cucumber-js --config cucumber.js",
22
24
  "generate-reports": "node ./bin/generate-reports.js",
23
25
  "start": "http-server examples -p 8080 -s"
24
26
  },
@@ -33,14 +35,19 @@
33
35
  },
34
36
  "homepage": "https://github.com/webship/webship-js",
35
37
  "dependencies": {
38
+ "@axe-core/playwright": "^4.11.3",
36
39
  "@cucumber/cucumber": "*",
37
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",
38
45
  "axios": "~1",
39
46
  "cucumber-html-reporter": "^6.0.0",
40
47
  "http-server": "^14.1.1",
48
+ "js-yaml": "^4.1.1",
41
49
  "playwright": "^1.58.2",
42
- "@types/node": "~20",
43
- "ts-node": "~10",
50
+ "tsx": "^4.19.2",
44
51
  "typescript": "~5"
45
52
  }
46
53
  }
@@ -25,8 +25,9 @@ interface PlaywrightConfig {
25
25
  const config: PlaywrightConfig = {
26
26
  browser,
27
27
  launchOptions: {
28
- headless: true,
29
- slowMo: 300,
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,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 3 seconds
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