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
@@ -9,3 +9,11 @@ Feature: An example to verify whether the field contains a specific value identi
9
9
  When I press "Reset" by attr
10
10
  And I fill in "Username" with "user2"
11
11
  Then the "Username" field should contain "user2"
12
+
13
+
14
+ Scenario: Verify that a field named by a CSS selector has a particular value
15
+ Given I am on "/test--then--i-should--not--see-text-in-element.html"
16
+ And I fill in "Username" with "user1"
17
+ Then the "#uname" field should contain "user1"
18
+ And the "[name=username]" field should contain "user1"
19
+ And the "input.unamecss" field should not contain "user2"
@@ -15,4 +15,5 @@ Feature: 🎬 Video recording
15
15
  When I press "🎉 Celebrate"
16
16
  Then I should see "Party time"
17
17
  When I save the current video as "demo.webm"
18
+ Then print video path
18
19
  When I stop video recording
@@ -5,3 +5,92 @@ Feature: Wait step definitions
5
5
  When I wait for 1 second
6
6
  And I wait for 1 seconds
7
7
  And I wait for 1 second for AJAX to finish
8
+
9
+ Scenario: Wait for an element to appear
10
+ Given I am on "/wait-conditions.html"
11
+ Then the element "#notice" should not be displayed
12
+ When I press "Show notice"
13
+ And I wait for "#notice" to appear
14
+ Then the element "#notice" should be displayed
15
+
16
+ Scenario: Wait for an element to disappear
17
+ Given I am on "/wait-conditions.html"
18
+ Then I should see 1 "#spinner" element
19
+ When I press "Finish loading"
20
+ And I wait for "#spinner" to disappear
21
+ Then I should see 0 "#spinner" elements
22
+
23
+ Scenario: Wait for text to appear
24
+ Given I am on "/wait-conditions.html"
25
+ When I press "Show notice"
26
+ And I wait for the text "Notice ready" to appear
27
+ Then the element "#notice" should be displayed
28
+
29
+ Scenario: Wait for text to disappear
30
+ Given I am on "/wait-conditions.html"
31
+ Then I should see "Loading data"
32
+ When I press "Finish loading"
33
+ And we wait for text "Loading data" to disappear
34
+ Then I should not see "Loading data"
35
+
36
+ Scenario: Wait until the URL contains a fragment
37
+ Given I am on "/wait-conditions.html"
38
+ Then the url should not match "step=2"
39
+ When I press "Go to step 2"
40
+ And I wait until the URL contains "?step=2"
41
+ Then the url should match "step=2"
42
+
43
+ Scenario: Wait until the page title is or contains a value
44
+ Given I am on "/wait-conditions.html"
45
+ When I press "Go to step 2"
46
+ And I wait until the page title contains "Step 2"
47
+ And I wait until the page title is "Step 2 - Wait conditions"
48
+ Then "#step" should have text "Step 2"
49
+
50
+ Scenario: Wait until a number of elements match
51
+ Given I am on "/wait-conditions.html"
52
+ When I wait until 0 elements match ".result"
53
+ And I press "Load results"
54
+ And I wait until 3 elements match ".result"
55
+ Then I should see 3 ".result" elements
56
+ When I press "Load more"
57
+ And I wait until at least 4 elements match ".result"
58
+ Then I should see 5 ".result" elements
59
+
60
+ Scenario: Wait until one element matches
61
+ Given I am on "/wait-conditions.html"
62
+ When I press "Show notice"
63
+ And I wait until 1 element matches "#notice:not([hidden])"
64
+ And I wait until at least 1 element matches "#notice:not([hidden])"
65
+ Then the element "#notice" should be displayed
66
+
67
+ Scenario: Eventually the text shows
68
+ Given I am on "/wait-conditions.html"
69
+ When I press "Show notice"
70
+ Then eventually I should see "Notice ready"
71
+ When I press "Go to step 2"
72
+ Then eventually we should see "Step 2" within 8 seconds
73
+
74
+ Scenario: Wait until the pending timers of the page have fired
75
+ Given I am on "/wait-conditions.html"
76
+ When I press "Show notice"
77
+ And I wait until pending timers settle
78
+ Then I should see 1 "#notice:not([hidden])" element
79
+
80
+ Scenario: A wait in minutes returns as soon as the page settles
81
+ Given I am on "/wait-conditions.html"
82
+ When I press "Show notice"
83
+ And I wait 1 minute
84
+ Then I should see 1 "#notice:not([hidden])" element
85
+ When I press "Load results"
86
+ And I wait max of 1 minute
87
+ Then I should see 3 ".result" elements
88
+
89
+ Scenario: A wait with no unit is a wait in seconds
90
+ Given I am on "/wait-conditions.html"
91
+ When I press "Show notice"
92
+ And I wait 5
93
+ Then I should see 1 "#notice:not([hidden])" element
94
+ When I press "Load results"
95
+ And we wait max of 5
96
+ Then I should see 3 ".result" elements
@@ -0,0 +1,100 @@
1
+ Feature: Web-first assertions wait for the page
2
+ As a tester,
3
+ I want an assertion that keeps looking until the page reaches the state I name,
4
+ so that I do not have to put a wait between an action and its check.
5
+
6
+ Scenario: The state of an element
7
+ Given I am on "/web-first.html"
8
+ Then "#banner" should be visible
9
+ And "#secret" should be hidden
10
+ And "#secret" should be attached
11
+ And "#save" should be disabled
12
+ And "#nickname" should be enabled
13
+ And "#nickname" should be editable
14
+
15
+ Scenario: The state an element is not in
16
+ Given I am on "/web-first.html"
17
+ Then "#secret" should not be visible
18
+ And "#banner" should not be hidden
19
+ And "#missing" should not be attached
20
+ And "#save" should not be enabled
21
+ And "#nickname" should not be disabled
22
+ And "#locked" should not be editable
23
+
24
+ Scenario: The focused element
25
+ Given I am on "/web-first.html"
26
+ Then "#nickname" should not be focused
27
+ When I focus on the element "#nickname"
28
+ Then "#nickname" should be focused
29
+ And "#locked" should not be focused
30
+
31
+ Scenario: A state that arrives a moment after the action
32
+ Given I am on "/web-first.html"
33
+ Then "#save" should be disabled
34
+ When I press "Unlock saving"
35
+ Then "#save" should be enabled within 5 seconds
36
+ And "#save" should not be disabled within 5 seconds
37
+
38
+ Scenario: An element inside and outside the viewport
39
+ Given I am on "/web-first.html"
40
+ Then "#banner" should be in the viewport
41
+ And "#footer-note" should not be in the viewport
42
+ When I scroll to the element "#footer-note"
43
+ Then "#footer-note" should be in the viewport within 3 seconds
44
+ And "#banner" should not be in the viewport within 3 seconds
45
+
46
+ Scenario: The number of elements that match
47
+ Given I am on "/web-first.html"
48
+ Then ".item" should have a count of 3
49
+ And "#missing" should have a count of 0
50
+ When I press "Add item"
51
+ Then ".item" should have a count of 4 within 5 seconds
52
+
53
+ Scenario: The value of a field
54
+ Given I am on "/web-first.html"
55
+ Then "#nickname" should have value "webship"
56
+ And "#locked" should have value "read only"
57
+ When I fill in the field "#nickname" with "automation"
58
+ Then "#nickname" should have value "automation" within 3 seconds
59
+
60
+ Scenario: An attribute and a class
61
+ Given I am on "/web-first.html"
62
+ Then "#tab-overview" should have attribute "aria-selected" with value "true"
63
+ And "#tab-overview" should have class "is-active"
64
+ And "#tab-details" should have attribute "aria-selected" with value "false"
65
+ And "#about-link" should have attribute "href" with value "about-us.html"
66
+
67
+ Scenario: Click a tab by its role and name
68
+ Given I am on "/web-first.html"
69
+ Then the "Details" tab should be visible
70
+ When I click the "Details" tab
71
+ Then "#tab-details" should have attribute "aria-selected" with value "true" within 3 seconds
72
+ And "#tab-details" should have class "is-active" within 3 seconds
73
+ And "#tab-overview" should have attribute "aria-selected" with value "false"
74
+ And "#panel" should have text "Details panel"
75
+
76
+ Scenario: Click buttons by their role and name
77
+ Given I am on "/web-first.html"
78
+ Then the "Unlock saving" button should be visible
79
+ And the "Save changes" button should be visible within 3 seconds
80
+ When I click the "Unlock saving" button
81
+ Then "#save" should be enabled
82
+ When we click the "Save changes" button
83
+ Then "#status" should have text "Saved"
84
+
85
+ Scenario: Click a link by its role and name
86
+ Given I am on "/web-first.html"
87
+ Then the "About Us" link should be visible
88
+ When I click the "About Us" link
89
+ Then I should be on "/about-us.html"
90
+
91
+ Scenario: Click a checkbox and a radio by their role and name
92
+ Given I am on "/web-first.html"
93
+ Then the "Subscribe" checkbox should be visible
94
+ And the "Premium" radio should be visible
95
+ And the "#subscribe" checkbox is not checked
96
+ When I click the "Subscribe" checkbox
97
+ Then the "#subscribe" checkbox is checked
98
+ When I click the "Premium" radio
99
+ Then "#choice" should have text "Plan: premium"
100
+ And the radio button "#plan-premium" should be selected
@@ -0,0 +1,96 @@
1
+ Feature: XML response assertions
2
+ As a tester,
3
+ I want to load an XML document from a file or from the scenario and check its elements, attributes and namespaces,
4
+ so that feeds, sitemaps and XML answers are covered like pages are.
5
+
6
+ Scenario: XML loaded from a file under tests/assets
7
+ Given the response content from the file "catalog.xml"
8
+ Then the response should be in XML format
9
+ And the XML element "/catalog" should exist
10
+ And the XML element "/catalog/book" should have 3 elements
11
+ And the XML element "/catalog/status" should have 1 element
12
+ And the XML element "/catalog/status" should be equal to "published"
13
+
14
+ Scenario: Elements exist, are equal and contain, and the opposite of each
15
+ Given the response content from the file "catalog.xml"
16
+ Then the XML element "//book/title" should exist
17
+ And the XML element "/catalog/book[2]/title" should exist
18
+ And the XML element "/catalog/magazine" should not exist
19
+ And the XML element "//error" should not exist
20
+ And the XML element "/catalog/book[1]/title" should be equal to "Testing with Webship-js"
21
+ And the XML element "/catalog/book[3]/title" should not be equal to "Testing with Webship-js"
22
+ And the XML element "/catalog/book[2]/title" should contain "development"
23
+ And the XML element "/catalog/book[2]/title" should not contain "Webship-js"
24
+ And the XML element "/catalog/book[@lang='fr']/price" should be equal to "19.00"
25
+
26
+ Scenario: Attributes exist, are equal and contain, and the opposite of each
27
+ Given the response content from the file "catalog.xml"
28
+ Then the XML attribute "id" on element "/catalog/book[1]" should exist
29
+ And the XML attribute "isbn" on element "/catalog/book[1]" should not exist
30
+ And the XML attribute "version" on element "/catalog" should be equal to "2.0"
31
+ And the XML attribute "lang" on element "/catalog/book[3]" should not be equal to "en"
32
+ And the XML attribute "updated" on element "/catalog" should contain "2026"
33
+ And the XML attribute "currency" on element "/catalog/book[2]/price" should not contain "USD"
34
+
35
+ Scenario: XML written in the scenario
36
+ Given the response content is the following:
37
+ """
38
+ <order id="A-100">
39
+ <customer><name>Webship Tester</name></customer>
40
+ <status>shipped</status>
41
+ </order>
42
+ """
43
+ Then the response should be in XML format
44
+ And the XML element "/order/customer/name" should be equal to "Webship Tester"
45
+ And the XML element "//status" should contain "ship"
46
+ And the XML attribute "id" on element "/order" should be equal to "A-100"
47
+
48
+ Scenario: Namespaces the root element declares
49
+ Given the response content from the file "feed-namespaced.xml"
50
+ Then the XML should use the namespace "http://www.w3.org/2005/Atom"
51
+ And the XML should use the namespace "http://purl.org/dc/elements/1.1/"
52
+ And the XML should not use the namespace "http://www.w3.org/1999/xhtml"
53
+ And the XML element "/feed/entry" should have 2 elements
54
+ And the XML element "/feed/entry[2]/title" should be equal to "Second release"
55
+
56
+ Scenario: Elements and attributes with a namespace prefix
57
+ Given the response content from the file "feed-namespaced.xml"
58
+ Then the XML element "//dc:creator" should exist
59
+ And the XML element "/feed/entry/dc:creator" should have 2 elements
60
+ And the XML element "/feed/entry[1]/dc:creator" should be equal to "Webship"
61
+ And the XML attribute "rel" on element "/feed/atom:link" should be equal to "self"
62
+ And the XML attribute "href" on element "/feed/atom:link" should contain "feed.xml"
63
+ And the XML element "//dc:publisher" should not exist
64
+
65
+ Scenario: A sitemap: names without a prefix in the default namespace
66
+ Given the response content from the file "sitemap.xml"
67
+ Then the XML should use the namespace "http://www.sitemaps.org/schemas/sitemap/0.9"
68
+ And the XML element "/urlset/url" should have 2 elements
69
+ And the XML element "/urlset/url[1]/loc" should be equal to "https://example.com/"
70
+ And the XML element "/urlset/url[2]/lastmod" should contain "2026-11"
71
+ And the XML element "//image:image/image:loc" should contain "logo.png"
72
+ And the XML element "/urlset/url[2]/image:image" should not exist
73
+ And the XML element "/urlset/url[1]/image" should not exist
74
+
75
+ Scenario: Content that is not XML
76
+ Given the response content is the following:
77
+ """
78
+ {"hello": "world"}
79
+ """
80
+ Then the response should not be in XML format
81
+ Given the response content is the following:
82
+ """
83
+ plain text
84
+ """
85
+ Then the response should not be in XML format
86
+ Given the response content is the following:
87
+ """
88
+ <order><status>shipped</order>
89
+ """
90
+ Then the response should not be in XML format
91
+ Given the response content is the following:
92
+ """
93
+ <order><status>shipped</status></order>
94
+ """
95
+ Then the response should be in XML format
96
+ And the XML element "/order/status" should be equal to "shipped"
@@ -47,6 +47,24 @@ Feature: YAML response assertions
47
47
  And the YAML value at "/meta" should be empty
