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
package/docs/13-faq.md CHANGED
@@ -63,6 +63,9 @@ filename embeds the feature, scenario line, and timestamp.
63
63
  # One feature.
64
64
  npx cucumber-js tests/features/login.feature
65
65
 
66
+ # One scenario, by the line of its Scenario: keyword.
67
+ npx cucumber-js tests/features/login.feature:12
68
+
66
69
  # One scenario by name match.
67
70
  npx cucumber-js --name "Successful login"
68
71
 
@@ -16,7 +16,7 @@ Keep them consistent across the suite.
16
16
  | `@perf` | Performance budget (page load, request count). |
17
17
  | `@flaky` | Known-unstable. CI retries it once via `--retry` + `--retryTagFilter "@flaky"`. **Never** ship long-term `@flaky` — fix the root cause. |
18
18
  | `@wip` | Work in progress. CI excludes with `--tags "not @wip"`. |
19
- | `@desktop` / `@mobile` | Viewport-locked variants. |
19
+ | `@desktop` / `@mobile` | Viewport-locked variants: the scenario opens at the `desktop` breakpoint (1200 × 900) or the `mobile` breakpoint (375 × 667), or at the sizes `worldParameters.selectors.breakpoints` gives those two names. `@mobile` wins when both are set. A step can still change the viewport. A mobile lane: `--tags "@mobile"`. |
20
20
  | `@external` | Hits a third-party service. Skip in offline test runs. |
21
21
  | `@auth-setup` | One-shot scenarios that produce auth state files. Run manually after credential rotation. |
22
22
 
@@ -55,6 +55,9 @@ npx cucumber-js --tags "not @wip and not @auth-setup"
55
55
  # Accessibility lane.
56
56
  npx cucumber-js --tags "@a11y"
57
57
 
58
+ # Mobile lane — every @mobile scenario at the mobile breakpoint.
59
+ npx cucumber-js --tags "@mobile"
60
+
58
61
  # Flaky lane — separate report, allowed to fail without blocking.
59
62
  npx cucumber-js --tags "@flaky" --retry 2
60
63
 
package/docs/16-ci-cd.md CHANGED
@@ -45,15 +45,23 @@ GitHub's native CI/CD. #1 by adoption (~33% of all open-source repos according t
45
45
 
46
46
  ### Workflow contents
47
47
 
48
- Single job `build` on `ubuntu-latest`:
48
+ Runs on a push to `2.0.x`, on a pull request to `2.0.x` and by hand (`Actions → Github Actions → Run workflow`). The token is read-only (`permissions: contents: read`). A newer push to the same pull request cancels the run in progress. A run on `2.0.x` and a run started by hand have a concurrency group of their own: they are never queued behind another run and never cancelled.
49
49
 
50
- 1. `actions/checkout@v3` — pulls the repo.
51
- 2. `actions/setup-node@v3` — Node 20.x.
50
+ Single job `build` on `ubuntu-latest`, 45-minute limit:
51
+
52
+ 1. `actions/checkout@v7` — pulls the repo.
53
+ 2. `actions/setup-node@v7` — Node 20.x, with the npm cache keyed on `package.json`.
52
54
  3. `npm install`.
53
- 4. `npx playwright install --with-deps chromium`.
54
- 5. `npm start &` — backgrounds the fixture server.
55
- 6. `sleep 3`.
56
- 7. `npm test`.
55
+ 4. `npm run test:report` — generates an HTML report from a small JSON and checks it: no third-party icon, the project's own version, the place of execution.
56
+ 5. `npx playwright install --with-deps chromium`.
57
+ 6. `npm run test:examples` — no browser: every step definition is documented, every example step and every feature step resolves to exactly one definition.
58
+ 7. `npm run test:paths` — no browser: a feature or a scenario (`file:line`) named on the command line runs alone, and naming none runs the whole suite (dry runs).
59
+ 8. `npm start &` — backgrounds the fixture server.
60
+ 9. Waits until the server answers on port 8080 (30 seconds at most).
61
+ 10. `npm run test:must-fail` — runs the scenarios of `tests/must-fail/`, which must fail, and checks that each fails at its last step with the message it announces, the address of the page and a hint.
62
+ 11. `npm test`.
63
+ 12. `npm run test:scaffold` — scaffolds a new project, runs its first `npm test` and one feature named on the command line (see the notes below).
64
+ 13. `actions/upload-artifact@v7` — uploads the report, screenshots and videos, on success and on failure.
57
65
 
