@quickpickle/vitest-browser 0.0.3 → 0.2.0
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/CHANGELOG.md +52 -0
- package/README.md +71 -0
- package/dist/VitestBrowserWorld.cjs +89 -22
- package/dist/VitestBrowserWorld.cjs.map +1 -1
- package/dist/VitestBrowserWorld.d.ts +45 -21
- package/dist/VitestBrowserWorld.mjs +90 -23
- package/dist/VitestBrowserWorld.mjs.map +1 -1
- package/dist/actions.steps.cjs +26 -2
- package/dist/actions.steps.cjs.map +1 -1
- package/dist/actions.steps.mjs +27 -3
- package/dist/actions.steps.mjs.map +1 -1
- package/dist/frameworks/ReactBrowserWorld.cjs +19 -6
- package/dist/frameworks/ReactBrowserWorld.cjs.map +1 -1
- package/dist/frameworks/ReactBrowserWorld.d.ts +9 -0
- package/dist/frameworks/ReactBrowserWorld.mjs +19 -7
- package/dist/frameworks/ReactBrowserWorld.mjs.map +1 -1
- package/dist/frameworks/SvelteBrowserWorld.cjs +13 -2
- package/dist/frameworks/SvelteBrowserWorld.cjs.map +1 -1
- package/dist/frameworks/SvelteBrowserWorld.d.ts +2 -3
- package/dist/frameworks/SvelteBrowserWorld.mjs +13 -2
- package/dist/frameworks/SvelteBrowserWorld.mjs.map +1 -1
- package/dist/frameworks/VueBrowserWorld.cjs +8 -4
- package/dist/frameworks/VueBrowserWorld.cjs.map +1 -1
- package/dist/frameworks/VueBrowserWorld.d.ts +1 -3
- package/dist/frameworks/VueBrowserWorld.mjs +8 -4
- package/dist/frameworks/VueBrowserWorld.mjs.map +1 -1
- package/dist/frameworks/react.cjs +2 -0
- package/dist/frameworks/react.cjs.map +1 -1
- package/dist/frameworks/react.mjs +2 -0
- package/dist/frameworks/react.mjs.map +1 -1
- package/dist/frameworks/svelte.cjs +2 -0
- package/dist/frameworks/svelte.cjs.map +1 -1
- package/dist/frameworks/svelte.mjs +2 -0
- package/dist/frameworks/svelte.mjs.map +1 -1
- package/dist/frameworks/vue.cjs +2 -0
- package/dist/frameworks/vue.cjs.map +1 -1
- package/dist/frameworks/vue.mjs +2 -0
- package/dist/frameworks/vue.mjs.map +1 -1
- package/dist/outcomes.steps.cjs +78 -22
- package/dist/outcomes.steps.cjs.map +1 -1
- package/dist/outcomes.steps.mjs +78 -22
- package/dist/outcomes.steps.mjs.map +1 -1
- package/package.json +5 -4
- package/rollup.config.js +1 -0
- package/src/VitestBrowserWorld.ts +127 -38
- package/src/actions.steps.ts +28 -2
- package/src/frameworks/ReactBrowserWorld.ts +22 -9
- package/src/frameworks/SvelteBrowserWorld.ts +11 -3
- package/src/frameworks/VueBrowserWorld.ts +6 -5
- package/src/outcomes.steps.ts +79 -22
- package/tests/generic/browser-actions.feature +193 -0
- package/tests/generic/browser-generic.feature +76 -0
- package/tests/generic/browser-outcomes.feature +138 -0
- package/tests/generic/generic.steps.ts +27 -0
- package/tests/svelte/Example.svelte +153 -0
- package/vite.config.ts +8 -0
- package/vitest.workspace.ts +34 -35
|
@@ -0,0 +1,193 @@
|
|
|
1
|
+
Feature: Actions step definitions in Vitest Browser
|
|
2
|
+
|
|
3
|
+
As a developer or tester
|
|
4
|
+
I need to be sure that the step definitions work as promised
|
|
5
|
+
|
|
6
|
+
Background: Load the example HTML page
|
|
7
|
+
Given I render the "Example" component
|
|
8
|
+
|
|
9
|
+
Rule: Interaction: Clicking must be supported
|
|
10
|
+
|
|
11
|
+
Scenario: clicking on exact text
|
|
12
|
+
When I click on "Text"
|
|
13
|
+
Then "Text" should have been clicked
|
|
14
|
+
When I click on "Do CSS transitions affect Playwright awaits?"
|
|
15
|
+
And I wait for 1000ms
|
|
16
|
+
Then I should see "AI says:"
|
|
17
|
+
|
|
18
|
+
@should-fail
|
|
19
|
+
Scenario: clicking on inexact text FAILS
|
|
20
|
+
When I click on "Do CSS transitions"
|
|
21
|
+
|
|
22
|
+
@should-fail
|
|
23
|
+
Scenario: clicking on hidden elements FAILS
|
|
24
|
+
When I click on "Hidden item"
|
|
25
|
+
|
|
26
|
+
@should-fail
|
|
27
|
+
Scenario: clicking on invisible elements FAILS
|
|
28
|
+
When I click on "Invisible item"
|
|
29
|
+
|
|
30
|
+
@todo
|
|
31
|
+
Scenario: clicking on elements by css selector
|
|
32
|
+
When I click the 'a[href="#faq"]' element
|
|
33
|
+
Then the url should contain "faq"
|
|
34
|
+
|
|
35
|
+
Scenario: clicking on elements by role
|
|
36
|
+
When I click the "Image" link
|
|
37
|
+
Then the "Image" link should have been clicked
|
|
38
|
+
|
|
39
|
+
Rule: Interaction: Focusing must be supported
|
|
40
|
+
|
|
41
|
+
Scenario: focusing on exact text
|
|
42
|
+
When I focus on "Text"
|
|
43
|
+
Then the "Text" link should be focused
|
|
44
|
+
|
|
45
|
+
@should-fail
|
|
46
|
+
Scenario: focusing on hidden elements fails
|
|
47
|
+
When I focus on "Do CSS transitions affect Playwright awaits?"
|
|
48
|
+
|
|
49
|
+
@should-fail
|
|
50
|
+
Scenario: focusing on non-selectable elements FAILS
|
|
51
|
+
When I focus on "Item 1"
|
|
52
|
+
|
|
53
|
+
@should-fail
|
|
54
|
+
Scenario: focusing on inexact text FAILS
|
|
55
|
+
When I focus on "List"
|
|
56
|
+
|
|
57
|
+
@todo
|
|
58
|
+
Scenario: Focusing on elements by css selector should work
|
|
59
|
+
When I focus the 'a[href="#faq"]' element
|
|
60
|
+
Then the "FAQ" link should be focused
|
|
61
|
+
|
|
62
|
+
Scenario: Focusing on elements by role should work
|
|
63
|
+
When I focus the "Image" link
|
|
64
|
+
Then the "Image" link should be focused
|
|
65
|
+
|
|
66
|
+
Rule: Typing must be supported
|
|
67
|
+
|
|
68
|
+
Scenario: Typing text into a textbox
|
|
69
|
+
When for "name" I type "David Hunt"
|
|
70
|
+
Then the value of "name" should be "David Hunt"
|
|
71
|
+
When for the "name" textbox I type " Sam Ziegler"
|
|
72
|
+
Then the value of the "name" textbox should be "David Hunt Sam Ziegler"
|
|
73
|
+
|
|
74
|
+
Scenario: Navigating through links
|
|
75
|
+
When I focus the "Lists" link
|
|
76
|
+
Then the "Lists" link should be focused
|
|
77
|
+
When I type the following keys: Tab Tab
|
|
78
|
+
Then the "Form" link should be focused
|
|
79
|
+
When I type the following keys: {Shift>} Tab {/Shift}
|
|
80
|
+
Then the "Table" link should be focused
|
|
81
|
+
|
|
82
|
+
Scenario: Navigating through form elements
|
|
83
|
+
When I activate the "Name" textbox
|
|
84
|
+
And I type the following keys: Tab Tab
|
|
85
|
+
Then the "Message" textbox should be focused
|
|
86
|
+
When I type the following keys: {Shift>} Tab {Shift}
|
|
87
|
+
Then the "Email" textbox should be focused
|
|
88
|
+
|
|
89
|
+
Rule: Form entry must be supported
|
|
90
|
+
|
|
91
|
+
@should-fail
|
|
92
|
+
Scenario: filling a disabled field FAILS
|
|
93
|
+
When for "From" I enter "anything"
|
|
94
|
+
|
|
95
|
+
Scenario: Filling one textbox
|
|
96
|
+
When for "Name" I fill in "David Hunt"
|
|
97
|
+
Then the value of "Name" should be "David Hunt"
|
|
98
|
+
When for "Name" I enter "Sam Ziegler"
|
|
99
|
+
Then the value of "Name" should be "Sam Ziegler"
|
|
100
|
+
When for "Name" I enter ""
|
|
101
|
+
Then the value of "Name" should be ""
|
|
102
|
+
|
|
103
|
+
Scenario: Filling a date field
|
|
104
|
+
When for "Date" I fill in "2024-10-21"
|
|
105
|
+
Then the value of "Date" should be "2024-10-21"
|
|
106
|
+
|
|
107
|
+
Scenario: Filling a number field
|
|
108
|
+
When for "Number" I enter "9"
|
|
109
|
+
Then the value of "Number" should be 9
|
|
110
|
+
|
|
111
|
+
Scenario: Selecting an option
|
|
112
|
+
When for "Color" I select "Red"
|
|
113
|
+
Then the value of "Color" should be "red"
|
|
114
|
+
When for "Color" I enter "- none -"
|
|
115
|
+
Then the value of "Color" should be ""
|
|
116
|
+
|
|
117
|
+
Scenario: Checking and unchecking a checkbox
|
|
118
|
+
When I check "I agree"
|
|
119
|
+
Then the "I agree" checkbox should be checked
|
|
120
|
+
|
|
121
|
+
Scenario: Checking a radio button
|
|
122
|
+
When I check "later"
|
|
123
|
+
Then the "later" radio should be checked
|
|
124
|
+
And the "now" radio should be unchecked
|
|
125
|
+
|
|
126
|
+
Scenario: Filling a whole form
|
|
127
|
+
When I fill in the following fields:
|
|
128
|
+
| Name | David Hunt |
|
|
129
|
+
| Email | git@github.com |
|
|
130
|
+
| Message | Hope this works! |
|
|
131
|
+
| Date | 2024-11-01 |
|
|
132
|
+
| Number | 493 |
|
|
133
|
+
| Color: | blue |
|
|
134
|
+
| later | true |
|
|
135
|
+
| I agree | no |
|
|
136
|
+
Then the value of "Name" should be "David Hunt"
|
|
137
|
+
And the value of "Email" should contain "git"
|
|
138
|
+
And the value of "Message" should be "Hope this works!"
|
|
139
|
+
And the value of "Date" should be "2024-11-01"
|
|
140
|
+
And the value of "Number" should be 493
|
|
141
|
+
And the value of "Color" should be "blue"
|
|
142
|
+
And the "later" radio should be checked
|
|
143
|
+
And the "I agree" checkbox should be unchecked
|
|
144
|
+
|
|
145
|
+
Rule: Waiting must be supported
|
|
146
|
+
|
|
147
|
+
Scenario: waiting for visible text works ONLY if the animation starts immediately
|
|
148
|
+
When I click on "Do CSS transitions affect Playwright awaits?"
|
|
149
|
+
Then I should see "AI says:"
|
|
150
|
+
|
|
151
|
+
@fails
|
|
152
|
+
Scenario: waiting for invisible text DOES NOT WORK
|
|
153
|
+
When I click on "Do CSS transitions affect Playwright awaits?"
|
|
154
|
+
Then I should NOT see "AI says:"
|
|
155
|
+
|
|
156
|
+
Rule: Scrolling must be supported
|
|
157
|
+
|
|
158
|
+
Scenario: Scrolling the full page
|
|
159
|
+
When I scroll down
|
|
160
|
+
Then the "HTML Test Page" heading should be outside the viewport
|
|
161
|
+
When I scroll up
|
|
162
|
+
Then the "HTML Test Page" heading should be inside the viewport
|
|
163
|
+
|
|
164
|
+
@todo
|
|
165
|
+
Scenario: Scrolling a particular div
|
|
166
|
+
|
|
167
|
+
Rule: Screenshots must be supported
|
|
168
|
+
|
|
169
|
+
Scenario: Taking a default screenshot
|
|
170
|
+
When I take a screenshot
|
|
171
|
+
Then the screenshot "Feature Actions step definitions in Vitest Browser_Taking a default screenshot_01.png" should exist--delete it
|
|
172
|
+
|
|
173
|
+
Scenario: Taking a named screenshot
|
|
174
|
+
When I take a screenshot named "pickles"
|
|
175
|
+
Then the screenshot "pickles.png" should exist--delete it
|
|
176
|
+
|
|
177
|
+
@tag1 @tag2 @sequential
|
|
178
|
+
Scenario: Taking a default screenshot with exploded tags
|
|
179
|
+
When I take a screenshot
|
|
180
|
+
|
|
181
|
+
@tag1 @tag2 @sequential
|
|
182
|
+
Scenario: Taking a named screenshot with exploded tags
|
|
183
|
+
When I take a screenshot named "temp"
|
|
184
|
+
|
|
185
|
+
@sequential
|
|
186
|
+
Scenario: Cleaning up the screenshots with exploded tags
|
|
187
|
+
Then the screenshot "Feature Actions step definitions in Vitest Browser_Taking a default screenshot with exploded tags (sequential,tag1)_01.png" should exist--delete it
|
|
188
|
+
And the screenshot "Feature Actions step definitions in Vitest Browser_Taking a default screenshot with exploded tags (sequential,tag2)_01.png" should exist--delete it
|
|
189
|
+
|
|
190
|
+
@sequential @skip-ci
|
|
191
|
+
Scenario: Cleaning up the screenshots with exploded tags
|
|
192
|
+
And the screenshot "temp_(sequential,tag1).png" should exist--delete it
|
|
193
|
+
And the screenshot "temp_(sequential,tag2).png" should exist--delete it
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
Feature: Basic tests of Vitest Browser Mode and steps
|
|
2
|
+
|
|
3
|
+
Background:
|
|
4
|
+
Given I render the "Example" component
|
|
5
|
+
|
|
6
|
+
@skip-ci
|
|
7
|
+
Rule: Visual regression testing must be supported
|
|
8
|
+
|
|
9
|
+
Example: Passing visual regression test
|
|
10
|
+
Then the screenshot should match
|
|
11
|
+
|
|
12
|
+
Example: Passing named visual regression test
|
|
13
|
+
Then the screenshot "visual-regression-example-page" should match
|
|
14
|
+
|
|
15
|
+
Example: Passing visual regression test of an element
|
|
16
|
+
Then the screenshot of the "XKCD Comic" img should match
|
|
17
|
+
|
|
18
|
+
@todo
|
|
19
|
+
Example: Passing named visual regression test of an element
|
|
20
|
+
Then the screenshot "visual-regression-faq-section" of the "#faq" element should match
|
|
21
|
+
|
|
22
|
+
@soft
|
|
23
|
+
Example: Failing visual regression test
|
|
24
|
+
When I take a screenshot of the "Image" link named "made-to-fail"
|
|
25
|
+
And I take a screenshot of the "FAQ" link named "faq"
|
|
26
|
+
Then the screenshot "made-to-fail.png.diff.png" should not exist
|
|
27
|
+
And the screenshot "made-to-fail.png.actual.png" should not exist
|
|
28
|
+
And the screenshot "made-to-fail" of the "FAQ" link should match
|
|
29
|
+
Then the screenshot "made-to-fail.png.diff.png" should not exist
|
|
30
|
+
And the screenshot "made-to-fail.png.actual.png" should exist--delete it
|
|
31
|
+
And the screenshot "faq.png" should exist--delete it
|
|
32
|
+
And the screenshot "made-to-fail.png" should exist--delete it
|
|
33
|
+
Then there should have been 1 error
|
|
34
|
+
|
|
35
|
+
@todo
|
|
36
|
+
Rule: Setting screenshot options must be supported
|
|
37
|
+
|
|
38
|
+
Scenario: Setting a screenshot mask
|
|
39
|
+
And the following world config:
|
|
40
|
+
```yaml
|
|
41
|
+
screenshotOptions:
|
|
42
|
+
mask:
|
|
43
|
+
- form
|
|
44
|
+
```
|
|
45
|
+
Then the screenshot should match
|
|
46
|
+
|
|
47
|
+
Scenario: Setting a clip area
|
|
48
|
+
And the following world config:
|
|
49
|
+
```yaml
|
|
50
|
+
screenshotOptions:
|
|
51
|
+
clip:
|
|
52
|
+
x: 0
|
|
53
|
+
y: 60
|
|
54
|
+
width: 300
|
|
55
|
+
height: 180
|
|
56
|
+
```
|
|
57
|
+
Then the screenshot should match
|
|
58
|
+
|
|
59
|
+
Rule: Screenshots should be placed in the proper directory
|
|
60
|
+
|
|
61
|
+
Scenario: Taking a screenshot
|
|
62
|
+
When I take a screenshot
|
|
63
|
+
Then the screenshot "Feature Basic tests of Vitest Browser Mode and steps_Taking a screenshot_01.png" should exist--delete it
|
|
64
|
+
|
|
65
|
+
Scenario: Taking a named screenshot
|
|
66
|
+
When I take a screenshot named "test"
|
|
67
|
+
Then the screenshot "test.png" should exist--delete it
|
|
68
|
+
|
|
69
|
+
Scenario: Taking a screenshot of an element
|
|
70
|
+
When I take a screenshot of the "Image" link
|
|
71
|
+
Then the screenshot "Feature Basic tests of Vitest Browser Mode and steps_Taking a screenshot of an element_01.png" should exist--delete it
|
|
72
|
+
|
|
73
|
+
Scenario: Taking a named screenshot of an element
|
|
74
|
+
When I take a screenshot of the "XKCD Comic" img named "test2"
|
|
75
|
+
Then the screenshot "test2.png" should exist--delete it
|
|
76
|
+
|
|
@@ -0,0 +1,138 @@
|
|
|
1
|
+
Feature: Outcome step definitions on a static page
|
|
2
|
+
|
|
3
|
+
As a developer or tester
|
|
4
|
+
I need to be sure that the step definitions work as promised
|
|
5
|
+
|
|
6
|
+
Background: Load the example HTML page
|
|
7
|
+
Given I render the "Example" component
|
|
8
|
+
|
|
9
|
+
Scenario: test if text is visible when a single element matches
|
|
10
|
+
Then I should see "Item 1"
|
|
11
|
+
And the text "Item 1" should be visible
|
|
12
|
+
|
|
13
|
+
Scenario: test if text is visible when multiple elements match
|
|
14
|
+
Then I should see "Image"
|
|
15
|
+
And the text "Image" should be visible
|
|
16
|
+
|
|
17
|
+
Scenario: test that text is not visible
|
|
18
|
+
Then I should not see "FWAH!!!"
|
|
19
|
+
And the text "FWAH!!!" should not be visible
|
|
20
|
+
|
|
21
|
+
Scenario: test that elements are visible with name and role
|
|
22
|
+
Then I should see an "Email:" textbox
|
|
23
|
+
And I should see a "Form" heading
|
|
24
|
+
|
|
25
|
+
Scenario: test that elements are visible with inexact name and role
|
|
26
|
+
Then I should see an "orm" heading
|
|
27
|
+
|
|
28
|
+
Scenario: test that elements are not visible
|
|
29
|
+
Then I should not see a "FWAH!!!" textbox
|
|
30
|
+
And I should not see a "Form" notheading
|
|
31
|
+
|
|
32
|
+
Scenario: test that an element hidden with display:none is not visible
|
|
33
|
+
Then I should not see "Hidden item"
|
|
34
|
+
|
|
35
|
+
Scenario: test that an element hidden with visibility:hidden is not visible
|
|
36
|
+
Then I should not see "Invisible item"
|
|
37
|
+
|
|
38
|
+
@todo
|
|
39
|
+
Scenario: test that elements matching text are visible
|
|
40
|
+
Then I should see an "h1" element with the text "HTML Test Page"
|
|
41
|
+
And I should see an "li" with the text "First item"
|
|
42
|
+
|
|
43
|
+
@todo
|
|
44
|
+
Scenario: test that elements matching text are not visible
|
|
45
|
+
Then I should NOT see an "h1" element with the text "FWAH!!!"
|
|
46
|
+
And I should NOT see a "fwah" element with the text "FWEEE!!!"
|
|
47
|
+
|
|
48
|
+
Rule: All of the ways of addressing an element should be tested
|
|
49
|
+
|
|
50
|
+
@todo
|
|
51
|
+
Example: it works to address an element with css selector
|
|
52
|
+
Then a "textarea#message" element should be visible
|
|
53
|
+
And an 'input[type="submit"]' element should be visible
|
|
54
|
+
And a "ul>li" element should be visible
|
|
55
|
+
And a "li.hidden" element should be hidden
|
|
56
|
+
|
|
57
|
+
@should-fail @todo
|
|
58
|
+
Example: it FAILS to address an element with a css selector AND a role other than "element"
|
|
59
|
+
Then a "ul>li" listitem should be visible
|
|
60
|
+
|
|
61
|
+
@todo
|
|
62
|
+
Example: it works to address an element with name and role
|
|
63
|
+
Then an "XKCD Comic" img should be visible
|
|
64
|
+
And a "message" textbox should be visible
|
|
65
|
+
And a "lists" link should be visible
|
|
66
|
+
|
|
67
|
+
@should-fail @todo
|
|
68
|
+
Example: it FAILS to address an element with name and role IF the element is hidden
|
|
69
|
+
And a "Hidden item" listitem should be hidden
|
|
70
|
+
|
|
71
|
+
@todo
|
|
72
|
+
Example: it works to address an element with css selector and text
|
|
73
|
+
Then the 'a[href="https://xkcd.com/2928"]' element with the text "2928" should be visible
|
|
74
|
+
And the "li.hidden" element with the text "Hidden item" should be hidden
|
|
75
|
+
|
|
76
|
+
Rule: Testing for invisible elements should be possible
|
|
77
|
+
|
|
78
|
+
@todo
|
|
79
|
+
Scenario: "I should not see" does not ensure presence of invisible elements
|
|
80
|
+
Then I should not see an "li.absent" with the text "nothing"
|
|
81
|
+
|
|
82
|
+
@todo
|
|
83
|
+
Scenario: "the {string} should be hidden" passes when elements are present and invisible
|
|
84
|
+
Then the "li.hidden" element should be invisible
|
|
85
|
+
|
|
86
|
+
@should-fail @todo
|
|
87
|
+
Scenario: "the {string} should be hidden" FAILS when elements are not present
|
|
88
|
+
Then the "li.imaginary" element should be invisible
|
|
89
|
+
|
|
90
|
+
Rule: Testing for disabled / enabled state should be possible
|
|
91
|
+
|
|
92
|
+
Scenario: test that elements are disabled
|
|
93
|
+
Then the "From" textbox should be disabled
|
|
94
|
+
|
|
95
|
+
Scenario: test that elements are enabled
|
|
96
|
+
Then the "Email" textbox should be enabled
|
|
97
|
+
|
|
98
|
+
Rule: Testing for checked / unchecked state should be possible
|
|
99
|
+
|
|
100
|
+
Scenario: Checking a checkbox
|
|
101
|
+
Then the "I agree" checkbox should be unchecked
|
|
102
|
+
When I click the "I agree" checkbox
|
|
103
|
+
Then the "I agree" checkbox should be checked
|
|
104
|
+
|
|
105
|
+
Scenario: Checking a radio button
|
|
106
|
+
Then the "now" radio should be checked
|
|
107
|
+
When I click the "later" radio
|
|
108
|
+
Then the "now" radio should be unchecked
|
|
109
|
+
And the "later" radio should be checked
|
|
110
|
+
|
|
111
|
+
Rule: Testing for focused / unfocused state should be possible
|
|
112
|
+
|
|
113
|
+
Scenario: navigating through the form
|
|
114
|
+
When I click the "Name" textbox
|
|
115
|
+
Then the "Name" textbox should be focused
|
|
116
|
+
When I activate the "Email" textbox
|
|
117
|
+
Then the "Name" textbox should be blurred
|
|
118
|
+
And the "Email" textbox should be focused
|
|
119
|
+
When I type the following keys: Tab
|
|
120
|
+
Then the "Email" textbox should be blurred
|
|
121
|
+
And the "Message" textbox should be focused
|
|
122
|
+
|
|
123
|
+
Rule: Testing for form input values should be possible
|
|
124
|
+
|
|
125
|
+
Scenario: default values should be available
|
|
126
|
+
Then the value of the "From" textbox should be "example@example.com"
|
|
127
|
+
And the value of the "From" textbox should contain "example"
|
|
128
|
+
And the value of the "From" textbox should not include "FWAH!"
|
|
129
|
+
And the value of the "From" textbox should NOT be "example"
|
|
130
|
+
And the value of "From" should contain "example"
|
|
131
|
+
And the value of "From" should NOT be "example"
|
|
132
|
+
|
|
133
|
+
Scenario: date values
|
|
134
|
+
Then the value of the "Date" textbox should be "2024-10-19"
|
|
135
|
+
When I focus on the "Date" textbox
|
|
136
|
+
And I type the following keys: ArrowLeft ArrowLeft ArrowLeft ArrowUp
|
|
137
|
+
Then the value of the "Date" textbox should be "2024-11-19"
|
|
138
|
+
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { Before, Then } from 'quickpickle'
|
|
2
|
+
import type { VitestBrowserWorld } from '../../src/VitestBrowserWorld'
|
|
3
|
+
import { expect } from 'vitest'
|
|
4
|
+
import { commands } from '@vitest/browser/context'
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
// Screenshots
|
|
9
|
+
Then('the screenshot {string} should exist(--delete it)', async function (world:VitestBrowserWorld, filepath:string) {
|
|
10
|
+
let fullpath = world.fullPath(`${world.screenshotDir}/${filepath}`)
|
|
11
|
+
await expect(commands.readFile(fullpath)).toBeTruthy();
|
|
12
|
+
if (world.info.step?.match(/--delete it$/)) await commands.removeFile(fullpath)
|
|
13
|
+
})
|
|
14
|
+
Then('the screenshot {string} should not exist', async function (world:VitestBrowserWorld, filepath:string) {
|
|
15
|
+
let fullpath = world.fullPath(`${world.screenshotDir}/${filepath}`)
|
|
16
|
+
try {
|
|
17
|
+
await commands.readFile(fullpath);
|
|
18
|
+
throw new Error(`Screenshot ${filepath} should not exist`)
|
|
19
|
+
}
|
|
20
|
+
catch(e) {
|
|
21
|
+
if (!e.message.match(/ENOENT/i)) throw e
|
|
22
|
+
}
|
|
23
|
+
})
|
|
24
|
+
Then('there should have been {int} error(s)', async (world:VitestBrowserWorld, int:number) => {
|
|
25
|
+
expect(world.info.errors.length).toBe(int)
|
|
26
|
+
world.info.errors = []
|
|
27
|
+
})
|
|
@@ -0,0 +1,153 @@
|
|
|
1
|
+
<style>
|
|
2
|
+
.hidden { display:none; }
|
|
3
|
+
.invisible { visibility:hidden; }
|
|
4
|
+
|
|
5
|
+
.faq-item:has(input:checked) .faq-answer {
|
|
6
|
+
display: block;
|
|
7
|
+
max-height: 200px; /* Adjust this value based on your content */
|
|
8
|
+
transition: max-height 0.5s ease-in;
|
|
9
|
+
}
|
|
10
|
+
.faq-toggle { cursor: pointer;}
|
|
11
|
+
.faq-answer {
|
|
12
|
+
max-height: 0;
|
|
13
|
+
overflow: hidden;
|
|
14
|
+
transition: max-height 0.3s ease-out;
|
|
15
|
+
}
|
|
16
|
+
.faq-item {
|
|
17
|
+
cursor: pointer;
|
|
18
|
+
}
|
|
19
|
+
.faq-item input[type="checkbox"] {
|
|
20
|
+
display: none;
|
|
21
|
+
}
|
|
22
|
+
</style>
|
|
23
|
+
|
|
24
|
+
<header>
|
|
25
|
+
<h1>HTML Test Page</h1>
|
|
26
|
+
<nav>
|
|
27
|
+
<ul>
|
|
28
|
+
<li><a href="#text">Text</a></li>
|
|
29
|
+
<li><a href="#lists">Lists</a></li>
|
|
30
|
+
<li><a href="#table">Table</a></li>
|
|
31
|
+
<li><a href="#form">Form</a></li>
|
|
32
|
+
<li><a href="#faq">FAQ</a></li>
|
|
33
|
+
<li><a href="#image">Image</a></li>
|
|
34
|
+
</ul>
|
|
35
|
+
</nav>
|
|
36
|
+
</header>
|
|
37
|
+
|
|
38
|
+
<main>
|
|
39
|
+
<section id="text">
|
|
40
|
+
<h2>Text Elements</h2>
|
|
41
|
+
<p>This is a paragraph with <strong>bold</strong> and <em>italic</em> text.</p>
|
|
42
|
+
<p>Here's a <a href="https://www.example.com">link</a> to an example website.</p>
|
|
43
|
+
<blockquote>This is a blockquote.</blockquote>
|
|
44
|
+
</section>
|
|
45
|
+
|
|
46
|
+
<section id="lists">
|
|
47
|
+
<h2>Lists</h2>
|
|
48
|
+
<h3>Unordered List</h3>
|
|
49
|
+
<ul>
|
|
50
|
+
<li>Item 1</li>
|
|
51
|
+
<li>Item 2</li>
|
|
52
|
+
<li>Item 3</li>
|
|
53
|
+
</ul>
|
|
54
|
+
<h3>Ordered List</h3>
|
|
55
|
+
<ol>
|
|
56
|
+
<li>First item</li>
|
|
57
|
+
<li>Second item</li>
|
|
58
|
+
<li>Third item</li>
|
|
59
|
+
<li class="hidden">Hidden item</li>
|
|
60
|
+
<li class="invisible">Invisible item</li>
|
|
61
|
+
</ol>
|
|
62
|
+
</section>
|
|
63
|
+
|
|
64
|
+
<section id="table">
|
|
65
|
+
<h2>Table</h2>
|
|
66
|
+
<table border="1">
|
|
67
|
+
<thead>
|
|
68
|
+
<tr>
|
|
69
|
+
<th>Header 1</th>
|
|
70
|
+
<th>Header 2</th>
|
|
71
|
+
</tr>
|
|
72
|
+
</thead>
|
|
73
|
+
<tbody>
|
|
74
|
+
<tr>
|
|
75
|
+
<td>Row 1, Cell 1</td>
|
|
76
|
+
<td>Row 1, Cell 2</td>
|
|
77
|
+
</tr>
|
|
78
|
+
<tr>
|
|
79
|
+
<td>Row 2, Cell 1</td>
|
|
80
|
+
<td>Row 2, Cell 2</td>
|
|
81
|
+
</tr>
|
|
82
|
+
</tbody>
|
|
83
|
+
</table>
|
|
84
|
+
</section>
|
|
85
|
+
|
|
86
|
+
<section id="form">
|
|
87
|
+
<h2>Form</h2>
|
|
88
|
+
<form action="#" method="post">
|
|
89
|
+
<label for="name">Name:</label>
|
|
90
|
+
<input type="text" id="name" name="name" required><br><br>
|
|
91
|
+
|
|
92
|
+
<label for="email">Email:</label>
|
|
93
|
+
<input type="email" id="email" name="email" required><br><br>
|
|
94
|
+
|
|
95
|
+
<label for="message">Message:</label><br>
|
|
96
|
+
<textarea id="message" name="message" rows="4" cols="50"></textarea><br><br>
|
|
97
|
+
|
|
98
|
+
<label for="from">From:</label>
|
|
99
|
+
<input type="text" id="from" name="from" disabled value="example@example.com"><br><br>
|
|
100
|
+
|
|
101
|
+
<label for="date">Date:</label>
|
|
102
|
+
<input type="date" id="date" name="date" value="2024-10-19"><br><br>
|
|
103
|
+
|
|
104
|
+
<label for="number">Number:</label>
|
|
105
|
+
<input type="number" id="number" name="number"><br><br>
|
|
106
|
+
|
|
107
|
+
<label for="color">Color:</label>
|
|
108
|
+
<select id="color" name="color">
|
|
109
|
+
<option value="">- none -</option>
|
|
110
|
+
<option value="red">Red</option>
|
|
111
|
+
<option value="green">Green</option>
|
|
112
|
+
<option value="blue">Blue</option>
|
|
113
|
+
</select><br><br>
|
|
114
|
+
|
|
115
|
+
<div>Send this message:</div>
|
|
116
|
+
<input type="radio" name="sendtime" id="sendtime-now" value="now" checked>
|
|
117
|
+
<label for="sendtime-now">Now</label>
|
|
118
|
+
<input type="radio" name="sendtime" id="sendtime-later" value="later">
|
|
119
|
+
<label for="sendtime-later">Later</label><br><br>
|
|
120
|
+
|
|
121
|
+
<input type="checkbox" name="tnc" id="tnc">
|
|
122
|
+
<label for="tnc">I agree to the terms and conditions</label><br><br>
|
|
123
|
+
|
|
124
|
+
<input type="submit" value="Submit">
|
|
125
|
+
</form>
|
|
126
|
+
</section>
|
|
127
|
+
|
|
128
|
+
<section id="faq">
|
|
129
|
+
<h2>FAQ</h2>
|
|
130
|
+
<div class="faq-item" id="faq-item-1">
|
|
131
|
+
<label for="faq-1" class="faq-toggle">
|
|
132
|
+
<input type="checkbox" id="faq-1" class="faq-toggle">
|
|
133
|
+
<h3>Do CSS transitions affect Playwright awaits?</h3>
|
|
134
|
+
</label>
|
|
135
|
+
<p class="faq-answer">
|
|
136
|
+
AI says: "CSS transitions can affect Playwright awaits if not handled properly.
|
|
137
|
+
Playwright's default waiting mechanism might not account for CSS transitions,
|
|
138
|
+
potentially leading to flaky tests. It's important to use appropriate waiting
|
|
139
|
+
strategies or disable transitions in test environments to ensure consistency."
|
|
140
|
+
</p>
|
|
141
|
+
</div>
|
|
142
|
+
</section>
|
|
143
|
+
|
|
144
|
+
<section id="image">
|
|
145
|
+
<h2>Image</h2>
|
|
146
|
+
<img src="https://imgs.xkcd.com/comics/software_testing_day.png" alt="XKCD Comic 2928: Software Testing Day" width="320">
|
|
147
|
+
<p>Image source: <a href="https://xkcd.com/2928">xkcd.com/2928</a></p>
|
|
148
|
+
</section>
|
|
149
|
+
</main>
|
|
150
|
+
|
|
151
|
+
<footer>
|
|
152
|
+
<p>© 2023 HTML Test Page. All rights reserved.</p>
|
|
153
|
+
</footer>
|