playwright-cucumber-ts-steps 1.3.2 → 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 +29 -29
- package/dist/backend/actions/form.d.ts +2 -2
- package/dist/backend/actions/form.js +2 -2
- package/dist/backend/actions/formTable.d.ts +1 -1
- package/dist/backend/actions/formTable.js +1 -1
- package/dist/backend/actions/frames.d.ts +3 -3
- package/dist/backend/actions/frames.js +3 -3
- package/dist/backend/actions/inputs.d.ts +14 -14
- package/dist/backend/actions/inputs.js +14 -14
- package/dist/backend/actions/interactions.d.ts +7 -7
- package/dist/backend/actions/interactions.js +7 -7
- package/dist/backend/actions/keyboard.d.ts +6 -6
- package/dist/backend/actions/keyboard.js +6 -6
- package/dist/backend/actions/misc.d.ts +15 -15
- package/dist/backend/actions/misc.js +15 -15
- package/dist/backend/actions/mobile.d.ts +7 -7
- package/dist/backend/actions/mobile.js +7 -7
- package/dist/backend/actions/mouse.d.ts +9 -9
- package/dist/backend/actions/mouse.js +9 -9
- package/dist/backend/actions/navigation.d.ts +5 -5
- package/dist/backend/actions/navigation.js +5 -5
- package/dist/backend/actions/visual.d.ts +6 -6
- package/dist/backend/actions/visual.js +6 -6
- package/dist/backend/actions/waits.d.ts +6 -6
- package/dist/backend/actions/waits.js +6 -6
- package/dist/backend/api/assertions.d.ts +3 -3
- package/dist/backend/api/assertions.js +3 -3
- package/dist/backend/api/mock.d.ts +3 -3
- package/dist/backend/api/mock.js +3 -3
- package/dist/backend/api/network.d.ts +6 -6
- package/dist/backend/api/network.js +6 -6
- package/dist/backend/api/requests.d.ts +4 -4
- package/dist/backend/api/requests.js +4 -4
- package/dist/backend/assertions/document.d.ts +10 -10
- package/dist/backend/assertions/document.js +10 -10
- package/dist/backend/assertions/elements.d.ts +28 -28
- package/dist/backend/assertions/elements.js +28 -28
- package/dist/backend/assertions/expectVisible.d.ts +1 -1
- package/dist/backend/assertions/expectVisible.js +1 -1
- package/dist/backend/assertions/forms.d.ts +7 -7
- package/dist/backend/assertions/forms.js +7 -7
- package/dist/backend/assertions/pageState.d.ts +4 -4
- package/dist/backend/assertions/pageState.js +4 -4
- package/dist/backend/assertions/storage.d.ts +11 -11
- package/dist/backend/assertions/storage.js +11 -11
- package/dist/backend/assertions/text.d.ts +17 -17
- package/dist/backend/assertions/text.js +17 -17
- package/dist/backend/assertions/visibility.d.ts +15 -15
- package/dist/backend/assertions/visibility.js +15 -15
- package/dist/backend/auth/index.d.ts +2 -2
- package/dist/backend/auth/index.js +2 -2
- package/dist/backend/db/steps.d.ts +9 -9
- package/dist/backend/db/steps.js +9 -9
- package/dist/backend/elements/alerts.d.ts +3 -3
- package/dist/backend/elements/alerts.js +3 -3
- package/dist/backend/elements/find.d.ts +15 -15
- package/dist/backend/elements/find.js +15 -15
- package/dist/backend/elements/forms.d.ts +4 -4
- package/dist/backend/elements/forms.js +4 -4
- package/dist/backend/elements/frames.d.ts +3 -3
- package/dist/backend/elements/frames.js +3 -3
- 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/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +3 -1
- package/package.json +1 -1
|
@@ -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);
|
|
@@ -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) {
|
|
@@ -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);
|
|
@@ -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
|
|
@@ -56,7 +56,7 @@ const state_1 = require("../utils/state");
|
|
|
56
56
|
// ==================================================
|
|
57
57
|
/**
|
|
58
58
|
* Pauses execution for a specified number of milliseconds.
|
|
59
|
-
* @example When I wait 1000 milliseconds
|
|
59
|
+
* @example When I pw wait 1000 milliseconds
|
|
60
60
|
*/
|
|
61
61
|
async function waitMilliseconds(page, ms) {
|
|
62
62
|
console.warn(`⚠️ Hard wait detected (${ms}ms). Consider replacing with dynamic waits.`);
|
|
@@ -65,7 +65,7 @@ async function waitMilliseconds(page, ms) {
|
|
|
65
65
|
}
|
|
66
66
|
/**
|
|
67
67
|
* Pauses execution for a specified number of seconds.
|
|
68
|
-
* @example When I wait 5 seconds
|
|
68
|
+
* @example When I pw wait 5 seconds
|
|
69
69
|
*/
|
|
70
70
|
async function waitSeconds(page, seconds) {
|
|
71
71
|
const ms = seconds * 1000;
|
|
@@ -75,7 +75,7 @@ async function waitSeconds(page, seconds) {
|
|
|
75
75
|
}
|
|
76
76
|
/**
|
|
77
77
|
* Pauses the test execution and opens the Playwright Inspector.
|
|
78
|
-
* @example When I pause
|
|
78
|
+
* @example When I pw pause
|
|
79
79
|
*/
|
|
80
80
|
async function pauseExecution(page) {
|
|
81
81
|
console.log("⏸️ Pausing test execution...");
|
|
@@ -83,7 +83,7 @@ async function pauseExecution(page) {
|
|
|
83
83
|
}
|
|
84
84
|
/**
|
|
85
85
|
* Alias for pauseExecution. Pauses execution for debugging.
|
|
86
|
-
* @example When I debug
|
|
86
|
+
* @example When I pw debug
|
|
87
87
|
*/
|
|
88
88
|
async function debugExecution(page) {
|
|
89
89
|
console.log("🐞 Debugging...");
|
|
@@ -91,14 +91,14 @@ async function debugExecution(page) {
|
|
|
91
91
|
}
|
|
92
92
|
/**
|
|
93
93
|
* Prints a custom message to the console logs.
|
|
94
|
-
* @example When I log "Starting Login Flow"
|
|
94
|
+
* @example When I pw log "Starting Login Flow"
|
|
95
95
|
*/
|
|
96
96
|
async function logMessage(page, message) {
|
|
97
97
|
console.log(`📝 LOG: ${message}`);
|
|
98
98
|
}
|
|
99
99
|
/**
|
|
100
100
|
* Focuses on the currently stored (active) element.
|
|
101
|
-
* @example When I focus
|
|
101
|
+
* @example When I pw focus
|
|
102
102
|
*/
|
|
103
103
|
async function focusElement(page) {
|
|
104
104
|
const element = (0, state_1.getActiveElement)(page);
|
|
@@ -107,7 +107,7 @@ async function focusElement(page) {
|
|
|
107
107
|
}
|
|
108
108
|
/**
|
|
109
109
|
* Blurs (removes focus from) the currently stored element.
|
|
110
|
-
* @example When I blur
|
|
110
|
+
* @example When I pw blur
|
|
111
111
|
*/
|
|
112
112
|
async function blurElement(page) {
|
|
113
113
|
const element = (0, state_1.getActiveElement)(page);
|
|
@@ -119,7 +119,7 @@ async function blurElement(page) {
|
|
|
119
119
|
}
|
|
120
120
|
/**
|
|
121
121
|
* Sets a cookie for the current context/URL.
|
|
122
|
-
* @example When I set cookie "session_id" to "12345ABC"
|
|
122
|
+
* @example When I pw set cookie "session_id" to "12345ABC"
|
|
123
123
|
*/
|
|
124
124
|
async function setCookie(page, name, value) {
|
|
125
125
|
const context = page.context();
|
|
@@ -129,7 +129,7 @@ async function setCookie(page, name, value) {
|
|
|
129
129
|
}
|
|
130
130
|
/**
|
|
131
131
|
* Clears all cookies for the current browser context.
|
|
132
|
-
* @example When I clear all cookies
|
|
132
|
+
* @example When I pw clear all cookies
|
|
133
133
|
*/
|
|
134
134
|
async function clearAllCookies(page) {
|
|
135
135
|
const context = page.context();
|
|
@@ -138,7 +138,7 @@ async function clearAllCookies(page) {
|
|
|
138
138
|
}
|
|
139
139
|
/**
|
|
140
140
|
* Sets an item in Local Storage.
|
|
141
|
-
* @example When I set local storage item "theme" to "dark"
|
|
141
|
+
* @example When I pw set local storage item "theme" to "dark"
|
|
142
142
|
*/
|
|
143
143
|
async function setLocalStorageItem(page, key, value) {
|
|
144
144
|
await page.evaluate((args) => localStorage.setItem(args.k, args.v), {
|
|
@@ -149,7 +149,7 @@ async function setLocalStorageItem(page, key, value) {
|
|
|
149
149
|
}
|
|
150
150
|
/**
|
|
151
151
|
* Retrieves a Local Storage item and logs it to the console.
|
|
152
|
-
* @example When I get local storage item "authToken"
|
|
152
|
+
* @example When I pw get local storage item "authToken"
|
|
153
153
|
*/
|
|
154
154
|
async function getLocalStorageItem(page, key) {
|
|
155
155
|
const value = await page.evaluate((k) => localStorage.getItem(k), key);
|
|
@@ -157,7 +157,7 @@ async function getLocalStorageItem(page, key) {
|
|
|
157
157
|
}
|
|
158
158
|
/**
|
|
159
159
|
* Clears all data from Local Storage.
|
|
160
|
-
* @example When I clear local storage
|
|
160
|
+
* @example When I pw clear local storage
|
|
161
161
|
*/
|
|
162
162
|
async function clearLocalStorage(page) {
|
|
163
163
|
await page.evaluate(() => localStorage.clear());
|
|
@@ -165,7 +165,7 @@ async function clearLocalStorage(page) {
|
|
|
165
165
|
}
|
|
166
166
|
/**
|
|
167
167
|
* Sets an item in Session Storage.
|
|
168
|
-
* @example When I set session storage item "user_role" to "admin"
|
|
168
|
+
* @example When I pw set session storage item "user_role" to "admin"
|
|
169
169
|
*/
|
|
170
170
|
async function setSessionStorageItem(page, key, value) {
|
|
171
171
|
await page.evaluate((args) => sessionStorage.setItem(args.k, args.v), {
|
|
@@ -176,7 +176,7 @@ async function setSessionStorageItem(page, key, value) {
|
|
|
176
176
|
}
|
|
177
177
|
/**
|
|
178
178
|
* Clears all data from Session Storage.
|
|
179
|
-
* @example When I clear session storage
|
|
179
|
+
* @example When I pw clear session storage
|
|
180
180
|
*/
|
|
181
181
|
async function clearSessionStorage(page) {
|
|
182
182
|
await page.evaluate(() => sessionStorage.clear());
|
|
@@ -185,7 +185,7 @@ async function clearSessionStorage(page) {
|
|
|
185
185
|
/**
|
|
186
186
|
* Stores the text content of the currently active element in a variable.
|
|
187
187
|
* This should be used after a step that selects an element (e.g., "I find element by text").
|
|
188
|
-
* @example When I store text as "extractedCode"
|
|
188
|
+
* @example When I pw store text as "extractedCode"
|
|
189
189
|
*/
|
|
190
190
|
async function storeActiveElementText(page, alias) {
|
|
191
191
|
const { getActiveElement, setVariable } = await Promise.resolve().then(() => __importStar(require("../utils/state")));
|
|
@@ -1,38 +1,38 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Taps on the currently stored (active) element.
|
|
3
3
|
* Uses a "Hybrid Tap" strategy: tries to tap, falls back to click if touch is unsupported.
|
|
4
|
-
* @example When I tap
|
|
4
|
+
* @example When I pw tap
|
|
5
5
|
*/
|
|
6
6
|
export declare function tapStoredElement(page: any): Promise<void>;
|
|
7
7
|
/**
|
|
8
8
|
* Finds an element by selector and taps it.
|
|
9
9
|
* Supports fixtures for reusable selectors.
|
|
10
|
-
* @example When I tap element "menu.toggleButton"
|
|
10
|
+
* @example When I pw tap element "menu.toggleButton"
|
|
11
11
|
*/
|
|
12
12
|
export declare function tapElementBySelector(page: any, selectorKey: string): Promise<void>;
|
|
13
13
|
/**
|
|
14
14
|
* Taps at specific X, Y coordinates on the screen.
|
|
15
|
-
* @example When I tap coordinates x:50 y:200
|
|
15
|
+
* @example When I pw tap coordinates x:50 y:200
|
|
16
16
|
*/
|
|
17
17
|
export declare function tapCoordinates(page: any, x: number, y: number): Promise<void>;
|
|
18
18
|
/**
|
|
19
19
|
* Resizes the browser window/viewport to specific dimensions.
|
|
20
|
-
* @example When I resize window to width 375 and height 812
|
|
20
|
+
* @example When I pw resize window to width 375 and height 812
|
|
21
21
|
*/
|
|
22
22
|
export declare function resizeWindow(page: any, width: number, height: number): Promise<void>;
|
|
23
23
|
/**
|
|
24
24
|
* Resizes the viewport to match a specific device preset.
|
|
25
|
-
* @example When I simulate device "iPhone 12"
|
|
25
|
+
* @example When I pw simulate device "iPhone 12"
|
|
26
26
|
*/
|
|
27
27
|
export declare function simulateDevice(page: any, deviceName: string): Promise<void>;
|
|
28
28
|
/**
|
|
29
29
|
* Sets the geolocation coordinates for the browser context and auto-grants permission.
|
|
30
|
-
* @example When I set geolocation to lat: 37.7749 long: -122.4194
|
|
30
|
+
* @example When I pw set geolocation to lat: 37.7749 long: -122.4194
|
|
31
31
|
*/
|
|
32
32
|
export declare function setGeolocation(page: any, lat: number, long: number): Promise<void>;
|
|
33
33
|
/**
|
|
34
34
|
* Grants a specific browser permission to the current context.
|
|
35
|
-
* @example When I grant permission "notifications"
|
|
35
|
+
* @example When I pw grant permission "notifications"
|
|
36
36
|
*/
|
|
37
37
|
export declare function grantPermission(page: any, permission: string): Promise<void>;
|
|
38
38
|
//# sourceMappingURL=mobile.d.ts.map
|
|
@@ -39,7 +39,7 @@ async function safeTap(target) {
|
|
|
39
39
|
/**
|
|
40
40
|
* Taps on the currently stored (active) element.
|
|
41
41
|
* Uses a "Hybrid Tap" strategy: tries to tap, falls back to click if touch is unsupported.
|
|
42
|
-
* @example When I tap
|
|
42
|
+
* @example When I pw tap
|
|
43
43
|
*/
|
|
44
44
|
async function tapStoredElement(page) {
|
|
45
45
|
const element = (0, state_1.getActiveElement)(page);
|
|
@@ -49,7 +49,7 @@ async function tapStoredElement(page) {
|
|
|
49
49
|
/**
|
|
50
50
|
* Finds an element by selector and taps it.
|
|
51
51
|
* Supports fixtures for reusable selectors.
|
|
52
|
-
* @example When I tap element "menu.toggleButton"
|
|
52
|
+
* @example When I pw tap element "menu.toggleButton"
|
|
53
53
|
*/
|
|
54
54
|
async function tapElementBySelector(page, selectorKey) {
|
|
55
55
|
const selectors = (0, fixtures_1.loadFixture)("selectors.json");
|
|
@@ -60,7 +60,7 @@ async function tapElementBySelector(page, selectorKey) {
|
|
|
60
60
|
}
|
|
61
61
|
/**
|
|
62
62
|
* Taps at specific X, Y coordinates on the screen.
|
|
63
|
-
* @example When I tap coordinates x:50 y:200
|
|
63
|
+
* @example When I pw tap coordinates x:50 y:200
|
|
64
64
|
*/
|
|
65
65
|
async function tapCoordinates(page, x, y) {
|
|
66
66
|
await page.mouse.click(x, y);
|
|
@@ -68,7 +68,7 @@ async function tapCoordinates(page, x, y) {
|
|
|
68
68
|
}
|
|
69
69
|
/**
|
|
70
70
|
* Resizes the browser window/viewport to specific dimensions.
|
|
71
|
-
* @example When I resize window to width 375 and height 812
|
|
71
|
+
* @example When I pw resize window to width 375 and height 812
|
|
72
72
|
*/
|
|
73
73
|
async function resizeWindow(page, width, height) {
|
|
74
74
|
await page.setViewportSize({ width, height });
|
|
@@ -76,7 +76,7 @@ async function resizeWindow(page, width, height) {
|
|
|
76
76
|
}
|
|
77
77
|
/**
|
|
78
78
|
* Resizes the viewport to match a specific device preset.
|
|
79
|
-
* @example When I simulate device "iPhone 12"
|
|
79
|
+
* @example When I pw simulate device "iPhone 12"
|
|
80
80
|
*/
|
|
81
81
|
async function simulateDevice(page, deviceName) {
|
|
82
82
|
const devices = {
|
|
@@ -96,7 +96,7 @@ async function simulateDevice(page, deviceName) {
|
|
|
96
96
|
}
|
|
97
97
|
/**
|
|
98
98
|
* Sets the geolocation coordinates for the browser context and auto-grants permission.
|
|
99
|
-
* @example When I set geolocation to lat: 37.7749 long: -122.4194
|
|
99
|
+
* @example When I pw set geolocation to lat: 37.7749 long: -122.4194
|
|
100
100
|
*/
|
|
101
101
|
async function setGeolocation(page, lat, long) {
|
|
102
102
|
await page.context().setGeolocation({ latitude: lat, longitude: long });
|
|
@@ -105,7 +105,7 @@ async function setGeolocation(page, lat, long) {
|
|
|
105
105
|
}
|
|
106
106
|
/**
|
|
107
107
|
* Grants a specific browser permission to the current context.
|
|
108
|
-
* @example When I grant permission "notifications"
|
|
108
|
+
* @example When I pw grant permission "notifications"
|
|
109
109
|
*/
|
|
110
110
|
async function grantPermission(page, permission) {
|
|
111
111
|
await page.context().grantPermissions([permission]);
|