48
48
  And the YAML value at "/name" should not be empty
49
49
 
50
+ Scenario: Content that is not YAML
51
+ Given the YAML response content is the following:
52
+ """
53
+ items: [one, two
54
+ """
55
+ Then the response should not be in YAML format
56
+ Given the YAML response content is the following:
57
+ """
58
+ key: : :
59
+ """
60
+ Then the response should not be in YAML format
61
+ Given the YAML response content is the following:
62
+ """
63
+ items: [one, two]
64
+ """
65
+ Then the response should be in YAML format
66
+ And the YAML element "/items" should have 2 elements
67
+
50
68
  Scenario: Numeric comparisons
51
69
  Given the YAML response content is the following:
52
70
  """
@@ -86,6 +104,20 @@ Feature: YAML response assertions
86
104
  Then the YAML keys at "/metadata" should be exactly "name, namespace, labels"
87
105
  And the YAML at "/metadata" should have keys "name, namespace"
88
106
 
107
+ Scenario: A namespace below the top level is in use, so it is not "not in use"
108
+ Given the YAML response content is the following:
109
+ """
110
+ apiVersion: apps/v1
111
+ kind: Deployment
112
+ metadata:
113
+ name: web
114
+ namespace: webship-production
115
+ """
116
+ Then the YAML should use the namespace "apps/v1"
117
+ And the YAML should use the namespace "webship-production"
118
+ And the YAML should not use the namespace "webship-staging"
119
+ And the YAML should not use the namespace "batch/v1"
120
+
89
121
  Scenario: Multi-document streams
90
122
  Given the YAML response content is the following:
91
123
  """