58
66
  `FORCE_COLOR=1` is set on the job so cucumber-js v10 emits ANSI colours.
59
67
 
@@ -69,24 +77,32 @@ The badge follows the workflow file name and branch — no extra setup.
69
77
 
70
78
  ### Reports
71
79
 
72
- The current workflow does not upload artefacts. To add them, append:
80
+ Every run, passed or failed, uploads one artifact named `cucumber-report`, kept 14 days (`run page → Artifacts`):
73
81
 
74
82
  ```yaml
75
- - uses: actions/upload-artifact@v4
83
+ - uses: actions/upload-artifact@v7
76
84
  if: always()
77
85
  with:
78
86
  name: cucumber-report
79
87
  path: |
80
- tests/reports/cucumber_report.html
81
- tests/reports/cucumber_report.pdf
82
- tests/reports/cucumber_report.json
88
+ tests/reports/
83
89
  screenshots/
90
+ videos/
91
+ retention-days: 14
92
+ if-no-files-found: ignore
84
93
  ```
85
94
 
95
+ - `tests/reports/` — `cucumber_report.json` and the HTML report `cucumber_report.html`.
96
+ - `screenshots/` — the screenshot of each failed step (`failed_*.png`) and the ones the screenshot steps save.
97
+ - `videos/` — the recordings, when `WEBSHIP_VIDEO` or a `@video` tag turns recording on.
98
+
99
+ For a PDF next to the HTML report, add `npx generate-reports --format pdf` as a step with `if: always()` before the upload.
100
+
86
101
  ### Notes
87
102
 
88
- - A deprecation warning fires on every run: `actions/checkout@v3` and `actions/setup-node@v3` use Node 20 internally; GitHub will force Node 24 on 2026-06-02. Bump to `@v4` (which targets Node 24) before then. We left them at `@v3` for now so existing forks do not need to rewrite YAML.
89
103
  - The fixture server is a tiny `http-server` static site on port 8080 — no Docker daemon required on the runner.
104
+ - After the suite, `npm run test:scaffold` scaffolds a new project in a temporary folder the way the post-install does after `npm init -y`, checks its files and scripts, and runs its first `npm test` against the `examples/` pages.
105
+ - The repository tracks no `package-lock.json`, so the npm cache is keyed on `package.json` (`cache-dependency-path`).
90
106
  - For per-browser matrix: add `strategy.matrix.browser: [chromium, firefox, webkit]` + `BROWSER: ${{ matrix.browser }}` to the env block, and replace `chromium` in the playwright install line with `${{ matrix.browser }}`.
91
107
 
92
108
  ---
@@ -4,10 +4,21 @@
4
4
  ## Overview
5
5
 
6
6
  webship-js ships native HTTP / REST API step definitions powered by
7
- Playwright's request fixture and `axios`. They share the browser
8
- context's cookie jar so the same scenario can mix UI actions and
7
+ Playwright's request API, so the same scenario can mix UI actions and
9
8
  direct API calls.
10
9
 
10
+ The API steps on this page send their requests outside the browser
11
+ session: a request carries the base URL, the authentication and the
12
+ headers the scenario set, and no cookie of the browser. They follow the
13
+ HTTPS setting of the browser context (`ignoreHTTPSErrors` in
14
+ `playwright.config.ts`), so an API served with a self-signed or locally
15
+ issued certificate answers them the same way it answers the browser.
16
+
17
+ To send a request with the cookies of the browser session, after a UI
18
+ login for example, use the short-form REST steps
19
+ (`When I send a REST "GET" request to "/api/me"`), which go through the
20
+ browser context.
21
+
11
22
  ## Available API Step Definitions
12
23
 
13
24
  The documentation lists 22 distinct step definition categories:
@@ -17,7 +17,7 @@ This page documents every supported setting plus its env-var override.
17
17
  | `timeout` | int (ms) | `30000` | Per-step timeout enforced by `setDefaultTimeout`. |
18
18
  | `requireModule` | array | `['tsx/cjs']` | TypeScript runtime support. |
19
19
  | `require` | array | step-definition globs | Files Cucumber-js loads at startup. |
