playwright-cucumber-ts-steps 1.3.1 → 1.3.3
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 +358 -671
- package/dist/backend/actions/click.d.ts +29 -29
- package/dist/backend/actions/click.js +59 -59
- package/dist/backend/actions/form.d.ts +2 -2
- package/dist/backend/actions/form.js +4 -4
- package/dist/backend/actions/formTable.d.ts +1 -1
- package/dist/backend/actions/formTable.js +2 -2
- package/dist/backend/actions/frames.d.ts +3 -3
- package/dist/backend/actions/frames.js +6 -6
- package/dist/backend/actions/inputs.d.ts +14 -14
- package/dist/backend/actions/inputs.js +32 -32
- package/dist/backend/actions/interactions.d.ts +7 -7
- package/dist/backend/actions/interactions.js +13 -13
- package/dist/backend/actions/keyboard.d.ts +6 -6
- package/dist/backend/actions/keyboard.js +12 -12
- package/dist/backend/actions/misc.d.ts +15 -15
- package/dist/backend/actions/misc.js +30 -30
- package/dist/backend/actions/mobile.d.ts +7 -7
- package/dist/backend/actions/mobile.js +14 -14
- package/dist/backend/actions/mouse.d.ts +9 -9
- package/dist/backend/actions/mouse.js +18 -18
- package/dist/backend/actions/navigation.d.ts +5 -5
- package/dist/backend/actions/navigation.js +10 -10
- package/dist/backend/actions/visual.d.ts +6 -6
- package/dist/backend/actions/visual.js +13 -13
- package/dist/backend/actions/waits.d.ts +6 -6
- package/dist/backend/actions/waits.js +12 -12
- package/dist/backend/api/assertions.d.ts +3 -3
- package/dist/backend/api/assertions.js +6 -6
- package/dist/backend/api/mock.d.ts +3 -3
- package/dist/backend/api/mock.js +6 -6
- package/dist/backend/api/network.d.ts +6 -6
- package/dist/backend/api/network.js +12 -12
- package/dist/backend/api/requests.d.ts +4 -4
- package/dist/backend/api/requests.js +8 -8
- package/dist/backend/assertions/document.d.ts +10 -10
- package/dist/backend/assertions/document.js +20 -20
- package/dist/backend/assertions/elements.d.ts +28 -28
- package/dist/backend/assertions/elements.js +56 -56
- package/dist/backend/assertions/expectVisible.d.ts +1 -1
- package/dist/backend/assertions/expectVisible.js +2 -2
- package/dist/backend/assertions/forms.d.ts +7 -7
- package/dist/backend/assertions/forms.js +14 -14
- package/dist/backend/assertions/pageState.d.ts +4 -4
- package/dist/backend/assertions/pageState.js +8 -8
- package/dist/backend/assertions/storage.d.ts +11 -11
- package/dist/backend/assertions/storage.js +22 -22
- package/dist/backend/assertions/text.d.ts +17 -17
- package/dist/backend/assertions/text.js +34 -34
- package/dist/backend/assertions/visibility.d.ts +15 -15
- package/dist/backend/assertions/visibility.js +30 -30
- package/dist/backend/auth/index.d.ts +2 -2
- package/dist/backend/auth/index.js +4 -4
- package/dist/backend/db/steps.d.ts +10 -10
- package/dist/backend/db/steps.d.ts.map +1 -1
- package/dist/backend/db/steps.js +19 -19
- package/dist/backend/elements/alerts.d.ts +3 -3
- package/dist/backend/elements/alerts.js +6 -6
- package/dist/backend/elements/find.d.ts +15 -15
- package/dist/backend/elements/find.js +41 -41
- package/dist/backend/elements/forms.d.ts +4 -4
- package/dist/backend/elements/forms.js +8 -8
- package/dist/backend/elements/frames.d.ts +3 -3
- package/dist/backend/elements/frames.js +6 -6
- package/dist/backend/utils/fixtures.d.ts +22 -0
- package/dist/backend/utils/fixtures.d.ts.map +1 -1
- package/dist/backend/utils/fixtures.js +76 -2
- package/dist/backend/utils/resolver.js +1 -1
- package/dist/component/runner.d.ts +1 -1
- package/dist/component/runner.d.ts.map +1 -1
- package/dist/component/runner.js +38 -5
- package/dist/core/runner.js +3 -3
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +3 -1
- package/dist/metadata.json +270 -270
- package/package.json +3 -2
|
@@ -1,68 +1,68 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Fills the currently stored (active) input element with specific text.
|
|
3
3
|
* Supports variable aliases using the "@" prefix.
|
|
4
|
-
* @example When I type "hello world"
|
|
5
|
-
* When I type "@storedPassword"
|
|
4
|
+
* @example When I pw type "hello world"
|
|
5
|
+
* When I pw type "@storedPassword"
|
|
6
6
|
*/
|
|
7
7
|
export declare function typeText(page: any, textOrAlias: string, table?: any): Promise<void>;
|
|
8
8
|
/**
|
|
9
9
|
* Fills the active input with a value explicitly retrieved from the variable store.
|
|
10
|
-
* @example When I type stored "userEmail"
|
|
10
|
+
* @example When I pw type stored "userEmail"
|
|
11
11
|
*/
|
|
12
12
|
export declare function typeStoredText(page: any, alias: string, table?: any): Promise<void>;
|
|
13
13
|
/**
|
|
14
14
|
* Types text character-by-character with a 100ms delay.
|
|
15
|
-
* @example When I slowly type "Playwright"
|
|
15
|
+
* @example When I pw slowly type "Playwright"
|
|
16
16
|
*/
|
|
17
17
|
export declare function typeSlowly(page: any, text: string): Promise<void>;
|
|
18
18
|
/**
|
|
19
19
|
* Sets the value of an input directly (alias for filling).
|
|
20
|
-
* @example When I set value "12345"
|
|
20
|
+
* @example When I pw set value "12345"
|
|
21
21
|
*/
|
|
22
22
|
export declare function setInputValue(page: any, value: string, table?: any): Promise<void>;
|
|
23
23
|
/**
|
|
24
24
|
* Clears the text content of the active input field.
|
|
25
|
-
* @example When I clear
|
|
25
|
+
* @example When I pw clear
|
|
26
26
|
*/
|
|
27
27
|
export declare function clearInput(page: any): Promise<void>;
|
|
28
28
|
/**
|
|
29
29
|
* Simulates pressing a specific keyboard key on the active element.
|
|
30
|
-
* @example When I press "Enter"
|
|
30
|
+
* @example When I pw press "Enter"
|
|
31
31
|
*/
|
|
32
32
|
export declare function pressKeyOnInput(page: any, key: string): Promise<void>;
|
|
33
33
|
/**
|
|
34
34
|
* Checks the currently active checkbox or radio button.
|
|
35
|
-
* @example When I check
|
|
35
|
+
* @example When I pw check
|
|
36
36
|
*/
|
|
37
37
|
export declare function checkElement(page: any, table?: any): Promise<void>;
|
|
38
38
|
/**
|
|
39
39
|
* Unchecks the currently active checkbox.
|
|
40
|
-
* @example When I uncheck
|
|
40
|
+
* @example When I pw uncheck
|
|
41
41
|
*/
|
|
42
42
|
export declare function uncheckElement(page: any, table?: any): Promise<void>;
|
|
43
43
|
/**
|
|
44
44
|
* Checks/Unchecks the Nth checkbox or radio button matching a selector.
|
|
45
|
-
* @example When I check 1st selector "input[type='checkbox']"
|
|
45
|
+
* @example When I pw check 1st selector "input[type='checkbox']"
|
|
46
46
|
*/
|
|
47
47
|
export declare function checkNthElementBySelector(page: any, action: string, indexStr: string, selectorKey: string, table?: any): Promise<void>;
|
|
48
48
|
/**
|
|
49
49
|
* Selects an option in a `<select>` dropdown by its visible label.
|
|
50
|
-
* @example When I select option "California"
|
|
50
|
+
* @example When I pw select option "California"
|
|
51
51
|
*/
|
|
52
52
|
export declare function selectOption(page: any, option: string, table?: any): Promise<void>;
|
|
53
53
|
/**
|
|
54
54
|
* Submits the form related to the active element.
|
|
55
|
-
* @example When I submit
|
|
55
|
+
* @example When I pw submit
|
|
56
56
|
*/
|
|
57
57
|
export declare function submitForm(page: any): Promise<void>;
|
|
58
58
|
/**
|
|
59
59
|
* Uploads a file to the active file input element.
|
|
60
|
-
* @example When I select file "data/invoice.pdf"
|
|
60
|
+
* @example When I pw select file "data/invoice.pdf"
|
|
61
61
|
*/
|
|
62
62
|
export declare function selectFile(page: any, filePath: string): Promise<void>;
|
|
63
63
|
/**
|
|
64
64
|
* Uploads a file to the active file input element (alias for selectFile).
|
|
65
|
-
* @example When I upload file "images/logo.png"
|
|
65
|
+
* @example When I pw upload file "images/logo.png"
|
|
66
66
|
*/
|
|
67
67
|
export declare function uploadFile(page: any, filePath: string): Promise<void>;
|
|
68
68
|
//# sourceMappingURL=inputs.d.ts.map
|
|
@@ -23,8 +23,8 @@ const fixtures_1 = require("../utils/fixtures");
|
|
|
23
23
|
/**
|
|
24
24
|
* Fills the currently stored (active) input element with specific text.
|
|
25
25
|
* Supports variable aliases using the "@" prefix.
|
|
26
|
-
* @example When I type "hello world"
|
|
27
|
-
* When I type "@storedPassword"
|
|
26
|
+
* @example When I pw type "hello world"
|
|
27
|
+
* When I pw type "@storedPassword"
|
|
28
28
|
*/
|
|
29
29
|
async function typeText(page, textOrAlias, table) {
|
|
30
30
|
const element = (0, state_1.getActiveElement)(page);
|
|
@@ -43,7 +43,7 @@ async function typeText(page, textOrAlias, table) {
|
|
|
43
43
|
}
|
|
44
44
|
/**
|
|
45
45
|
* Fills the active input with a value explicitly retrieved from the variable store.
|
|
46
|
-
* @example When I type stored "userEmail"
|
|
46
|
+
* @example When I pw type stored "userEmail"
|
|
47
47
|
*/
|
|
48
48
|
async function typeStoredText(page, alias, table) {
|
|
49
49
|
const element = (0, state_1.getActiveElement)(page);
|
|
@@ -56,7 +56,7 @@ async function typeStoredText(page, alias, table) {
|
|
|
56
56
|
}
|
|
57
57
|
/**
|
|
58
58
|
* Types text character-by-character with a 100ms delay.
|
|
59
|
-
* @example When I slowly type "Playwright"
|
|
59
|
+
* @example When I pw slowly type "Playwright"
|
|
60
60
|
*/
|
|
61
61
|
async function typeSlowly(page, text) {
|
|
62
62
|
const element = (0, state_1.getActiveElement)(page);
|
|
@@ -65,7 +65,7 @@ async function typeSlowly(page, text) {
|
|
|
65
65
|
}
|
|
66
66
|
/**
|
|
67
67
|
* Sets the value of an input directly (alias for filling).
|
|
68
|
-
* @example When I set value "12345"
|
|
68
|
+
* @example When I pw set value "12345"
|
|
69
69
|
*/
|
|
70
70
|
async function setInputValue(page, value, table) {
|
|
71
71
|
const element = (0, state_1.getActiveElement)(page);
|
|
@@ -75,7 +75,7 @@ async function setInputValue(page, value, table) {
|
|
|
75
75
|
}
|
|
76
76
|
/**
|
|
77
77
|
* Clears the text content of the active input field.
|
|
78
|
-
* @example When I clear
|
|
78
|
+
* @example When I pw clear
|
|
79
79
|
*/
|
|
80
80
|
async function clearInput(page) {
|
|
81
81
|
const element = (0, state_1.getActiveElement)(page);
|
|
@@ -84,7 +84,7 @@ async function clearInput(page) {
|
|
|
84
84
|
}
|
|
85
85
|
/**
|
|
86
86
|
* Simulates pressing a specific keyboard key on the active element.
|
|
87
|
-
* @example When I press "Enter"
|
|
87
|
+
* @example When I pw press "Enter"
|
|
88
88
|
*/
|
|
89
89
|
async function pressKeyOnInput(page, key) {
|
|
90
90
|
const element = (0, state_1.getActiveElement)(page);
|
|
@@ -93,7 +93,7 @@ async function pressKeyOnInput(page, key) {
|
|
|
93
93
|
}
|
|
94
94
|
/**
|
|
95
95
|
* Checks the currently active checkbox or radio button.
|
|
96
|
-
* @example When I check
|
|
96
|
+
* @example When I pw check
|
|
97
97
|
*/
|
|
98
98
|
async function checkElement(page, table) {
|
|
99
99
|
const element = (0, state_1.getActiveElement)(page);
|
|
@@ -103,7 +103,7 @@ async function checkElement(page, table) {
|
|
|
103
103
|
}
|
|
104
104
|
/**
|
|
105
105
|
* Unchecks the currently active checkbox.
|
|
106
|
-
* @example When I uncheck
|
|
106
|
+
* @example When I pw uncheck
|
|
107
107
|
*/
|
|
108
108
|
async function uncheckElement(page, table) {
|
|
109
109
|
const element = (0, state_1.getActiveElement)(page);
|
|
@@ -113,7 +113,7 @@ async function uncheckElement(page, table) {
|
|
|
113
113
|
}
|
|
114
114
|
/**
|
|
115
115
|
* Checks/Unchecks the Nth checkbox or radio button matching a selector.
|
|
116
|
-
* @example When I check 1st selector "input[type='checkbox']"
|
|
116
|
+
* @example When I pw check 1st selector "input[type='checkbox']"
|
|
117
117
|
*/
|
|
118
118
|
async function checkNthElementBySelector(page, action, indexStr, selectorKey, table) {
|
|
119
119
|
const index = parseInt(indexStr, 10);
|
|
@@ -134,7 +134,7 @@ async function checkNthElementBySelector(page, action, indexStr, selectorKey, ta
|
|
|
134
134
|
}
|
|
135
135
|
/**
|
|
136
136
|
* Selects an option in a `<select>` dropdown by its visible label.
|
|
137
|
-
* @example When I select option "California"
|
|
137
|
+
* @example When I pw select option "California"
|
|
138
138
|
*/
|
|
139
139
|
async function selectOption(page, option, table) {
|
|
140
140
|
const element = (0, state_1.getActiveElement)(page);
|
|
@@ -144,7 +144,7 @@ async function selectOption(page, option, table) {
|
|
|
144
144
|
}
|
|
145
145
|
/**
|
|
146
146
|
* Submits the form related to the active element.
|
|
147
|
-
* @example When I submit
|
|
147
|
+
* @example When I pw submit
|
|
148
148
|
*/
|
|
149
149
|
async function submitForm(page) {
|
|
150
150
|
let formLocator;
|
|
@@ -164,7 +164,7 @@ async function submitForm(page) {
|
|
|
164
164
|
}
|
|
165
165
|
/**
|
|
166
166
|
* Uploads a file to the active file input element.
|
|
167
|
-
* @example When I select file "data/invoice.pdf"
|
|
167
|
+
* @example When I pw select file "data/invoice.pdf"
|
|
168
168
|
*/
|
|
169
169
|
async function selectFile(page, filePath) {
|
|
170
170
|
const element = (0, state_1.getActiveElement)(page);
|
|
@@ -173,7 +173,7 @@ async function selectFile(page, filePath) {
|
|
|
173
173
|
}
|
|
174
174
|
/**
|
|
175
175
|
* Uploads a file to the active file input element (alias for selectFile).
|
|
176
|
-
* @example When I upload file "images/logo.png"
|
|
176
|
+
* @example When I pw upload file "images/logo.png"
|
|
177
177
|
*/
|
|
178
178
|
async function uploadFile(page, filePath) {
|
|
179
179
|
const element = (0, state_1.getActiveElement)(page);
|
|
@@ -183,21 +183,21 @@ async function uploadFile(page, filePath) {
|
|
|
183
183
|
// ==================================================
|
|
184
184
|
// GLUE STEPS
|
|
185
185
|
// ==================================================
|
|
186
|
-
(0, registry_1.Step)("I type {string}", typeText, "When");
|
|
187
|
-
(0, registry_1.Step)("I fill {string}", typeText, "When");
|
|
188
|
-
(0, registry_1.Step)("I type stored {string}", typeStoredText, "When");
|
|
189
|
-
(0, registry_1.Step)("I fill stored {string}", typeStoredText, "When");
|
|
190
|
-
(0, registry_1.Step)("I slowly type {string}", typeSlowly, "When");
|
|
191
|
-
(0, registry_1.Step)("I slowly fill {string}", typeSlowly, "When");
|
|
192
|
-
(0, registry_1.Step)("I set value {string}", setInputValue, "When");
|
|
193
|
-
(0, registry_1.Step)("I clear", clearInput, "When");
|
|
194
|
-
(0, registry_1.Step)("I press {string}", pressKeyOnInput, "When");
|
|
195
|
-
(0, registry_1.Step)("I check", checkElement, "When");
|
|
196
|
-
(0, registry_1.Step)("I uncheck", uncheckElement, "When");
|
|
197
|
-
(0, registry_1.Step)("I check input", checkElement, "When");
|
|
198
|
-
(0, registry_1.Step)("I uncheck input", uncheckElement, "When");
|
|
199
|
-
(0, registry_1.Step)("I {string} {int}(?:st|nd|rd|th) selector {string}", checkNthElementBySelector, "When");
|
|
200
|
-
(0, registry_1.Step)("I select option {string}", selectOption, "When");
|
|
201
|
-
(0, registry_1.Step)("I submit", submitForm, "When");
|
|
202
|
-
(0, registry_1.Step)("I select file {string}", selectFile, "When");
|
|
203
|
-
(0, registry_1.Step)("I upload file {string}", uploadFile, "When");
|
|
186
|
+
(0, registry_1.Step)("I pw type {string}", typeText, "When");
|
|
187
|
+
(0, registry_1.Step)("I pw fill {string}", typeText, "When");
|
|
188
|
+
(0, registry_1.Step)("I pw type stored {string}", typeStoredText, "When");
|
|
189
|
+
(0, registry_1.Step)("I pw fill stored {string}", typeStoredText, "When");
|
|
190
|
+
(0, registry_1.Step)("I pw slowly type {string}", typeSlowly, "When");
|
|
191
|
+
(0, registry_1.Step)("I pw slowly fill {string}", typeSlowly, "When");
|
|
192
|
+
(0, registry_1.Step)("I pw set value {string}", setInputValue, "When");
|
|
193
|
+
(0, registry_1.Step)("I pw clear", clearInput, "When");
|
|
194
|
+
(0, registry_1.Step)("I pw press {string}", pressKeyOnInput, "When");
|
|
195
|
+
(0, registry_1.Step)("I pw check", checkElement, "When");
|
|
196
|
+
(0, registry_1.Step)("I pw uncheck", uncheckElement, "When");
|
|
197
|
+
(0, registry_1.Step)("I pw check input", checkElement, "When");
|
|
198
|
+
(0, registry_1.Step)("I pw uncheck input", uncheckElement, "When");
|
|
199
|
+
(0, registry_1.Step)("I pw {string} {int}(?:st|nd|rd|th) selector {string}", checkNthElementBySelector, "When");
|
|
200
|
+
(0, registry_1.Step)("I pw select option {string}", selectOption, "When");
|
|
201
|
+
(0, registry_1.Step)("I pw submit", submitForm, "When");
|
|
202
|
+
(0, registry_1.Step)("I pw select file {string}", selectFile, "When");
|
|
203
|
+
(0, registry_1.Step)("I pw upload file {string}", uploadFile, "When");
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Performs a standard click on the element matching the selector.
|
|
3
3
|
* Supports fixtures for reusable selectors.
|
|
4
|
-
* @example When I click "submit.submitButton"
|
|
4
|
+
* @example When I pw click "submit.submitButton"
|
|
5
5
|
* @param selectorKey - The key of the selector in the fixtures or a raw CSS/XPath selector.
|
|
6
6
|
*/
|
|
7
7
|
export declare function clickElement(page: any, selectorKey: string): Promise<void>;
|
|
@@ -9,14 +9,14 @@ export declare function clickElement(page: any, selectorKey: string): Promise<vo
|
|
|
9
9
|
* Performs a forced click on the element, bypassing visibility checks.
|
|
10
10
|
* Useful for elements obscured by overlays or technically "hidden" but interactable.
|
|
11
11
|
* Supports fixtures for reusable selectors.
|
|
12
|
-
* @example When I force click "hidden.hiddenCheckbox"
|
|
12
|
+
* @example When I pw force click "hidden.hiddenCheckbox"
|
|
13
13
|
* @param selectorKey - The key of the selector in the fixtures or a raw CSS/XPath selector.
|
|
14
14
|
*/
|
|
15
15
|
export declare function forceClickElement(page: any, selectorKey: string): Promise<void>;
|
|
16
16
|
/**
|
|
17
17
|
* Fills an input field with the specified value.
|
|
18
18
|
* Supports fixtures for reusable selectors.
|
|
19
|
-
* @example When I fill "login.usernameField" with "testuser"
|
|
19
|
+
* @example When I pw fill "login.usernameField" with "testuser"
|
|
20
20
|
* @param selectorKey - The key of the selector in the fixtures or a raw CSS/XPath selector.
|
|
21
21
|
* @param value - The text value to type/fill.
|
|
22
22
|
*/
|
|
@@ -24,15 +24,15 @@ export declare function fillElement(page: any, selectorKey: string, value: strin
|
|
|
24
24
|
/**
|
|
25
25
|
* Presses a specific key on the keyboard globally.
|
|
26
26
|
* Useful for submitting forms (Enter) or closing modals (Escape).
|
|
27
|
-
* @example When I press "Enter"
|
|
28
|
-
* When I press "Escape"
|
|
27
|
+
* @example When I pw press "Enter"
|
|
28
|
+
* When I pw press "Escape"
|
|
29
29
|
* @param key - The name of the key (e.g., "Enter", "Tab", "ArrowDown").
|
|
30
30
|
*/
|
|
31
31
|
export declare function pressKeyGlobal(page: any, key: string): Promise<void>;
|
|
32
32
|
/**
|
|
33
33
|
* Drags one element and drops it onto another.
|
|
34
34
|
* Supports fixtures for reusable selectors.
|
|
35
|
-
* @example When I drag "droppable.draggable" to "droppable.dropZone"
|
|
35
|
+
* @example When I pw drag "droppable.draggable" to "droppable.dropZone"
|
|
36
36
|
* @param sourceKey - The selector of the element to drag.
|
|
37
37
|
* @param targetKey - The selector of the drop target element.
|
|
38
38
|
*/
|
|
@@ -41,7 +41,7 @@ export declare function dragElementTo(page: any, sourceKey: string, targetKey: s
|
|
|
41
41
|
* Continues a drag operation from a previously selected element to a target.
|
|
42
42
|
* This is meant to be used after selecting an element to drag.
|
|
43
43
|
* Supports fixtures for reusable selectors.
|
|
44
|
-
* @example And I drag to "droppable.dropZone"
|
|
44
|
+
* @example And I pw drag to "droppable.dropZone"
|
|
45
45
|
* @param targetKey - The selector of the drop target element.
|
|
46
46
|
*/
|
|
47
47
|
export declare function dragToTarget(page: any, targetKey: string): Promise<void>;
|
|
@@ -48,7 +48,7 @@ const fixtures_1 = require("../utils/fixtures");
|
|
|
48
48
|
/**
|
|
49
49
|
* Performs a standard click on the element matching the selector.
|
|
50
50
|
* Supports fixtures for reusable selectors.
|
|
51
|
-
* @example When I click "submit.submitButton"
|
|
51
|
+
* @example When I pw click "submit.submitButton"
|
|
52
52
|
* @param selectorKey - The key of the selector in the fixtures or a raw CSS/XPath selector.
|
|
53
53
|
*/
|
|
54
54
|
async function clickElement(page, selectorKey) {
|
|
@@ -61,7 +61,7 @@ async function clickElement(page, selectorKey) {
|
|
|
61
61
|
* Performs a forced click on the element, bypassing visibility checks.
|
|
62
62
|
* Useful for elements obscured by overlays or technically "hidden" but interactable.
|
|
63
63
|
* Supports fixtures for reusable selectors.
|
|
64
|
-
* @example When I force click "hidden.hiddenCheckbox"
|
|
64
|
+
* @example When I pw force click "hidden.hiddenCheckbox"
|
|
65
65
|
* @param selectorKey - The key of the selector in the fixtures or a raw CSS/XPath selector.
|
|
66
66
|
*/
|
|
67
67
|
async function forceClickElement(page, selectorKey) {
|
|
@@ -73,7 +73,7 @@ async function forceClickElement(page, selectorKey) {
|
|
|
73
73
|
/**
|
|
74
74
|
* Fills an input field with the specified value.
|
|
75
75
|
* Supports fixtures for reusable selectors.
|
|
76
|
-
* @example When I fill "login.usernameField" with "testuser"
|
|
76
|
+
* @example When I pw fill "login.usernameField" with "testuser"
|
|
77
77
|
* @param selectorKey - The key of the selector in the fixtures or a raw CSS/XPath selector.
|
|
78
78
|
* @param value - The text value to type/fill.
|
|
79
79
|
*/
|
|
@@ -86,8 +86,8 @@ async function fillElement(page, selectorKey, value) {
|
|
|
86
86
|
/**
|
|
87
87
|
* Presses a specific key on the keyboard globally.
|
|
88
88
|
* Useful for submitting forms (Enter) or closing modals (Escape).
|
|
89
|
-
* @example When I press "Enter"
|
|
90
|
-
* When I press "Escape"
|
|
89
|
+
* @example When I pw press "Enter"
|
|
90
|
+
* When I pw press "Escape"
|
|
91
91
|
* @param key - The name of the key (e.g., "Enter", "Tab", "ArrowDown").
|
|
92
92
|
*/
|
|
93
93
|
async function pressKeyGlobal(page, key) {
|
|
@@ -97,7 +97,7 @@ async function pressKeyGlobal(page, key) {
|
|
|
97
97
|
/**
|
|
98
98
|
* Drags one element and drops it onto another.
|
|
99
99
|
* Supports fixtures for reusable selectors.
|
|
100
|
-
* @example When I drag "droppable.draggable" to "droppable.dropZone"
|
|
100
|
+
* @example When I pw drag "droppable.draggable" to "droppable.dropZone"
|
|
101
101
|
* @param sourceKey - The selector of the element to drag.
|
|
102
102
|
* @param targetKey - The selector of the drop target element.
|
|
103
103
|
*/
|
|
@@ -112,7 +112,7 @@ async function dragElementTo(page, sourceKey, targetKey) {
|
|
|
112
112
|
* Continues a drag operation from a previously selected element to a target.
|
|
113
113
|
* This is meant to be used after selecting an element to drag.
|
|
114
114
|
* Supports fixtures for reusable selectors.
|
|
115
|
-
* @example And I drag to "droppable.dropZone"
|
|
115
|
+
* @example And I pw drag to "droppable.dropZone"
|
|
116
116
|
* @param targetKey - The selector of the drop target element.
|
|
117
117
|
*/
|
|
118
118
|
async function dragToTarget(page, targetKey) {
|
|
@@ -128,9 +128,9 @@ async function dragToTarget(page, targetKey) {
|
|
|
128
128
|
// ==================================================
|
|
129
129
|
// GLUE STEPS
|
|
130
130
|
// ==================================================
|
|
131
|
-
(0, registry_1.Step)("I click {string}", clickElement, "When");
|
|
132
|
-
(0, registry_1.Step)("I force click {string}", forceClickElement, "When");
|
|
133
|
-
(0, registry_1.Step)("I fill {string} with {string}", fillElement, "When");
|
|
134
|
-
(0, registry_1.Step)("I press {string}", pressKeyGlobal, "When");
|
|
135
|
-
(0, registry_1.Step)("I drag {string} to {string}", dragElementTo, "When");
|
|
136
|
-
(0, registry_1.Step)("I drag to {string}", dragToTarget, "And");
|
|
131
|
+
(0, registry_1.Step)("I pw click {string}", clickElement, "When");
|
|
132
|
+
(0, registry_1.Step)("I pw force click {string}", forceClickElement, "When");
|
|
133
|
+
(0, registry_1.Step)("I pw fill {string} with {string}", fillElement, "When");
|
|
134
|
+
(0, registry_1.Step)("I pw press {string}", pressKeyGlobal, "When");
|
|
135
|
+
(0, registry_1.Step)("I pw drag {string} to {string}", dragElementTo, "When");
|
|
136
|
+
(0, registry_1.Step)("I pw drag to {string}", dragToTarget, "And");
|
|
@@ -1,33 +1,33 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Presses a specific key globally on the page.
|
|
3
3
|
* This simulates a user pressing a key without targeting any specific element.
|
|
4
|
-
* @example When I press key "Enter"
|
|
4
|
+
* @example When I pw press key "Enter"
|
|
5
5
|
*/
|
|
6
6
|
export declare function pressKey(page: any, key: string): Promise<void>;
|
|
7
7
|
/**
|
|
8
8
|
* Presses a specific key targeted at the currently stored (active) element.
|
|
9
|
-
* @example When I press key "Enter" on element
|
|
9
|
+
* @example When I pw press key "Enter" on element
|
|
10
10
|
*/
|
|
11
11
|
export declare function pressKeyOnElement(page: any, key: string): Promise<void>;
|
|
12
12
|
/**
|
|
13
13
|
* Types text globally using the keyboard, character by character.
|
|
14
|
-
* @example When I press keys "Hello World"
|
|
14
|
+
* @example When I pw press keys "Hello World"
|
|
15
15
|
*/
|
|
16
16
|
export declare function typeKeysGlobal(page: any, text: string): Promise<void>;
|
|
17
17
|
/**
|
|
18
18
|
* Performs a specific keyboard shortcut or combination.
|
|
19
|
-
* @example When I press shortcut "Control+C"
|
|
19
|
+
* @example When I pw press shortcut "Control+C"
|
|
20
20
|
*/
|
|
21
21
|
export declare function pressShortcut(page: any, shortcut: string): Promise<void>;
|
|
22
22
|
/**
|
|
23
23
|
* Holds down a specific key.
|
|
24
24
|
* Useful for operations like multiple selections (holding Shift) or drag-and-drop.
|
|
25
|
-
* @example When I hold down key "Shift"
|
|
25
|
+
* @example When I pw hold down key "Shift"
|
|
26
26
|
*/
|
|
27
27
|
export declare function holdDownKey(page: any, key: string): Promise<void>;
|
|
28
28
|
/**
|
|
29
29
|
* Releases a specific key that was previously held down.
|
|
30
|
-
* @example When I release key "Shift"
|
|
30
|
+
* @example When I pw release key "Shift"
|
|
31
31
|
*/
|
|
32
32
|
export declare function releaseKey(page: any, key: string): Promise<void>;
|
|
33
33
|
//# sourceMappingURL=keyboard.d.ts.map
|
|
@@ -15,7 +15,7 @@ const state_1 = require("../utils/state");
|
|
|
15
15
|
/**
|
|
16
16
|
* Presses a specific key globally on the page.
|
|
17
17
|
* This simulates a user pressing a key without targeting any specific element.
|
|
18
|
-
* @example When I press key "Enter"
|
|
18
|
+
* @example When I pw press key "Enter"
|
|
19
19
|
*/
|
|
20
20
|
async function pressKey(page, key) {
|
|
21
21
|
await page.keyboard.press(key);
|
|
@@ -23,7 +23,7 @@ async function pressKey(page, key) {
|
|
|
23
23
|
}
|
|
24
24
|
/**
|
|
25
25
|
* Presses a specific key targeted at the currently stored (active) element.
|
|
26
|
-
* @example When I press key "Enter" on element
|
|
26
|
+
* @example When I pw press key "Enter" on element
|
|
27
27
|
*/
|
|
28
28
|
async function pressKeyOnElement(page, key) {
|
|
29
29
|
const element = (0, state_1.getActiveElement)(page);
|
|
@@ -32,7 +32,7 @@ async function pressKeyOnElement(page, key) {
|
|
|
32
32
|
}
|
|
33
33
|
/**
|
|
34
34
|
* Types text globally using the keyboard, character by character.
|
|
35
|
-
* @example When I press keys "Hello World"
|
|
35
|
+
* @example When I pw press keys "Hello World"
|
|
36
36
|
*/
|
|
37
37
|
async function typeKeysGlobal(page, text) {
|
|
38
38
|
await page.keyboard.type(text);
|
|
@@ -40,7 +40,7 @@ async function typeKeysGlobal(page, text) {
|
|
|
40
40
|
}
|
|
41
41
|
/**
|
|
42
42
|
* Performs a specific keyboard shortcut or combination.
|
|
43
|
-
* @example When I press shortcut "Control+C"
|
|
43
|
+
* @example When I pw press shortcut "Control+C"
|
|
44
44
|
*/
|
|
45
45
|
async function pressShortcut(page, shortcut) {
|
|
46
46
|
await page.keyboard.press(shortcut);
|
|
@@ -49,7 +49,7 @@ async function pressShortcut(page, shortcut) {
|
|
|
49
49
|
/**
|
|
50
50
|
* Holds down a specific key.
|
|
51
51
|
* Useful for operations like multiple selections (holding Shift) or drag-and-drop.
|
|
52
|
-
* @example When I hold down key "Shift"
|
|
52
|
+
* @example When I pw hold down key "Shift"
|
|
53
53
|
*/
|
|
54
54
|
async function holdDownKey(page, key) {
|
|
55
55
|
await page.keyboard.down(key);
|
|
@@ -57,7 +57,7 @@ async function holdDownKey(page, key) {
|
|
|
57
57
|
}
|
|
58
58
|
/**
|
|
59
59
|
* Releases a specific key that was previously held down.
|
|
60
|
-
* @example When I release key "Shift"
|
|
60
|
+
* @example When I pw release key "Shift"
|
|
61
61
|
*/
|
|
62
62
|
async function releaseKey(page, key) {
|
|
63
63
|
await page.keyboard.up(key);
|
|
@@ -66,9 +66,9 @@ async function releaseKey(page, key) {
|
|
|
66
66
|
// ==================================================
|
|
67
67
|
// GLUE STEPS
|
|
68
68
|
// ==================================================
|
|
69
|
-
(0, registry_1.Step)("I press key {string}", pressKey, "When");
|
|
70
|
-
(0, registry_1.Step)("I press key {string} on element", pressKeyOnElement, "When");
|
|
71
|
-
(0, registry_1.Step)("I press keys {string}", typeKeysGlobal, "When");
|
|
72
|
-
(0, registry_1.Step)("I press shortcut {string}", pressShortcut, "When");
|
|
73
|
-
(0, registry_1.Step)("I hold down key {string}", holdDownKey, "When");
|
|
74
|
-
(0, registry_1.Step)("I release key {string}", releaseKey, "When");
|
|
69
|
+
(0, registry_1.Step)("I pw press key {string}", pressKey, "When");
|
|
70
|
+
(0, registry_1.Step)("I pw press key {string} on element", pressKeyOnElement, "When");
|
|
71
|
+
(0, registry_1.Step)("I pw press keys {string}", typeKeysGlobal, "When");
|
|
72
|
+
(0, registry_1.Step)("I pw press shortcut {string}", pressShortcut, "When");
|
|
73
|
+
(0, registry_1.Step)("I pw hold down key {string}", holdDownKey, "When");
|
|
74
|
+
(0, registry_1.Step)("I pw release key {string}", releaseKey, "When");
|
|
@@ -1,77 +1,77 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Pauses execution for a specified number of milliseconds.
|
|
3
|
-
* @example When I wait 1000 milliseconds
|
|
3
|
+
* @example When I pw wait 1000 milliseconds
|
|
4
4
|
*/
|
|
5
5
|
export declare function waitMilliseconds(page: any, ms: number): Promise<void>;
|
|
6
6
|
/**
|
|
7
7
|
* Pauses execution for a specified number of seconds.
|
|
8
|
-
* @example When I wait 5 seconds
|
|
8
|
+
* @example When I pw wait 5 seconds
|
|
9
9
|
*/
|
|
10
10
|
export declare function waitSeconds(page: any, seconds: number): Promise<void>;
|
|
11
11
|
/**
|
|
12
12
|
* Pauses the test execution and opens the Playwright Inspector.
|
|
13
|
-
* @example When I pause
|
|
13
|
+
* @example When I pw pause
|
|
14
14
|
*/
|
|
15
15
|
export declare function pauseExecution(page: any): Promise<void>;
|
|
16
16
|
/**
|
|
17
17
|
* Alias for pauseExecution. Pauses execution for debugging.
|
|
18
|
-
* @example When I debug
|
|
18
|
+
* @example When I pw debug
|
|
19
19
|
*/
|
|
20
20
|
export declare function debugExecution(page: any): Promise<void>;
|
|
21
21
|
/**
|
|
22
22
|
* Prints a custom message to the console logs.
|
|
23
|
-
* @example When I log "Starting Login Flow"
|
|
23
|
+
* @example When I pw log "Starting Login Flow"
|
|
24
24
|
*/
|
|
25
25
|
export declare function logMessage(page: any, message: string): Promise<void>;
|
|
26
26
|
/**
|
|
27
27
|
* Focuses on the currently stored (active) element.
|
|
28
|
-
* @example When I focus
|
|
28
|
+
* @example When I pw focus
|
|
29
29
|
*/
|
|
30
30
|
export declare function focusElement(page: any): Promise<void>;
|
|
31
31
|
/**
|
|
32
32
|
* Blurs (removes focus from) the currently stored element.
|
|
33
|
-
* @example When I blur
|
|
33
|
+
* @example When I pw blur
|
|
34
34
|
*/
|
|
35
35
|
export declare function blurElement(page: any): Promise<void>;
|
|
36
36
|
/**
|
|
37
37
|
* Sets a cookie for the current context/URL.
|
|
38
|
-
* @example When I set cookie "session_id" to "12345ABC"
|
|
38
|
+
* @example When I pw set cookie "session_id" to "12345ABC"
|
|
39
39
|
*/
|
|
40
40
|
export declare function setCookie(page: any, name: string, value: string): Promise<void>;
|
|
41
41
|
/**
|
|
42
42
|
* Clears all cookies for the current browser context.
|
|
43
|
-
* @example When I clear all cookies
|
|
43
|
+
* @example When I pw clear all cookies
|
|
44
44
|
*/
|
|
45
45
|
export declare function clearAllCookies(page: any): Promise<void>;
|
|
46
46
|
/**
|
|
47
47
|
* Sets an item in Local Storage.
|
|
48
|
-
* @example When I set local storage item "theme" to "dark"
|
|
48
|
+
* @example When I pw set local storage item "theme" to "dark"
|
|
49
49
|
*/
|
|
50
50
|
export declare function setLocalStorageItem(page: any, key: string, value: string): Promise<void>;
|
|
51
51
|
/**
|
|
52
52
|
* Retrieves a Local Storage item and logs it to the console.
|
|
53
|
-
* @example When I get local storage item "authToken"
|
|
53
|
+
* @example When I pw get local storage item "authToken"
|
|
54
54
|
*/
|
|
55
55
|
export declare function getLocalStorageItem(page: any, key: string): Promise<void>;
|
|
56
56
|
/**
|
|
57
57
|
* Clears all data from Local Storage.
|
|
58
|
-
* @example When I clear local storage
|
|
58
|
+
* @example When I pw clear local storage
|
|
59
59
|
*/
|
|
60
60
|
export declare function clearLocalStorage(page: any): Promise<void>;
|
|
61
61
|
/**
|
|
62
62
|
* Sets an item in Session Storage.
|
|
63
|
-
* @example When I set session storage item "user_role" to "admin"
|
|
63
|
+
* @example When I pw set session storage item "user_role" to "admin"
|
|
64
64
|
*/
|
|
65
65
|
export declare function setSessionStorageItem(page: any, key: string, value: string): Promise<void>;
|
|
66
66
|
/**
|
|
67
67
|
* Clears all data from Session Storage.
|
|
68
|
-
* @example When I clear session storage
|
|
68
|
+
* @example When I pw clear session storage
|
|
69
69
|
*/
|
|
70
70
|
export declare function clearSessionStorage(page: any): Promise<void>;
|
|
71
71
|
/**
|
|
72
72
|
* Stores the text content of the currently active element in a variable.
|
|
73
73
|
* This should be used after a step that selects an element (e.g., "I find element by text").
|
|
74
|
-
* @example When I store text as "extractedCode"
|
|
74
|
+
* @example When I pw store text as "extractedCode"
|
|
75
75
|
*/
|
|
76
76
|
export declare function storeActiveElementText(page: any, alias: string): Promise<void>;
|
|
77
77
|
//# sourceMappingURL=misc.d.ts.map
|