@@ -100,3 +132,46 @@ Feature: YAML response assertions
100
132
  Given the active YAML document is 2
101
133
  Then the YAML element "/kind" should be equal to "Service"
102
134
 
135
+
136
+ Scenario: YAML loaded from a file under tests/assets
137
+ Given the YAML response content from the file "webship-site.yaml"
138
+ Then the response should be in YAML format
139
+ And the YAML response should have 1 document
140
+ And the YAML element "/name" should be equal to "webship-site"
141
+ And the YAML element "/settings/languages/1" should be equal to "fr"
142
+ And the YAML element "/pages" should have 2 elements
143
+ And the YAML array at "/pages" should contain an item where "/title" is "About us"
144
+
145
+ Scenario: Elements that do not exist, are not equal and do not contain
146
+ Given the YAML response content from the file "webship-site.yaml"
147
+ Then the YAML element "/settings/theme" should not exist
148
+ And the YAML element "/pages/2" should not exist
149
+ And the YAML element "/name" should not be equal to "another-site"
150
+ And the YAML element "/version" should not be equal to "3"
151
+ And the YAML element "/owner/contact" should not contain "webmaster"
152
+ And the YAML element "/settings/languages" should not contain "de"
153
+
154
+ Scenario: Keys of an element that do not exist, are not equal, contain and do not contain
155
+ Given the YAML response content from the file "webship-site.yaml"
156
+ Then the YAML attribute "phone" on element "/owner" should not exist
157
+ And the YAML attribute "theme" on element "/settings" should not exist
158
+ And the YAML attribute "team" on element "/owner" should not be equal to "marketing"
159
+ And the YAML attribute "version" on element "/" should not be equal to "1"
160
+ And the YAML attribute "contact" on element "/owner" should contain "@example.com"
161
+ And the YAML attribute "title" on element "/pages/1" should contain "About"
162
+ And the YAML attribute "contact" on element "/owner" should not contain "webmaster"
163
+ And the YAML attribute "homepage" on element "/settings" should not contain "http"
164
+
165
+ Scenario: The YAML matches a JSON Schema
166
+ Given the YAML response content from the file "webship-site.yaml"
167
+ Then the YAML should match JSON Schema "webship-site.schema.json"
168
+
169
+ Scenario: The YAML equals an expected file once the changing keys are left out
170
+ Given the YAML response content from the file "webship-site.yaml"
171
+ Then the YAML should equal the file "webship-site-expected.yaml" ignoring keys "/status"
172
+ And the YAML should equal the file "webship-site-expected.yaml" ignoring keys "/status/updated, /status/revision"
173
+
174
+ Scenario: The namespace the YAML declares
175
+ Given the YAML response content from the file "webship-site.yaml"
176
+ Then the YAML should use the namespace "production"
177
+ And the YAML should not use the namespace "staging"
@@ -0,0 +1,96 @@
1
+ @must-fail
2
+ Feature: Assertions that must fail, and what they say
3
+ Every scenario asserts something that is not true on the example pages.
4
+ tests/check-must-fail.js runs them and checks that each one fails at its
5
+ last step with the message its description announces, the address of the
6
+ page and a hint.
7
+
8
+ Scenario: A text that is not on the page
9
+ Fails with: The text "Completely different words" was not found on the page after 5 seconds.
10
+ Given I am on "/about-us.html"
11
+ Then I should see "Completely different words"
12
+
13
+ Scenario: A text that is on the page
14
+ Fails with: The text "Paragraph example" is on the page, but it should not be.
15
+ Given I am on "/about-us.html"
16
+ Then I should not see "Paragraph example"
17
+
18
+ Scenario: No text matches a pattern
19
+ Fails with: No text of the page matches "\d{4}-\d{2}-\d{2}".
20
+ Given I am on "/about-us.html"
21
+ Then I should see text matching "\d{4}-\d{2}-\d{2}"
22
+
23
+ Scenario: An element that is not on the page
24
+ Fails with: No element with the text or the label "No such label" was found after 3 seconds.
25
+ Given I am on "/about-us.html"
26
+ Then I should see a "No such label" element
27
+
28
+ Scenario: An element that is not on the page, by attribute
29
+ Fails with: No element with "no-such-element-here" was found after 3 seconds.
30
+ Given I am on "/about-us.html"
31
+ Then I should see a "no-such-element-here" element by attr
32
+
33
+ Scenario: An element that is on the page, by attribute
34
+ Fails with: An element with "paragraphid" is on the page, but it should not be.
35
+ Given I am on "/about-us.html"
36
+ Then I should not see a "paragraphid" element by attr
37
+
38
+ Scenario: A wrong text in an element
39
+ Fails with: The element "h1" does not contain "Completely different words".
40
+ Given I am on "/about-us.html"
41
+ Then I should see "Completely different words" in the "h1" element
42
+
43
+ Scenario: A text in an element that is not on the page
44
+ Fails with: The element "#no-such-element-here" was not found on the page after 5 seconds.
45
+ Given I am on "/about-us.html"
46
+ Then I should see "About Us" in the "#no-such-element-here" element
47
+
48
+ Scenario: A wrong text in an element, by attribute
49
+ Fails with: The element with "paragraphid" does not contain "Completely different words".
50
+ Given I am on "/about-us.html"
51
+ Then I should see "Completely different words" in the "paragraphid" element by attr
52
+
53
+ Scenario: A text of an element that does not match a pattern
54
+ Fails with: The text of the element "h1" does not match "^Contact".
55
+ Given I am on "/about-us.html"
56
+ Then I should see text matching "^Contact" in the "h1" element
57
+
58
+ Scenario: A wrong text in a table row
59
+ Fails with: The "Alice" row does not contain "Pending".
60
+ Given I am on "/table.html"
61
+ Then I should see "Pending" in the "Alice" row
62
+
63
+ Scenario: A table row that is not there
64
+ Fails with: No table row contains "Zoe"
65
+ Given I am on "/table.html"
66
+ Then I should see "Active" in the "Zoe" row
67
+
68
+ Scenario: A wrong number of elements
69
+ Fails with: Expected 7 "#users tbody tr" element(s), got 3.
70
+ Given I am on "/table.html"
71
+ Then I should see 7 "#users tbody tr" elements
72
+
73
+ Scenario: A wrong CSS value
74
+ Fails with: The element "paragraphid" does not have the CSS "display: none".
75
+ Given I am on "/about-us.html"
76
+ Then the "paragraphid" element should contain "display: none"
77
+
78
+ Scenario: A link that leads somewhere else
79
+ Fails with: The address of the link "Contact" does not contain "/pricing".
80
+ Given I am on "/links.html"
81
+ Then the "Contact" link should contain "/pricing"
82
+
83
+ Scenario: A link that is not on the page
84
+ Fails with: No visible link with the text "Pricing" was found after 5 seconds.
85
+ Given I am on "/links.html"
86
+ Then the "Pricing" link should contain "/pricing"
87
+
88
+ Scenario: A wrong response status code
89
+ Fails with: Expected the response status code 404, got 200.
90
+ Given I am on "/about-us.html"
91
+ Then the response status code should be 404
92
+
93
+ Scenario: A response that does not contain a text
94
+ Fails with: The response does not contain "Completely different words".
95
+ Given I am on "/about-us.html"
96
+ Then the response should contain "Completely different words"
@@ -0,0 +1,51 @@
1
+ @must-fail
2
+ Feature: Waits that must fail, and what they say
3
+ Every scenario waits for something that never happens on the example pages.
4
+ tests/check-must-fail.js runs them and checks that each one fails at its
5
+ last step with the message its description announces, the address of the
6
+ page and a hint.
7
+
8
+ Scenario: A text that never arrives
9
+ Fails with: The text "Never arrives" did not appear within 10 seconds.
10
+ Given I am on "/about-us.html"
11
+ When I wait for the text "Never arrives" to appear
12
+
13
+ Scenario: A text that never leaves
14
+ Fails with: The text "Paragraph example" is still on the page after 10 seconds.
15
+ Given I am on "/about-us.html"
16
+ When I wait for the text "Paragraph example" to disappear
17
+
18
+ Scenario: An element that never appears
19
+ Fails with: The element "#no-such-element-here" did not appear within 10 seconds.
20
+ Given I am on "/about-us.html"
21
+ When I wait for "#no-such-element-here" to appear
22
+
23
+ Scenario: An element that never disappears
24
+ Fails with: The element "#paragraphid" is still visible after 10 seconds.
25
+ Given I am on "/about-us.html"
26
+ When I wait for "#paragraphid" to disappear
27
+
28
+ Scenario: A URL that never comes
29
+ Fails with: The URL does not contain "/dashboard" after 10 seconds.
30
+ Given I am on "/about-us.html"
31
+ When I wait until the URL contains "/dashboard"
32
+
33
+ Scenario: A page title that never comes
34
+ Fails with: The page title is not "Dashboard" after 10 seconds.
35
+ Given I am on "/about-us.html"
36
+ When I wait until the page title is "Dashboard"
37
+
38
+ Scenario: A number of elements that is never reached
39
+ Fails with: Expected 7 element(s) matching "#users tbody tr" within 10 seconds.
40
+ Given I am on "/table.html"
41
+ When I wait until 7 elements match "#users tbody tr"
42
+
43
+ Scenario: A minimum number of elements that is never reached
44
+ Fails with: Expected at least 7 element(s) matching "#users tbody tr" within 10 seconds.
45
+ Given I am on "/table.html"
46
+ When I wait until at least 7 elements match "#users tbody tr"
47
+
48
+ Scenario: A text that does not show up in time
49
+ Fails with: The text "Never arrives" did not appear within 2 seconds.
50
+ Given I am on "/about-us.html"
51
+ Then eventually I should see "Never arrives" within 2 seconds
@@ -20,9 +20,9 @@ Override paths with env vars:
20
20
  | `WEBSHIP_REPORT_DISABLE` | _unset_ | `1` to skip HTML generation |
