webship-js 2.0.10 → 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 (110) 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/11-debugging.md +21 -0
  13. package/docs/12-ai-agent-guide.md +3 -1
  14. package/docs/13-faq.md +3 -0
  15. package/docs/15-tag-conventions.md +4 -1
  16. package/docs/16-ci-cd.md +29 -13
  17. package/docs/global-settings.md +2 -2
  18. package/docs/install-webship-js/ddev-webship-js.md +3 -0
  19. package/docs/install-webship-js.md +14 -2
  20. package/examples/a11y-legacy-widget.html +34 -0
  21. package/examples/auth-state.html +42 -0
  22. package/examples/clock.html +33 -0
  23. package/examples/downloads/webship-archive.zip +0 -0
  24. package/examples/downloads/webship-notes.txt +4 -0
  25. package/examples/downloads/webship-report.csv +4 -0
  26. package/examples/downloads.html +16 -0
  27. package/examples/element-viewport.html +42 -0
  28. package/examples/field-types.html +98 -0
  29. package/examples/iframe-newsletter.html +29 -0
  30. package/examples/iframe-order.html +26 -0
  31. package/examples/iframe.html +21 -0
  32. package/examples/javascript-errors.html +35 -0
  33. package/examples/links.html +1 -0
  34. package/examples/metatags.html +18 -0
  35. package/examples/mouse-and-pointer.html +83 -0
  36. package/examples/native-dialogs.html +8 -0
  37. package/examples/network.html +83 -0
  38. package/examples/scroll-horizontal.html +50 -0
  39. package/examples/selectors-position.html +29 -0
  40. package/examples/storage.html +57 -0
  41. package/examples/viewport-size.html +24 -0
  42. package/examples/wait-conditions.html +69 -0
  43. package/examples/web-first.html +99 -0
  44. package/package.json +9 -2
  45. package/tests/assets/catalog.xml +19 -0
  46. package/tests/assets/feed-namespaced.xml +13 -0
  47. package/tests/assets/sitemap.xml +14 -0
  48. package/tests/assets/webship-site-expected.yaml +21 -0
  49. package/tests/assets/webship-site.schema.json +46 -0
  50. package/tests/assets/webship-site.yaml +21 -0
  51. package/tests/check-examples.js +235 -0
  52. package/tests/check-must-fail.js +84 -0
  53. package/tests/check-paths.js +82 -0
  54. package/tests/check-report.js +119 -0
  55. package/tests/check-scaffold.js +211 -0
  56. package/tests/features/a11y.feature +18 -0
  57. package/tests/features/auth-state.feature +32 -0
  58. package/tests/features/clock.feature +27 -0
  59. package/tests/features/cookie.feature +9 -0
  60. package/tests/features/dialog.feature +27 -0
  61. package/tests/features/element.feature +47 -0
  62. package/tests/features/field.feature +104 -0
  63. package/tests/features/file-download.feature +64 -0
  64. package/tests/features/iframe.feature +83 -0
  65. package/tests/features/javascript.feature +47 -0
  66. package/tests/features/link.feature +11 -0
  67. package/tests/features/metatag.feature +38 -0
  68. package/tests/features/mouse-and-pointer.feature +86 -0
  69. package/tests/features/network-mocking.feature +80 -0
  70. package/tests/features/responsive.feature +27 -0
  71. package/tests/features/scroll-horizontal.feature +55 -0
  72. package/tests/features/selectors-position.feature +41 -0
  73. package/tests/features/storage.feature +98 -0
  74. package/tests/features/test--then--i-see-locator.feature +13 -0
  75. package/tests/features/test--then--i-should--see-text-in-element.feature +9 -1
  76. package/tests/features/test--then--the-field-should-contain-value.feature +8 -0
  77. package/tests/features/video.feature +1 -0
  78. package/tests/features/wait.feature +89 -0
  79. package/tests/features/web-first.feature +100 -0
  80. package/tests/features/xml.feature +96 -0
  81. package/tests/features/yaml.feature +75 -0
  82. package/tests/must-fail/assertions.feature +96 -0
  83. package/tests/must-fail/waits.feature +51 -0
  84. package/tests/reports/README.md +2 -2
  85. package/tests/step-definitions/a11y.steps.js +12 -8
  86. package/tests/step-definitions/assertion.steps.js +235 -61
  87. package/tests/step-definitions/dialog.steps.js +2 -2
  88. package/tests/step-definitions/element.steps.js +3 -1
  89. package/tests/step-definitions/field.steps.js +152 -22
  90. package/tests/step-definitions/file-download.steps.js +74 -10
  91. package/tests/step-definitions/screenshot.steps.js +1 -1
  92. package/tests/step-definitions/selectors.steps.js +9 -3
  93. package/tests/step-definitions/storage.steps.js +3 -3
  94. package/tests/step-definitions/wait.steps.js +129 -39
  95. package/tests/step-definitions/webship.js +144 -3
  96. package/tests/step-definitions/xml.steps.js +76 -14
  97. package/tests/step-definitions/yaml.steps.js +46 -27
  98. package/.scratch/commit.txt +0 -14
  99. package/.scratch/docs.py +0 -42
  100. package/.scratch/echo-server.js +0 -8
  101. package/.scratch/echo.js +0 -35
  102. package/.scratch/echo.pid +0 -1
  103. package/.scratch/features/cookies.feature +0 -22
  104. package/.scratch/http.pid +0 -1
  105. package/.scratch/https.pid +0 -1
  106. package/.scratch/issue.md +0 -49
  107. package/.scratch/one.js +0 -2
  108. package/.scratch/one.json +0 -280
  109. package/.scratch/patch.py +0 -163
  110. package/.scratch/pr.md +0 -30
@@ -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,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
@@ -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