artes 1.2.17 → 1.2.19

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.
Files changed (38) hide show
  1. package/README.md +644 -630
  2. package/cucumber.config.js +182 -171
  3. package/docs/functionDefinitions.md +2398 -2401
  4. package/docs/stepDefinitions.md +401 -391
  5. package/executer.js +165 -161
  6. package/index.js +48 -48
  7. package/package.json +52 -51
  8. package/src/helper/contextManager/browserManager.js +63 -63
  9. package/src/helper/contextManager/requestManager.js +23 -23
  10. package/src/helper/controller/elementController.js +182 -182
  11. package/src/helper/controller/pomCollector.js +25 -25
  12. package/src/helper/executers/cleaner.js +19 -19
  13. package/src/helper/executers/exporter.js +15 -15
  14. package/src/helper/executers/helper.js +98 -95
  15. package/src/helper/executers/projectCreator.js +201 -198
  16. package/src/helper/executers/reportGenerator.js +74 -58
  17. package/src/helper/executers/testRunner.js +30 -30
  18. package/src/helper/executers/versionChecker.js +31 -31
  19. package/src/helper/imports/commons.js +57 -56
  20. package/src/helper/stepFunctions/APIActions.js +362 -363
  21. package/src/helper/stepFunctions/assertions.js +523 -523
  22. package/src/helper/stepFunctions/browserActions.js +22 -22
  23. package/src/helper/stepFunctions/elementInteractions.js +38 -38
  24. package/src/helper/stepFunctions/exporter.js +19 -19
  25. package/src/helper/stepFunctions/frameActions.js +50 -50
  26. package/src/helper/stepFunctions/keyboardActions.js +41 -41
  27. package/src/helper/stepFunctions/mouseActions.js +145 -145
  28. package/src/helper/stepFunctions/pageActions.js +27 -27
  29. package/src/hooks/context.js +15 -15
  30. package/src/hooks/hooks.js +257 -257
  31. package/src/stepDefinitions/API.steps.js +300 -300
  32. package/src/stepDefinitions/assertions.steps.js +864 -862
  33. package/src/stepDefinitions/browser.steps.js +7 -7
  34. package/src/stepDefinitions/frameActions.steps.js +76 -76
  35. package/src/stepDefinitions/keyboardActions.steps.js +261 -227
  36. package/src/stepDefinitions/mouseActions.steps.js +276 -276
  37. package/src/stepDefinitions/page.steps.js +71 -71
  38. package/src/stepDefinitions/random.steps.js +178 -159
