webship-js 2.0.10 → 2.0.12
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.circleci/config.yml +10 -1
- package/.drone.yml +7 -7
- package/.github/ISSUE_TEMPLATE/issue.md +37 -0
- package/.github/PULL_REQUEST_TEMPLATE.md +24 -0
- package/.github/workflows/github-actions.yml +101 -4
- package/.gitlab-ci.yml +9 -4
- package/.harness/webship-js-pipeline.yml +5 -6
- package/.semaphore/semaphore.yml +6 -9
- package/.teamcity/settings.kts +7 -6
- package/.travis.yml +6 -1
- package/AGENTS.md +1 -1
- package/CLAUDE.md +69 -24
- package/Jenkinsfile +5 -3
- package/README.md +13 -1
- package/azure-pipelines.yml +17 -8
- package/bamboo-specs/bamboo.yml +9 -15
- package/bin/generate-reports.js +51 -7
- package/bin/init-webship.js +127 -23
- package/bitbucket-pipelines.yml +5 -1
- package/buildspec.yml +6 -7
- package/cloudbuild.yaml +28 -12
- package/codefresh.yml +6 -6
- package/cucumber.js +46 -11
- package/docs/00-quick-start.md +38 -7
- package/docs/02-bbr-smart-waits.md +21 -10
- package/docs/03-selector-registry.md +24 -0
- package/docs/04-step-reference.md +53 -27
- package/docs/05-web-first-assertions.md +6 -0
- package/docs/07-auth-state.md +1 -1
- package/docs/08-clock-mocking.md +21 -2
- package/docs/09-api-testing.md +40 -2
- package/docs/10-accessibility.md +2 -0
- package/docs/11-debugging.md +24 -1
- package/docs/12-ai-agent-guide.md +8 -1
- package/docs/13-faq.md +75 -1
- package/docs/14-recipes-cookbook.md +2 -0
- package/docs/15-tag-conventions.md +5 -1
- package/docs/16-ci-cd.md +161 -124
- package/docs/README.md +5 -5
- package/docs/advanced-screenshots.md +3 -1
- package/docs/api-step-definitions.md +16 -2
- package/docs/global-settings.md +70 -18
- package/docs/install-webship-js/ddev-webship-js.md +3 -0
- package/docs/install-webship-js.md +16 -2
- package/docs/step-definitions/then-i-should-see.md +14 -1
- package/docs/step-definitions/then-item-checkbox.md +2 -0
- package/docs/step-definitions/when-i-fill.md +4 -0
- package/docs/step-definitions/when-i-select-option-select-list.md +2 -0
- package/examples/a11y-legacy-widget.html +34 -0
- package/examples/auth-state.html +42 -0
- package/examples/choice-controls.html +29 -0
- package/examples/clock.html +33 -0
- package/examples/datetime-fields.html +52 -0
- package/examples/downloads/webship-archive.zip +0 -0
- package/examples/downloads/webship-notes.txt +4 -0
- package/examples/downloads/webship-report.csv +4 -0
- package/examples/downloads.html +16 -0
- package/examples/element-selector-hint.html +16 -0
- package/examples/element-viewport.html +42 -0
- package/examples/field-states.html +27 -0
- package/examples/field-types.html +98 -0
- package/examples/fill-in-empty.html +26 -0
- package/examples/fill-unreachable.html +27 -0
- package/examples/iframe-inner.html +20 -0
- package/examples/iframe-nested.html +16 -0
- package/examples/iframe-newsletter.html +29 -0
- package/examples/iframe-order.html +26 -0
- package/examples/iframe-outer.html +15 -0
- package/examples/iframe.html +21 -0
- package/examples/javascript-errors.html +35 -0
- package/examples/links.html +1 -0
- package/examples/metatags.html +18 -0
- package/examples/mouse-and-pointer.html +83 -0
- package/examples/multi-value-fields.html +54 -0
- package/examples/native-dialogs.html +8 -0
- package/examples/network.html +83 -0
- package/examples/registered-names.html +15 -0
- package/examples/scroll-horizontal.html +50 -0
- package/examples/select-by-label.html +33 -0
- package/examples/selectors-position.html +29 -0
- package/examples/settle-budget.html +21 -0
- package/examples/sorted-tables.html +38 -0
- package/examples/storage.html +57 -0
- package/examples/text-matching.html +48 -0
- package/examples/text-order.html +25 -0
- package/examples/touch.html +22 -0
- package/examples/viewport-size.html +24 -0
- package/examples/viewport-top.html +36 -0
- package/examples/wait-conditions.html +69 -0
- package/examples/web-first.html +99 -0
- package/package.json +24 -2
- package/playwright.config.ts +3 -1
- package/tests/assets/catalog.xml +19 -0
- package/tests/assets/feed-namespaced.xml +13 -0
- package/tests/assets/sitemap.xml +14 -0
- package/tests/assets/webship-site-expected.yaml +21 -0
- package/tests/assets/webship-site.schema.json +46 -0
- package/tests/assets/webship-site.yaml +21 -0
- package/tests/check-api-launch-url.js +106 -0
- package/tests/check-assets.js +103 -0
- package/tests/check-attachments.js +105 -0
- package/tests/check-breakpoints.js +117 -0
- package/tests/check-clock.js +143 -0
- package/tests/check-config.js +90 -0
- package/tests/check-context.js +215 -0
- package/tests/check-dry-run.js +104 -0
- package/tests/check-examples.js +241 -0
- package/tests/check-exit-report.js +141 -0
- package/tests/check-javascript-errors.js +105 -0
- package/tests/check-must-fail.js +85 -0
- package/tests/check-paths.js +82 -0
- package/tests/check-report.js +119 -0
- package/tests/check-scaffold.js +246 -0
- package/tests/check-screenshots.js +117 -0
- package/tests/check-settle-verbs.js +137 -0
- package/tests/check-time-limit.js +104 -0
- package/tests/check-video.js +156 -0
- package/tests/check-world.js +167 -0
- package/tests/features/a11y.feature +18 -0
- package/tests/features/api-base-url.feature +25 -0
- package/tests/features/api-form-data.feature +18 -0
- package/tests/features/api-json-paths.feature +24 -0
- package/tests/features/api-response-contains.feature +21 -0
- package/tests/features/api-response-header-presence.feature +17 -0
- package/tests/features/api-response-header.feature +17 -0
- package/tests/features/api-saved-placeholders.feature +37 -0
- package/tests/features/api-step-definitions-individual.feature +1 -1
- package/tests/features/api-tables.feature +40 -0
- package/tests/features/auth-state.feature +32 -0
- package/tests/features/breakpoints.feature +25 -0
- package/tests/features/choice-controls.feature +35 -0
- package/tests/features/clock.feature +27 -0
- package/tests/features/complete-api-testing-examples.feature +1 -1
- package/tests/features/cookie.feature +9 -0
- package/tests/features/datetime-field-lookup.feature +29 -0
- package/tests/features/dialog.feature +27 -0
- package/tests/features/element-selector-hint.feature +14 -0
- package/tests/features/element.feature +47 -0
- package/tests/features/field-state.feature +21 -0
- package/tests/features/field.feature +104 -0
- package/tests/features/file-download.feature +64 -0
- package/tests/features/fill-in-empty-value.feature +41 -0
- package/tests/features/fill-reachable.feature +13 -0
- package/tests/features/iframe-nested.feature +43 -0
- package/tests/features/iframe.feature +83 -0
- package/tests/features/javascript-tolerated-errors.feature +20 -0
- package/tests/features/javascript.feature +47 -0
- package/tests/features/link.feature +11 -0
- package/tests/features/metatag.feature +38 -0
- package/tests/features/modal-open.feature +13 -0
- package/tests/features/mouse-and-pointer.feature +86 -0
- package/tests/features/multi-value-field-lookup.feature +30 -0
- package/tests/features/network-mocking.feature +80 -0
- package/tests/features/registered-names.feature +14 -0
- package/tests/features/responsive.feature +27 -0
- package/tests/features/scroll-horizontal.feature +55 -0
- package/tests/features/select-by-label.feature +31 -0
- package/tests/features/selector-files.feature +14 -0
- package/tests/features/selectors-position.feature +41 -0
- package/tests/features/selectors-table-header.feature +35 -0
- package/tests/features/settle-budget.feature +11 -0
- package/tests/features/sorted-tables.feature +19 -0
- package/tests/features/storage-quoted-values.feature +26 -0
- package/tests/features/storage.feature +98 -0
- package/tests/features/test--then--i-see-locator.feature +13 -0
- package/tests/features/test--then--i-should--see-text-in-element.feature +9 -1
- package/tests/features/test--then--the-field-should-contain-value.feature +8 -0
- package/tests/features/text-matching.feature +38 -0
- package/tests/features/text-order.feature +14 -0
- package/tests/features/touch.feature +21 -0
- package/tests/features/video.feature +1 -0
- package/tests/features/viewport-top.feature +13 -0
- package/tests/features/wait.feature +89 -0
- package/tests/features/web-first.feature +100 -0
- package/tests/features/xml-namespaces.feature +34 -0
- package/tests/features/xml.feature +96 -0
- package/tests/features/yaml.feature +75 -0
- package/tests/must-fail/api-json-paths.feature +21 -0
- package/tests/must-fail/api-response-contains.feature +23 -0
- package/tests/must-fail/api-response-header-presence.feature +17 -0
- package/tests/must-fail/api-response-header.feature +21 -0
- package/tests/must-fail/api-without-base-url.feature +11 -0
- package/tests/must-fail/assertions.feature +96 -0
- package/tests/must-fail/breakpoints.feature +15 -0
- package/tests/must-fail/choice-controls.feature +25 -0
- package/tests/must-fail/clock.feature +11 -0
- package/tests/must-fail/datetime-field.feature +10 -0
- package/tests/must-fail/element-selector-hint.feature +17 -0
- package/tests/must-fail/field-state.feature +20 -0
- package/tests/must-fail/fill-field.feature +30 -0
- package/tests/must-fail/iframe-text.feature +17 -0
- package/tests/must-fail/modal-open.feature +26 -0
- package/tests/must-fail/multi-value-field.feature +18 -0
- package/tests/must-fail/registered-names.feature +25 -0
- package/tests/must-fail/select-list.feature +15 -0
- package/tests/must-fail/selector-files.feature +10 -0
- package/tests/must-fail/sorted-tables.feature +20 -0
- package/tests/must-fail/storage-before-a-page.feature +13 -0
- package/tests/must-fail/text-matching.feature +16 -0
- package/tests/must-fail/text-order.feature +15 -0
- package/tests/must-fail/viewport-top.feature +20 -0
- package/tests/must-fail/waits.feature +51 -0
- package/tests/must-fail/yaml-numbers.feature +48 -0
- package/tests/reports/README.md +2 -2
- package/tests/step-definitions/a11y.steps.js +36 -23
- package/tests/step-definitions/action.steps.js +22 -8
- package/tests/step-definitions/api.steps.js +349 -67
- package/tests/step-definitions/assertion.steps.js +327 -63
- package/tests/step-definitions/auth.steps.js +15 -18
- package/tests/step-definitions/clock.steps.js +22 -0
- package/tests/step-definitions/debug.steps.js +8 -0
- package/tests/step-definitions/dialog.steps.js +9 -2
- package/tests/step-definitions/element.steps.js +135 -18
- package/tests/step-definitions/field.steps.js +523 -80
- package/tests/step-definitions/file-download.steps.js +74 -10
- package/tests/step-definitions/form.steps.js +76 -29
- package/tests/step-definitions/iframe.steps.js +89 -29
- package/tests/step-definitions/input.steps.js +26 -7
- package/tests/step-definitions/javascript.steps.js +64 -22
- package/tests/step-definitions/modal.steps.js +79 -13
- package/tests/step-definitions/navigation.steps.js +14 -0
- package/tests/step-definitions/network.steps.js +15 -5
- package/tests/step-definitions/response.steps.js +6 -4
- package/tests/step-definitions/responsive.steps.js +26 -33
- package/tests/step-definitions/screenshot.steps.js +26 -9
- package/tests/step-definitions/scroll.steps.js +20 -0
- package/tests/step-definitions/selectors.steps.js +104 -51
- package/tests/step-definitions/storage.steps.js +41 -16
- package/tests/step-definitions/table.steps.js +81 -6
- package/tests/step-definitions/video.steps.js +52 -55
- package/tests/step-definitions/wait.steps.js +209 -54
- package/tests/step-definitions/web-first.steps.js +69 -35
- package/tests/step-definitions/webship.js +807 -128
- package/tests/step-definitions/xml.steps.js +124 -28
- package/tests/step-definitions/yaml.steps.js +90 -46
- package/.scratch/commit.txt +0 -14
- package/.scratch/docs.py +0 -42
- package/.scratch/echo-server.js +0 -8
- package/.scratch/echo.js +0 -35
- package/.scratch/echo.pid +0 -1
- package/.scratch/features/cookies.feature +0 -22
- package/.scratch/http.pid +0 -1
- package/.scratch/https.pid +0 -1
- package/.scratch/issue.md +0 -49
- package/.scratch/one.js +0 -2
- package/.scratch/one.json +0 -280
- package/.scratch/patch.py +0 -163
- package/.scratch/pr.md +0 -30
|
@@ -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,15 @@
|
|
|
1
|
+
<!DOCTYPE html>
|
|
2
|
+
<html lang="en">
|
|
3
|
+
<head>
|
|
4
|
+
<meta charset="utf-8">
|
|
5
|
+
<title>Registered names</title>
|
|
6
|
+
</head>
|
|
7
|
+
<body>
|
|
8
|
+
<div class="promo-banner">Members save 10 percent this week</div>
|
|
9
|
+
<form class="search-box" action="#">
|
|
10
|
+
<input type="search" aria-describedby="search-help">
|
|
11
|
+
<p id="search-help">Type a product name</p>
|
|
12
|
+
<button type="submit" id="subscribe">Subscribe</button>
|
|
13
|
+
</form>
|
|
14
|
+
</body>
|
|
15
|
+
</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,33 @@
|
|
|
1
|
+
<!DOCTYPE html>
|
|
2
|
+
<html lang="en">
|
|
3
|
+
<head>
|
|
4
|
+
<meta charset="utf-8">
|
|
5
|
+
<title>Select lists named by their label</title>
|
|
6
|
+
<style>
|
|
7
|
+
body { font-family: Arial, sans-serif; padding: 20px; }
|
|
8
|
+
label { display: block; margin-top: 12px; }
|
|
9
|
+
</style>
|
|
10
|
+
</head>
|
|
11
|
+
<body>
|
|
12
|
+
<h1>Select lists named by their label</h1>
|
|
13
|
+
<p>The label of each select list is one word, and its name and id are something else.</p>
|
|
14
|
+
|
|
15
|
+
<form id="vehicle-form">
|
|
16
|
+
<label for="vehicle-list">Cars</label>
|
|
17
|
+
<select id="vehicle-list" name="vehicle">
|
|
18
|
+
<option value="">- Choose -</option>
|
|
19
|
+
<option value="volvo">Volvo</option>
|
|
20
|
+
<option value="saab">Saab</option>
|
|
21
|
+
<option value="mercedes">Mercedes</option>
|
|
22
|
+
</select>
|
|
23
|
+
|
|
24
|
+
<label for="filters-colour">Colour</label>
|
|
25
|
+
<select id="filters-colour" name="filters[colour]">
|
|
26
|
+
<option value="">- Any -</option>
|
|
27
|
+
<option value="red">Red</option>
|
|
28
|
+
<option value="green">Green</option>
|
|
29
|
+
<option value="blue">Blue</option>
|
|
30
|
+
</select>
|
|
31
|
+
</form>
|
|
32
|
+
</body>
|
|
33
|
+
</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,21 @@
|
|
|
1
|
+
<!DOCTYPE html>
|
|
2
|
+
<html lang="en">
|
|
3
|
+
<head>
|
|
4
|
+
<meta charset="utf-8">
|
|
5
|
+
<title>Settle budget</title>
|
|
6
|
+
</head>
|
|
7
|
+
<body>
|
|
8
|
+
<h1>Settle budget</h1>
|
|
9
|
+
<p>The button answers one second after it is pressed, the way a slow request would.</p>
|
|
10
|
+
<button id="load" type="button">Load</button>
|
|
11
|
+
<p id="status">Waiting</p>
|
|
12
|
+
<script>
|
|
13
|
+
document.getElementById('load').addEventListener('click', function () {
|
|
14
|
+
document.getElementById('status').textContent = 'Loading';
|
|
15
|
+
setTimeout(function () {
|
|
16
|
+
document.getElementById('status').textContent = 'Loaded';
|
|
17
|
+
}, 1000);
|
|
18
|
+
});
|
|
19
|
+
</script>
|
|
20
|
+
</body>
|
|
21
|
+
</html>
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
<!DOCTYPE html>
|
|
2
|
+
<html lang="en">
|
|
3
|
+
<head>
|
|
4
|
+
<meta charset="utf-8">
|
|
5
|
+
<title>Sorted tables</title>
|
|
6
|
+
</head>
|
|
7
|
+
<body>
|
|
8
|
+
<h1>Sorted tables</h1>
|
|
9
|
+
|
|
10
|
+
<table id="prices">
|
|
11
|
+
<thead><tr><th>Product</th><th>Price</th><th>Stock</th><th>Released</th></tr></thead>
|
|
12
|
+
<tbody>
|
|
13
|
+
<tr><td>Cable</td><td>$9.99</td><td>2</td><td>Mar 9, 2026</td></tr>
|
|
14
|
+
<tr><td>keyboard</td><td>$49.99</td><td>10</td><td>Jun 21, 2026</td></tr>
|
|
15
|
+
<tr><td>Monitor</td><td>$900.00</td><td>100</td><td>Nov 17, 2026</td></tr>
|
|
16
|
+
<tr><td>Workstation</td><td>$1,299.00</td><td>1,250</td><td>Dec 1, 2026</td></tr>
|
|
17
|
+
</tbody>
|
|
18
|
+
</table>
|
|
19
|
+
|
|
20
|
+
<table id="items">
|
|
21
|
+
<thead><tr><th>Item</th><th>Discount</th></tr></thead>
|
|
22
|
+
<tbody>
|
|
23
|
+
<tr><td>Item 10</td><td>5 %</td></tr>
|
|
24
|
+
<tr><td>Item 2</td><td>12 %</td></tr>
|
|
25
|
+
<tr><td>Item 1</td><td>12 %</td></tr>
|
|
26
|
+
</tbody>
|
|
27
|
+
</table>
|
|
28
|
+
|
|
29
|
+
<table id="unsorted">
|
|
30
|
+
<thead><tr><th>Price</th></tr></thead>
|
|
31
|
+
<tbody>
|
|
32
|
+
<tr><td>$49.99</td></tr>
|
|
33
|
+
<tr><td>$9.99</td></tr>
|
|
34
|
+
<tr><td>$900.00</td></tr>
|
|
35
|
+
</tbody>
|
|
36
|
+
</table>
|
|
37
|
+
</body>
|
|
38
|
+
</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,48 @@
|
|
|
1
|
+
<!DOCTYPE html>
|
|
2
|
+
<html lang="en">
|
|
3
|
+
<head>
|
|
4
|
+
<meta charset="utf-8">
|
|
5
|
+
<title>Text matching</title>
|
|
6
|
+
<style>
|
|
7
|
+
.visually-hidden { display: none; }
|
|
8
|
+
</style>
|
|
9
|
+
</head>
|
|
10
|
+
<body>
|
|
11
|
+
<h1>Text matching</h1>
|
|
12
|
+
|
|
13
|
+
<nav class="pager">
|
|
14
|
+
<a href="#page-2">Next page</a>
|
|
15
|
+
</nav>
|
|
16
|
+
|
|
17
|
+
<p class="promo visually-hidden">Members save 10 percent</p>
|
|
18
|
+
|
|
19
|
+
<p class="total">Order
|
|
20
|
+
total: 42
|
|
21
|
+
items</p>
|
|
22
|
+
|
|
23
|
+
<div id="toast">Saving draft</div>
|
|
24
|
+
<div id="status"></div>
|
|
25
|
+
<p class="late-hidden visually-hidden"></p>
|
|
26
|
+
|
|
27
|
+
<style>
|
|
28
|
+
.styleRuleMarker { color: #333; }
|
|
29
|
+
</style>
|
|
30
|
+
<script>
|
|
31
|
+
var inlineScriptMarker = 'only a script reads this';
|
|
32
|
+
// A countdown on setInterval, which the smart waits do not count as a
|
|
33
|
+
// pending timer: the page has settled before the toast goes and the
|
|
34
|
+
// status arrives, so a step has to wait for them itself.
|
|
35
|
+
(function () {
|
|
36
|
+
var start = Date.now();
|
|
37
|
+
var timer = setInterval(function () {
|
|
38
|
+
if (Date.now() - start < 2000) return;
|
|
39
|
+
clearInterval(timer);
|
|
40
|
+
var toast = document.getElementById('toast');
|
|
41
|
+
if (toast) toast.remove();
|
|
42
|
+
document.getElementById('status').textContent = 'Draft saved';
|
|
43
|
+
document.querySelector('.late-hidden').textContent = 'Saved as version 2';
|
|
44
|
+
}, 100);
|
|
45
|
+
})();
|
|
46
|
+
</script>
|
|
47
|
+
</body>
|
|
48
|
+
</html>
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
<!DOCTYPE html>
|
|
2
|
+
<html lang="en">
|
|
3
|
+
<head>
|
|
4
|
+
<meta charset="utf-8">
|
|
5
|
+
<title>Text order</title>
|
|
6
|
+
</head>
|
|
7
|
+
<body>
|
|
8
|
+
<header>
|
|
9
|
+
<nav class="main-menu">
|
|
10
|
+
<a href="#products">Products</a> ·
|
|
11
|
+
<a href="#home">Home</a>
|
|
12
|
+
</nav>
|
|
13
|
+
</header>
|
|
14
|
+
<nav class="breadcrumb">
|
|
15
|
+
<a href="#home">Home</a> ›
|
|
16
|
+
<a href="#products">Products</a> ›
|
|
17
|
+
<span>Laptops</span>
|
|
18
|
+
</nav>
|
|
19
|
+
<main>
|
|
20
|
+
<h1>Laptops</h1>
|
|
21
|
+
<p>Subtotal: $900.00</p>
|
|
22
|
+
<p>Total: $990.00</p>
|
|
23
|
+
</main>
|
|
24
|
+
</body>
|
|
25
|
+
</html>
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
<!DOCTYPE html>
|
|
2
|
+
<html lang="en">
|
|
3
|
+
<head>
|
|
4
|
+
<meta charset="utf-8">
|
|
5
|
+
<title>Touch</title>
|
|
6
|
+
</head>
|
|
7
|
+
<body>
|
|
8
|
+
<h1>Touch</h1>
|
|
9
|
+
<p>One card listens to touch only, the way a mobile control often does; the other one to a click.</p>
|
|
10
|
+
<div id="touch-card" style="padding:24px;border:1px solid #888">Touch card</div>
|
|
11
|
+
<div id="click-card" style="padding:24px;border:1px solid #888">Click card</div>
|
|
12
|
+
<p id="result">Nothing happened yet</p>
|
|
13
|
+
<script>
|
|
14
|
+
document.getElementById('touch-card').addEventListener('touchstart', function () {
|
|
15
|
+
document.getElementById('result').textContent = 'Touched the card';
|
|
16
|
+
});
|
|
17
|
+
document.getElementById('click-card').addEventListener('click', function () {
|
|
18
|
+
document.getElementById('result').textContent = 'Clicked the card';
|
|
19
|
+
});
|
|
20
|
+
</script>
|
|
21
|
+
</body>
|
|
22
|
+
</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,36 @@
|
|
|
1
|
+
<!DOCTYPE html>
|
|
2
|
+
<html lang="en">
|
|
3
|
+
<head>
|
|
4
|
+
<meta charset="utf-8">
|
|
5
|
+
<title>Top of the viewport</title>
|
|
6
|
+
<style>
|
|
7
|
+
body { margin: 0; }
|
|
8
|
+
section { height: 1200px; padding: 0; border-top: 1px solid #ccc; }
|
|
9
|
+
h2 { margin: 0; }
|
|
10
|
+
</style>
|
|
11
|
+
</head>
|
|
12
|
+
<body>
|
|
13
|
+
<section id="section-1">
|
|
14
|
+
<h2>Section 1</h2>
|
|
15
|
+
<button type="button" id="go-3">Go to section 3</button>
|
|
16
|
+
</section>
|
|
17
|
+
<section id="section-2"><h2>Section 2</h2></section>
|
|
18
|
+
<section id="section-3"><h2>Section 3</h2></section>
|
|
19
|
+
<section id="section-4"><h2>Section 4</h2></section>
|
|
20
|
+
<section id="section-5"><h2>Section 5</h2></section>
|
|
21
|
+
<div id="hidden-section" style="display: none">Hidden</div>
|
|
22
|
+
<script>
|
|
23
|
+
// The page scrolls to section 3 a second and a half after the click, on
|
|
24
|
+
// setInterval, which the smart waits do not count as a pending timer: the
|
|
25
|
+
// step that checks the place of the section has to wait for it itself.
|
|
26
|
+
document.getElementById('go-3').addEventListener('click', function () {
|
|
27
|
+
var start = Date.now();
|
|
28
|
+
var timer = setInterval(function () {
|
|
29
|
+
if (Date.now() - start < 1500) return;
|
|
30
|
+
clearInterval(timer);
|
|
31
|
+
window.scrollTo(0, document.getElementById('section-3').offsetTop);
|
|
32
|
+
}, 100);
|
|
33
|
+
});
|
|
34
|
+
</script>
|
|
35
|
+
</body>
|
|
36
|
+
</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>
|