21
21
  | `WEBSHIP_REPORT_THEME` | `bootstrap` | `bootstrap` / `hierarchy` / `foundation` / `simple` |
22
22
  | `WEBSHIP_REPORT_TITLE` | `Test Report` | Brand title in the HTML header |
23
- | `WEBSHIP_REPORT_APP_VERSION` | `2.0.0` | Metadata field |
23
+ | `WEBSHIP_REPORT_APP_VERSION` | the `version` of the project's `package.json` | Metadata field |
24
24
  | `WEBSHIP_REPORT_ENV` | `development` | Test-environment metadata |
25
- | `WEBSHIP_REPORT_EXECUTED` | `Remote` | Execution location metadata |
25
+ | `WEBSHIP_REPORT_EXECUTED` | `Remote` when `CI` is set, else `Local` | Execution location metadata |
26
26
 
27
27
  ## Regenerate manually
28
28
 
@@ -273,7 +273,7 @@ Then(/^every image should have an alt attribute$/, async function () {
273
273
  * Example #1: Then every form field should have an accessible label
274
274
  * Example #2: Given I am on "/register"
275
275
  * Then every form field should have an accessible label
276
- * Example #3: When I open the settings modal
276
+ * Example #3: When I press "Open settings"
277
277
  * Then every form field should have an accessible label
278
278
  * Example #4: And every form field should have an accessible label
279
279
  * Example #5: Then the page should have a main landmark
@@ -362,9 +362,10 @@ Then(/^the page should have exactly one h1$/, async function () {
362
362
  * Useful for tab-order and skip-link tests.
363
363
  *
364
364
  * Example #1: Then the focused element should match "#email"
365
- * Example #2: When I press the "Tab" key
365
+ * Example #2: When I press the key "Tab"
366
366
  * Then the focused element should match "#email"
367
- * Example #3: When I press the "Tab" key 2 times
367
+ * Example #3: When I press the key "Tab"
368
+ * And I press the key "Tab"
368
369
  * Then the focused element should match "#password"
369
370
  * Example #4: When I focus on the element "#search"
370
371
  * Then the focused element should match "input[type=search]"
@@ -387,11 +388,14 @@ Then(/^the focused element should match "([^"]*)"$/, async function (selector) {
387
388
  * <label> → value/placeholder/title/textContent.
388
389
  *
389
390
  * Example #1: Then the focused element should be labeled "Email"
390
- * Example #2: When I press the "Tab" key
391
+ * Example #2: When I press the key "Tab"
391
392
  * Then the focused element should be labeled "Email"
392
- * Example #3: When I press the "Tab" key 2 times
393
+ * Example #3: When I press the key "Tab"
394
+ * And I press the key "Tab"
393
395
  * Then the focused element should be labeled "Password"
394
- * Example #4: When I press the "Tab" key 3 times
396
+ * Example #4: When I press the key "Tab"
397
+ * And I press the key "Tab"
398
+ * And I press the key "Tab"
395
399
  * Then the focused element should be labeled "Sign in"
396
400
  * Example #5: When I focus on the element "#agree"
397
401
  * Then the focused element should be labeled "I agree"
@@ -451,9 +455,9 @@ Then(/^the page should declare a language$/, async function () {
451
455
  * Example #1: Then the page language should be "en"
452
456
  * Example #2: Given I am on the homepage
453
457
  * Then the page language should be "en"
454
- * Example #3: When I switch to the French version
458
+ * Example #3: When I follow "Français"
455
459
  * Then the page language should be "fr"
456
- * Example #4: When I switch to the Arabic version
460
+ * Example #4: When I follow "العربية"
457
461
  * Then the page language should be "ar"
458
462
  * Example #5: And the page language should be "en-US"
459
463
  *