@@ -1,227 +1,261 @@
1
- const { When, random, element, selector, time } = require("../helper/imports/commons");
2
- const { keyboard, frame } = require("../helper/stepFunctions/exporter");
3
-
4
- // User presses a key on a specific selector
5
- When("User presses {string} on {string}", async function (key, selector) {
6
- await keyboard.press(selector, key);
7
- });
8
-
9
- // User presses keys sequentially on a specific selector
10
- When(
11
- "User types {string} by hand in {string}",
12
- async function (keys, selector) {
13
- await keyboard.pressSequentially(selector, keys);
14
- },
15
- );
16
-
17
- When(
18
- "User types {string} by hand in {int} th of {string}",
19
- async (text, order, elements) => {
20
- const nthElement = await frame.nth(elements, order);
21
- await nthElement.pressSequentially(text);
22
- },
23
- );
24
-
25
- // User presses keys sequentially with a delay on a specific selector
26
- When(
27
- "User types {string} by hand with delay {int} in {string}",
28
- async function (keys, delay, selector) {
29
- await keyboard.pressSequentiallyDelay(selector, keys, delay);
30
- },
31
- );
32
-
33
- // User fills a value into a specific selector
34
- When("User types {string} in {string}", async function (value, selector) {
35
- await keyboard.fill(selector, value);
36
- });
37
-
38
- When(
39
- "User types {string} in {int} th of {string}",
40
- async (text, order, elements) => {
41
- const nthElement = await frame.nth(elements, order);
42
- await nthElement.fill(text);
43
- },
44
- );
45
-
46
- When(
47
- "User types {string} in multiple {string}",
48
- async function (value, selectors) {
49
- await keyboard.multipleElementFill(selectors, value);
50
- },
51
- );
52
-
53
- // User clears the input of a specific selector
54
- When("User clears {string}", async function (selector) {
55
- await keyboard.clear(selector);
56
- });
57
-
58
- // User selects text in a specific selector
59
- When("User selects {string} text", async function (text) {
60
- await keyboard.selectText(text);
61
- });
62
-
63
- // User sets input files for a specific selector
64
- When(
65
- "User sets input files {string} for {string}",
66
- async function (files, selector) {
67
- const fileArray = files.split(","); // Assuming files are comma-separated
68
- await keyboard.setInputFiles(selector, fileArray);
69
- },
70
- );
71
-
72
- // User presses a key down
73
- When("User holds down {string}", async function (key) {
74
- await keyboard.keyDown(key);
75
- });
76
-
77
- // User releases a key
78
- When("User releases {string}", async function (key) {
79
- await keyboard.keyUp(key);
80
- });
81
-
82
- // User inserts text
83
- When("User inserts text {string}", async function (text) {
84
- await keyboard.insertText(text);
85
- });
86
-
87
- // User presses a key
88
- When("User presses {string}", async function (key) {
89
- await keyboard.keyboardPress(key);
90
- });
91
-
92
- // User types a key with a delay
93
- When("User types {string} with delay {int}", async function (key, delay) {
94
- await keyboard.keyboardType(key, delay);
95
- });
96
-
97
-
98
-
99
- When('User types random word in {string}', async (input) => {
100
- const randomWord = random.lorem.word();
101
- await keyboard.fill(input, randomWord);
102
- });
103
-
104
- When('User types random word that has character between {int} and {int} in {string}', async (from,to, input) => {
105
- const randomWord = random.lorem.word({min:from, max:to});
106
- await keyboard.fill(input, randomWord);
107
- });
108
-
109
- When('User types random words in {string}', async (input) => {
110
- const randomWord = random.lorem.words();
111
- await keyboard.fill(input, randomWord);
112
- });
113
-
114
- When(
115
- "User types random words that range between {int} and {int} in {string}",
116
- async (from, to, input) => {
117
- const words = random.lorem.words({ min: from, max: to });
118
- await keyboard.fill(input, words);
119
- },
120
- );
121
-
122
- When('User types random paragraph in {string}', async (input) => {
123
- const randomParagraph = random.lorem.paragraph();
124
- await keyboard.fill(input, randomParagraph);
125
- });
126
-
127
- When(
128
- "User types random paragraph that range between {int} and {int} in {string}",
129
- async (from, to, input) => {
130
- const words = random.lorem.paragraph({ min: from, max: to });
131
- await keyboard.fill(input, words);
132
- },
133
- );
134
-
135
- When('User types random url in {string}', async (input) => {
136
- const randomURL = random.internet.url();
137
- await keyboard.fill(input, randomURL);
138
- });
139
-
140
- When('User types random number in {string}', async (input) => {
141
- const randomNumber = random.number.int();
142
- await keyboard.fill(input, randomNumber.toString());
143
- });
144
-
145
- When('User types random number that range between {int} and {int} in {string}', async (from, to, input) => {
146
- const randomNumber = random.number.int({ min: from, max: to });
147
- await keyboard.fill(input, randomNumber.toString());
148
- });
149
-
150
- When('User types random email in {string}', async (key) => {
151
- const email = random.internet.email()
152
- await keyboard.fill(key, email);
153
- });
154
-
155
- When(
156
- "User types random word in {int} th of {string}",
157
- async (th, inputs) => {
158
- const nthElement = await frame.nth(th, inputs);
159
- const randomWord = random.lorem.word();
160
- await nthElement.fill(randomWord);
161
- },
162
- );
163
-
164
- When('User types random word that has character between {int} and {int} in {int} th of {string}', async (from,to,th, inputs) => {
165
- const nthElement = await frame.nth(th, inputs);
166
- const randomWord = random.lorem.word({min:from, max:to});
167
- await nthElement.fill(randomWord);
168
- });
169
-
170
- When('User types random characters from {string} in {string}', async (chars, input) => {
171
- const randomCharacters = random.string.fromCharacters(chars,10);
172
- input = await element(selector(input))
173
- await input.fill(randomCharacters)
174
- })
175
-
176
- When('User types random number by hand in range from {int} to {int} in {string} with {int} ms delay', async (from,to, input, delay) => {
177
- const randomNumber = Math.floor(Math.random() * (to - from + 1)) + from;
178
- await keyboard.pressSequentiallyDelay(input, randomNumber.toString(), delay);
179
- })
180
-
181
- When('User types random alphanumeric in range from {int} to {int} in {string}', async (from,to, input) => {
182
- const randomWords = await random.string.alphanumeric({length: { min: from, max: to }})
183
- await element(input).fill(randomWords)
184
- })
185
-
186
- When('User types random fullname in {string}', async (input) => {
187
- const randomFirstName = await random.person.firstName()
188
- const randomLastName = await random.person.lastName()
189
-
190
- await element(input).fill(`${randomFirstName} ${randomLastName}`)
191
- })
192
-
193
- When('User types random first name in {string}', async (input) => {
194
- const randomFirstName = await random.person.firstName()
195
- await element(input).fill(randomFirstName)
196
- })
197
-
198
- When('User types random last name in {string}', async (input) => {
199
- const randomLastName = await random.person.lastName()
200
- await element(input).fill(randomLastName)
201
- })
202
-
203
- When('User types random middle name in {string}', async (input) => {
204
- const randomMiddleName = await random.person.middleName()
205
- await element(input).fill(randomMiddleName)
206
- })
207
-
208
- When('User types random date between {int} and {int} in {string}', async (fromYear, toYear, input) => {
209
- const year = Math.floor(Math.random() * (toYear - fromYear + 1)) + fromYear
210
- const month = Math.floor(Math.random() * 12) + 1
211
- const day = Math.floor(Math.random() * 28) + 1
212
- const pad = (num) => num.toString().padStart(2, '0')
213
- const dateStr = `${pad(day)}.${pad(month)}.${year}`
214
- await element(input).fill(dateStr)
215
- })
216
-
217
- When('User types date {int} days after today in {string}', async (day, input) => {
218
- const now = new time();
219
- const afterDate = now.add(day, 'day').format("DD-MM-YYYY");
220
- await element(input).fill(afterDate)
221
- })
222
-
223
- When('User types date {int} days before today in {string}', async (day, input) => {
224
- const now = new time();
225
- const beforeDate = now.subtract(day, 'day').format("DD-MM-YYYY");
226
- await element(input).fill(beforeDate)
227
- })
1
+ const {
2
+ When,
3
+ random,
4
+ element,
5
+ selector,
6
+ time,
7
+ } = require("../helper/imports/commons");
8
+ const { keyboard, frame } = require("../helper/stepFunctions/exporter");
9
+
10
+ // User presses a key on a specific selector
11
+ When("User presses {string} on {string}", async function (key, selector) {
12
+ await keyboard.press(selector, key);
13
+ });
14
+
15
+ // User presses keys sequentially on a specific selector
16
+ When(
17
+ "User types {string} by hand in {string}",
18
+ async function (keys, selector) {
19
+ await keyboard.pressSequentially(selector, keys);
20
+ },
21
+ );
22
+
23
+ When(
24
+ "User types {string} by hand in {int} th of {string}",
25
+ async (text, order, elements) => {
26
+ const nthElement = await frame.nth(elements, order);
27
+ await nthElement.pressSequentially(text);
28
+ },
29
+ );
30
+
31
+ // User presses keys sequentially with a delay on a specific selector
32
+ When(
33
+ "User types {string} by hand with delay {int} in {string}",
34
+ async function (keys, delay, selector) {
35
+ await keyboard.pressSequentiallyDelay(selector, keys, delay);
36
+ },
37
+ );
38
+
39
+ // User fills a value into a specific selector
40
+ When("User types {string} in {string}", async function (value, selector) {
41
+ await keyboard.fill(selector, value);
42
+ });
43
+
44
+ When(
45
+ "User types {string} in {int} th of {string}",
46
+ async (text, order, elements) => {
47
+ const nthElement = await frame.nth(elements, order);
48
+ await nthElement.fill(text);
49
+ },
50
+ );
51
+
52
+ When(
53
+ "User types {string} in multiple {string}",
54
+ async function (value, selectors) {
55
+ await keyboard.multipleElementFill(selectors, value);
56
+ },
57
+ );
58
+
59
+ // User clears the input of a specific selector
60
+ When("User clears {string}", async function (selector) {
61
+ await keyboard.clear(selector);
62
+ });
63
+
64
+ // User selects text in a specific selector
65
+ When("User selects {string} text", async function (text) {
66
+ await keyboard.selectText(text);
67
+ });
68
+
69
+ // User sets input files for a specific selector
70
+ When(
71
+ "User sets input files {string} for {string}",
72
+ async function (files, selector) {
73
+ const fileArray = files.split(","); // Assuming files are comma-separated
74
+ await keyboard.setInputFiles(selector, fileArray);
75
+ },
76
+ );
77
+
78
+ // User presses a key down
79
+ When("User holds down {string}", async function (key) {
80
+ await keyboard.keyDown(key);
81
+ });
82
+
83
+ // User releases a key
84
+ When("User releases {string}", async function (key) {
85
+ await keyboard.keyUp(key);
86
+ });
87
+
88
+ // User inserts text
89
+ When("User inserts text {string}", async function (text) {
90
+ await keyboard.insertText(text);
91
+ });
92
+
93
+ // User presses a key
94
+ When("User presses {string}", async function (key) {
95
+ await keyboard.keyboardPress(key);
96
+ });
97
+
98
+ // User types a key with a delay
99
+ When("User types {string} with delay {int}", async function (key, delay) {
100
+ await keyboard.keyboardType(key, delay);
101
+ });
102
+
103
+ When("User types random word in {string}", async (input) => {
104
+ const randomWord = random.lorem.word();
105
+ await keyboard.fill(input, randomWord);
106
+ });
107
+
108
+ When(
109
+ "User types random word that has character between {int} and {int} in {string}",
110
+ async (from, to, input) => {
111
+ const randomWord = random.lorem.word({ min: from, max: to });
112
+ await keyboard.fill(input, randomWord);
113
+ },
114
+ );
115
+
116
+ When("User types random words in {string}", async (input) => {
117
+ const randomWord = random.lorem.words();
118
+ await keyboard.fill(input, randomWord);
119
+ });
120
+
121
+ When(
122
+ "User types random words that range between {int} and {int} in {string}",
123
+ async (from, to, input) => {
124
+ const words = random.lorem.words({ min: from, max: to });
125
+ await keyboard.fill(input, words);
126
+ },
127
+ );
128
+
129
+ When("User types random paragraph in {string}", async (input) => {
130
+ const randomParagraph = random.lorem.paragraph();
131
+ await keyboard.fill(input, randomParagraph);
132
+ });
133
+
134
+ When(
135
+ "User types random paragraph that range between {int} and {int} in {string}",
136
+ async (from, to, input) => {
137
+ const words = random.lorem.paragraph({ min: from, max: to });
138
+ await keyboard.fill(input, words);
139
+ },
140
+ );
141
+
142
+ When("User types random url in {string}", async (input) => {
143
+ const randomURL = random.internet.url();
144
+ await keyboard.fill(input, randomURL);
145
+ });
146
+
147
+ When("User types random number in {string}", async (input) => {
148
+ const randomNumber = random.number.int();
149
+ await keyboard.fill(input, randomNumber.toString());
150
+ });
151
+
152
+ When(
153
+ "User types random number that range between {int} and {int} in {string}",
154
+ async (from, to, input) => {
155
+ const randomNumber = random.number.int({ min: from, max: to });
156
+ await keyboard.fill(input, randomNumber.toString());
157
+ },
158
+ );
159
+
160
+ When("User types random email in {string}", async (key) => {
161
+ const email = random.internet.email();
162
+ await keyboard.fill(key, email);
163
+ });
164
+
165
+ When("User types random word in {int} th of {string}", async (th, inputs) => {
166
+ const nthElement = await frame.nth(th, inputs);
167
+ const randomWord = random.lorem.word();
168
+ await nthElement.fill(randomWord);
169
+ });
170
+
171
+ When(
172
+ "User types random word that has character between {int} and {int} in {int} th of {string}",
173
+ async (from, to, th, inputs) => {
174
+ const nthElement = await frame.nth(th, inputs);
175
+ const randomWord = random.lorem.word({ min: from, max: to });
176
+ await nthElement.fill(randomWord);
177
+ },
178
+ );
179
+
180
+ When(
181
+ "User types random characters from {string} in {string}",
182
+ async (chars, input) => {
183
+ const randomCharacters = random.string.fromCharacters(chars, 10);
184
+ input = await element(selector(input));
185
+ await input.fill(randomCharacters);
186
+ },
187
+ );
188
+
189
+ When(
190
+ "User types random number by hand in range from {int} to {int} in {string} with {int} ms delay",
191
+ async (from, to, input, delay) => {
192
+ const randomNumber = Math.floor(Math.random() * (to - from + 1)) + from;
193
+ await keyboard.pressSequentiallyDelay(
194
+ input,
195
+ randomNumber.toString(),
196
+ delay,
197
+ );
198
+ },
199
+ );
200
+
201
+ When(
202
+ "User types random alphanumeric in range from {int} to {int} in {string}",
203
+ async (from, to, input) => {
204
+ const randomWords = await random.string.alphanumeric({
205
+ length: { min: from, max: to },
206
+ });
207
+ await element(input).fill(randomWords);
208
+ },
209
+ );
210
+
211
+ When("User types random fullname in {string}", async (input) => {
212
+ const randomFirstName = await random.person.firstName();
213
+ const randomLastName = await random.person.lastName();
214
+
215
+ await element(input).fill(`${randomFirstName} ${randomLastName}`);
216
+ });
217
+
218
+ When("User types random first name in {string}", async (input) => {
219
+ const randomFirstName = await random.person.firstName();
220
+ await element(input).fill(randomFirstName);
221
+ });
222
+
223
+ When("User types random last name in {string}", async (input) => {
224
+ const randomLastName = await random.person.lastName();
225
+ await element(input).fill(randomLastName);
226
+ });
227
+
228
+ When("User types random middle name in {string}", async (input) => {
229
+ const randomMiddleName = await random.person.middleName();
230
+ await element(input).fill(randomMiddleName);
231
+ });
232
+
233
+ When(
234
+ "User types random date between {int} and {int} in {string}",
235
+ async (fromYear, toYear, input) => {
236
+ const year = Math.floor(Math.random() * (toYear - fromYear + 1)) + fromYear;
237
+ const month = Math.floor(Math.random() * 12) + 1;
238
+ const day = Math.floor(Math.random() * 28) + 1;
239
+ const pad = (num) => num.toString().padStart(2, "0");
240
+ const dateStr = `${pad(day)}.${pad(month)}.${year}`;
241
+ await element(input).fill(dateStr);
242
+ },
243
+ );
244
+
245
+ When(
246
+ "User types date {int} days after today in {string}",
247
+ async (day, input) => {
248
+ const now = new time();
249
+ const afterDate = now.add(day, "day").format("DD-MM-YYYY");
250
+ await element(input).fill(afterDate);
251
+ },
252
+ );
253
+
254
+ When(
255
+ "User types date {int} days before today in {string}",
256
+ async (day, input) => {
257
+ const now = new time();
258
+ const beforeDate = now.subtract(day, "day").format("DD-MM-YYYY");
259
+ await element(input).fill(beforeDate);
260
+ },
261
+ );