artes 1.2.16 → 1.2.18
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 +629 -533
- package/cucumber.config.js +171 -171
- package/docs/functionDefinitions.md +2401 -2401
- package/docs/stepDefinitions.md +391 -352
- package/executer.js +161 -161
- package/index.js +48 -48
- package/package.json +52 -51
- package/src/helper/contextManager/browserManager.js +63 -63
- package/src/helper/contextManager/requestManager.js +23 -23
- package/src/helper/controller/elementController.js +182 -182
- package/src/helper/controller/pomCollector.js +25 -25
- package/src/helper/executers/cleaner.js +19 -19
- package/src/helper/executers/exporter.js +15 -15
- package/src/helper/executers/helper.js +95 -95
- package/src/helper/executers/projectCreator.js +198 -198
- package/src/helper/executers/reportGenerator.js +58 -58
- package/src/helper/executers/testRunner.js +30 -30
- package/src/helper/executers/versionChecker.js +31 -31
- package/src/helper/imports/commons.js +56 -56
- package/src/helper/stepFunctions/APIActions.js +362 -362
- package/src/helper/stepFunctions/assertions.js +523 -523
- package/src/helper/stepFunctions/browserActions.js +22 -22
- package/src/helper/stepFunctions/elementInteractions.js +38 -38
- package/src/helper/stepFunctions/exporter.js +19 -19
- package/src/helper/stepFunctions/frameActions.js +50 -50
- package/src/helper/stepFunctions/keyboardActions.js +41 -41
- package/src/helper/stepFunctions/mouseActions.js +145 -145
- package/src/helper/stepFunctions/pageActions.js +27 -27
- package/src/hooks/context.js +15 -15
- package/src/hooks/hooks.js +257 -257
- package/src/stepDefinitions/API.steps.js +299 -299
- package/src/stepDefinitions/assertions.steps.js +861 -861
- package/src/stepDefinitions/browser.steps.js +7 -7
- package/src/stepDefinitions/frameActions.steps.js +76 -76
- package/src/stepDefinitions/keyboardActions.steps.js +226 -226
- package/src/stepDefinitions/mouseActions.steps.js +275 -275
- package/src/stepDefinitions/page.steps.js +71 -71
- package/src/stepDefinitions/random.steps.js +158 -158
|
@@ -1,276 +1,276 @@
|
|
|
1
|
-
const { When, element, selector } = require("../helper/imports/commons");
|
|
2
|
-
const { mouse, frame } = require("../helper/stepFunctions/exporter");
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
// User clicks on a selector
|
|
6
|
-
When("User clicks {string}", async function (selector) {
|
|
7
|
-
await mouse.click(selector);
|
|
8
|
-
});
|
|
9
|
-
|
|
10
|
-
When("User clicks last of {string}", async (selector) => {
|
|
11
|
-
const elementCount = await frame.count(selector);
|
|
12
|
-
const lastElement = await frame.nth(selector, elementCount);
|
|
13
|
-
await mouse.click(lastElement);
|
|
14
|
-
});
|
|
15
|
-
|
|
16
|
-
When("User clicks {int} th of {string}", async (order, elements) => {
|
|
17
|
-
const nthElement = await frame.nth(elements, order);
|
|
18
|
-
await nthElement.click();
|
|
19
|
-
});
|
|
20
|
-
|
|
21
|
-
When("User clicks multiple {string}", async (elements) => {
|
|
22
|
-
await mouse.multipleElementClick(elements);
|
|
23
|
-
});
|
|
24
|
-
|
|
25
|
-
// User clicks on a selector with force
|
|
26
|
-
When("User clicks {string} with force", async function (selector) {
|
|
27
|
-
await mouse.click(selector, true);
|
|
28
|
-
});
|
|
29
|
-
|
|
30
|
-
// User clicks on a selector at a specific position
|
|
31
|
-
When(
|
|
32
|
-
"User clicks {string} at {int}, {int} position",
|
|
33
|
-
async function (selector, x, y) {
|
|
34
|
-
await mouse.clickPosition(selector, x, y);
|
|
35
|
-
},
|
|
36
|
-
);
|
|
37
|
-
|
|
38
|
-
// User clicks on a selector at a specific position with force
|
|
39
|
-
When(
|
|
40
|
-
"User clicks {string} at {int}, {int} position with force",
|
|
41
|
-
async function (selector, x, y) {
|
|
42
|
-
await mouse.clickPosition(selector, x, y, true);
|
|
43
|
-
},
|
|
44
|
-
);
|
|
45
|
-
|
|
46
|
-
// User clicks at specific coordinates
|
|
47
|
-
When("User clicks at {int}, {int} coordinates", async function (x, y) {
|
|
48
|
-
await mouse.mouseClickPosition(x, y);
|
|
49
|
-
});
|
|
50
|
-
|
|
51
|
-
// User clicks at specific coordinates with click count and delay
|
|
52
|
-
When(
|
|
53
|
-
"User clicks at {int}, {int} coordinates with click count {int} and delay {int}",
|
|
54
|
-
async function (x, y, clickCount, delay) {
|
|
55
|
-
await mouse.mouseClickPosition(x, y, clickCount, delay);
|
|
56
|
-
},
|
|
57
|
-
);
|
|
58
|
-
|
|
59
|
-
// User clicks at specific coordinates with force
|
|
60
|
-
When(
|
|
61
|
-
"User clicks at {int}, {int} coordinates with force",
|
|
62
|
-
async function (x, y) {
|
|
63
|
-
await mouse.mouseClickPosition(x, y, 1, 0, true); // Defaulting clickCount and delay
|
|
64
|
-
},
|
|
65
|
-
);
|
|
66
|
-
|
|
67
|
-
// User clicks on a selector with a specific mouse button
|
|
68
|
-
When(
|
|
69
|
-
"User clicks {string} with button {string}",
|
|
70
|
-
async function (selector, button) {
|
|
71
|
-
await mouse.clickByBtn(selector, button);
|
|
72
|
-
},
|
|
73
|
-
);
|
|
74
|
-
|
|
75
|
-
// User clicks on a selector with a specific mouse button and force
|
|
76
|
-
When(
|
|
77
|
-
"User clicks {string} with button {string} and force",
|
|
78
|
-
async function (selector, button) {
|
|
79
|
-
await mouse.clickByBtn(selector, button, true);
|
|
80
|
-
},
|
|
81
|
-
);
|
|
82
|
-
|
|
83
|
-
// User double clicks on a selector
|
|
84
|
-
When("User double clicks {string}", async function (selector) {
|
|
85
|
-
await mouse.doubleClick(selector);
|
|
86
|
-
});
|
|
87
|
-
|
|
88
|
-
When("User double clicks multiple {string}", async (elements) => {
|
|
89
|
-
await mouse.multipleElementDoubleClick(elements);
|
|
90
|
-
});
|
|
91
|
-
|
|
92
|
-
// User double clicks on a selector with force
|
|
93
|
-
When("User double clicks {string} with force", async function (selector) {
|
|
94
|
-
await mouse.doubleClick(selector, true);
|
|
95
|
-
});
|
|
96
|
-
|
|
97
|
-
// User double clicks on a selector at a specific position
|
|
98
|
-
When(
|
|
99
|
-
"User double clicks {string} at {int}, {int} position",
|
|
100
|
-
async function (selector, x, y) {
|
|
101
|
-
await mouse.doubleClickPosition(selector, x, y);
|
|
102
|
-
},
|
|
103
|
-
);
|
|
104
|
-
|
|
105
|
-
// User double clicks on a selector at a specific position with force
|
|
106
|
-
When(
|
|
107
|
-
"User double clicks {string} at {int}, {int} position with force",
|
|
108
|
-
async function (selector, x, y) {
|
|
109
|
-
await mouse.doubleClickPosition(selector, x, y, true);
|
|
110
|
-
},
|
|
111
|
-
);
|
|
112
|
-
|
|
113
|
-
// User double clicks at specific coordinates
|
|
114
|
-
When("User double clicks at {int}, {int} coordinates", async function (x, y) {
|
|
115
|
-
await mouse.mouseDoubleClickPosition(x, y);
|
|
116
|
-
});
|
|
117
|
-
|
|
118
|
-
// User double clicks at specific coordinates with click count and delay
|
|
119
|
-
When(
|
|
120
|
-
"User double clicks at {int}, {int} coordinates with click count {int} and delay {int}",
|
|
121
|
-
async function (x, y, clickCount, delay) {
|
|
122
|
-
await mouse.mouseDoubleClickPosition(x, y, clickCount, delay);
|
|
123
|
-
},
|
|
124
|
-
);
|
|
125
|
-
|
|
126
|
-
// User double clicks at specific coordinates with force
|
|
127
|
-
When(
|
|
128
|
-
"User double clicks at {int}, {int} coordinates with force",
|
|
129
|
-
async function (x, y) {
|
|
130
|
-
await mouse.mouseDoubleClickPosition(x, y, 1, 0, true); // Defaulting clickCount and delay
|
|
131
|
-
},
|
|
132
|
-
);
|
|
133
|
-
|
|
134
|
-
// User moves the mouse to specific coordinates
|
|
135
|
-
When("User moves to {int}, {int} coordinates", async function (x, y) {
|
|
136
|
-
await mouse.move(x, y);
|
|
137
|
-
});
|
|
138
|
-
|
|
139
|
-
// User scrolls the mouse wheel at specific coordinates
|
|
140
|
-
When(
|
|
141
|
-
"User scrolls the mouse wheel at {int}, {int} coordinates",
|
|
142
|
-
async function (x, y) {
|
|
143
|
-
await mouse.wheel(x, y);
|
|
144
|
-
},
|
|
145
|
-
);
|
|
146
|
-
|
|
147
|
-
// User hovers over a selector
|
|
148
|
-
When("User hovers over {string}", async function (selector) {
|
|
149
|
-
await mouse.hover(selector);
|
|
150
|
-
});
|
|
151
|
-
|
|
152
|
-
// User hovers over a selector with force
|
|
153
|
-
When("User hovers over {string} with force", async function (selector) {
|
|
154
|
-
await mouse.hover(selector, true);
|
|
155
|
-
});
|
|
156
|
-
|
|
157
|
-
// User hovers over a selector at a specific position
|
|
158
|
-
When(
|
|
159
|
-
"User hovers over {string} at {int}, {int} position",
|
|
160
|
-
async function (selector, x, y) {
|
|
161
|
-
await mouse.hoverPosition(selector, x, y);
|
|
162
|
-
},
|
|
163
|
-
);
|
|
164
|
-
|
|
165
|
-
// User hovers over a selector at a specific position with force
|
|
166
|
-
When(
|
|
167
|
-
"User hovers over {string} at {int}, {int} position with force",
|
|
168
|
-
async function (selector, x, y) {
|
|
169
|
-
await mouse.hoverPosition(selector, x, y, true);
|
|
170
|
-
},
|
|
171
|
-
);
|
|
172
|
-
|
|
173
|
-
// User focuses on a selector
|
|
174
|
-
When("User focuses on {string}", async function (selector) {
|
|
175
|
-
await mouse.focus(selector);
|
|
176
|
-
});
|
|
177
|
-
|
|
178
|
-
// User focuses on a selector with force
|
|
179
|
-
When("User focuses on {string} with force", async function (selector) {
|
|
180
|
-
await mouse.focus(selector, true);
|
|
181
|
-
});
|
|
182
|
-
|
|
183
|
-
// User focuses on a selector at a specific position
|
|
184
|
-
When(
|
|
185
|
-
"User focuses on {string} at {int}, {int} position",
|
|
186
|
-
async function (selector, x, y) {
|
|
187
|
-
await mouse.focusPosition(selector, x, y);
|
|
188
|
-
},
|
|
189
|
-
);
|
|
190
|
-
|
|
191
|
-
// User focuses on a selector at a specific position with force
|
|
192
|
-
When(
|
|
193
|
-
"User focuses on {string} at {int}, {int} position with force",
|
|
194
|
-
async function (selector, x, y) {
|
|
195
|
-
await mouse.focusPosition(selector, x, y, true);
|
|
196
|
-
},
|
|
197
|
-
);
|
|
198
|
-
|
|
199
|
-
// User drags an element from one selector to another
|
|
200
|
-
When(
|
|
201
|
-
"User drags {string} to {string}",
|
|
202
|
-
async function (sourceSelector, targetSelector) {
|
|
203
|
-
await mouse.dragAndDrop(sourceSelector, targetSelector);
|
|
204
|
-
},
|
|
205
|
-
);
|
|
206
|
-
|
|
207
|
-
// User drags an element to a specific position
|
|
208
|
-
When(
|
|
209
|
-
"User drags {string} to {int}, {int} position",
|
|
210
|
-
async function (sourceSelector, x, y) {
|
|
211
|
-
await mouse.dragAndDropPosition(sourceSelector, x, y);
|
|
212
|
-
},
|
|
213
|
-
);
|
|
214
|
-
|
|
215
|
-
// User selects options by value
|
|
216
|
-
When(
|
|
217
|
-
"User selects by value {string} from {string}",
|
|
218
|
-
async function (value, selector) {
|
|
219
|
-
await mouse.selectByValue(selector, value);
|
|
220
|
-
},
|
|
221
|
-
);
|
|
222
|
-
|
|
223
|
-
// User selects an option by text
|
|
224
|
-
When(
|
|
225
|
-
"User selects by text {string} from {string}",
|
|
226
|
-
async function (text, selector) {
|
|
227
|
-
await mouse.selectByText(selector, text);
|
|
228
|
-
},
|
|
229
|
-
);
|
|
230
|
-
|
|
231
|
-
// User checks a checkbox or radio button
|
|
232
|
-
When("User checks {string}", async function (selector) {
|
|
233
|
-
await mouse.check(selector);
|
|
234
|
-
});
|
|
235
|
-
|
|
236
|
-
When("User checks multiple {string}", async function (selectors) {
|
|
237
|
-
await mouse.multipleElementCheck(selectors);
|
|
238
|
-
});
|
|
239
|
-
|
|
240
|
-
// User unchecks a checkbox or radio button
|
|
241
|
-
When("User unchecks {string}", async function (selector) {
|
|
242
|
-
await mouse.uncheck(selector);
|
|
243
|
-
});
|
|
244
|
-
|
|
245
|
-
When("User unchecks multiple {string}", async function (selectors) {
|
|
246
|
-
await mouse.multipleElementUncheck(selectors);
|
|
247
|
-
});
|
|
248
|
-
|
|
249
|
-
// User scrolls into view if needed for a selector
|
|
250
|
-
When("User scrolls {string} into view", async function (selector) {
|
|
251
|
-
await mouse.scrollIntoViewIfNeeded(selector);
|
|
252
|
-
});
|
|
253
|
-
|
|
254
|
-
// User uploads file
|
|
255
|
-
When("User uploads {string} file to {string}", async (filePath, fileInput) => {
|
|
256
|
-
await mouse.upload(filePath, fileInput);
|
|
257
|
-
});
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
When('User selects by text from {string} randomly', async ( select) => {
|
|
261
|
-
const optionsArray = await element(`${selector(select)} option`).evaluateAll(
|
|
262
|
-
options => options.map(option => option.text)
|
|
263
|
-
);
|
|
264
|
-
const randomOption = await optionsArray[Math.floor(Math.random() * optionsArray.length)];
|
|
265
|
-
|
|
266
|
-
await mouse.selectByText(select, randomOption);
|
|
267
|
-
})
|
|
268
|
-
|
|
269
|
-
When('User selects by value from {string} randomly', async ( select) => {
|
|
270
|
-
const optionsArray = await element(`${selector(select)} option`).evaluateAll(
|
|
271
|
-
options => options.map(option => option.value)
|
|
272
|
-
);
|
|
273
|
-
const randomOption = await optionsArray[Math.floor(Math.random() * optionsArray.length)];
|
|
274
|
-
|
|
275
|
-
await mouse.selectByValue(select, randomOption);
|
|
1
|
+
const { When, element, selector } = require("../helper/imports/commons");
|
|
2
|
+
const { mouse, frame } = require("../helper/stepFunctions/exporter");
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
// User clicks on a selector
|
|
6
|
+
When("User clicks {string}", async function (selector) {
|
|
7
|
+
await mouse.click(selector);
|
|
8
|
+
});
|
|
9
|
+
|
|
10
|
+
When("User clicks last of {string}", async (selector) => {
|
|
11
|
+
const elementCount = await frame.count(selector);
|
|
12
|
+
const lastElement = await frame.nth(selector, elementCount);
|
|
13
|
+
await mouse.click(lastElement);
|
|
14
|
+
});
|
|
15
|
+
|
|
16
|
+
When("User clicks {int} th of {string}", async (order, elements) => {
|
|
17
|
+
const nthElement = await frame.nth(elements, order);
|
|
18
|
+
await nthElement.click();
|
|
19
|
+
});
|
|
20
|
+
|
|
21
|
+
When("User clicks multiple {string}", async (elements) => {
|
|
22
|
+
await mouse.multipleElementClick(elements);
|
|
23
|
+
});
|
|
24
|
+
|
|
25
|
+
// User clicks on a selector with force
|
|
26
|
+
When("User clicks {string} with force", async function (selector) {
|
|
27
|
+
await mouse.click(selector, true);
|
|
28
|
+
});
|
|
29
|
+
|
|
30
|
+
// User clicks on a selector at a specific position
|
|
31
|
+
When(
|
|
32
|
+
"User clicks {string} at {int}, {int} position",
|
|
33
|
+
async function (selector, x, y) {
|
|
34
|
+
await mouse.clickPosition(selector, x, y);
|
|
35
|
+
},
|
|
36
|
+
);
|
|
37
|
+
|
|
38
|
+
// User clicks on a selector at a specific position with force
|
|
39
|
+
When(
|
|
40
|
+
"User clicks {string} at {int}, {int} position with force",
|
|
41
|
+
async function (selector, x, y) {
|
|
42
|
+
await mouse.clickPosition(selector, x, y, true);
|
|
43
|
+
},
|
|
44
|
+
);
|
|
45
|
+
|
|
46
|
+
// User clicks at specific coordinates
|
|
47
|
+
When("User clicks at {int}, {int} coordinates", async function (x, y) {
|
|
48
|
+
await mouse.mouseClickPosition(x, y);
|
|
49
|
+
});
|
|
50
|
+
|
|
51
|
+
// User clicks at specific coordinates with click count and delay
|
|
52
|
+
When(
|
|
53
|
+
"User clicks at {int}, {int} coordinates with click count {int} and delay {int}",
|
|
54
|
+
async function (x, y, clickCount, delay) {
|
|
55
|
+
await mouse.mouseClickPosition(x, y, clickCount, delay);
|
|
56
|
+
},
|
|
57
|
+
);
|
|
58
|
+
|
|
59
|
+
// User clicks at specific coordinates with force
|
|
60
|
+
When(
|
|
61
|
+
"User clicks at {int}, {int} coordinates with force",
|
|
62
|
+
async function (x, y) {
|
|
63
|
+
await mouse.mouseClickPosition(x, y, 1, 0, true); // Defaulting clickCount and delay
|
|
64
|
+
},
|
|
65
|
+
);
|
|
66
|
+
|
|
67
|
+
// User clicks on a selector with a specific mouse button
|
|
68
|
+
When(
|
|
69
|
+
"User clicks {string} with button {string}",
|
|
70
|
+
async function (selector, button) {
|
|
71
|
+
await mouse.clickByBtn(selector, button);
|
|
72
|
+
},
|
|
73
|
+
);
|
|
74
|
+
|
|
75
|
+
// User clicks on a selector with a specific mouse button and force
|
|
76
|
+
When(
|
|
77
|
+
"User clicks {string} with button {string} and force",
|
|
78
|
+
async function (selector, button) {
|
|
79
|
+
await mouse.clickByBtn(selector, button, true);
|
|
80
|
+
},
|
|
81
|
+
);
|
|
82
|
+
|
|
83
|
+
// User double clicks on a selector
|
|
84
|
+
When("User double clicks {string}", async function (selector) {
|
|
85
|
+
await mouse.doubleClick(selector);
|
|
86
|
+
});
|
|
87
|
+
|
|
88
|
+
When("User double clicks multiple {string}", async (elements) => {
|
|
89
|
+
await mouse.multipleElementDoubleClick(elements);
|
|
90
|
+
});
|
|
91
|
+
|
|
92
|
+
// User double clicks on a selector with force
|
|
93
|
+
When("User double clicks {string} with force", async function (selector) {
|
|
94
|
+
await mouse.doubleClick(selector, true);
|
|
95
|
+
});
|
|
96
|
+
|
|
97
|
+
// User double clicks on a selector at a specific position
|
|
98
|
+
When(
|
|
99
|
+
"User double clicks {string} at {int}, {int} position",
|
|
100
|
+
async function (selector, x, y) {
|
|
101
|
+
await mouse.doubleClickPosition(selector, x, y);
|
|
102
|
+
},
|
|
103
|
+
);
|
|
104
|
+
|
|
105
|
+
// User double clicks on a selector at a specific position with force
|
|
106
|
+
When(
|
|
107
|
+
"User double clicks {string} at {int}, {int} position with force",
|
|
108
|
+
async function (selector, x, y) {
|
|
109
|
+
await mouse.doubleClickPosition(selector, x, y, true);
|
|
110
|
+
},
|
|
111
|
+
);
|
|
112
|
+
|
|
113
|
+
// User double clicks at specific coordinates
|
|
114
|
+
When("User double clicks at {int}, {int} coordinates", async function (x, y) {
|
|
115
|
+
await mouse.mouseDoubleClickPosition(x, y);
|
|
116
|
+
});
|
|
117
|
+
|
|
118
|
+
// User double clicks at specific coordinates with click count and delay
|
|
119
|
+
When(
|
|
120
|
+
"User double clicks at {int}, {int} coordinates with click count {int} and delay {int}",
|
|
121
|
+
async function (x, y, clickCount, delay) {
|
|
122
|
+
await mouse.mouseDoubleClickPosition(x, y, clickCount, delay);
|
|
123
|
+
},
|
|
124
|
+
);
|
|
125
|
+
|
|
126
|
+
// User double clicks at specific coordinates with force
|
|
127
|
+
When(
|
|
128
|
+
"User double clicks at {int}, {int} coordinates with force",
|
|
129
|
+
async function (x, y) {
|
|
130
|
+
await mouse.mouseDoubleClickPosition(x, y, 1, 0, true); // Defaulting clickCount and delay
|
|
131
|
+
},
|
|
132
|
+
);
|
|
133
|
+
|
|
134
|
+
// User moves the mouse to specific coordinates
|
|
135
|
+
When("User moves to {int}, {int} coordinates", async function (x, y) {
|
|
136
|
+
await mouse.move(x, y);
|
|
137
|
+
});
|
|
138
|
+
|
|
139
|
+
// User scrolls the mouse wheel at specific coordinates
|
|
140
|
+
When(
|
|
141
|
+
"User scrolls the mouse wheel at {int}, {int} coordinates",
|
|
142
|
+
async function (x, y) {
|
|
143
|
+
await mouse.wheel(x, y);
|
|
144
|
+
},
|
|
145
|
+
);
|
|
146
|
+
|
|
147
|
+
// User hovers over a selector
|
|
148
|
+
When("User hovers over {string}", async function (selector) {
|
|
149
|
+
await mouse.hover(selector);
|
|
150
|
+
});
|
|
151
|
+
|
|
152
|
+
// User hovers over a selector with force
|
|
153
|
+
When("User hovers over {string} with force", async function (selector) {
|
|
154
|
+
await mouse.hover(selector, true);
|
|
155
|
+
});
|
|
156
|
+
|
|
157
|
+
// User hovers over a selector at a specific position
|
|
158
|
+
When(
|
|
159
|
+
"User hovers over {string} at {int}, {int} position",
|
|
160
|
+
async function (selector, x, y) {
|
|
161
|
+
await mouse.hoverPosition(selector, x, y);
|
|
162
|
+
},
|
|
163
|
+
);
|
|
164
|
+
|
|
165
|
+
// User hovers over a selector at a specific position with force
|
|
166
|
+
When(
|
|
167
|
+
"User hovers over {string} at {int}, {int} position with force",
|
|
168
|
+
async function (selector, x, y) {
|
|
169
|
+
await mouse.hoverPosition(selector, x, y, true);
|
|
170
|
+
},
|
|
171
|
+
);
|
|
172
|
+
|
|
173
|
+
// User focuses on a selector
|
|
174
|
+
When("User focuses on {string}", async function (selector) {
|
|
175
|
+
await mouse.focus(selector);
|
|
176
|
+
});
|
|
177
|
+
|
|
178
|
+
// User focuses on a selector with force
|
|
179
|
+
When("User focuses on {string} with force", async function (selector) {
|
|
180
|
+
await mouse.focus(selector, true);
|
|
181
|
+
});
|
|
182
|
+
|
|
183
|
+
// User focuses on a selector at a specific position
|
|
184
|
+
When(
|
|
185
|
+
"User focuses on {string} at {int}, {int} position",
|
|
186
|
+
async function (selector, x, y) {
|
|
187
|
+
await mouse.focusPosition(selector, x, y);
|
|
188
|
+
},
|
|
189
|
+
);
|
|
190
|
+
|
|
191
|
+
// User focuses on a selector at a specific position with force
|
|
192
|
+
When(
|
|
193
|
+
"User focuses on {string} at {int}, {int} position with force",
|
|
194
|
+
async function (selector, x, y) {
|
|
195
|
+
await mouse.focusPosition(selector, x, y, true);
|
|
196
|
+
},
|
|
197
|
+
);
|
|
198
|
+
|
|
199
|
+
// User drags an element from one selector to another
|
|
200
|
+
When(
|
|
201
|
+
"User drags {string} to {string}",
|
|
202
|
+
async function (sourceSelector, targetSelector) {
|
|
203
|
+
await mouse.dragAndDrop(sourceSelector, targetSelector);
|
|
204
|
+
},
|
|
205
|
+
);
|
|
206
|
+
|
|
207
|
+
// User drags an element to a specific position
|
|
208
|
+
When(
|
|
209
|
+
"User drags {string} to {int}, {int} position",
|
|
210
|
+
async function (sourceSelector, x, y) {
|
|
211
|
+
await mouse.dragAndDropPosition(sourceSelector, x, y);
|
|
212
|
+
},
|
|
213
|
+
);
|
|
214
|
+
|
|
215
|
+
// User selects options by value
|
|
216
|
+
When(
|
|
217
|
+
"User selects by value {string} from {string}",
|
|
218
|
+
async function (value, selector) {
|
|
219
|
+
await mouse.selectByValue(selector, value);
|
|
220
|
+
},
|
|
221
|
+
);
|
|
222
|
+
|
|
223
|
+
// User selects an option by text
|
|
224
|
+
When(
|
|
225
|
+
"User selects by text {string} from {string}",
|
|
226
|
+
async function (text, selector) {
|
|
227
|
+
await mouse.selectByText(selector, text);
|
|
228
|
+
},
|
|
229
|
+
);
|
|
230
|
+
|
|
231
|
+
// User checks a checkbox or radio button
|
|
232
|
+
When("User checks {string}", async function (selector) {
|
|
233
|
+
await mouse.check(selector);
|
|
234
|
+
});
|
|
235
|
+
|
|
236
|
+
When("User checks multiple {string}", async function (selectors) {
|
|
237
|
+
await mouse.multipleElementCheck(selectors);
|
|
238
|
+
});
|
|
239
|
+
|
|
240
|
+
// User unchecks a checkbox or radio button
|
|
241
|
+
When("User unchecks {string}", async function (selector) {
|
|
242
|
+
await mouse.uncheck(selector);
|
|
243
|
+
});
|
|
244
|
+
|
|
245
|
+
When("User unchecks multiple {string}", async function (selectors) {
|
|
246
|
+
await mouse.multipleElementUncheck(selectors);
|
|
247
|
+
});
|
|
248
|
+
|
|
249
|
+
// User scrolls into view if needed for a selector
|
|
250
|
+
When("User scrolls {string} into view", async function (selector) {
|
|
251
|
+
await mouse.scrollIntoViewIfNeeded(selector);
|
|
252
|
+
});
|
|
253
|
+
|
|
254
|
+
// User uploads file
|
|
255
|
+
When("User uploads {string} file to {string}", async (filePath, fileInput) => {
|
|
256
|
+
await mouse.upload(filePath, fileInput);
|
|
257
|
+
});
|
|
258
|
+
|
|
259
|
+
|
|
260
|
+
When('User selects by text from {string} randomly', async ( select) => {
|
|
261
|
+
const optionsArray = await element(`${selector(select)} option`).evaluateAll(
|
|
262
|
+
options => options.map(option => option.text)
|
|
263
|
+
);
|
|
264
|
+
const randomOption = await optionsArray[Math.floor(Math.random() * optionsArray.length)];
|
|
265
|
+
|
|
266
|
+
await mouse.selectByText(select, randomOption);
|
|
267
|
+
})
|
|
268
|
+
|
|
269
|
+
When('User selects by value from {string} randomly', async ( select) => {
|
|
270
|
+
const optionsArray = await element(`${selector(select)} option`).evaluateAll(
|
|
271
|
+
options => options.map(option => option.value)
|
|
272
|
+
);
|
|
273
|
+
const randomOption = await optionsArray[Math.floor(Math.random() * optionsArray.length)];
|
|
274
|
+
|
|
275
|
+
await mouse.selectByValue(select, randomOption);
|
|
276
276
|
})
|