playwright-cucumber-ts-steps 0.1.7 → 1.0.1
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/README.md +21 -11
- package/lib/actions/clickSteps.d.ts +251 -1
- package/lib/actions/clickSteps.js +297 -47
- package/lib/actions/cookieSteps.d.ts +18 -1
- package/lib/actions/cookieSteps.js +65 -0
- package/lib/actions/debugSteps.d.ts +14 -1
- package/lib/actions/debugSteps.js +18 -3
- package/lib/actions/elementFindSteps.d.ts +668 -1
- package/lib/actions/elementFindSteps.js +808 -94
- package/lib/actions/fillFormSteps.d.ts +69 -1
- package/lib/actions/fillFormSteps.js +178 -71
- package/lib/actions/index.d.ts +11 -0
- package/lib/actions/index.js +28 -0
- package/lib/actions/inputSteps.d.ts +218 -1
- package/lib/actions/inputSteps.js +303 -57
- package/lib/actions/interceptionSteps.d.ts +169 -1
- package/lib/actions/interceptionSteps.js +258 -38
- package/lib/actions/miscSteps.d.ts +645 -1
- package/lib/actions/miscSteps.js +898 -157
- package/lib/actions/mouseSteps.d.ts +143 -1
- package/lib/actions/mouseSteps.js +200 -32
- package/lib/actions/scrollSteps.d.ts +82 -1
- package/lib/actions/scrollSteps.js +116 -16
- package/lib/actions/storageSteps.d.ts +174 -1
- package/lib/actions/storageSteps.js +253 -33
- package/lib/assertions/buttonAndTextVisibilitySteps.d.ts +245 -1
- package/lib/assertions/buttonAndTextVisibilitySteps.js +342 -91
- package/lib/assertions/cookieSteps.d.ts +75 -1
- package/lib/assertions/cookieSteps.js +97 -29
- package/lib/assertions/elementSteps.d.ts +264 -1
- package/lib/assertions/elementSteps.js +376 -78
- package/lib/assertions/formInputSteps.d.ts +248 -1
- package/lib/assertions/formInputSteps.js +342 -79
- package/lib/assertions/index.d.ts +10 -0
- package/lib/assertions/index.js +27 -0
- package/lib/assertions/interceptionRequestsSteps.d.ts +353 -1
- package/lib/assertions/interceptionRequestsSteps.js +569 -177
- package/lib/assertions/locationSteps.d.ts +217 -1
- package/lib/assertions/locationSteps.js +287 -64
- package/lib/assertions/roleTestIdSteps.d.ts +159 -1
- package/lib/assertions/roleTestIdSteps.js +217 -22
- package/lib/assertions/semanticSteps.d.ts +176 -1
- package/lib/assertions/semanticSteps.js +245 -60
- package/lib/assertions/storageSteps.d.ts +149 -1
- package/lib/assertions/storageSteps.js +201 -65
- package/lib/assertions/visualSteps.d.ts +74 -1
- package/lib/assertions/visualSteps.js +178 -45
- package/lib/custom_setups/loginHooks.js +19 -2
- package/lib/helpers/world.d.ts +3 -0
- package/lib/helpers/world.js +11 -5
- package/lib/index.d.ts +3 -21
- package/lib/index.js +3 -23
- package/package.json +9 -2
- package/src/actions/clickSteps.ts +364 -142
- package/src/actions/cookieSteps.ts +66 -0
- package/src/actions/debugSteps.ts +17 -3
- package/src/actions/elementFindSteps.ts +822 -117
- package/src/actions/fillFormSteps.ts +234 -177
- package/src/actions/index.ts +12 -0
- package/src/actions/inputSteps.ts +318 -82
- package/src/actions/interceptionSteps.ts +295 -57
- package/src/actions/miscSteps.ts +984 -254
- package/src/actions/mouseSteps.ts +212 -55
- package/src/actions/scrollSteps.ts +114 -16
- package/src/actions/storageSteps.ts +267 -42
- package/src/assertions/buttonAndTextVisibilitySteps.ts +353 -95
- package/src/assertions/cookieSteps.ts +115 -36
- package/src/assertions/elementSteps.ts +414 -85
- package/src/assertions/formInputSteps.ts +375 -108
- package/src/assertions/index.ts +11 -0
- package/src/assertions/interceptionRequestsSteps.ts +619 -195
- package/src/assertions/locationSteps.ts +280 -64
- package/src/assertions/roleTestIdSteps.ts +244 -26
- package/src/assertions/semanticSteps.ts +257 -69
- package/src/assertions/storageSteps.ts +234 -73
- package/src/assertions/visualSteps.ts +245 -68
- package/src/custom_setups/loginHooks.ts +21 -2
- package/src/helpers/world.ts +30 -4
- package/src/index.ts +4 -25
package/README.md
CHANGED
|
@@ -1,17 +1,22 @@
|
|
|
1
1
|
# 🎭 playwright-cucumber-ts-steps
|
|
2
2
|
|
|
3
|
-
[](https://github.com/qaPaschalE/playwright-cucumber-ts-steps/blob/main/LICENSE)
|
|
5
|
-
[](https://github.com/qaPaschalE/playwright-cucumber-ts-steps/actions)
|
|
6
|
-
[](https://www.npmjs.com/package/playwright-cucumber-ts-steps)
|
|
7
|
-
[](https://github.com/qaPaschalE/playwright-cucumber-ts-steps/issues)
|
|
8
|
-
[](https://github.com/qaPaschalE/playwright-cucumber-ts-steps/stargazers)
|
|
3
|
+
[](https://nodei.co/npm/playwright-cucumber-ts-steps/)
|
|
9
4
|
|
|
10
|
-
|
|
5
|
+
<table align="center" style="margin-bottom:30px;"><tr><td align="center" width="9999" heigth="9999" >
|
|
6
|
+
<img src="https://github.com/qaPaschalE/k6-cucumber-steps/blob/main/assets/paschal%20logo%20(2).png?raw=true" alt="paschal Logo" style="margin-top:25px;" align="center"/>
|
|
7
|
+
</td></tr></table>
|
|
11
8
|
|
|
12
|
-
|
|
9
|
+
[](https://www.npmjs.com/package/playwright-cucumber-ts-steps)
|
|
10
|
+
[](https://github.com/qaPaschalE/playwright-cucumber-ts-steps/blob/main/LICENSE)
|
|
11
|
+
[](https://nodejs.org/)
|
|
12
|
+
[](https://github.com/qaPaschalE/playwright-cucumber-ts-steps/actions)
|
|
13
|
+
[](https://www.npmjs.com/package/playwright-cucumber-ts-steps)
|
|
14
|
+
[](https://github.com/qaPaschalE/playwright-cucumber-ts-steps/issues)
|
|
15
|
+
[](https://github.com/qaPaschalE/playwright-cucumber-ts-steps/stargazers)
|
|
13
16
|
|
|
14
|
-
|
|
17
|
+
> A collection of reusable Playwright step definitions for Cucumber in TypeScript, designed to streamline end-to-end testing across web, API, and mobile applications.
|
|
18
|
+
|
|
19
|
+
> **Note:** This package is designed for advanced Cucumber+Playwright+TypeScript setups. For basic Playwright usage, see the [official Playwright docs](https://playwright.dev/).
|
|
15
20
|
|
|
16
21
|
## ✨ Features
|
|
17
22
|
|
|
@@ -54,6 +59,10 @@ npm install --save-dev @playwright/test @cucumber/cucumber typescript ts-node
|
|
|
54
59
|
npx playwright install
|
|
55
60
|
```
|
|
56
61
|
|
|
62
|
+
## 📘 Step Definition Documentation
|
|
63
|
+
|
|
64
|
+
👉 [View Steps Documentation](https://qapaschale.github.io/playwright-cucumber-ts-steps/) and [examples](https://github.com/qaPaschale/playwright-cucumber-ts-steps/tree/master/playwright/e2e).
|
|
65
|
+
|
|
57
66
|
---
|
|
58
67
|
|
|
59
68
|
## 🛠️ Usage
|
|
@@ -229,8 +238,9 @@ const ARTIFACT_DIR = process.env.TEST_ARTIFACT_DIR || "test-artifacts";
|
|
|
229
238
|
const defaultWorldParams = {
|
|
230
239
|
artifactDir: ARTIFACT_DIR,
|
|
231
240
|
payloadDir: "payloads",
|
|
232
|
-
|
|
233
|
-
|
|
241
|
+
enableTrace: process.env.ENABLE_TRACE || "fail", // "false" | "fail" | "all"
|
|
242
|
+
enableScreenshots: process.env.ENABLE_SCREENSHOTS || "fail", // "false" | "fail" | "all"
|
|
243
|
+
enableVideos: process.env.ENABLE_VIDEOS || "all", // "false" | "fail" | "all"
|
|
234
244
|
enableVisualTest: process.env.ENABLE_VISUAL_TEST === "true",
|
|
235
245
|
device: process.env.MOBILE_DEVICE || undefined, // e.g., "Pixel 5"
|
|
236
246
|
};
|
|
@@ -1 +1,251 @@
|
|
|
1
|
-
|
|
1
|
+
import { DataTable } from "@cucumber/cucumber";
|
|
2
|
+
import { CustomWorld } from "../helpers/world";
|
|
3
|
+
/**
|
|
4
|
+
* Clicks on the previously stored element.
|
|
5
|
+
*
|
|
6
|
+
* ```gherkin
|
|
7
|
+
* When I click
|
|
8
|
+
* ```
|
|
9
|
+
*
|
|
10
|
+
* @example
|
|
11
|
+
* ```gherkin
|
|
12
|
+
* When I click
|
|
13
|
+
* ```
|
|
14
|
+
* @remarks
|
|
15
|
+
* Requires a previous step that stores an element.
|
|
16
|
+
* @category Click Steps
|
|
17
|
+
*/
|
|
18
|
+
export declare function When_I_click(this: CustomWorld, ...rest: any[]): Promise<void>;
|
|
19
|
+
/**
|
|
20
|
+
* Clicks on an element matching the given selector.
|
|
21
|
+
*
|
|
22
|
+
* ```gherkin
|
|
23
|
+
* When I click on element {string}
|
|
24
|
+
* ```
|
|
25
|
+
*
|
|
26
|
+
* @example
|
|
27
|
+
* ```gherkin
|
|
28
|
+
* When I click on element ".my-class"
|
|
29
|
+
* ```
|
|
30
|
+
* @remarks
|
|
31
|
+
* Stores the clicked element for later use.
|
|
32
|
+
* @category Click Steps
|
|
33
|
+
*/
|
|
34
|
+
export declare function When_I_click_on_element(this: CustomWorld, selector: string, ...rest: any[]): Promise<void>;
|
|
35
|
+
/**
|
|
36
|
+
* Clicks on a button with the given label.
|
|
37
|
+
*
|
|
38
|
+
* ```gherkin
|
|
39
|
+
* When I click on button {string}
|
|
40
|
+
* ```
|
|
41
|
+
*
|
|
42
|
+
* @example
|
|
43
|
+
* ```gherkin
|
|
44
|
+
* When I click on button "Submit"
|
|
45
|
+
* ```
|
|
46
|
+
* @remarks
|
|
47
|
+
* Stores the clicked button for later use.
|
|
48
|
+
* @category Click Steps
|
|
49
|
+
*/
|
|
50
|
+
export declare function When_I_click_on_button(this: CustomWorld, label: string, ...rest: any[]): Promise<void>;
|
|
51
|
+
/**
|
|
52
|
+
* Clicks on a link with the given text.
|
|
53
|
+
*
|
|
54
|
+
* ```gherkin
|
|
55
|
+
* When I click on link {string}
|
|
56
|
+
* ```
|
|
57
|
+
*
|
|
58
|
+
* @example
|
|
59
|
+
* ```gherkin
|
|
60
|
+
* When I click on link "Home"
|
|
61
|
+
* ```
|
|
62
|
+
* @remarks
|
|
63
|
+
* Stores the clicked link for later use.
|
|
64
|
+
* @category Click Steps
|
|
65
|
+
*/
|
|
66
|
+
export declare function When_I_click_on_link(this: CustomWorld, text: string, ...rest: any[]): Promise<void>;
|
|
67
|
+
/**
|
|
68
|
+
* Clicks on a label with the given text.
|
|
69
|
+
*
|
|
70
|
+
* ```gherkin
|
|
71
|
+
* When I click on label {string}
|
|
72
|
+
* ```
|
|
73
|
+
*
|
|
74
|
+
* @example
|
|
75
|
+
* ```gherkin
|
|
76
|
+
* When I click on label "Username"
|
|
77
|
+
* ```
|
|
78
|
+
* @remarks
|
|
79
|
+
* Stores the clicked label for later use.
|
|
80
|
+
* @category Click Steps
|
|
81
|
+
*/
|
|
82
|
+
export declare function When_I_click_on_label(this: CustomWorld, labelText: string, ...rest: any[]): Promise<void>;
|
|
83
|
+
/**
|
|
84
|
+
* Clicks on an element containing the given text (not exact match). Supports aliasing with @alias.
|
|
85
|
+
*
|
|
86
|
+
* ```gherkin
|
|
87
|
+
* When I click on text {string}
|
|
88
|
+
* ```
|
|
89
|
+
*
|
|
90
|
+
* @example
|
|
91
|
+
* ```gherkin
|
|
92
|
+
* When I click on text "Welcome"
|
|
93
|
+
* When I click on text "@username"
|
|
94
|
+
* ```
|
|
95
|
+
* @remarks
|
|
96
|
+
* Stores the clicked element for later use.
|
|
97
|
+
* @category Click Steps
|
|
98
|
+
*/
|
|
99
|
+
export declare function When_I_click_on_text(this: CustomWorld, rawText: string, ...rest: any[]): Promise<void>;
|
|
100
|
+
/**
|
|
101
|
+
* Clicks on an element containing the exact given text.
|
|
102
|
+
*
|
|
103
|
+
* ```gherkin
|
|
104
|
+
* When I click on exact text {string}
|
|
105
|
+
* ```
|
|
106
|
+
*
|
|
107
|
+
* @example
|
|
108
|
+
* ```gherkin
|
|
109
|
+
* When I click on exact text "Log out"
|
|
110
|
+
* ```
|
|
111
|
+
* @remarks
|
|
112
|
+
* Stores the clicked element for later use.
|
|
113
|
+
* @category Click Steps
|
|
114
|
+
*/
|
|
115
|
+
export declare function When_I_click_on_exact_text(this: CustomWorld, exactText: string, ...rest: any[]): Promise<void>;
|
|
116
|
+
/**
|
|
117
|
+
* Clicks all previously stored elements.
|
|
118
|
+
*
|
|
119
|
+
* ```gherkin
|
|
120
|
+
* When I click all
|
|
121
|
+
* ```
|
|
122
|
+
*
|
|
123
|
+
* @example
|
|
124
|
+
* ```gherkin
|
|
125
|
+
* When I click all
|
|
126
|
+
* ```
|
|
127
|
+
* @remarks
|
|
128
|
+
* Requires a previous step that stores elements.
|
|
129
|
+
* @category Click Steps
|
|
130
|
+
*/
|
|
131
|
+
export declare function When_I_click_all(this: CustomWorld, ...rest: any[]): Promise<void>;
|
|
132
|
+
/**
|
|
133
|
+
* Double-clicks on an element containing the given text.
|
|
134
|
+
*
|
|
135
|
+
* ```gherkin
|
|
136
|
+
* When I double click on text {string}
|
|
137
|
+
* ```
|
|
138
|
+
*
|
|
139
|
+
* @example
|
|
140
|
+
* ```gherkin
|
|
141
|
+
* When I double click on text "Edit"
|
|
142
|
+
* ```
|
|
143
|
+
* @remarks
|
|
144
|
+
* Uses the previously stored element if available.
|
|
145
|
+
* @category Click Steps
|
|
146
|
+
*/
|
|
147
|
+
export declare function When_I_double_click_on_text(this: CustomWorld, text: string, ...rest: any[]): Promise<void>;
|
|
148
|
+
/**
|
|
149
|
+
* Double-clicks at the given page coordinates.
|
|
150
|
+
*
|
|
151
|
+
* ```gherkin
|
|
152
|
+
* When I double click position {int} {int}
|
|
153
|
+
* ```
|
|
154
|
+
*
|
|
155
|
+
* @example
|
|
156
|
+
* ```gherkin
|
|
157
|
+
* When I double click position 100 200
|
|
158
|
+
* ```
|
|
159
|
+
* @category Click Steps
|
|
160
|
+
*/
|
|
161
|
+
export declare function When_I_double_click_position(this: CustomWorld, x: number, y: number, ...rest: any[]): Promise<void>;
|
|
162
|
+
/**
|
|
163
|
+
* Double-clicks on the previously stored element.
|
|
164
|
+
*
|
|
165
|
+
* ```gherkin
|
|
166
|
+
* When I double click
|
|
167
|
+
* ```
|
|
168
|
+
*
|
|
169
|
+
* @example
|
|
170
|
+
* ```gherkin
|
|
171
|
+
* When I double click
|
|
172
|
+
* ```
|
|
173
|
+
* @remarks
|
|
174
|
+
* Requires a previous step that stores an element.
|
|
175
|
+
* @category Click Steps
|
|
176
|
+
*/
|
|
177
|
+
export declare function When_I_double_click(this: CustomWorld, ...rest: any[]): Promise<void>;
|
|
178
|
+
/**
|
|
179
|
+
* Right-clicks on the previously stored element.
|
|
180
|
+
*
|
|
181
|
+
* ```gherkin
|
|
182
|
+
* When I right click
|
|
183
|
+
* ```
|
|
184
|
+
*
|
|
185
|
+
* @example
|
|
186
|
+
* ```gherkin
|
|
187
|
+
* When I right click
|
|
188
|
+
* ```
|
|
189
|
+
* @remarks
|
|
190
|
+
* Requires a previous step that stores an element.
|
|
191
|
+
* @category Click Steps
|
|
192
|
+
*/
|
|
193
|
+
export declare function When_I_right_click(this: CustomWorld, ...rest: any[]): Promise<void>;
|
|
194
|
+
/**
|
|
195
|
+
* Right-clicks on an element containing the given text.
|
|
196
|
+
*
|
|
197
|
+
* ```gherkin
|
|
198
|
+
* When I right click on text {string}
|
|
199
|
+
* ```
|
|
200
|
+
*
|
|
201
|
+
* @example
|
|
202
|
+
* ```gherkin
|
|
203
|
+
* When I right click on text "Options"
|
|
204
|
+
* ```
|
|
205
|
+
* @category Click Steps
|
|
206
|
+
*/
|
|
207
|
+
export declare function When_I_right_click_on_text(this: CustomWorld, text: string, ...rest: any[]): Promise<void>;
|
|
208
|
+
/**
|
|
209
|
+
* Right-clicks at the given page coordinates.
|
|
210
|
+
*
|
|
211
|
+
* ```gherkin
|
|
212
|
+
* When I right click position {int} {int}
|
|
213
|
+
* ```
|
|
214
|
+
*
|
|
215
|
+
* @example
|
|
216
|
+
* ```gherkin
|
|
217
|
+
* When I right click position 50 50
|
|
218
|
+
* ```
|
|
219
|
+
* @category Click Steps
|
|
220
|
+
*/
|
|
221
|
+
export declare function When_I_right_click_position(this: CustomWorld, x: number, y: number, ...rest: any[]): Promise<void>;
|
|
222
|
+
/**
|
|
223
|
+
* Clicks all stored elements (alternative signature).
|
|
224
|
+
*
|
|
225
|
+
* ```gherkin
|
|
226
|
+
* When I click all
|
|
227
|
+
* ```
|
|
228
|
+
*
|
|
229
|
+
* @example
|
|
230
|
+
* ```gherkin
|
|
231
|
+
* When I click all
|
|
232
|
+
* ```
|
|
233
|
+
* @remarks
|
|
234
|
+
* Requires a previous step that stores elements.
|
|
235
|
+
* @category Click Steps
|
|
236
|
+
*/
|
|
237
|
+
export declare function When_I_click_all_alt(this: CustomWorld, dataTable?: DataTable): Promise<void>;
|
|
238
|
+
/**
|
|
239
|
+
* Clicks on an element matching the given selector (regex step).
|
|
240
|
+
*
|
|
241
|
+
* ```gherkin
|
|
242
|
+
* When I click on selector {string}
|
|
243
|
+
* ```
|
|
244
|
+
*
|
|
245
|
+
* @example
|
|
246
|
+
* ```gherkin
|
|
247
|
+
* When I click on selector ".my-selector"
|
|
248
|
+
* ```
|
|
249
|
+
* @category Click Steps
|
|
250
|
+
*/
|
|
251
|
+
export declare function When_I_click_on_selector(this: CustomWorld, selector: string): Promise<void>;
|