artes 1.0.0
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 +330 -0
- package/cucumber.config.js +98 -0
- package/executer.js +45 -0
- package/functionDefinitions.md +2065 -0
- package/index.js +33 -0
- package/package.json +35 -0
- package/src/helper/contextManager/browserManager.js +44 -0
- package/src/helper/contextManager/requestManager.js +10 -0
- package/src/helper/executers/cleaner.js +27 -0
- package/src/helper/executers/helper.js +32 -0
- package/src/helper/executers/projectCreator.js +152 -0
- package/src/helper/executers/reportGenerator.js +36 -0
- package/src/helper/executers/testRunner.js +35 -0
- package/src/helper/executers/versionChecker.js +13 -0
- package/src/helper/imports/commons.js +36 -0
- package/src/helper/pomController/elementController.js +24 -0
- package/src/helper/pomController/pomCollector.js +18 -0
- package/src/helper/stepFunctions/actionCommons.js +15 -0
- package/src/helper/stepFunctions/assertions.js +421 -0
- package/src/helper/stepFunctions/elementInteractions.js +38 -0
- package/src/helper/stepFunctions/frameActions.js +50 -0
- package/src/helper/stepFunctions/keyboardActions.js +29 -0
- package/src/helper/stepFunctions/mouseActions.js +97 -0
- package/src/helper/stepFunctions/pageActions.js +14 -0
- package/src/hooks/context.js +12 -0
- package/src/hooks/hooks.js +53 -0
- package/src/tests/stepDefinitions/assertions.steps.js +769 -0
- package/src/tests/stepDefinitions/frameActions.steps.js +76 -0
- package/src/tests/stepDefinitions/keyboardActions.steps.js +72 -0
- package/src/tests/stepDefinitions/mouseActions.steps.js +224 -0
- package/src/tests/stepDefinitions/page.steps.js +30 -0
- package/stepDefinitions.md +267 -0
|
@@ -0,0 +1,421 @@
|
|
|
1
|
+
const { expect, element, context } = require("../imports/commons");
|
|
2
|
+
const { elementInteractions } = require("./elementInteractions");
|
|
3
|
+
|
|
4
|
+
const assert = {
|
|
5
|
+
// Element Assertion
|
|
6
|
+
shouldBeAttached: async (selector) => {
|
|
7
|
+
await expect(element(selector)).toBeAttached();
|
|
8
|
+
},
|
|
9
|
+
shouldBeChecked: async (selector) => {
|
|
10
|
+
await expect(element(selector)).toBeChecked();
|
|
11
|
+
},
|
|
12
|
+
shouldBeDisabled: async (selector) => {
|
|
13
|
+
await expect(element(selector)).toBeDisabled();
|
|
14
|
+
},
|
|
15
|
+
shouldBeEditable: async (selector) => {
|
|
16
|
+
await expect(element(selector)).toBeEditable();
|
|
17
|
+
},
|
|
18
|
+
shouldBeEmpty: async (selector) => {
|
|
19
|
+
await expect(element(selector)).toBeEmpty();
|
|
20
|
+
},
|
|
21
|
+
shouldBeEnabled: async (selector) => {
|
|
22
|
+
await expect(element(selector)).toBeEnabled();
|
|
23
|
+
},
|
|
24
|
+
shouldBeFocused: async (selector) => {
|
|
25
|
+
await expect(element(selector)).toBeFocused();
|
|
26
|
+
},
|
|
27
|
+
shouldBeHidden: async (selector) => {
|
|
28
|
+
await expect(element(selector)).toBeHidden();
|
|
29
|
+
},
|
|
30
|
+
shouldBeInViewport: async (selector) => {
|
|
31
|
+
await expect(element(selector)).toBeInViewport();
|
|
32
|
+
},
|
|
33
|
+
shouldBeVisible: async (selector) => {
|
|
34
|
+
await expect(element(selector)).toBeVisible();
|
|
35
|
+
},
|
|
36
|
+
shouldContainText: async (selector, text) => {
|
|
37
|
+
await expect(element(selector)).toContainText(text);
|
|
38
|
+
},
|
|
39
|
+
shouldHaveAccessibleDescription: async (selector, description) => {
|
|
40
|
+
await expect(element(selector)).toHaveAccessibleDescription(description);
|
|
41
|
+
},
|
|
42
|
+
shouldHaveAccessibleName: async (selector, name) => {
|
|
43
|
+
await expect(element(selector)).toHaveAccessibleName(name);
|
|
44
|
+
},
|
|
45
|
+
shouldHaveAttribute: async (selector, attribute, value) => {
|
|
46
|
+
await expect(element(selector)).toHaveAttribute(attribute, value);
|
|
47
|
+
},
|
|
48
|
+
shouldHaveClass: async (selector, className) => {
|
|
49
|
+
await expect(element(selector)).toHaveClass(className);
|
|
50
|
+
},
|
|
51
|
+
shouldHaveCount: async (selector, count) => {
|
|
52
|
+
await expect(element(selector)).toHaveCount(count);
|
|
53
|
+
},
|
|
54
|
+
shouldHaveCSS: async (selector, property, value) => {
|
|
55
|
+
await expect(element(selector)).toHaveCSS(property, value);
|
|
56
|
+
},
|
|
57
|
+
shouldHaveId: async (selector, id) => {
|
|
58
|
+
await expect(element(selector)).toHaveId(id);
|
|
59
|
+
},
|
|
60
|
+
shouldHaveJSProperty: async (selector, property, value) => {
|
|
61
|
+
await expect(element(selector)).toHaveJSProperty(property, value);
|
|
62
|
+
},
|
|
63
|
+
shouldHaveRole: async (selector, role) => {
|
|
64
|
+
await expect(element(selector)).toHaveRole(role);
|
|
65
|
+
},
|
|
66
|
+
shouldHaveScreenshot: async (selector) => {
|
|
67
|
+
await expect(element(selector)).toHaveScreenshot();
|
|
68
|
+
},
|
|
69
|
+
shouldHaveText: async (selector, text) => {
|
|
70
|
+
await expect(element(selector)).toHaveText(text);
|
|
71
|
+
},
|
|
72
|
+
shouldHaveValue: async (selector, value) => {
|
|
73
|
+
await expect(element(selector)).toHaveValue(value);
|
|
74
|
+
},
|
|
75
|
+
shouldHaveValues: async (selector, values) => {
|
|
76
|
+
await expect(element(selector)).toHaveValues(values);
|
|
77
|
+
},
|
|
78
|
+
shouldPageHaveScreenshot: async () => {
|
|
79
|
+
await expect(context.page).toHaveScreenshot();
|
|
80
|
+
},
|
|
81
|
+
shouldPageHaveTitle: async (title) => {
|
|
82
|
+
await expect(context.page).toHaveTitle(title);
|
|
83
|
+
},
|
|
84
|
+
shouldPageHaveURL: async (url) => {
|
|
85
|
+
await expect(context.page).toHaveURL(url);
|
|
86
|
+
},
|
|
87
|
+
shouldResponseBeOK: async (response) => {
|
|
88
|
+
await expect(response).toBeOK();
|
|
89
|
+
},
|
|
90
|
+
|
|
91
|
+
// Negative Element Assertion
|
|
92
|
+
shouldNotBeAttached: async (selector) => {
|
|
93
|
+
await expect(element(selector)).not.toBeAttached();
|
|
94
|
+
},
|
|
95
|
+
shouldNotBeChecked: async (selector) => {
|
|
96
|
+
await expect(element(selector)).not.toBeChecked();
|
|
97
|
+
},
|
|
98
|
+
shouldNotBeDisabled: async (selector) => {
|
|
99
|
+
await expect(element(selector)).not.toBeDisabled();
|
|
100
|
+
},
|
|
101
|
+
shouldNotBeEditable: async (selector) => {
|
|
102
|
+
await expect(element(selector)).not.toBeEditable();
|
|
103
|
+
},
|
|
104
|
+
shouldNotBeEmpty: async (selector) => {
|
|
105
|
+
await expect(element(selector)).not.toBeEmpty();
|
|
106
|
+
},
|
|
107
|
+
shouldNotBeEnabled: async (selector) => {
|
|
108
|
+
await expect(element(selector)).not.toBeEnabled();
|
|
109
|
+
},
|
|
110
|
+
shouldNotBeFocused: async (selector) => {
|
|
111
|
+
await expect(element(selector)).not.toBeFocused();
|
|
112
|
+
},
|
|
113
|
+
shouldNotBeHidden: async (selector) => {
|
|
114
|
+
await expect(element(selector)).not.toBeHidden();
|
|
115
|
+
},
|
|
116
|
+
shouldNotBeInViewport: async (selector) => {
|
|
117
|
+
await expect(element(selector)).not.toBeInViewport();
|
|
118
|
+
},
|
|
119
|
+
shouldNotBeVisible: async (selector) => {
|
|
120
|
+
await expect(element(selector)).not.toBeVisible();
|
|
121
|
+
},
|
|
122
|
+
shouldNotContainText: async (selector, text) => {
|
|
123
|
+
await expect(element(selector)).not.toContainText(text);
|
|
124
|
+
},
|
|
125
|
+
shouldNotHaveAccessibleDescription: async (selector, description) => {
|
|
126
|
+
await expect(element(selector)).not.toHaveAccessibleDescription(
|
|
127
|
+
description,
|
|
128
|
+
);
|
|
129
|
+
},
|
|
130
|
+
shouldNotHaveAccessibleName: async (selector, name) => {
|
|
131
|
+
await expect(element(selector)).not.toHaveAccessibleName(name);
|
|
132
|
+
},
|
|
133
|
+
shouldNotHaveAttribute: async (selector, attribute, value) => {
|
|
134
|
+
await expect(element(selector)).not.toHaveAttribute(attribute, value);
|
|
135
|
+
},
|
|
136
|
+
shouldNotHaveClass: async (selector, className) => {
|
|
137
|
+
await expect(element(selector)).not.toHaveClass(className);
|
|
138
|
+
},
|
|
139
|
+
shouldNotHaveCount: async (selector, count) => {
|
|
140
|
+
await expect(element(selector)).not.toHaveCount(count);
|
|
141
|
+
},
|
|
142
|
+
shouldNotHaveCSS: async (selector, property, value) => {
|
|
143
|
+
await expect(element(selector)).not.toHaveCSS(property, value);
|
|
144
|
+
},
|
|
145
|
+
shouldNotHaveId: async (selector, id) => {
|
|
146
|
+
await expect(element(selector)).not.toHaveId(id);
|
|
147
|
+
},
|
|
148
|
+
shouldNotHaveJSProperty: async (selector, property, value) => {
|
|
149
|
+
await expect(element(selector)).not.toHaveJSProperty(property, value);
|
|
150
|
+
},
|
|
151
|
+
shouldNotHaveRole: async (selector, role) => {
|
|
152
|
+
await expect(element(selector)).not.toHaveRole(role);
|
|
153
|
+
},
|
|
154
|
+
shouldNotHaveScreenshot: async (selector) => {
|
|
155
|
+
await expect(element(selector)).not.toHaveScreenshot();
|
|
156
|
+
},
|
|
157
|
+
shouldNotHaveText: async (selector, text) => {
|
|
158
|
+
await expect(element(selector)).not.toHaveText(text);
|
|
159
|
+
},
|
|
160
|
+
shouldNotHaveValue: async (selector, value) => {
|
|
161
|
+
await expect(element(selector)).not.toHaveValue(value);
|
|
162
|
+
},
|
|
163
|
+
shouldNotHaveValues: async (selector, values) => {
|
|
164
|
+
await expect(element(selector)).not.toHaveValues(values);
|
|
165
|
+
},
|
|
166
|
+
shouldNotPageHaveScreenshot: async () => {
|
|
167
|
+
await expect(context.page).not.toHaveScreenshot();
|
|
168
|
+
},
|
|
169
|
+
shouldNotPageHaveTitle: async (title) => {
|
|
170
|
+
await expect(context.page).not.toHaveTitle(title);
|
|
171
|
+
},
|
|
172
|
+
shouldNotPageHaveURL: async (url) => {
|
|
173
|
+
await expect(context.page).not.toHaveURL(url);
|
|
174
|
+
},
|
|
175
|
+
shouldNotResponseBeOK: async (response) => {
|
|
176
|
+
await expect(response).not.toBeOK();
|
|
177
|
+
},
|
|
178
|
+
|
|
179
|
+
// Value Assertion
|
|
180
|
+
|
|
181
|
+
shouldBe: (selector, expected) => {
|
|
182
|
+
expect(elementInteractions.textContent(selector)).toBe(expected);
|
|
183
|
+
},
|
|
184
|
+
shouldBeCloseTo: (selector, expected, precision) => {
|
|
185
|
+
expect(Number(elementInteractions.textContent(selector))).toBeCloseTo(
|
|
186
|
+
expected,
|
|
187
|
+
precision,
|
|
188
|
+
);
|
|
189
|
+
},
|
|
190
|
+
shouldBeDefined: (selector) => {
|
|
191
|
+
expect(elementInteractions.textContent(selector)).toBeDefined();
|
|
192
|
+
},
|
|
193
|
+
shouldBeFalsy: (selector) => {
|
|
194
|
+
expect(elementInteractions.textContent(selector)).toBeFalsy();
|
|
195
|
+
},
|
|
196
|
+
shouldBeGreaterThan: (selector, expected) => {
|
|
197
|
+
expect(Number(elementInteractions.textContent(selector))).toBeGreaterThan(
|
|
198
|
+
expected,
|
|
199
|
+
);
|
|
200
|
+
},
|
|
201
|
+
shouldBeGreaterThanOrEqual: (selector, expected) => {
|
|
202
|
+
expect(
|
|
203
|
+
Number(elementInteractions.textContent(selector)),
|
|
204
|
+
).toBeGreaterThanOrEqual(expected);
|
|
205
|
+
},
|
|
206
|
+
shouldBeInstanceOf: (selector, constructor) => {
|
|
207
|
+
expect(elementInteractions.textContent(selector)).toBeInstanceOf(
|
|
208
|
+
constructor,
|
|
209
|
+
);
|
|
210
|
+
},
|
|
211
|
+
shouldBeLessThan: (selector, expected) => {
|
|
212
|
+
expect(Number(elementInteractions.textContent(selector))).toBeLessThan(
|
|
213
|
+
expected,
|
|
214
|
+
);
|
|
215
|
+
},
|
|
216
|
+
shouldBeLessThanOrEqual: (selector, expected) => {
|
|
217
|
+
expect(
|
|
218
|
+
Number(elementInteractions.textContent(selector)),
|
|
219
|
+
).toBeLessThanOrEqual(expected);
|
|
220
|
+
},
|
|
221
|
+
shouldBeNaN: (selector) => {
|
|
222
|
+
expect(Number(elementInteractions.textContent(selector))).toBeNaN();
|
|
223
|
+
},
|
|
224
|
+
shouldBeNull: (selector) => {
|
|
225
|
+
expect(elementInteractions.textContent(selector)).toBeNull();
|
|
226
|
+
},
|
|
227
|
+
shouldBeTruthy: (selector) => {
|
|
228
|
+
expect(elementInteractions.textContent(selector)).toBeTruthy();
|
|
229
|
+
},
|
|
230
|
+
shouldBeUndefined: (selector) => {
|
|
231
|
+
expect(elementInteractions.textContent(selector)).toBeUndefined();
|
|
232
|
+
},
|
|
233
|
+
shouldContain: (selector, substring) => {
|
|
234
|
+
expect(elementInteractions.textContent(selector)).toContain(substring);
|
|
235
|
+
},
|
|
236
|
+
shouldContainEqual: (selector, expected) => {
|
|
237
|
+
expect(elementInteractions.textContent(selector)).toContainEqual(element);
|
|
238
|
+
},
|
|
239
|
+
shouldEqual: (selector, expected) => {
|
|
240
|
+
expect(Number(elementInteractions.textContent(selector))).toEqual(expected);
|
|
241
|
+
},
|
|
242
|
+
shouldHaveLength: (selector, length) => {
|
|
243
|
+
expect(elementInteractions.textContent(selector)).toHaveLength(length);
|
|
244
|
+
},
|
|
245
|
+
shouldHaveProperty: (selector, property) => {
|
|
246
|
+
expect(elementInteractions.textContent(selector)).toHaveProperty(property);
|
|
247
|
+
},
|
|
248
|
+
shouldMatch: (selector, regex) => {
|
|
249
|
+
expect(elementInteractions.textContent(selector)).toMatch(regex);
|
|
250
|
+
},
|
|
251
|
+
shouldMatchObject: (selector, object) => {
|
|
252
|
+
expect(elementInteractions.textContent(selector)).toMatchObject(object);
|
|
253
|
+
},
|
|
254
|
+
shouldStrictEqual: (selector, expected) => {
|
|
255
|
+
expect(Number(elementInteractions.textContent(selector))).toStrictEqual(
|
|
256
|
+
expected,
|
|
257
|
+
);
|
|
258
|
+
},
|
|
259
|
+
shouldThrow: (fn) => {
|
|
260
|
+
expect(fn).toThrow();
|
|
261
|
+
},
|
|
262
|
+
shouldAny: (selector, constructor) => {
|
|
263
|
+
expect(elementInteractions.textContent(selector)).any.toBeInstanceOf(
|
|
264
|
+
constructor,
|
|
265
|
+
);
|
|
266
|
+
},
|
|
267
|
+
shouldAnything: (selector) => {
|
|
268
|
+
expect(elementInteractions.textContent(selector)).anything();
|
|
269
|
+
},
|
|
270
|
+
shouldArrayContaining: (selector, elements) => {
|
|
271
|
+
expect(elementInteractions.textContent(selector)).toEqual(
|
|
272
|
+
expect.arrayContaining(elements),
|
|
273
|
+
);
|
|
274
|
+
},
|
|
275
|
+
shouldCloseTo: (selector, expected, precision) => {
|
|
276
|
+
expect(Number(elementInteractions.textContent(selector))).toBeCloseTo(
|
|
277
|
+
expected,
|
|
278
|
+
precision,
|
|
279
|
+
);
|
|
280
|
+
},
|
|
281
|
+
shouldObjectContaining: (selector, properties) => {
|
|
282
|
+
expect(elementInteractions.textContent(selector)).toEqual(
|
|
283
|
+
expect.objectContaining(properties),
|
|
284
|
+
);
|
|
285
|
+
},
|
|
286
|
+
shouldStringContaining: (selector, substring) => {
|
|
287
|
+
expect(elementInteractions.textContent(selector)).toEqual(
|
|
288
|
+
expect.stringContaining(substring),
|
|
289
|
+
);
|
|
290
|
+
},
|
|
291
|
+
shouldStringMatching: (selector, regex) => {
|
|
292
|
+
expect(elementInteractions.textContent(selector)).toEqual(
|
|
293
|
+
expect.stringMatching(regex),
|
|
294
|
+
);
|
|
295
|
+
},
|
|
296
|
+
|
|
297
|
+
// Negative Value Assertion
|
|
298
|
+
shouldNotBe: (selector, expected) => {
|
|
299
|
+
expect(elementInteractions.textContent(selector)).not.toBe(expected);
|
|
300
|
+
},
|
|
301
|
+
shouldNotBeCloseTo: (selector, expected, precision) => {
|
|
302
|
+
expect(Number(elementInteractions.textContent(selector))).not.toBeCloseTo(
|
|
303
|
+
expected,
|
|
304
|
+
precision,
|
|
305
|
+
);
|
|
306
|
+
},
|
|
307
|
+
shouldNotBeDefined: (selector) => {
|
|
308
|
+
expect(elementInteractions.textContent(selector)).not.toBeDefined();
|
|
309
|
+
},
|
|
310
|
+
shouldNotBeFalsy: (selector) => {
|
|
311
|
+
expect(elementInteractions.textContent(selector)).not.toBeFalsy();
|
|
312
|
+
},
|
|
313
|
+
shouldNotBeGreaterThan: (selector, expected) => {
|
|
314
|
+
expect(elementInteractions.textContent(selector)).not.toBeGreaterThan(
|
|
315
|
+
expected,
|
|
316
|
+
);
|
|
317
|
+
},
|
|
318
|
+
shouldNotBeGreaterThanOrEqual: (selector, expected) => {
|
|
319
|
+
expect(
|
|
320
|
+
Number(elementInteractions.textContent(selector)),
|
|
321
|
+
).not.toBeGreaterThanOrEqual(expected);
|
|
322
|
+
},
|
|
323
|
+
shouldNotBeInstanceOf: (selector, constructor) => {
|
|
324
|
+
expect(elementInteractions.textContent(selector)).not.toBeInstanceOf(
|
|
325
|
+
constructor,
|
|
326
|
+
);
|
|
327
|
+
},
|
|
328
|
+
shouldNotBeLessThan: (selector, expected) => {
|
|
329
|
+
expect(Number(elementInteractions.textContent(selector))).not.toBeLessThan(
|
|
330
|
+
expected,
|
|
331
|
+
);
|
|
332
|
+
},
|
|
333
|
+
shouldNotBeLessThanOrEqual: (selector, expected) => {
|
|
334
|
+
expect(
|
|
335
|
+
Number(elementInteractions.textContent(selector)),
|
|
336
|
+
).not.toBeLessThanOrEqual(expected);
|
|
337
|
+
},
|
|
338
|
+
shouldNotBeNaN: (selector) => {
|
|
339
|
+
expect(Number(elementInteractions.textContent(selector))).not.toBeNaN();
|
|
340
|
+
},
|
|
341
|
+
shouldNotBeNull: (selector) => {
|
|
342
|
+
expect(elementInteractions.textContent(selector)).not.toBeNull();
|
|
343
|
+
},
|
|
344
|
+
shouldNotBeTruthy: (selector) => {
|
|
345
|
+
expect(elementInteractions.textContent(selector)).not.toBeTruthy();
|
|
346
|
+
},
|
|
347
|
+
shouldNotBeUndefined: (selector) => {
|
|
348
|
+
expect(elementInteractions.textContent(selector)).not.toBeUndefined();
|
|
349
|
+
},
|
|
350
|
+
shouldNotContain: (selector, substring) => {
|
|
351
|
+
expect(elementInteractions.textContent(selector)).not.toContain(substring);
|
|
352
|
+
},
|
|
353
|
+
shouldNotContainEqual: (selector, expected) => {
|
|
354
|
+
expect(
|
|
355
|
+
Number(elementInteractions.textContent(selector)),
|
|
356
|
+
).not.toContainEqual(element);
|
|
357
|
+
},
|
|
358
|
+
shouldNotEqual: (selector, expected) => {
|
|
359
|
+
expect(Number(elementInteractions.textContent(selector))).not.toEqual(
|
|
360
|
+
expected,
|
|
361
|
+
);
|
|
362
|
+
},
|
|
363
|
+
shouldNotHaveLength: (selector, length) => {
|
|
364
|
+
expect(elementInteractions.textContent(selector)).not.toHaveLength(length);
|
|
365
|
+
},
|
|
366
|
+
shouldNotHaveProperty: (selector, property) => {
|
|
367
|
+
expect(elementInteractions.textContent(selector)).not.toHaveProperty(
|
|
368
|
+
property,
|
|
369
|
+
);
|
|
370
|
+
},
|
|
371
|
+
shouldNotMatch: (selector, regex) => {
|
|
372
|
+
expect(elementInteractions.textContent(selector)).not.toMatch(regex);
|
|
373
|
+
},
|
|
374
|
+
shouldNotMatchObject: (selector, object) => {
|
|
375
|
+
expect(elementInteractions.textContent(selector)).not.toMatchObject(object);
|
|
376
|
+
},
|
|
377
|
+
shouldNotStrictEqual: (selector, expected) => {
|
|
378
|
+
expect(Number(elementInteractions.textContent(selector))).not.toStrictEqual(
|
|
379
|
+
expected,
|
|
380
|
+
);
|
|
381
|
+
},
|
|
382
|
+
shouldNotThrow: (fn) => {
|
|
383
|
+
expect(fn).not.toThrow();
|
|
384
|
+
},
|
|
385
|
+
shouldNotAny: (selector, constructor) => {
|
|
386
|
+
expect(elementInteractions.textContent(selector)).any.toBeInstanceOf(
|
|
387
|
+
constructor,
|
|
388
|
+
);
|
|
389
|
+
},
|
|
390
|
+
shouldNotAnything: (selector) => {
|
|
391
|
+
expect(elementInteractions.textContent(selector)).not.anything();
|
|
392
|
+
},
|
|
393
|
+
shouldNotArrayContaining: (selector, elements) => {
|
|
394
|
+
expect(elementInteractions.textContent(selector)).not.toEqual(
|
|
395
|
+
expect.arrayContaining(elements),
|
|
396
|
+
);
|
|
397
|
+
},
|
|
398
|
+
shouldNotCloseTo: (selector, expected, precision) => {
|
|
399
|
+
expect(Number(elementInteractions.textContent(selector))).not.toBeCloseTo(
|
|
400
|
+
expected,
|
|
401
|
+
precision,
|
|
402
|
+
);
|
|
403
|
+
},
|
|
404
|
+
shouldNotObjectContaining: (selector, properties) => {
|
|
405
|
+
expect(elementInteractions.textContent(selector)).not.toEqual(
|
|
406
|
+
expect.objectContaining(properties),
|
|
407
|
+
);
|
|
408
|
+
},
|
|
409
|
+
shouldNotStringContaining: (selector, substring) => {
|
|
410
|
+
expect(elementInteractions.textContent(selector)).not.toEqual(
|
|
411
|
+
expect.stringContaining(substring),
|
|
412
|
+
);
|
|
413
|
+
},
|
|
414
|
+
shouldNotStringMatching: (selector, regex) => {
|
|
415
|
+
expect(elementInteractions.textContent(selector)).not.toEqual(
|
|
416
|
+
expect.stringMatchingStringMatching(regex),
|
|
417
|
+
);
|
|
418
|
+
},
|
|
419
|
+
};
|
|
420
|
+
|
|
421
|
+
module.exports = { assert };
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
const { element } = require("../imports/commons");
|
|
2
|
+
|
|
3
|
+
const elementInteractions = {
|
|
4
|
+
isChecked: async (selector) => {
|
|
5
|
+
return await element(selector).isChecked();
|
|
6
|
+
},
|
|
7
|
+
isDisabled: async (selector) => {
|
|
8
|
+
return await element(selector).isDisabled();
|
|
9
|
+
},
|
|
10
|
+
isEditable: async (selector) => {
|
|
11
|
+
return await element(selector).isEditable();
|
|
12
|
+
},
|
|
13
|
+
isEnabled: async (selector) => {
|
|
14
|
+
return await element(selector).isEnabled();
|
|
15
|
+
},
|
|
16
|
+
isHidden: async (selector) => {
|
|
17
|
+
return await element(selector).isHidden();
|
|
18
|
+
},
|
|
19
|
+
isVisible: async (selector) => {
|
|
20
|
+
return await element(selector).isVisible();
|
|
21
|
+
},
|
|
22
|
+
getAttribute: async (selector, attribute) => {
|
|
23
|
+
return await element(selector).getAttribute(attribute);
|
|
24
|
+
},
|
|
25
|
+
innerHTML: async (selector) => {
|
|
26
|
+
return await element(selector).innerHTML();
|
|
27
|
+
},
|
|
28
|
+
innerText: async (selector) => {
|
|
29
|
+
return await element(selector).innerText();
|
|
30
|
+
},
|
|
31
|
+
textContent: async (selector) => {
|
|
32
|
+
return await element(selector).textContent();
|
|
33
|
+
},
|
|
34
|
+
};
|
|
35
|
+
|
|
36
|
+
module.exports = {
|
|
37
|
+
elementInteractions,
|
|
38
|
+
};
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
const { element, moduleConfig } = require("../imports/commons");
|
|
2
|
+
const path = require("path");
|
|
3
|
+
|
|
4
|
+
const frame = {
|
|
5
|
+
screenshot: async (selector) => {
|
|
6
|
+
return await element(selector).screenshot({
|
|
7
|
+
path: path.join(moduleConfig.projectPath, `${selector}.png`),
|
|
8
|
+
});
|
|
9
|
+
},
|
|
10
|
+
contentFrame: async (selector) => {
|
|
11
|
+
return await element(selector).contentFrame();
|
|
12
|
+
},
|
|
13
|
+
frameLocator: async (selector) => {
|
|
14
|
+
return await element(selector).frameLocator();
|
|
15
|
+
},
|
|
16
|
+
nth: async (selector, index) => {
|
|
17
|
+
return await element(selector).nth(index);
|
|
18
|
+
},
|
|
19
|
+
first: async (selector) => {
|
|
20
|
+
return await element(selector).first();
|
|
21
|
+
},
|
|
22
|
+
last: async (selector) => {
|
|
23
|
+
return await element(selector).last();
|
|
24
|
+
},
|
|
25
|
+
filter: async (selector, filter) => {
|
|
26
|
+
return await element(selector).filter(filter);
|
|
27
|
+
},
|
|
28
|
+
count: async (selector) => {
|
|
29
|
+
return await element(selector).count();
|
|
30
|
+
},
|
|
31
|
+
getByAltText: async (text) => {
|
|
32
|
+
return await element(text).getByAltText();
|
|
33
|
+
},
|
|
34
|
+
getByLabel: async (label) => {
|
|
35
|
+
return await element(label).getByLabel();
|
|
36
|
+
},
|
|
37
|
+
getByPlaceholder: async (placeholder) => {
|
|
38
|
+
return await element(placeholder).getByPlaceholder();
|
|
39
|
+
},
|
|
40
|
+
getByRole: async (role) => {
|
|
41
|
+
return await element(role).getByRole();
|
|
42
|
+
},
|
|
43
|
+
getByTestId: async (testId) => {
|
|
44
|
+
return await element(testId).getByTestId();
|
|
45
|
+
},
|
|
46
|
+
};
|
|
47
|
+
|
|
48
|
+
module.exports = {
|
|
49
|
+
frame,
|
|
50
|
+
};
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
const { element } = require("../imports/commons");
|
|
2
|
+
|
|
3
|
+
const keyboard = {
|
|
4
|
+
press: async (selector, key) => {
|
|
5
|
+
await element(selector).press(key);
|
|
6
|
+
},
|
|
7
|
+
pressSequentially: async (selector, keys) => {
|
|
8
|
+
await element(selector).pressSequentially(keys);
|
|
9
|
+
},
|
|
10
|
+
pressSequentiallyDelay: async (selector, keys, delay) => {
|
|
11
|
+
await element(selector).pressSequentially(keys, { delay: delay });
|
|
12
|
+
},
|
|
13
|
+
fill: async (selector, value) => {
|
|
14
|
+
await element(selector).fill(value);
|
|
15
|
+
},
|
|
16
|
+
clear: async (selector) => {
|
|
17
|
+
await element(selector).clear();
|
|
18
|
+
},
|
|
19
|
+
selectText: async (selector) => {
|
|
20
|
+
await element(selector).selectText();
|
|
21
|
+
},
|
|
22
|
+
setInputFiles: async (selector, files) => {
|
|
23
|
+
await element(selector).setInputFiles(files);
|
|
24
|
+
},
|
|
25
|
+
};
|
|
26
|
+
|
|
27
|
+
module.exports = {
|
|
28
|
+
keyboard,
|
|
29
|
+
};
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
const { element } = require("../imports/commons");
|
|
2
|
+
|
|
3
|
+
const mouse = {
|
|
4
|
+
click: async (selector) => {
|
|
5
|
+
await element(selector).click(selector);
|
|
6
|
+
},
|
|
7
|
+
forceClick: async (selector) => {
|
|
8
|
+
await element(selector).click({ force: true });
|
|
9
|
+
},
|
|
10
|
+
clickPosition: async (selector, position) => {
|
|
11
|
+
const [x, y] = position.split(",").map(Number);
|
|
12
|
+
await element(selector).click({ position: { x: x, y: y } });
|
|
13
|
+
},
|
|
14
|
+
forceClickPosition: async (selector, position) => {
|
|
15
|
+
const [x, y] = position.split(",").map(Number);
|
|
16
|
+
await element(selector).click({ force: true, position: { x: x, y: y } });
|
|
17
|
+
},
|
|
18
|
+
rightClick: async (selector) => {
|
|
19
|
+
await element(selector).click({ button: "right" });
|
|
20
|
+
},
|
|
21
|
+
forceRightClick: async (selector) => {
|
|
22
|
+
await element(selector).click({ force: true, button: "right" });
|
|
23
|
+
},
|
|
24
|
+
leftClick: async (selector) => {
|
|
25
|
+
await element(selector).click({ button: "left" });
|
|
26
|
+
},
|
|
27
|
+
forceLeftClick: async (selector) => {
|
|
28
|
+
await element(selector).click({ force: true, button: "left" });
|
|
29
|
+
},
|
|
30
|
+
doubleClick: async (selector) => {
|
|
31
|
+
await element(selector).dblclick();
|
|
32
|
+
},
|
|
33
|
+
forceDoubleClick: async (selector) => {
|
|
34
|
+
await element(selector).dblclick({ force: true });
|
|
35
|
+
},
|
|
36
|
+
forceDoubleClickPosition: async (selector, position) => {
|
|
37
|
+
const [x, y] = position.split(",").map(Number);
|
|
38
|
+
await element(selector).dblclick({ force: true, position: { x: x, y: y } });
|
|
39
|
+
},
|
|
40
|
+
hover: async (selector) => {
|
|
41
|
+
await element(selector).hover();
|
|
42
|
+
},
|
|
43
|
+
forceHover: async (selector) => {
|
|
44
|
+
await element(selector).hover({ force: true });
|
|
45
|
+
},
|
|
46
|
+
hoverPosition: async (selector, position) => {
|
|
47
|
+
const [x, y] = position.split(",").map(Number);
|
|
48
|
+
await element(selector).hover({ x: x, y: y });
|
|
49
|
+
},
|
|
50
|
+
forceHoverPosition: async (selector, position) => {
|
|
51
|
+
const [x, y] = position.split(",").map(Number);
|
|
52
|
+
await element(selector).hover({ force: true, x: x, y: y });
|
|
53
|
+
},
|
|
54
|
+
focus: async (selector) => {
|
|
55
|
+
await element(selector).focus();
|
|
56
|
+
},
|
|
57
|
+
forceFocus: async (selector) => {
|
|
58
|
+
await element(selector).focus({ force: true });
|
|
59
|
+
},
|
|
60
|
+
focusPosition: async (selector, position) => {
|
|
61
|
+
const [x, y] = position.split(",").map(Number);
|
|
62
|
+
await element(selector).focus({ x: x, y: y });
|
|
63
|
+
},
|
|
64
|
+
forceFocusPosition: async (selector, position) => {
|
|
65
|
+
const [x, y] = position.split(",").map(Number);
|
|
66
|
+
await element(selector).focus({ force: true, x: x, y: y });
|
|
67
|
+
},
|
|
68
|
+
dragAndDrop: async (sourceSelector, targetSelector) => {
|
|
69
|
+
const source = await element(sourceSelector);
|
|
70
|
+
const target = await element(targetSelector);
|
|
71
|
+
await source.dragTo(target);
|
|
72
|
+
},
|
|
73
|
+
dragAndDropPosition: async (sourceSelector, position) => {
|
|
74
|
+
const [x, y] = position.split(",").map(Number);
|
|
75
|
+
await element(sourceSelector).dragTo({ targetPosition: { x: x, y: y } });
|
|
76
|
+
},
|
|
77
|
+
selectByValue: async (selector, value) => {
|
|
78
|
+
const valueArray = value.split(",");
|
|
79
|
+
await element(selector).selectOption(valueArray);
|
|
80
|
+
},
|
|
81
|
+
selectByText: async (selector, value) => {
|
|
82
|
+
await element(selector).selectOption(value);
|
|
83
|
+
},
|
|
84
|
+
check: async (selector) => {
|
|
85
|
+
await element(selector).check();
|
|
86
|
+
},
|
|
87
|
+
uncheck: async (selector) => {
|
|
88
|
+
await element(selector).uncheck();
|
|
89
|
+
},
|
|
90
|
+
scrollIntoViewIfNeeded: async (selector) => {
|
|
91
|
+
await element(selector).scrollIntoViewIfNeeded();
|
|
92
|
+
},
|
|
93
|
+
};
|
|
94
|
+
|
|
95
|
+
module.exports = {
|
|
96
|
+
mouse,
|
|
97
|
+
};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
const { context } = require("../imports/commons");
|
|
2
|
+
|
|
3
|
+
const page = {
|
|
4
|
+
navigateTo: async (url) => {
|
|
5
|
+
return await context.page.goto(url);
|
|
6
|
+
},
|
|
7
|
+
getURL: async () => {
|
|
8
|
+
return await context.page.url();
|
|
9
|
+
},
|
|
10
|
+
};
|
|
11
|
+
|
|
12
|
+
module.exports = {
|
|
13
|
+
page,
|
|
14
|
+
};
|