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.
- package/.github/ISSUE_TEMPLATE/issue.md +37 -0
- package/.github/PULL_REQUEST_TEMPLATE.md +24 -0
- package/.github/workflows/github-actions.yml +56 -4
- package/CLAUDE.md +5 -2
- package/README.md +13 -1
- package/bin/generate-reports.js +51 -7
- package/bin/init-webship.js +85 -17
- package/cucumber.js +29 -1
- package/docs/00-quick-start.md +30 -7
- package/docs/02-bbr-smart-waits.md +6 -0
- package/docs/04-step-reference.md +2 -2
- package/docs/09-api-testing.md +9 -2
- package/docs/11-debugging.md +21 -0
- package/docs/12-ai-agent-guide.md +3 -1
- package/docs/13-faq.md +3 -0
- package/docs/15-tag-conventions.md +4 -1
- package/docs/16-ci-cd.md +29 -13
- package/docs/api-step-definitions.md +13 -2
- package/docs/global-settings.md +2 -2
- package/docs/install-webship-js/ddev-webship-js.md +3 -0
- package/docs/install-webship-js.md +14 -2
- package/examples/a11y-legacy-widget.html +34 -0
- package/examples/auth-state.html +42 -0
- package/examples/clock.html +33 -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-viewport.html +42 -0
- package/examples/field-types.html +98 -0
- package/examples/iframe-newsletter.html +29 -0
- package/examples/iframe-order.html +26 -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/native-dialogs.html +8 -0
- package/examples/network.html +83 -0
- package/examples/scroll-horizontal.html +50 -0
- package/examples/selectors-position.html +29 -0
- package/examples/storage.html +57 -0
- package/examples/viewport-size.html +24 -0
- package/examples/wait-conditions.html +69 -0
- package/examples/web-first.html +99 -0
- package/package.json +9 -2
- 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-examples.js +235 -0
- package/tests/check-must-fail.js +84 -0
- package/tests/check-paths.js +82 -0
- package/tests/check-report.js +119 -0
- package/tests/check-scaffold.js +211 -0
- package/tests/features/a11y.feature +18 -0
- package/tests/features/auth-state.feature +32 -0
- package/tests/features/clock.feature +27 -0
- package/tests/features/cookie.feature +9 -0
- package/tests/features/dialog.feature +27 -0
- package/tests/features/element.feature +47 -0
- package/tests/features/field.feature +104 -0
- package/tests/features/file-download.feature +64 -0
- package/tests/features/iframe.feature +83 -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/mouse-and-pointer.feature +86 -0
- package/tests/features/network-mocking.feature +80 -0
- package/tests/features/responsive.feature +27 -0
- package/tests/features/rest-and-api-requests.feature +120 -0
- package/tests/features/scroll-horizontal.feature +55 -0
- package/tests/features/selectors-position.feature +41 -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/video.feature +1 -0
- package/tests/features/wait.feature +89 -0
- package/tests/features/web-first.feature +100 -0
- package/tests/features/xml.feature +96 -0
- package/tests/features/yaml.feature +75 -0
- package/tests/must-fail/assertions.feature +96 -0
- package/tests/must-fail/waits.feature +51 -0
- package/tests/reports/README.md +2 -2
- package/tests/step-definitions/a11y.steps.js +12 -8
- package/tests/step-definitions/api.steps.js +18 -45
- package/tests/step-definitions/assertion.steps.js +235 -61
- package/tests/step-definitions/dialog.steps.js +2 -2
- package/tests/step-definitions/element.steps.js +3 -1
- package/tests/step-definitions/field.steps.js +152 -22
- package/tests/step-definitions/file-download.steps.js +74 -10
- package/tests/step-definitions/rest.steps.js +23 -12
- package/tests/step-definitions/screenshot.steps.js +1 -1
- package/tests/step-definitions/selectors.steps.js +9 -3
- package/tests/step-definitions/storage.steps.js +3 -3
- package/tests/step-definitions/wait.steps.js +129 -39
- package/tests/step-definitions/webship.js +211 -3
- package/tests/step-definitions/xml.steps.js +76 -14
- package/tests/step-definitions/yaml.steps.js +46 -27
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
Feature: JavaScript errors of the page
|
|
2
|
+
As a tester,
|
|
3
|
+
I want to know when the page throws or logs an error,
|
|
4
|
+
so that a broken script does not hide behind a page that still looks right.
|
|
5
|
+
|
|
6
|
+
Scenario: A quiet page has no JavaScript errors and no warnings
|
|
7
|
+
Given I am on "/javascript-errors.html"
|
|
8
|
+
Then I should see "Nothing has happened yet"
|
|
9
|
+
And there should be no JavaScript errors
|
|
10
|
+
And there should be no JavaScript warnings
|
|
11
|
+
And JavaScript errors should not match "Demo"
|
|
12
|
+
And print JavaScript errors
|
|
13
|
+
|
|
14
|
+
Scenario: A warning is not an error
|
|
15
|
+
Given I am on "/javascript-errors.html"
|
|
16
|
+
When I press "Log a warning"
|
|
17
|
+
Then I should see "A warning was logged"
|
|
18
|
+
And there should be no JavaScript errors
|
|
19
|
+
|
|
20
|
+
# The page throws on purpose here. "@js-warn" keeps this scenario in the
|
|
21
|
+
# reporting mode whatever WEBSHIP_JS_ERROR_MODE the run uses, so a run in
|
|
22
|
+
# "fail" mode does not fail on the error this scenario asks for.
|
|
23
|
+
@js-warn
|
|
24
|
+
Scenario: An error the page throws is collected and can be matched
|
|
25
|
+
Given I am on "/javascript-errors.html"
|
|
26
|
+
When I press "Throw an error"
|
|
27
|
+
Then I should see "An error was thrown"
|
|
28
|
+
And JavaScript errors should not match "TypeError"
|
|
29
|
+
And JavaScript errors should not match "is not defined"
|
|
30
|
+
And print JavaScript errors
|
|
31
|
+
|
|
32
|
+
@js-warn
|
|
33
|
+
Scenario: An error the page logs is collected and can be matched
|
|
34
|
+
Given I am on "/javascript-errors.html"
|
|
35
|
+
When I press "Log an error"
|
|
36
|
+
Then I should see "An error was logged"
|
|
37
|
+
And JavaScript errors should not match "^Demo failure"
|
|
38
|
+
And print JavaScript errors
|
|
39
|
+
|
|
40
|
+
# With "@js-off" nothing is collected, so the hard check passes even on a
|
|
41
|
+
# page that throws.
|
|
42
|
+
@js-off
|
|
43
|
+
Scenario: Nothing is collected when the collector is off
|
|
44
|
+
Given I am on "/javascript-errors.html"
|
|
45
|
+
When I press "Throw an error"
|
|
46
|
+
Then I should see "An error was thrown"
|
|
47
|
+
And there should be no JavaScript errors
|
|
@@ -9,3 +9,14 @@ Feature: Link step definitions
|
|
|
9
9
|
And the link with the title "Nonexistent" should not exist
|
|
10
10
|
And the link "Example" should be an absolute link
|
|
11
11
|
And the link "About" should not be an absolute link
|
|
12
|
+
|
|
13
|
+
Scenario: No link with the text and the href within an element
|
|
14
|
+
Given I am on "/links.html"
|
|
15
|
+
Then the link "Contact" with the href "/contact" within the element "#nav" should exist
|
|
16
|
+
And the link "About" with the href "/about" within the element "#nav" should not exist
|
|
17
|
+
And the link "Contact" with the href "/missing" within the element "#nav" should not exist
|
|
18
|
+
|
|
19
|
+
Scenario: Click on the link with a title
|
|
20
|
+
Given I am on "/links.html"
|
|
21
|
+
When I click on the link with the title "Meet the team"
|
|
22
|
+
Then I should be on "/about-us.html"
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
Feature: Meta tag steps
|
|
2
|
+
As a tester,
|
|
3
|
+
I want to check the meta tags in the head of a page,
|
|
4
|
+
so that search engines and link previews get what the page promises.
|
|
5
|
+
|
|
6
|
+
Scenario: A meta tag with the given attributes exists
|
|
7
|
+
Given I am on "/metatags.html"
|
|
8
|
+
Then the meta tag should exist with the following attributes:
|
|
9
|
+
| name | description |
|
|
10
|
+
| content | A plain page with meta tags for the Webship-js meta tag steps. |
|
|
11
|
+
And the meta tag should exist with the following attributes:
|
|
12
|
+
| property | og:title |
|
|
13
|
+
| content | Meta tags - Webship Testing |
|
|
14
|
+
And the meta tag should exist with the following attributes:
|
|
15
|
+
| name | robots |
|
|
16
|
+
| content | index,follow |
|
|
17
|
+
And the meta tag should exist with the following attributes:
|
|
18
|
+
| charset | utf-8 |
|
|
19
|
+
|
|
20
|
+
Scenario: A meta tag with the given attributes does not exist
|
|
21
|
+
Given I am on "/metatags.html"
|
|
22
|
+
Then the meta tag should not exist with the following attributes:
|
|
23
|
+
| name | robots |
|
|
24
|
+
| content | noindex,nofollow |
|
|
25
|
+
And the meta tag should not exist with the following attributes:
|
|
26
|
+
| name | description |
|
|
27
|
+
| content | Coming soon |
|
|
28
|
+
And the meta tag should not exist with the following attributes:
|
|
29
|
+
| http-equiv | refresh |
|
|
30
|
+
And the meta tag should not exist with the following attributes:
|
|
31
|
+
| property | og:title |
|
|
32
|
+
| content | Placeholder |
|
|
33
|
+
|
|
34
|
+
Scenario: The content of a meta tag is plain text
|
|
35
|
+
Given I am on "/metatags.html"
|
|
36
|
+
Then the "description" meta tag should not contain any HTML tags
|
|
37
|
+
And the "keywords" meta tag should not contain any HTML tags
|
|
38
|
+
And the "og:title" meta tag should not contain any HTML tags
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
Feature: Mouse and pointer step definitions
|
|
2
|
+
As a tester,
|
|
3
|
+
I want to hover, double-click, right-click, middle-click, click with a key held,
|
|
4
|
+
drag, tap and resize the viewport,
|
|
5
|
+
so that pages reacting to the pointer can be tested.
|
|
6
|
+
|
|
7
|
+
Scenario: Hover over an element
|
|
8
|
+
Given I am on "/mouse-and-pointer.html"
|
|
9
|
+
Then "#result" should have text "Nothing happened yet"
|
|
10
|
+
When I hover over "#hover-card"
|
|
11
|
+
Then "#result" should have text "Hovered over the hover card"
|
|
12
|
+
|
|
13
|
+
Scenario: Move the pointer to an element
|
|
14
|
+
Given I am on "/mouse-and-pointer.html"
|
|
15
|
+
When I move the pointer to "#pointer-card"
|
|
16
|
+
Then "#result" should have text "Pointer moved to the pointer card"
|
|
17
|
+
|
|
18
|
+
Scenario: Move the pointer from one element to another
|
|
19
|
+
Given I am on "/mouse-and-pointer.html"
|
|
20
|
+
When I hover over "#hover-card"
|
|
21
|
+
And I move the pointer to "#pointer-card"
|
|
22
|
+
Then "#result" should have text "Pointer moved to the pointer card"
|
|
23
|
+
|
|
24
|
+
Scenario: Double-click on an element
|
|
25
|
+
Given I am on "/mouse-and-pointer.html"
|
|
26
|
+
When I double-click on "#double-click-card"
|
|
27
|
+
Then "#result" should have text "Double-clicked the card"
|
|
28
|
+
|
|
29
|
+
Scenario: Double click on an element, written without the hyphen
|
|
30
|
+
Given I am on "/mouse-and-pointer.html"
|
|
31
|
+
When I double click on "#double-click-card"
|
|
32
|
+
Then "#result" should have text "Double-clicked the card"
|
|
33
|
+
|
|
34
|
+
Scenario: Right-click on an element
|
|
35
|
+
Given I am on "/mouse-and-pointer.html"
|
|
36
|
+
When I right-click on "#right-click-card"
|
|
37
|
+
Then "#result" should have text "Right-clicked the card"
|
|
38
|
+
|
|
39
|
+
Scenario: Right click on an element, written without the hyphen
|
|
40
|
+
Given I am on "/mouse-and-pointer.html"
|
|
41
|
+
When I right click on "#right-click-card"
|
|
42
|
+
Then "#result" should have text "Right-clicked the card"
|
|
43
|
+
|
|
44
|
+
Scenario: Middle-click on an element
|
|
45
|
+
Given I am on "/mouse-and-pointer.html"
|
|
46
|
+
When I middle-click on "#middle-click-card"
|
|
47
|
+
Then "#result" should have text "Middle-clicked the card"
|
|
48
|
+
|
|
49
|
+
Scenario: Middle click on an element, written without the hyphen
|
|
50
|
+
Given I am on "/mouse-and-pointer.html"
|
|
51
|
+
When I middle click on "#middle-click-card"
|
|
52
|
+
Then "#result" should have text "Middle-clicked the card"
|
|
53
|
+
|
|
54
|
+
Scenario: Click on an element while holding Shift
|
|
55
|
+
Given I am on "/mouse-and-pointer.html"
|
|
56
|
+
When I click on "#modifier-card" while holding "Shift"
|
|
57
|
+
Then "#result" should have text "Clicked while holding Shift"
|
|
58
|
+
|
|
59
|
+
Scenario: Click on an element while holding Control
|
|
60
|
+
Given I am on "/mouse-and-pointer.html"
|
|
61
|
+
When I click on "#modifier-card" while holding "Control"
|
|
62
|
+
Then "#result" should have text "Clicked while holding Control"
|
|
63
|
+
|
|
64
|
+
Scenario: Click on an element while holding Alt
|
|
65
|
+
Given I am on "/mouse-and-pointer.html"
|
|
66
|
+
When I click on "#modifier-card" while holding "Alt"
|
|
67
|
+
Then "#result" should have text "Clicked while holding Alt"
|
|
68
|
+
|
|
69
|
+
Scenario: Drag an element to another element
|
|
70
|
+
Given I am on "/mouse-and-pointer.html"
|
|
71
|
+
Then "#result" should have text "Nothing happened yet"
|
|
72
|
+
When I drag "#drag-card" to "#drop-zone"
|
|
73
|
+
Then "#result" should have text "Dropped the drag card in the drop zone"
|
|
74
|
+
And I should see "Drag card" in the "#drop-zone" element
|
|
75
|
+
|
|
76
|
+
Scenario: Tap on an element
|
|
77
|
+
Given I am on "/mouse-and-pointer.html"
|
|
78
|
+
When I tap on "#tap-card"
|
|
79
|
+
Then "#result" should have text "Tapped the card"
|
|
80
|
+
|
|
81
|
+
Scenario: Set the viewport size
|
|
82
|
+
Given I am on "/viewport-size.html"
|
|
83
|
+
When I set the viewport size to 375x667
|
|
84
|
+
Then "#viewport-size" should have text "Viewport is 375 by 667"
|
|
85
|
+
When I set the viewport size to 1280x720
|
|
86
|
+
Then "#viewport-size" should have text "Viewport is 1280 by 720"
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
Feature: Network mocking, blocking, delaying, offline mode and request assertions
|
|
2
|
+
As a tester,
|
|
3
|
+
I want to decide what a URL answers, to block it, to slow it down and to cut the network,
|
|
4
|
+
so that I can check what the page shows in each case and which requests it sent.
|
|
5
|
+
|
|
6
|
+
Scenario: Without mocking the page shows what the site answers
|
|
7
|
+
Given I am on "/network.html"
|
|
8
|
+
When I press "Load article"
|
|
9
|
+
Then "#article-status" should have text "Article loaded" within 10 seconds
|
|
10
|
+
And "#article-title" should have text "JSON:API paints my bikeshed!"
|
|
11
|
+
And "#article-author" should have text "Written by John"
|
|
12
|
+
And "#article-timing" should have text "Answered in under 2 seconds"
|
|
13
|
+
|
|
14
|
+
Scenario: A URL answers with the JSON of the scenario
|
|
15
|
+
Given the URL "**/example-api.json" returns the JSON:
|
|
16
|
+
"""
|
|
17
|
+
{
|
|
18
|
+
"data": [{"attributes": {"title": "A mocked article"}}],
|
|
19
|
+
"included": [{"attributes": {"name": "Webship"}}]
|
|
20
|
+
}
|
|
21
|
+
"""
|
|
22
|
+
And I am on "/network.html"
|
|
23
|
+
When I press "Load article"
|
|
24
|
+
Then "#article-status" should have text "Article loaded" within 10 seconds
|
|
25
|
+
And "#article-title" should have text "A mocked article"
|
|
26
|
+
And "#article-author" should have text "Written by Webship"
|
|
27
|
+
And I should not see "JSON:API paints my bikeshed!"
|
|
28
|
+
|
|
29
|
+
@js-off
|
|
30
|
+
Scenario: A blocked URL fails in the page
|
|
31
|
+
Given I am on "/network.html"
|
|
32
|
+
And the URL "**/example-api.json" is blocked
|
|
33
|
+
When I press "Load article"
|
|
34
|
+
Then "#article-status" should have text "The article request failed" within 10 seconds
|
|
35
|
+
And "#article-title" should have text ""
|
|
36
|
+
|
|
37
|
+
Scenario: A delayed URL answers late, with the answer of the site
|
|
38
|
+
Given I am on "/network.html"
|
|
39
|
+
And the URL "**/example-api.json" is delayed by 2500 ms
|
|
40
|
+
When I press "Load article"
|
|
41
|
+
Then "#article-status" should have text "Article loaded" within 15 seconds
|
|
42
|
+
And "#article-timing" should have text "Answered after 2 seconds or more"
|
|
43
|
+
And "#article-title" should have text "JSON:API paints my bikeshed!"
|
|
44
|
+
|
|
45
|
+
Scenario: The delay is also written without a space before ms
|
|
46
|
+
Given I am on "/network.html"
|
|
47
|
+
And the URL "**/example-api.json" is delayed by 2500ms
|
|
48
|
+
When I press "Load article"
|
|
49
|
+
Then "#article-status" should have text "Article loaded" within 15 seconds
|
|
50
|
+
And "#article-timing" should have text "Answered after 2 seconds or more"
|
|
51
|
+
|
|
52
|
+
@js-off
|
|
53
|
+
Scenario: Requests fail while the network is offline and work again once it is online
|
|
54
|
+
Given I am on "/network.html"
|
|
55
|
+
Then "#connection" should have text "The browser is online"
|
|
56
|
+
When the network is offline
|
|
57
|
+
And I press "Load article"
|
|
58
|
+
Then "#article-status" should have text "The article request failed" within 10 seconds
|
|
59
|
+
And "#connection" should have text "The browser is offline"
|
|
60
|
+
When the network is online
|
|
61
|
+
And I press "Load article"
|
|
62
|
+
Then "#article-status" should have text "Article loaded" within 10 seconds
|
|
63
|
+
And "#article-title" should have text "JSON:API paints my bikeshed!"
|
|
64
|
+
And "#connection" should have text "The browser is online"
|
|
65
|
+
|
|
66
|
+
Scenario: The requests the page sent are recorded with their method
|
|
67
|
+
Given I am on "/network.html"
|
|
68
|
+
And the URL "**/api/feedback" returns the JSON:
|
|
69
|
+
"""
|
|
70
|
+
{"message": "Thank you from Webship"}
|
|
71
|
+
"""
|
|
72
|
+
And I start recording network requests
|
|
73
|
+
When I press "Load article"
|
|
74
|
+
Then "#article-status" should have text "Article loaded" within 10 seconds
|
|
75
|
+
When I press "Send feedback"
|
|
76
|
+
Then "#feedback-status" should have text "Feedback answer: Thank you from Webship" within 10 seconds
|
|
77
|
+
And a GET request to "**/example-api.json" should have been made
|
|
78
|
+
And a POST request to "**/api/feedback" should have been made
|
|
79
|
+
And a request to "**/api/feedback" should have been made
|
|
80
|
+
And no request to "**/api/tracking" should have been made
|
|
@@ -8,3 +8,30 @@ Feature: Responsive step definitions
|
|
|
8
8
|
And I set the viewport width to 800
|
|
9
9
|
And I set the viewport height to 600
|
|
10
10
|
And I set the viewport to 1024 by 768
|
|
11
|
+
|
|
12
|
+
Scenario: Define responsive breakpoints for the scenario
|
|
13
|
+
Given I am on "/viewport-size.html"
|
|
14
|
+
And the following responsive breakpoints:
|
|
15
|
+
| pocket | 320 | 480 |
|
|
16
|
+
| mobile | 400 | 700 |
|
|
17
|
+
| poster | 900 | 1200 |
|
|
18
|
+
When I set the viewport to the "pocket" breakpoint
|
|
19
|
+
Then "#viewport-size" should have text "Viewport is 320 by 480"
|
|
20
|
+
When I set the viewport to the "poster" breakpoint
|
|
21
|
+
Then "#viewport-size" should have text "Viewport is 900 by 1200"
|
|
22
|
+
When I set the viewport to the "mobile" breakpoint
|
|
23
|
+
Then "#viewport-size" should have text "Viewport is 400 by 700"
|
|
24
|
+
When I set the viewport to the "tablet" breakpoint
|
|
25
|
+
Then "#viewport-size" should have text "Viewport is 768 by 1024"
|
|
26
|
+
|
|
27
|
+
@mobile
|
|
28
|
+
Scenario: A scenario tagged @mobile opens at the mobile breakpoint
|
|
29
|
+
Given I am on "/viewport-size.html"
|
|
30
|
+
Then "#viewport-size" should have text "Viewport is 375 by 667"
|
|
31
|
+
When I set the viewport to the "tablet" breakpoint
|
|
32
|
+
Then "#viewport-size" should have text "Viewport is 768 by 1024"
|
|
33
|
+
|
|
34
|
+
@desktop
|
|
35
|
+
Scenario: A scenario tagged @desktop opens at the desktop breakpoint
|
|
36
|
+
Given I am on "/viewport-size.html"
|
|
37
|
+
Then "#viewport-size" should have text "Viewport is 1200 by 900"
|
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
Feature: REST and API requests follow the HTTPS setting of the browser
|
|
2
|
+
As a tester,
|
|
3
|
+
I want the REST and API request steps to reach every site the browser reaches
|
|
4
|
+
So that they work on a site served over HTTPS with a self-signed or locally issued certificate
|
|
5
|
+
|
|
6
|
+
Background:
|
|
7
|
+
Given the API base URL is "/"
|
|
8
|
+
|
|
9
|
+
Scenario: A REST GET request to a path
|
|
10
|
+
When I send a REST "GET" request to "/example-api.json"
|
|
11
|
+
Then the REST response status code should be 200
|
|
12
|
+
And the REST response should contain "JSON:API paints my bikeshed!"
|
|
13
|
+
And the REST response should contain "articles"
|
|
14
|
+
|
|
15
|
+
Scenario: A REST GET request to an absolute URL
|
|
16
|
+
When I send a REST "GET" request to "http://localhost:8080/example-api.json"
|
|
17
|
+
Then the REST response status code should be 200
|
|
18
|
+
And the REST response should contain "The shortest article. Ever."
|
|
19
|
+
|
|
20
|
+
Scenario: A REST GET request to a missing page answers 404
|
|
21
|
+
When I send a REST "GET" request to "/not-existing-page.json"
|
|
22
|
+
Then the REST response status code should be 404
|
|
23
|
+
|
|
24
|
+
Scenario: A REST request after the browser opened a page
|
|
25
|
+
Given I am on "/about-us.html"
|
|
26
|
+
When we send a REST "GET" request to "/example-api.json"
|
|
27
|
+
Then the REST response status code should be 200
|
|
28
|
+
And the REST response should contain "people"
|
|
29
|
+
And I should see "About Us"
|
|
30
|
+
|
|
31
|
+
Scenario: A REST POST request with a JSON body to a path that takes no POST
|
|
32
|
+
Given a REST header "Content-Type" with value "application/json"
|
|
33
|
+
When I send a REST "POST" request to "/example-api.json" with body:
|
|
34
|
+
"""
|
|
35
|
+
{"title": "Webship", "body": "A REST request with a JSON body"}
|
|
36
|
+
"""
|
|
37
|
+
Then the REST response status code should be 405
|
|
38
|
+
|
|
39
|
+
Scenario: A REST POST request with a JSON body to an absolute URL
|
|
40
|
+
Given a REST header "Content-Type" with value "application/json"
|
|
41
|
+
When I send a REST "POST" request to "https://jsonplaceholder.typicode.com/posts" with body:
|
|
42
|
+
"""
|
|
43
|
+
{"title": "Webship", "body": "A REST request with a JSON body", "userId": 1}
|
|
44
|
+
"""
|
|
45
|
+
Then the REST response status code should be 201
|
|
46
|
+
And the REST response should contain "Webship"
|
|
47
|
+
And the REST response should contain "A REST request with a JSON body"
|
|
48
|
+
And the REST response should contain "id"
|
|
49
|
+
|
|
50
|
+
Scenario: A REST DELETE request to an absolute URL
|
|
51
|
+
When I send a REST "DELETE" request to "https://jsonplaceholder.typicode.com/posts/1"
|
|
52
|
+
Then the REST response status code should be 200
|
|
53
|
+
|
|
54
|
+
Scenario: An API GET request to a path under the launch URL
|
|
55
|
+
When I send a GET request to "/example-api.json"
|
|
56
|
+
Then the API response code should be 200
|
|
57
|
+
And the response should be valid JSON
|
|
58
|
+
And the response header "Content-Type" should contain "application/json"
|
|
59
|
+
And the JSON response should have "data.0.type" equal to "articles"
|
|
60
|
+
And the JSON response should have "included.0.attributes.name" equal to "John"
|
|
61
|
+
And the JSON property "included.0.attributes.age" should be 80
|
|
62
|
+
And the JSON response should have property "data.0.relationships.author"
|
|
63
|
+
And the JSON response should not have property "data.0.password"
|
|
64
|
+
And the API response should contain "JSON:API paints my bikeshed!"
|
|
65
|
+
|
|
66
|
+
Scenario: An API GET request to an absolute base URL
|
|
67
|
+
Given the API base URL is "http://localhost:8080"
|
|
68
|
+
When I send a GET request to "/example-api.json"
|
|
69
|
+
Then the API response code should be 200
|
|
70
|
+
And the header "Content-Type" should contain "application/json"
|
|
71
|
+
And the JSON response should have "data.0.id" equal to "1"
|
|
72
|
+
|
|
73
|
+
Scenario: An API GET request to a missing page answers 404
|
|
74
|
+
When I send a GET request to "/not-existing-page.json"
|
|
75
|
+
Then the API response code should be 404
|
|
76
|
+
And the API response should not contain "articles"
|
|
77
|
+
|
|
78
|
+
Scenario: An API POST request with a JSON body to a path that takes no POST
|
|
79
|
+
When I send a POST request to "/example-api.json" with body:
|
|
80
|
+
"""
|
|
81
|
+
{"title": "Webship", "body": "An API request with a JSON body"}
|
|
82
|
+
"""
|
|
83
|
+
Then the API response code should be 405
|
|
84
|
+
|
|
85
|
+
Scenario: An API POST request with a JSON body to an absolute base URL
|
|
86
|
+
Given the API base URL is "https://jsonplaceholder.typicode.com"
|
|
87
|
+
When I send a POST request to "/posts" with body:
|
|
88
|
+
"""
|
|
89
|
+
{"title": "Webship", "body": "An API request with a JSON body", "userId": 1}
|
|
90
|
+
"""
|
|
91
|
+
Then the API response code should be 201
|
|
92
|
+
And the response should be valid JSON
|
|
93
|
+
And the response header "Content-Type" should contain "application/json"
|
|
94
|
+
And the JSON response should have "title" equal to "Webship"
|
|
95
|
+
And the JSON response should have "userId" equal to 1
|
|
96
|
+
And the JSON response should have property "id"
|
|
97
|
+
|
|
98
|
+
Scenario: An API POST request with values and with form data
|
|
99
|
+
Given the API base URL is "https://jsonplaceholder.typicode.com"
|
|
100
|
+
When I send a POST request to "/posts" with values:
|
|
101
|
+
| title | Webship |
|
|
102
|
+
| body | Sent as values |
|
|
103
|
+
Then the API response code should be 201
|
|
104
|
+
And the JSON response should have "title" equal to "Webship"
|
|
105
|
+
When I send a POST request to "/posts" with form data:
|
|
106
|
+
"""
|
|
107
|
+
title=Webship
|
|
108
|
+
body=Sent as form data
|
|
109
|
+
"""
|
|
110
|
+
Then the API response code should be 201
|
|
111
|
+
And the JSON response should have "body" equal to "Sent as form data"
|
|
112
|
+
|
|
113
|
+
Scenario: An API request with a request body set before it and basic authentication
|
|
114
|
+
Given the API base URL is "https://jsonplaceholder.typicode.com"
|
|
115
|
+
And I am authenticating as "tester" with "secret" password
|
|
116
|
+
And I set the request body to '{"title": "Webship", "userId": 7}'
|
|
117
|
+
When I send a PUT request to "/posts/1"
|
|
118
|
+
Then the API response code should be 200
|
|
119
|
+
And the JSON response should have "title" equal to "Webship"
|
|
120
|
+
And the JSON response should have "userId" equal to 7
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
Feature: Horizontal scrolling step definitions
|
|
2
|
+
As a tester,
|
|
3
|
+
I want to scroll a page and an element to the right, to the left, to the start and to the end,
|
|
4
|
+
so that content wider than the window can be reached.
|
|
5
|
+
|
|
6
|
+
Scenario: Scroll right by the default distance
|
|
7
|
+
Given I am on "/scroll-horizontal.html"
|
|
8
|
+
Then "#page-position" should have text "Page scrolled 0 pixels to the right"
|
|
9
|
+
When I scroll right
|
|
10
|
+
Then "#page-position" should have text "Page scrolled 350 pixels to the right"
|
|
11
|
+
|
|
12
|
+
Scenario: Scroll right by a custom distance
|
|
13
|
+
Given I am on "/scroll-horizontal.html"
|
|
14
|
+
When I scroll right 1000
|
|
15
|
+
Then "#page-position" should have text "Page scrolled 1000 pixels to the right"
|
|
16
|
+
|
|
17
|
+
Scenario: Scroll left by the default distance
|
|
18
|
+
Given I am on "/scroll-horizontal.html"
|
|
19
|
+
When I scroll right 1000
|
|
20
|
+
And I scroll left
|
|
21
|
+
Then "#page-position" should have text "Page scrolled 650 pixels to the right"
|
|
22
|
+
|
|
23
|
+
Scenario: Scroll left by a custom distance
|
|
24
|
+
Given I am on "/scroll-horizontal.html"
|
|
25
|
+
When I scroll right 1000
|
|
26
|
+
And I scroll left 300
|
|
27
|
+
Then "#page-position" should have text "Page scrolled 700 pixels to the right"
|
|
28
|
+
|
|
29
|
+
Scenario: Scroll to the end of the page
|
|
30
|
+
Given I am on "/scroll-horizontal.html"
|
|
31
|
+
Then "#page-edge" should have text "Page is at the start"
|
|
32
|
+
When I scroll to the end
|
|
33
|
+
Then "#page-edge" should have text "Page is at the end"
|
|
34
|
+
|
|
35
|
+
Scenario: Scroll to the start of the page
|
|
36
|
+
Given I am on "/scroll-horizontal.html"
|
|
37
|
+
When I scroll to the end of the page
|
|
38
|
+
Then "#page-edge" should have text "Page is at the end"
|
|
39
|
+
When I scroll to the start of the page
|
|
40
|
+
Then "#page-edge" should have text "Page is at the start"
|
|
41
|
+
And "#page-position" should have text "Page scrolled 0 pixels to the right"
|
|
42
|
+
|
|
43
|
+
Scenario: Scroll to the end of an element
|
|
44
|
+
Given I am on "/scroll-horizontal.html"
|
|
45
|
+
Then "#strip-edge" should have text "Strip is at the start"
|
|
46
|
+
When I scroll to end of "#strip"
|
|
47
|
+
Then "#strip-edge" should have text "Strip is at the end"
|
|
48
|
+
And "#page-position" should have text "Page scrolled 0 pixels to the right"
|
|
49
|
+
|
|
50
|
+
Scenario: Scroll to the start of an element
|
|
51
|
+
Given I am on "/scroll-horizontal.html"
|
|
52
|
+
When I scroll to end of "#strip"
|
|
53
|
+
Then "#strip-edge" should have text "Strip is at the end"
|
|
54
|
+
When I scroll to start of "#strip"
|
|
55
|
+
Then "#strip-edge" should have text "Strip is at the start"
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
Feature: Selector position step definitions, left and right
|
|
2
|
+
As a tester,
|
|
3
|
+
I want to assert that a named component sits to the left or to the right of another,
|
|
4
|
+
so that the layout of a row can be tested.
|
|
5
|
+
|
|
6
|
+
Background:
|
|
7
|
+
Given I am on "/selectors-position.html"
|
|
8
|
+
And I define css selectors:
|
|
9
|
+
| logo | #logo |
|
|
10
|
+
| menu | #menu |
|
|
11
|
+
| search | #search |
|
|
12
|
+
|
|
13
|
+
Scenario: A component is to the left of another
|
|
14
|
+
Then I see logo to the left of menu
|
|
15
|
+
|
|
16
|
+
Scenario: A component is to the left of several others
|
|
17
|
+
Then I see logo to left of menu, search
|
|
18
|
+
|
|
19
|
+
Scenario: A component is to the right of another
|
|
20
|
+
Then I see search to the right of menu
|
|
21
|
+
|
|
22
|
+
Scenario: A component is to the right of several others
|
|
23
|
+
Then I see search to right of logo, menu
|
|
24
|
+
|
|
25
|
+
Scenario: A component is over another it overlaps and is stacked on
|
|
26
|
+
Given I define css selectors:
|
|
27
|
+
| popup | #popup |
|
|
28
|
+
| article | #article |
|
|
29
|
+
Then I see popup over article
|
|
30
|
+
|
|
31
|
+
Scenario: A component is not over another it is stacked under
|
|
32
|
+
Given I define css selectors:
|
|
33
|
+
| popup | #popup |
|
|
34
|
+
| article | #article |
|
|
35
|
+
Then I see article not over popup
|
|
36
|
+
|
|
37
|
+
Scenario: A component is not over another it does not overlap
|
|
38
|
+
Given I define css selectors:
|
|
39
|
+
| popup | #popup |
|
|
40
|
+
Then I see popup not over logo
|
|
41
|
+
And I see logo not over popup
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
Feature: Cookie, local storage and session storage steps
|
|
2
|
+
As a tester,
|
|
3
|
+
I want to set, remove and clear cookies, local storage and session storage from a scenario,
|
|
4
|
+
so that a page starts in the state the scenario needs without clicking through the site.
|
|
5
|
+
|
|
6
|
+
Scenario: A cookie set before the first page is sent with that page
|
|
7
|
+
Given the cookie "theme" is set to "dark"
|
|
8
|
+
When I am on "/storage.html"
|
|
9
|
+
Then "#cookies" should have text "theme = dark"
|
|
10
|
+
And a cookie with the name "theme" and the value "dark" should exist
|
|
11
|
+
|
|
12
|
+
Scenario: A cookie set on a loaded page shows after a reload
|
|
13
|
+
Given I am on "/storage.html"
|
|
14
|
+
Then "#cookies" should have text "No cookies"
|
|
15
|
+
When cookie "ab_bucket" is set to "variant-b"
|
|
16
|
+
And I reload the page
|
|
17
|
+
Then "#cookies" should have text "ab_bucket = variant-b"
|
|
18
|
+
|
|
19
|
+
Scenario: Removing one cookie keeps the other cookies
|
|
20
|
+
Given I am on "/storage.html"
|
|
21
|
+
And the cookie "theme" is set to "dark"
|
|
22
|
+
And the cookie "lang" is set to "en"
|
|
23
|
+
When I reload the page
|
|
24
|
+
Then "#cookies" should contain text "theme = dark"
|
|
25
|
+
And "#cookies" should contain text "lang = en"
|
|
26
|
+
When the cookie "theme" is removed
|
|
27
|
+
And I reload the page
|
|
28
|
+
Then "#cookies" should have text "lang = en"
|
|
29
|
+
And a cookie with the name "theme" should not exist
|
|
30
|
+
And a cookie with the name "lang" and the value "en" should exist
|
|
31
|
+
|
|
32
|
+
Scenario: Clearing all cookies leaves none
|
|
33
|
+
Given I am on "/storage.html"
|
|
34
|
+
And the cookie "theme" is set to "dark"
|
|
35
|
+
And the cookie "lang" is set to "en"
|
|
36
|
+
When I reload the page
|
|
37
|
+
And "#cookies li" should have a count of 2
|
|
38
|
+
When all cookies are cleared
|
|
39
|
+
And I reload the page
|
|
40
|
+
Then "#cookies" should have text "No cookies"
|
|
41
|
+
And a cookie with the name "theme" should not exist
|
|
42
|
+
And a cookie with the name "lang" should not exist
|
|
43
|
+
|
|
44
|
+
Scenario: Local storage entries are set, removed one by one, then gone
|
|
45
|
+
Given I am on "/storage.html"
|
|
46
|
+
Then "#local-storage" should have text "Local storage is empty"
|
|
47
|
+
When the local storage "theme" is set to "dark"
|
|
48
|
+
And local storage "lang" is set to "fr"
|
|
49
|
+
And I reload the page
|
|
50
|
+
Then "#local-storage li" should have a count of 2
|
|
51
|
+
And "#local-storage" should contain text "theme = dark"
|
|
52
|
+
And "#local-storage" should contain text "lang = fr"
|
|
53
|
+
When the local storage "theme" is removed
|
|
54
|
+
And I reload the page
|
|
55
|
+
Then "#local-storage" should have text "lang = fr"
|
|
56
|
+
When local storage "lang" is removed
|
|
57
|
+
And I reload the page
|
|
58
|
+
Then "#local-storage" should have text "Local storage is empty"
|
|
59
|
+
|
|
60
|
+
Scenario: Clearing local storage leaves the session storage alone
|
|
61
|
+
Given I am on "/storage.html"
|
|
62
|
+
And the local storage "theme" is set to "dark"
|
|
63
|
+
And the local storage "onboarding_complete" is set to "true"
|
|
64
|
+
And the session storage "wizard progress" is set to "3/5"
|
|
65
|
+
When I reload the page
|
|
66
|
+
Then "#local-storage li" should have a count of 2
|
|
67
|
+
When local storage is cleared
|
|
68
|
+
And I reload the page
|
|
69
|
+
Then "#local-storage" should have text "Local storage is empty"
|
|
70
|
+
And "#session-storage" should have text "wizard progress = 3/5"
|
|
71
|
+
|
|
72
|
+
Scenario: Session storage entries are set, removed one by one, then gone
|
|
73
|
+
Given I am on "/storage.html"
|
|
74
|
+
Then "#session-storage" should have text "Session storage is empty"
|
|
75
|
+
When the session storage "checkout step" is set to "2"
|
|
76
|
+
And session storage "tab id" is set to "tab-1"
|
|
77
|
+
And I reload the page
|
|
78
|
+
Then "#session-storage li" should have a count of 2
|
|
79
|
+
And "#session-storage" should contain text "checkout step = 2"
|
|
80
|
+
And "#session-storage" should contain text "tab id = tab-1"
|
|
81
|
+
When the session storage "checkout step" is removed
|
|
82
|
+
And I reload the page
|
|
83
|
+
Then "#session-storage" should have text "tab id = tab-1"
|
|
84
|
+
When session storage "tab id" is removed
|
|
85
|
+
And I reload the page
|
|
86
|
+
Then "#session-storage" should have text "Session storage is empty"
|
|
87
|
+
|
|
88
|
+
Scenario: Clearing session storage leaves the local storage alone
|
|
89
|
+
Given I am on "/storage.html"
|
|
90
|
+
And the session storage "checkout step" is set to "2"
|
|
91
|
+
And the session storage "from checkout" is set to "true"
|
|
92
|
+
And the local storage "theme" is set to "dark"
|
|
93
|
+
When I reload the page
|
|
94
|
+
Then "#session-storage li" should have a count of 2
|
|
95
|
+
When session storage is cleared
|
|
96
|
+
And I reload the page
|
|
97
|
+
Then "#session-storage" should have text "Session storage is empty"
|
|
98
|
+
And "#local-storage" should have text "theme = dark"
|
|
@@ -273,6 +273,19 @@ Feature: Relative element positioning assertions and advanced selector system.
|
|
|
273
273
|
Then I see heading, list inside of body
|
|
274
274
|
And I see body outside of heading, list
|
|
275
275
|
|
|
276
|
+
# ---------------------------------------------------------------------------
|
|
277
|
+
# Advanced — selector names that contain the letters "and".
|
|
278
|
+
# ---------------------------------------------------------------------------
|
|
279
|
+
Scenario: A selector name may contain the letters "and".
|
|
280
|
+
Given I define css selectors:
|
|
281
|
+
| brand heading | h1 |
|
|
282
|
+
| landing subline | h3 |
|
|
283
|
+
| standard list | ul |
|
|
284
|
+
Then I see brand heading above landing subline
|
|
285
|
+
And I see brand heading above landing subline and standard list
|
|
286
|
+
And I see brand heading, landing subline above standard list
|
|
287
|
+
And I see standard list below brand heading, and landing subline
|
|
288
|
+
|
|
276
289
|
# ---------------------------------------------------------------------------
|
|
277
290
|
# Advanced — "not over" negation (non-overlap).
|
|
278
291
|
# ---------------------------------------------------------------------------
|
|
@@ -7,4 +7,12 @@ Feature: An example to ensure that the input text contain a specific value based
|
|
|
7
7
|
When I fill in "Username" with "user1"
|
|
8
8
|
And I fill in "Password" with "1234"
|
|
9
9
|
Then I should see "user1" in the "Username" element
|
|
10
|
-
And I should see "1234" in the "Password" element
|
|
10
|
+
And I should see "1234" in the "Password" element
|
|
11
|
+
|
|
12
|
+
Scenario: Ensuring that an element named by a CSS selector contains a specific text.
|
|
13
|
+
Given I am on "/test--then--i-should--not--see-text-in-element.html"
|
|
14
|
+
When I fill in "Username" with "user1"
|
|
15
|
+
Then I should see "Login" in the "h1" element
|
|
16
|
+
And I should see "user1" in the "#uname" element
|
|
17
|
+
And I should see "user1" in the "[name=username]" element
|
|
18
|
+
And I should not see "user2" in the "input.unamecss" element
|