20
- | `paths` | array | `['tests/features/**/*.feature']` | Where to find feature files. The scaffolded `cucumber.js` also reads `FEATURES`, comma-separated: `FEATURES=tests/features/a.feature,tests/features/b.feature`. |
20
+ | `paths` | array | `['tests/features/**/*.feature']` | Where to find feature files. Left empty when the command line names features, scenarios (`file:line`), folders or a rerun file, so that `npx cucumber-js tests/features/a.feature` runs that feature alone (cucumber-js 12 would add it to `paths`). The scaffolded `cucumber.js` also reads `FEATURES`, comma-separated: `FEATURES=tests/features/a.feature,tests/features/b.feature`. |
21
21
  | `format` | array | pretty + JSON report | Output formatters. |
22
22
  | `formatOptions` | object | colour theme | Pretty-formatter colours. |
23
23
  | `worldParameters` | object | (sections below) | Everything passed to the Playwright World. |
@@ -83,7 +83,7 @@ selectors: {
83
83
  filesPath: './tests/selectors/', // base path for JSON presets
84
84
  files: [], // JSON files to auto-load per scenario
85
85
  offset: 60, // px — scroll offset for relative-position assertions
86
- breakpoints: { // viewport sizes (used by responsive.steps.js)
86
+ breakpoints: { // viewport sizes (the viewing-the-site steps; add `mobile` / `desktop` to size the @mobile / @desktop tags)
87
87
  xs: { width: 375, height: 667 },
88
88
  sm: { width: 576, height: 800 },
89
89
  md: { width: 768, height: 1024 },
@@ -49,4 +49,7 @@ ddev yarn test:webkit # Run all tests with WebKit
49
49
 
50
50
  ```
51
51
  ddev exec npx cucumber-js --config cucumber.js tests/features/example.feature
52
+ ddev exec npx cucumber-js --config cucumber.js tests/features/example.feature:12
52
53
  ```
54
+
55
+ A feature, or a scenario by the line of its `Scenario:` keyword, named this way runs alone. A `cucumber.js` scaffolded by an earlier release of Webship-js runs the whole suite instead: there, use `ddev exec env FEATURES=tests/features/example.feature npx cucumber-js --config cucumber.js`, or delete `cucumber.js` and write it again with `ddev exec npx init-webship-js --skip-browsers`.
@@ -4,15 +4,27 @@
4
4
  **Install Webship-js on your project. Simply execute the following command:**
5
5
 
6
6
  ```
7
- npm add webship-js
7
+ npm install webship-js
8
8
  ```
9
9
 
10
+ The install script of the package scaffolds the test project: `cucumber.js`, `playwright.config.ts`, a `tests/` folder with a starter feature, the `test` scripts of `package.json`, and Chromium. When npm skips it (npm warns that webship-js has "install scripts not yet covered by allowScripts", or `--ignore-scripts` is set), scaffold it with:
11
+
12
+ ```
13
+ npx init-webship-js
14
+ ```
15
+
16
+ `npm install-scripts approve webship-js` lets the install script run on the next installs.
17
+
10
18
  ## Automated Functional Acceptance Testing
11
19
 
20
+ The starter feature opens the home page of your site:
21
+
12
22
  ```
13
- npm test
23
+ LAUNCH_URL=https://your-site.example npm test
14
24
  ```
15
25
 
26
+ Without `LAUNCH_URL` the suite opens `http://localhost:8080`.
27
+
16
28
  ### Boost your site's success with automated testing
17
29
 
18
30
  #### For Commercial Professional Support
@@ -0,0 +1,34 @@
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>Accessible page with a legacy widget</title>
7
+ <style>
8
+ .skip-link { position: absolute; left: -9999px; }
9
+ .skip-link:focus { position: static; }
10
+ </style>
11
+ </head>
12
+ <body>
13
+ <a class="skip-link" href="#main-content">Skip to main content</a>
14
+ <header>
15
+ <nav aria-label="Primary"><ul><li><a href="/">Home</a></li></ul></nav>
16
+ </header>
17
+ <main id="main-content">
18
+ <h1>Accessible page with a legacy widget</h1>
19
+ <p>The main content of this page is accessible.</p>
20
+ <form>
21
+ <label for="search">Search</label>
22
+ <input id="search" type="search" name="search">
23
+ <button type="submit">Search</button>
24
+ </form>
25
+ </main>
26
+ <!-- An embedded widget the page does not control: an image without a text
27
+ alternative and a field without a label. -->
28
+ <aside class="legacy-widget" aria-label="Legacy widget">
29
+ <img src="data:image/gif;base64,R0lGODlhAQABAIAAAP///wAAACH5BAEAAAAALAAAAAABAAEAAAICRAEAOw==">
30
+ <input type="text" name="legacy-code">
31
+ </aside>
32
+ <footer><small>&copy; 2026</small></footer>
33
+ </body>
34
+ </html>
@@ -0,0 +1,42 @@
1
+ <!DOCTYPE html>
2
+ <html lang="en">
3
+ <head>
4
+ <meta charset="utf-8">
5
+ <title>Auth state - Webship Testing</title>
6
+ </head>
7
+ <body>
8
+ <h1>Auth state</h1>
9
+ <p>A visitor is signed in when the browser holds the "webship_session" cookie and the "webship_user" local storage entry.</p>
10
+
11
+ <p id="auth-status"></p>
12
+ <button type="button" id="sign-in">Sign in</button>
13
+ <button type="button" id="sign-out">Sign out</button>
14
+
15
+ <script>
16
+ function hasSessionCookie() {
17
+ return document.cookie.split('; ').indexOf('webship_session=signed-in') !== -1;
18
+ }
19
+
20
+ function render() {
21
+ var user = window.localStorage.getItem('webship_user');
22
+ document.getElementById('auth-status').textContent = (hasSessionCookie() && user)
23
+ ? 'Signed in as ' + user
24
+ : 'You are not signed in';
25
+ }
26
+
27
+ document.getElementById('sign-in').addEventListener('click', function () {
28
+ document.cookie = 'webship_session=signed-in; path=/';
29
+ window.localStorage.setItem('webship_user', 'Webship Tester');
30
+ render();
31
+ });
32
+
33
+ document.getElementById('sign-out').addEventListener('click', function () {
34
+ document.cookie = 'webship_session=; path=/; max-age=0';
35
+ window.localStorage.removeItem('webship_user');
36
+ render();
37
+ });
38
+
39
+ render();
40
+ </script>
41
+ </body>
42
+ </html>
@@ -0,0 +1,33 @@
1
+ <!DOCTYPE html>
2
+ <html lang="en">
3
+ <head>
4
+ <meta charset="utf-8">
5
+ <title>Clock</title>
6
+ </head>
7
+ <body>
8
+ <h1>Clock</h1>
9
+
10
+ <p>Today is <span id="today"></span></p>
11
+ <p id="autosave">Draft not saved yet</p>
12
+ <p id="session">Session active</p>
13
+
14
+ <script>
15
+ // Everything on this page reads the browser clock: the date shown, an
16
+ // autosave thirty seconds after the page opens and a session that expires
17
+ // after five minutes.
18
+ var opened = Date.now();
19
+ function set(id, text) {
20
+ var el = document.getElementById(id);
21
+ if (el.textContent !== text) el.textContent = text;
22
+ }
23
+ function render() {
24
+ var elapsed = Date.now() - opened;
25
+ set('today', new Date().toISOString().slice(0, 10));
26
+ if (elapsed >= 30 * 1000) set('autosave', 'Draft saved');
27
+ if (elapsed >= 5 * 60 * 1000) set('session', 'Session expired');
28
+ }
29
+ render();
30
+ setInterval(render, 100);
31
+ </script>
32
+ </body>
33
+ </html>
@@ -0,0 +1,4 @@
1
+ Webship-js release notes
2
+
3
+ - Added: steps for file downloads.
4
+ - Fixed: nothing to see here.
@@ -0,0 +1,4 @@
1
+ name,role,status
2
+ Webship Tester,editor,active
3
+ Webship Admin,administrator,active
4
+ Webship Guest,visitor,blocked
@@ -0,0 +1,16 @@
1
+ <!DOCTYPE html>
2
+ <html lang="en">
3
+ <head>
4
+ <meta charset="utf-8">
5
+ <title>Downloads - Webship Testing</title>
6
+ </head>
7
+ <body>
8
+ <h1>Downloads</h1>
9
+ <p>Each link below saves a file instead of opening it.</p>
10
+ <ul>
11
+ <li><a href="downloads/webship-report.csv" download>Download report</a></li>
12
+ <li><a href="downloads/webship-notes.txt" download="release-notes-2026.txt">Download release notes</a></li>
13
+ <li><a href="downloads/webship-archive.zip" download>Download archive</a></li>
14
+ </ul>
15
+ </body>
16
+ </html>
@@ -0,0 +1,42 @@
1
+ <!DOCTYPE html>
2
+ <html lang="en">
3
+ <head>
4
+ <meta charset="utf-8">
5
+ <title>Elements and the viewport</title>
6
+ <style>
7
+ body { margin: 0; font-family: Arial, sans-serif; }
8
+ #top-banner { height: 40px; line-height: 40px; padding: 0 20px; background: #e7f3ff; }
9
+ #centered-box { width: 300px; margin: 30px auto; padding: 10px; border: 2px solid #333; text-align: center; }
10
+ #left-box { width: 200px; margin: 20px 0 20px 10px; padding: 10px; border: 2px solid #333; }
11
+ #spacer { height: 3000px; background: #f0f4f8; }
12
+ #below-fold { margin: 20px; padding: 10px; border: 2px solid #007bff; }
13
+ #event-log { margin: 20px; font-weight: bold; color: #007bff; }
14
+ </style>
15
+ </head>
16
+ <body>
17
+ <div id="top-banner">Top banner</div>
18
+ <div id="centered-box">Centered box</div>
19
+ <div id="left-box">Left box</div>
20
+ <label for="country" style="margin-left: 10px">Country</label>
21
+ <select id="country" name="country">
22
+ <option value="jo">Jordan</option>
23
+ <option value="ps">Palestine</option>
24
+ </select>
25
+ <button type="button" id="hover-button">Hover button</button>
26
+ <p id="event-log">No event yet</p>
27
+ <div id="spacer">A tall block that pushes the next box below the fold</div>
28
+ <div id="below-fold">Box below the fold</div>
29
+ <script>
30
+ var eventLog = document.getElementById('event-log');
31
+ document.getElementById('country').addEventListener('change', function () {
32
+ eventLog.textContent = 'The change event reached the country field';
33
+ });
34
+ document.getElementById('left-box').addEventListener('webship-ping', function () {
35
+ eventLog.textContent = 'The webship-ping event reached the left box';
36
+ });
37
+ document.getElementById('hover-button').addEventListener('mouseenter', function () {
38
+ eventLog.textContent = 'The pointer is over the hover button';
39
+ });
40
+ </script>
41
+ </body>
42
+ </html>
@@ -0,0 +1,98 @@
1
+ <!DOCTYPE html>
2
+ <html lang="en">
3
+ <head>
4
+ <meta charset="utf-8">
5
+ <title>Field types</title>
6
+ <style>
7
+ .editor { border: 1px solid #999; min-height: 40px; padding: 4px; }
8
+ </style>
9
+ </head>
10
+ <body>
11
+ <h1>Field types</h1>
12
+
13
+ <form id="field-types">
14
+ <h2>Field state</h2>
15
+ <p>
16
+ <label for="account-id">Account ID</label>
17
+ <input id="account-id" name="account_id" type="text" value="A-100" disabled>
18
+ </p>
19
+ <p>
20
+ <label for="display-name">Display name</label>
21
+ <input id="display-name" name="display_name" type="text">
22
+ </p>
23
+
24
+ <h2>Multi-value fields</h2>
25
+ <p>
26
+ <input id="tags-1" name="tags[]" type="text" aria-label="Tag 1">
27
+ <input id="tags-2" name="tags[]" type="text" aria-label="Tag 2">
28
+ <input id="tags-3" name="tags[]" type="text" aria-label="Tag 3">
29
+ </p>
30
+ <p>
31
+ <input id="phones-1" name="phones[0]" type="text" aria-label="Phone 1">
32
+ <input id="phones-2" name="phones[1]" type="text" aria-label="Phone 2">
33
+ </p>
34
+
35
+ <h2>Rich text</h2>
36
+ <textarea id="body" name="body" hidden></textarea>
37
+ <div id="body-editor" class="editor" contenteditable="true" role="textbox" aria-multiline="true" aria-label="Body"></div>
38
+ <p><label id="summary-label" for="summary">Summary</label></p>
39
+ <textarea id="summary" name="summary" hidden></textarea>
40
+ <div id="summary-editor" class="editor" contenteditable="true" role="textbox" aria-multiline="true" aria-labelledby="summary-label"></div>
41
+
42
+ <h2>Select with several values</h2>
43
+ <p>
44
+ <label for="colors">Colors</label>
45
+ <select id="colors" name="colors" multiple size="3">
46
+ <option value="red" selected>Red</option>
47
+ <option value="green">Green</option>
48
+ <option value="blue" selected>Blue</option>
49
+ </select>
50
+ </p>
51
+ <p id="colors-summary">Selected: Red, Blue</p>
52
+
53
+ <h2>Checkboxes</h2>
54
+ <p><label><input type="checkbox" id="newsletter" name="newsletter" checked> Newsletter</label></p>
55
+ <p><label><input type="checkbox" id="terms" name="terms"> Terms</label></p>
56
+
57
+ <h2>Date and time</h2>
58
+ <div class="form-item">
59
+ <label for="reminder-date">Reminder</label>
60
+ <div class="datetime">
61
+ <input type="date" id="reminder-date" name="reminder_date" aria-label="Reminder date">
62
+ <input type="time" id="reminder-time" name="reminder_time" aria-label="Reminder time">
63
+ </div>
64
+ </div>
65
+ <div class="form-item">
66
+ <label for="pickup-date">Pickup</label>
67
+ <div class="datetime">
68
+ <input type="date" id="pickup-date" name="pickup_date" aria-label="Pickup date">
69
+ <input type="time" id="pickup-time" name="pickup_time" aria-label="Pickup time">
70
+ </div>
71
+ </div>
72
+
73
+ <p class="form-item">
74
+ <label for="departure-date">Departure</label>
75
+ <input type="date" id="departure-date" name="departure_date">
76
+ <input type="time" id="departure-time" name="departure_time" aria-label="Departure time">
77
+ </p>
78
+
79
+ <h2>Date range</h2>
80
+ <fieldset>
81
+ <legend>Event</legend>
82
+ <input type="date" id="event-start-date" name="event_start_date" aria-label="Event start date">
83
+ <input type="time" id="event-start-time" name="event_start_time" aria-label="Event start time">
84
+ <input type="date" id="event-end-date" name="event_end_date" aria-label="Event end date">
85
+ <input type="time" id="event-end-time" name="event_end_time" aria-label="Event end time">
86
+ </fieldset>
87
+ </form>
88
+
89
+ <script>
90
+ // Show which colors are selected, so a change is visible on the page.
91
+ var colors = document.getElementById('colors');
92
+ colors.addEventListener('change', function () {
93
+ var names = Array.prototype.map.call(colors.selectedOptions, function (o) { return o.text; });
94
+ document.getElementById('colors-summary').textContent = 'Selected: ' + (names.length ? names.join(', ') : 'none');
95
+ });
96
+ </script>
97
+ </body>
98
+ </html>
@@ -0,0 +1,29 @@
1
+ <!DOCTYPE html>
2
+ <html lang="en">
3
+ <head>
4
+ <meta charset="utf-8">
5
+ <title>Newsletter form</title>
6
+ <style>
7
+ body { margin: 0; padding: 12px; font-family: Arial, sans-serif; }
8
+ input { padding: 6px; margin: 4px 0; }
9
+ </style>
10
+ </head>
11
+ <body>
12
+ <p>Newsletter form inside the iframe</p>
13
+ <label for="subscriber">Your name</label>
14
+ <input type="text" id="subscriber" name="subscriber_name">
15
+ <br>
16
+ <label for="city">Your city</label>
17
+ <input type="text" id="city" name="subscriber_city">
18
+ <p id="greeting"></p>
19
+ <p id="city-note"></p>
20
+ <script>
21
+ document.getElementById('subscriber').addEventListener('input', function () {
22
+ document.getElementById('greeting').textContent = this.value ? 'Hello ' + this.value : '';
23
+ });
24
+ document.getElementById('city').addEventListener('input', function () {
25
+ document.getElementById('city-note').textContent = this.value ? 'City set to ' + this.value : '';
26
+ });
27
+ </script>
28
+ </body>
29
+ </html>
@@ -0,0 +1,26 @@
1
+ <!DOCTYPE html>
2
+ <html lang="en">
3
+ <head>
4
+ <meta charset="utf-8">
5
+ <title>Order form</title>
6
+ <style>
7
+ body { margin: 0; padding: 12px; font-family: Arial, sans-serif; }
8
+ button { margin-right: 8px; padding: 6px 12px; }
9
+ </style>
10
+ </head>
11
+ <body>
12
+ <p>Order form inside the iframe</p>
13
+ <button type="button" id="confirm-btn">Confirm</button>
14
+ <button type="button" id="cancel-btn" class="cancel" name="cancel" data-testid="cancel-order">Cancel</button>
15
+ <p id="order-status"></p>
16
+ <script>
17
+ var orderStatus = document.getElementById('order-status');
18
+ document.getElementById('confirm-btn').addEventListener('click', function () {
19
+ orderStatus.textContent = 'Order confirmed';
20
+ });
21
+ document.getElementById('cancel-btn').addEventListener('click', function () {
22
+ orderStatus.textContent = 'Order cancelled';
23
+ });
24
+ </script>
25
+ </body>
26
+ </html>
@@ -0,0 +1,21 @@
1
+ <!DOCTYPE html>
2
+ <html lang="en">
3
+ <head>
4
+ <meta charset="utf-8">
5
+ <title>Iframes</title>
6
+ <style>
7
+ body { margin: 0; padding: 20px; font-family: Arial, sans-serif; }
8
+ iframe { display: block; width: 480px; height: 220px; border: 2px solid #333; margin: 10px 0 20px; }
9
+ </style>
10
+ </head>
11
+ <body>
12
+ <h1>Iframes</h1>
13
+ <p id="root-note">This text is in the root document</p>
14
+
15
+ <h2>Order</h2>
16
+ <iframe id="order-frame" class="order-widget" name="order" title="Order form" src="iframe-order.html"></iframe>
17
+
18
+ <h2>Newsletter</h2>
19
+ <iframe id="newsletter-frame" class="newsletter-widget" name="newsletter" title="Newsletter form" src="iframe-newsletter.html"></iframe>
20
+ </body>
21
+ </html>
@@ -0,0 +1,35 @@
1
+ <!DOCTYPE html>
2
+ <html lang="en">
3
+ <head>
4
+ <meta charset="utf-8">
5
+ <title>JavaScript errors</title>
6
+ </head>
7
+ <body>
8
+ <h1>JavaScript errors</h1>
9
+ <p>This page is quiet until one of the buttons is pressed.</p>
10
+
11
+ <p>
12
+ <button id="throw-error" type="button">Throw an error</button>
13
+ <button id="log-error" type="button">Log an error</button>
14
+ <button id="log-warning" type="button">Log a warning</button>
15
+ </p>
16
+ <p id="log">Nothing has happened yet</p>
17
+
18
+ <script>
19
+ function note(text) { document.getElementById('log').textContent = text; }
20
+
21
+ document.getElementById('throw-error').addEventListener('click', function () {
22
+ note('An error was thrown');
23
+ throw new Error('Demo failure: the save handler broke');
24
+ });
25
+ document.getElementById('log-error').addEventListener('click', function () {
26
+ note('An error was logged');
27
+ console.error('Demo console error: the request was refused');
28
+ });
29
+ document.getElementById('log-warning').addEventListener('click', function () {
30
+ note('A warning was logged');
31
+ console.warn('Demo console warning: this option is deprecated');
32
+ });
33
+ </script>
34
+ </body>
35
+ </html>
@@ -3,6 +3,7 @@
3
3
  <body>
4
4
  <a href="/about" title="About us">About</a>
5
5
  <a href="https://example.com" title="External">Example</a>
6
+ <a href="/about-us.html" title="Meet the team">Team</a>
6
7
  <div id="nav">
7
8
  <a href="/contact">Contact</a>
8
9
  </div>
@@ -0,0 +1,18 @@
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
+ <meta name="description" content="A plain page with meta tags for the Webship-js meta tag steps.">
7
+ <meta name="keywords" content="webship, testing, meta tags">
8
+ <meta name="robots" content="index,follow">
9
+ <meta name="author" content="Webship">
10
+ <meta property="og:title" content="Meta tags - Webship Testing">
11
+ <meta property="og:type" content="website">
12
+ <title>Meta tags - Webship Testing</title>
13
+ </head>
14
+ <body>
15
+ <h1>Meta tags</h1>
16
+ <p>The head of this page carries a description, keywords, robots, author and Open Graph meta tags.</p>
17
+ </body>
18
+ </html>