artes 1.2.15 → 1.2.16
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 +533 -533
- package/cucumber.config.js +171 -171
- package/docs/functionDefinitions.md +2401 -2401
- package/docs/stepDefinitions.md +352 -352
- package/executer.js +161 -161
- package/index.js +48 -48
- package/package.json +51 -54
- 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,523 +1,523 @@
|
|
|
1
|
-
const { expect, element, context } = require("../imports/commons");
|
|
2
|
-
const { elementInteractions } = require("./elementInteractions");
|
|
3
|
-
const { frame } = require("../stepFunctions/frameActions");
|
|
4
|
-
|
|
5
|
-
const assert = {
|
|
6
|
-
// Element Assertion
|
|
7
|
-
shouldBeAttached: async (selector) => {
|
|
8
|
-
await expect(
|
|
9
|
-
typeof selector === "string" ? element(selector) : await selector,
|
|
10
|
-
).toBeAttached();
|
|
11
|
-
},
|
|
12
|
-
shouldBeChecked: async (selector) => {
|
|
13
|
-
await expect(
|
|
14
|
-
typeof selector === "string" ? element(selector) : await selector,
|
|
15
|
-
).toBeChecked();
|
|
16
|
-
},
|
|
17
|
-
shouldBeDisabled: async (selector) => {
|
|
18
|
-
await expect(
|
|
19
|
-
typeof selector === "string" ? element(selector) : await selector,
|
|
20
|
-
).toBeDisabled();
|
|
21
|
-
},
|
|
22
|
-
shouldBeEditable: async (selector) => {
|
|
23
|
-
await expect(
|
|
24
|
-
typeof selector === "string" ? element(selector) : await selector,
|
|
25
|
-
).toBeEditable();
|
|
26
|
-
},
|
|
27
|
-
shouldBeEmpty: async (selector) => {
|
|
28
|
-
await expect(
|
|
29
|
-
typeof selector === "string" ? element(selector) : await selector,
|
|
30
|
-
).toBeEmpty();
|
|
31
|
-
},
|
|
32
|
-
shouldBeEnabled: async (selector) => {
|
|
33
|
-
await expect(
|
|
34
|
-
typeof selector === "string" ? element(selector) : await selector,
|
|
35
|
-
).toBeEnabled();
|
|
36
|
-
},
|
|
37
|
-
shouldBeFocused: async (selector) => {
|
|
38
|
-
await expect(
|
|
39
|
-
typeof selector === "string" ? element(selector) : await selector,
|
|
40
|
-
).toBeFocused();
|
|
41
|
-
},
|
|
42
|
-
shouldBeHidden: async (selector) => {
|
|
43
|
-
await expect(
|
|
44
|
-
typeof selector === "string" ? element(selector) : await selector,
|
|
45
|
-
).toBeHidden();
|
|
46
|
-
},
|
|
47
|
-
shouldBeInViewport: async (selector) => {
|
|
48
|
-
await expect(
|
|
49
|
-
typeof selector === "string" ? element(selector) : await selector,
|
|
50
|
-
).toBeInViewport();
|
|
51
|
-
},
|
|
52
|
-
shouldBeVisible: async (selector) => {
|
|
53
|
-
await expect(
|
|
54
|
-
typeof selector === "string" ? element(selector) : await selector,
|
|
55
|
-
).toBeVisible();
|
|
56
|
-
},
|
|
57
|
-
shouldContainText: async (selector, text) => {
|
|
58
|
-
await expect(
|
|
59
|
-
typeof selector === "string" ? element(selector) : await selector,
|
|
60
|
-
).toContainText(text);
|
|
61
|
-
},
|
|
62
|
-
multipleElementsShouldContainText: async (elements, expectedText) => {
|
|
63
|
-
const count = await frame.count(elements);
|
|
64
|
-
|
|
65
|
-
for (let i = 0; i < count; i++) {
|
|
66
|
-
await assert.shouldContainText(frame.nth(elements, i), expectedText);
|
|
67
|
-
}
|
|
68
|
-
},
|
|
69
|
-
shouldHaveAccessibleDescription: async (selector, description) => {
|
|
70
|
-
await expect(
|
|
71
|
-
typeof selector === "string" ? element(selector) : await selector,
|
|
72
|
-
).toHaveAccessibleDescription(description);
|
|
73
|
-
},
|
|
74
|
-
shouldHaveAccessibleName: async (selector, name) => {
|
|
75
|
-
await expect(
|
|
76
|
-
typeof selector === "string" ? element(selector) : await selector,
|
|
77
|
-
).toHaveAccessibleName(name);
|
|
78
|
-
},
|
|
79
|
-
shouldHaveAttribute: async (selector, attribute, value) => {
|
|
80
|
-
await expect(
|
|
81
|
-
typeof selector === "string" ? element(selector) : await selector,
|
|
82
|
-
).toHaveAttribute(attribute, value);
|
|
83
|
-
},
|
|
84
|
-
shouldHaveClass: async (selector, className) => {
|
|
85
|
-
await expect(
|
|
86
|
-
typeof selector === "string" ? element(selector) : await selector,
|
|
87
|
-
).toHaveClass(className);
|
|
88
|
-
},
|
|
89
|
-
shouldHaveCount: async (selector, count) => {
|
|
90
|
-
await expect(
|
|
91
|
-
typeof selector === "string" ? element(selector) : await selector,
|
|
92
|
-
).toHaveCount(count);
|
|
93
|
-
},
|
|
94
|
-
shouldHaveCSS: async (selector, property, value) => {
|
|
95
|
-
await expect(
|
|
96
|
-
typeof selector === "string" ? element(selector) : await selector,
|
|
97
|
-
).toHaveCSS(property, value);
|
|
98
|
-
},
|
|
99
|
-
shouldHaveId: async (selector, id) => {
|
|
100
|
-
await expect(
|
|
101
|
-
typeof selector === "string" ? element(selector) : await selector,
|
|
102
|
-
).toHaveId(id);
|
|
103
|
-
},
|
|
104
|
-
shouldHaveJSProperty: async (selector, property, value) => {
|
|
105
|
-
await expect(
|
|
106
|
-
typeof selector === "string" ? element(selector) : await selector,
|
|
107
|
-
).toHaveJSProperty(property, value);
|
|
108
|
-
},
|
|
109
|
-
shouldHaveRole: async (selector, role) => {
|
|
110
|
-
await expect(
|
|
111
|
-
typeof selector === "string" ? element(selector) : await selector,
|
|
112
|
-
).toHaveRole(role);
|
|
113
|
-
},
|
|
114
|
-
shouldHaveScreenshot: async (selector) => {
|
|
115
|
-
await expect(
|
|
116
|
-
typeof selector === "string" ? element(selector) : await selector,
|
|
117
|
-
).toHaveScreenshot();
|
|
118
|
-
},
|
|
119
|
-
shouldHaveText: async (selector, text) => {
|
|
120
|
-
await expect(
|
|
121
|
-
typeof selector === "string" ? element(selector) : await selector,
|
|
122
|
-
).toHaveText(text);
|
|
123
|
-
},
|
|
124
|
-
shouldHaveValue: async (selector, value) => {
|
|
125
|
-
await expect(
|
|
126
|
-
typeof selector === "string" ? element(selector) : await selector,
|
|
127
|
-
).toHaveValue(value);
|
|
128
|
-
},
|
|
129
|
-
shouldHaveValues: async (selector, values) => {
|
|
130
|
-
await expect(
|
|
131
|
-
typeof selector === "string" ? element(selector) : await selector,
|
|
132
|
-
).toHaveValues(values);
|
|
133
|
-
},
|
|
134
|
-
shouldPageHaveScreenshot: async () => {
|
|
135
|
-
await expect(context.page).toHaveScreenshot();
|
|
136
|
-
},
|
|
137
|
-
shouldPageHaveTitle: async (title) => {
|
|
138
|
-
await expect(context.page).toHaveTitle(title);
|
|
139
|
-
},
|
|
140
|
-
shouldPageHaveURL: async (url) => {
|
|
141
|
-
await expect(context.page).toHaveURL(url);
|
|
142
|
-
},
|
|
143
|
-
shouldResponseBeOK: async (response) => {
|
|
144
|
-
await expect(response).toBeOK();
|
|
145
|
-
},
|
|
146
|
-
|
|
147
|
-
// Negative Element Assertion
|
|
148
|
-
shouldNotBeAttached: async (selector) => {
|
|
149
|
-
await expect(
|
|
150
|
-
typeof selector === "string" ? element(selector) : await selector,
|
|
151
|
-
).not.toBeAttached();
|
|
152
|
-
},
|
|
153
|
-
shouldNotBeChecked: async (selector) => {
|
|
154
|
-
await expect(
|
|
155
|
-
typeof selector === "string" ? element(selector) : await selector,
|
|
156
|
-
).not.toBeChecked();
|
|
157
|
-
},
|
|
158
|
-
shouldNotBeDisabled: async (selector) => {
|
|
159
|
-
await expect(
|
|
160
|
-
typeof selector === "string" ? element(selector) : await selector,
|
|
161
|
-
).not.toBeDisabled();
|
|
162
|
-
},
|
|
163
|
-
shouldNotBeEditable: async (selector) => {
|
|
164
|
-
await expect(
|
|
165
|
-
typeof selector === "string" ? element(selector) : await selector,
|
|
166
|
-
).not.toBeEditable();
|
|
167
|
-
},
|
|
168
|
-
shouldNotBeEmpty: async (selector) => {
|
|
169
|
-
await expect(
|
|
170
|
-
typeof selector === "string" ? element(selector) : await selector,
|
|
171
|
-
).not.toBeEmpty();
|
|
172
|
-
},
|
|
173
|
-
shouldNotBeEnabled: async (selector) => {
|
|
174
|
-
await expect(
|
|
175
|
-
typeof selector === "string" ? element(selector) : await selector,
|
|
176
|
-
).not.toBeEnabled();
|
|
177
|
-
},
|
|
178
|
-
shouldNotBeFocused: async (selector) => {
|
|
179
|
-
await expect(
|
|
180
|
-
typeof selector === "string" ? element(selector) : await selector,
|
|
181
|
-
).not.toBeFocused();
|
|
182
|
-
},
|
|
183
|
-
shouldNotBeHidden: async (selector) => {
|
|
184
|
-
await expect(
|
|
185
|
-
typeof selector === "string" ? element(selector) : await selector,
|
|
186
|
-
).not.toBeHidden();
|
|
187
|
-
},
|
|
188
|
-
shouldNotBeInViewport: async (selector) => {
|
|
189
|
-
await expect(
|
|
190
|
-
typeof selector === "string" ? element(selector) : await selector,
|
|
191
|
-
).not.toBeInViewport();
|
|
192
|
-
},
|
|
193
|
-
shouldNotBeVisible: async (selector) => {
|
|
194
|
-
await expect(
|
|
195
|
-
typeof selector === "string" ? element(selector) : await selector,
|
|
196
|
-
).not.toBeVisible();
|
|
197
|
-
},
|
|
198
|
-
shouldNotContainText: async (selector, text) => {
|
|
199
|
-
await expect(
|
|
200
|
-
typeof selector === "string" ? element(selector) : await selector,
|
|
201
|
-
).not.toContainText(text);
|
|
202
|
-
},
|
|
203
|
-
shouldNotHaveAccessibleDescription: async (selector, description) => {
|
|
204
|
-
await expect(
|
|
205
|
-
typeof selector === "string" ? element(selector) : await selector,
|
|
206
|
-
).not.toHaveAccessibleDescription(description);
|
|
207
|
-
},
|
|
208
|
-
shouldNotHaveAccessibleName: async (selector, name) => {
|
|
209
|
-
await expect(
|
|
210
|
-
typeof selector === "string" ? element(selector) : await selector,
|
|
211
|
-
).not.toHaveAccessibleName(name);
|
|
212
|
-
},
|
|
213
|
-
shouldNotHaveAttribute: async (selector, attribute, value) => {
|
|
214
|
-
await expect(
|
|
215
|
-
typeof selector === "string" ? element(selector) : await selector,
|
|
216
|
-
).not.toHaveAttribute(attribute, value);
|
|
217
|
-
},
|
|
218
|
-
shouldNotHaveClass: async (selector, className) => {
|
|
219
|
-
await expect(
|
|
220
|
-
typeof selector === "string" ? element(selector) : await selector,
|
|
221
|
-
).not.toHaveClass(className);
|
|
222
|
-
},
|
|
223
|
-
shouldNotHaveCount: async (selector, count) => {
|
|
224
|
-
await expect(
|
|
225
|
-
typeof selector === "string" ? element(selector) : await selector,
|
|
226
|
-
).not.toHaveCount(count);
|
|
227
|
-
},
|
|
228
|
-
shouldNotHaveCSS: async (selector, property, value) => {
|
|
229
|
-
await expect(
|
|
230
|
-
typeof selector === "string" ? element(selector) : await selector,
|
|
231
|
-
).not.toHaveCSS(property, value);
|
|
232
|
-
},
|
|
233
|
-
shouldNotHaveId: async (selector, id) => {
|
|
234
|
-
await expect(
|
|
235
|
-
typeof selector === "string" ? element(selector) : await selector,
|
|
236
|
-
).not.toHaveId(id);
|
|
237
|
-
},
|
|
238
|
-
shouldNotHaveJSProperty: async (selector, property, value) => {
|
|
239
|
-
await expect(
|
|
240
|
-
typeof selector === "string" ? element(selector) : await selector,
|
|
241
|
-
).not.toHaveJSProperty(property, value);
|
|
242
|
-
},
|
|
243
|
-
shouldNotHaveRole: async (selector, role) => {
|
|
244
|
-
await expect(
|
|
245
|
-
typeof selector === "string" ? element(selector) : await selector,
|
|
246
|
-
).not.toHaveRole(role);
|
|
247
|
-
},
|
|
248
|
-
shouldNotHaveScreenshot: async (selector) => {
|
|
249
|
-
await expect(
|
|
250
|
-
typeof selector === "string" ? element(selector) : await selector,
|
|
251
|
-
).not.toHaveScreenshot();
|
|
252
|
-
},
|
|
253
|
-
shouldNotHaveText: async (selector, text) => {
|
|
254
|
-
await expect(
|
|
255
|
-
typeof selector === "string" ? element(selector) : await selector,
|
|
256
|
-
).not.toHaveText(text);
|
|
257
|
-
},
|
|
258
|
-
shouldNotHaveValue: async (selector, value) => {
|
|
259
|
-
await expect(
|
|
260
|
-
typeof selector === "string" ? element(selector) : await selector,
|
|
261
|
-
).not.toHaveValue(value);
|
|
262
|
-
},
|
|
263
|
-
shouldNotHaveValues: async (selector, values) => {
|
|
264
|
-
await expect(
|
|
265
|
-
typeof selector === "string" ? element(selector) : await selector,
|
|
266
|
-
).not.toHaveValues(values);
|
|
267
|
-
},
|
|
268
|
-
shouldNotPageHaveScreenshot: async () => {
|
|
269
|
-
await expect(context.page).not.toHaveScreenshot();
|
|
270
|
-
},
|
|
271
|
-
shouldNotPageHaveTitle: async (title) => {
|
|
272
|
-
await expect(context.page).not.toHaveTitle(title);
|
|
273
|
-
},
|
|
274
|
-
shouldNotPageHaveURL: async (url) => {
|
|
275
|
-
await expect(context.page).not.toHaveURL(url);
|
|
276
|
-
},
|
|
277
|
-
shouldNotResponseBeOK: async (response) => {
|
|
278
|
-
await expect(response).not.toBeOK();
|
|
279
|
-
},
|
|
280
|
-
|
|
281
|
-
// Value Assertion
|
|
282
|
-
|
|
283
|
-
shouldBe: (selector, expected) => {
|
|
284
|
-
expect(elementInteractions.textContent(selector)).toBe(expected);
|
|
285
|
-
},
|
|
286
|
-
shouldBeCloseTo: (selector, expected, precision) => {
|
|
287
|
-
expect(Number(elementInteractions.textContent(selector))).toBeCloseTo(
|
|
288
|
-
expected,
|
|
289
|
-
precision,
|
|
290
|
-
);
|
|
291
|
-
},
|
|
292
|
-
shouldBeDefined: (selector) => {
|
|
293
|
-
expect(elementInteractions.textContent(selector)).toBeDefined();
|
|
294
|
-
},
|
|
295
|
-
shouldBeFalsy: (selector) => {
|
|
296
|
-
expect(elementInteractions.textContent(selector)).toBeFalsy();
|
|
297
|
-
},
|
|
298
|
-
shouldBeGreaterThan: (selector, expected) => {
|
|
299
|
-
expect(Number(elementInteractions.textContent(selector))).toBeGreaterThan(
|
|
300
|
-
expected,
|
|
301
|
-
);
|
|
302
|
-
},
|
|
303
|
-
shouldBeGreaterThanOrEqual: (selector, expected) => {
|
|
304
|
-
expect(
|
|
305
|
-
Number(elementInteractions.textContent(selector)),
|
|
306
|
-
).toBeGreaterThanOrEqual(expected);
|
|
307
|
-
},
|
|
308
|
-
shouldBeInstanceOf: (selector, constructor) => {
|
|
309
|
-
expect(elementInteractions.textContent(selector)).toBeInstanceOf(
|
|
310
|
-
constructor,
|
|
311
|
-
);
|
|
312
|
-
},
|
|
313
|
-
shouldBeLessThan: (selector, expected) => {
|
|
314
|
-
expect(Number(elementInteractions.textContent(selector))).toBeLessThan(
|
|
315
|
-
expected,
|
|
316
|
-
);
|
|
317
|
-
},
|
|
318
|
-
shouldBeLessThanOrEqual: (selector, expected) => {
|
|
319
|
-
expect(
|
|
320
|
-
Number(elementInteractions.textContent(selector)),
|
|
321
|
-
).toBeLessThanOrEqual(expected);
|
|
322
|
-
},
|
|
323
|
-
shouldBeNaN: (selector) => {
|
|
324
|
-
expect(Number(elementInteractions.textContent(selector))).toBeNaN();
|
|
325
|
-
},
|
|
326
|
-
shouldBeNull: (selector) => {
|
|
327
|
-
expect(elementInteractions.textContent(selector)).toBeNull();
|
|
328
|
-
},
|
|
329
|
-
shouldBeTruthy: (selector) => {
|
|
330
|
-
expect(elementInteractions.textContent(selector)).toBeTruthy();
|
|
331
|
-
},
|
|
332
|
-
shouldBeUndefined: (selector) => {
|
|
333
|
-
expect(elementInteractions.textContent(selector)).toBeUndefined();
|
|
334
|
-
},
|
|
335
|
-
shouldContain: (selector, substring) => {
|
|
336
|
-
expect(elementInteractions.textContent(selector)).toContain(substring);
|
|
337
|
-
},
|
|
338
|
-
shouldContainEqual: (selector, expected) => {
|
|
339
|
-
expect(elementInteractions.textContent(selector)).toContainEqual(element);
|
|
340
|
-
},
|
|
341
|
-
shouldEqual: (selector, expected) => {
|
|
342
|
-
expect(Number(elementInteractions.textContent(selector))).toEqual(expected);
|
|
343
|
-
},
|
|
344
|
-
shouldHaveLength: (selector, length) => {
|
|
345
|
-
expect(elementInteractions.textContent(selector)).toHaveLength(length);
|
|
346
|
-
},
|
|
347
|
-
shouldHaveProperty: (selector, property) => {
|
|
348
|
-
expect(elementInteractions.textContent(selector)).toHaveProperty(property);
|
|
349
|
-
},
|
|
350
|
-
shouldMatch: (selector, regex) => {
|
|
351
|
-
expect(elementInteractions.textContent(selector)).toMatch(regex);
|
|
352
|
-
},
|
|
353
|
-
shouldMatchObject: (selector, object) => {
|
|
354
|
-
expect(elementInteractions.textContent(selector)).toMatchObject(object);
|
|
355
|
-
},
|
|
356
|
-
shouldStrictEqual: (selector, expected) => {
|
|
357
|
-
expect(Number(elementInteractions.textContent(selector))).toStrictEqual(
|
|
358
|
-
expected,
|
|
359
|
-
);
|
|
360
|
-
},
|
|
361
|
-
shouldThrow: (fn) => {
|
|
362
|
-
expect(fn).toThrow();
|
|
363
|
-
},
|
|
364
|
-
shouldAny: (selector, constructor) => {
|
|
365
|
-
expect(elementInteractions.textContent(selector)).any.toBeInstanceOf(
|
|
366
|
-
constructor,
|
|
367
|
-
);
|
|
368
|
-
},
|
|
369
|
-
shouldAnything: (selector) => {
|
|
370
|
-
expect(elementInteractions.textContent(selector)).anything();
|
|
371
|
-
},
|
|
372
|
-
shouldArrayContaining: (selector, elements) => {
|
|
373
|
-
expect(elementInteractions.textContent(selector)).toEqual(
|
|
374
|
-
expect.arrayContaining(elements),
|
|
375
|
-
);
|
|
376
|
-
},
|
|
377
|
-
shouldCloseTo: (selector, expected, precision) => {
|
|
378
|
-
expect(Number(elementInteractions.textContent(selector))).toBeCloseTo(
|
|
379
|
-
expected,
|
|
380
|
-
precision,
|
|
381
|
-
);
|
|
382
|
-
},
|
|
383
|
-
shouldObjectContaining: (selector, properties) => {
|
|
384
|
-
expect(elementInteractions.textContent(selector)).toEqual(
|
|
385
|
-
expect.objectContaining(properties),
|
|
386
|
-
);
|
|
387
|
-
},
|
|
388
|
-
shouldStringContaining: (selector, substring) => {
|
|
389
|
-
expect(elementInteractions.textContent(selector)).toEqual(
|
|
390
|
-
expect.stringContaining(substring),
|
|
391
|
-
);
|
|
392
|
-
},
|
|
393
|
-
shouldStringMatching: (selector, regex) => {
|
|
394
|
-
expect(elementInteractions.textContent(selector)).toEqual(
|
|
395
|
-
expect.stringMatching(regex),
|
|
396
|
-
);
|
|
397
|
-
},
|
|
398
|
-
|
|
399
|
-
// Negative Value Assertion
|
|
400
|
-
shouldNotBe: (selector, expected) => {
|
|
401
|
-
expect(elementInteractions.textContent(selector)).not.toBe(expected);
|
|
402
|
-
},
|
|
403
|
-
shouldNotBeCloseTo: (selector, expected, precision) => {
|
|
404
|
-
expect(Number(elementInteractions.textContent(selector))).not.toBeCloseTo(
|
|
405
|
-
expected,
|
|
406
|
-
precision,
|
|
407
|
-
);
|
|
408
|
-
},
|
|
409
|
-
shouldNotBeDefined: (selector) => {
|
|
410
|
-
expect(elementInteractions.textContent(selector)).not.toBeDefined();
|
|
411
|
-
},
|
|
412
|
-
shouldNotBeFalsy: (selector) => {
|
|
413
|
-
expect(elementInteractions.textContent(selector)).not.toBeFalsy();
|
|
414
|
-
},
|
|
415
|
-
shouldNotBeGreaterThan: (selector, expected) => {
|
|
416
|
-
expect(elementInteractions.textContent(selector)).not.toBeGreaterThan(
|
|
417
|
-
expected,
|
|
418
|
-
);
|
|
419
|
-
},
|
|
420
|
-
shouldNotBeGreaterThanOrEqual: (selector, expected) => {
|
|
421
|
-
expect(
|
|
422
|
-
Number(elementInteractions.textContent(selector)),
|
|
423
|
-
).not.toBeGreaterThanOrEqual(expected);
|
|
424
|
-
},
|
|
425
|
-
shouldNotBeInstanceOf: (selector, constructor) => {
|
|
426
|
-
expect(elementInteractions.textContent(selector)).not.toBeInstanceOf(
|
|
427
|
-
constructor,
|
|
428
|
-
);
|
|
429
|
-
},
|
|
430
|
-
shouldNotBeLessThan: (selector, expected) => {
|
|
431
|
-
expect(Number(elementInteractions.textContent(selector))).not.toBeLessThan(
|
|
432
|
-
expected,
|
|
433
|
-
);
|
|
434
|
-
},
|
|
435
|
-
shouldNotBeLessThanOrEqual: (selector, expected) => {
|
|
436
|
-
expect(
|
|
437
|
-
Number(elementInteractions.textContent(selector)),
|
|
438
|
-
).not.toBeLessThanOrEqual(expected);
|
|
439
|
-
},
|
|
440
|
-
shouldNotBeNaN: (selector) => {
|
|
441
|
-
expect(Number(elementInteractions.textContent(selector))).not.toBeNaN();
|
|
442
|
-
},
|
|
443
|
-
shouldNotBeNull: (selector) => {
|
|
444
|
-
expect(elementInteractions.textContent(selector)).not.toBeNull();
|
|
445
|
-
},
|
|
446
|
-
shouldNotBeTruthy: (selector) => {
|
|
447
|
-
expect(elementInteractions.textContent(selector)).not.toBeTruthy();
|
|
448
|
-
},
|
|
449
|
-
shouldNotBeUndefined: (selector) => {
|
|
450
|
-
expect(elementInteractions.textContent(selector)).not.toBeUndefined();
|
|
451
|
-
},
|
|
452
|
-
shouldNotContain: (selector, substring) => {
|
|
453
|
-
expect(elementInteractions.textContent(selector)).not.toContain(substring);
|
|
454
|
-
},
|
|
455
|
-
shouldNotContainEqual: (selector, expected) => {
|
|
456
|
-
expect(
|
|
457
|
-
Number(elementInteractions.textContent(selector)),
|
|
458
|
-
).not.toContainEqual(element);
|
|
459
|
-
},
|
|
460
|
-
shouldNotEqual: (selector, expected) => {
|
|
461
|
-
expect(Number(elementInteractions.textContent(selector))).not.toEqual(
|
|
462
|
-
expected,
|
|
463
|
-
);
|
|
464
|
-
},
|
|
465
|
-
shouldNotHaveLength: (selector, length) => {
|
|
466
|
-
expect(elementInteractions.textContent(selector)).not.toHaveLength(length);
|
|
467
|
-
},
|
|
468
|
-
shouldNotHaveProperty: (selector, property) => {
|
|
469
|
-
expect(elementInteractions.textContent(selector)).not.toHaveProperty(
|
|
470
|
-
property,
|
|
471
|
-
);
|
|
472
|
-
},
|
|
473
|
-
shouldNotMatch: (selector, regex) => {
|
|
474
|
-
expect(elementInteractions.textContent(selector)).not.toMatch(regex);
|
|
475
|
-
},
|
|
476
|
-
shouldNotMatchObject: (selector, object) => {
|
|
477
|
-
expect(elementInteractions.textContent(selector)).not.toMatchObject(object);
|
|
478
|
-
},
|
|
479
|
-
shouldNotStrictEqual: (selector, expected) => {
|
|
480
|
-
expect(Number(elementInteractions.textContent(selector))).not.toStrictEqual(
|
|
481
|
-
expected,
|
|
482
|
-
);
|
|
483
|
-
},
|
|
484
|
-
shouldNotThrow: (fn) => {
|
|
485
|
-
expect(fn).not.toThrow();
|
|
486
|
-
},
|
|
487
|
-
shouldNotAny: (selector, constructor) => {
|
|
488
|
-
expect(elementInteractions.textContent(selector)).any.toBeInstanceOf(
|
|
489
|
-
constructor,
|
|
490
|
-
);
|
|
491
|
-
},
|
|
492
|
-
shouldNotAnything: (selector) => {
|
|
493
|
-
expect(elementInteractions.textContent(selector)).not.anything();
|
|
494
|
-
},
|
|
495
|
-
shouldNotArrayContaining: (selector, elements) => {
|
|
496
|
-
expect(elementInteractions.textContent(selector)).not.toEqual(
|
|
497
|
-
expect.arrayContaining(elements),
|
|
498
|
-
);
|
|
499
|
-
},
|
|
500
|
-
shouldNotCloseTo: (selector, expected, precision) => {
|
|
501
|
-
expect(Number(elementInteractions.textContent(selector))).not.toBeCloseTo(
|
|
502
|
-
expected,
|
|
503
|
-
precision,
|
|
504
|
-
);
|
|
505
|
-
},
|
|
506
|
-
shouldNotObjectContaining: (selector, properties) => {
|
|
507
|
-
expect(elementInteractions.textContent(selector)).not.toEqual(
|
|
508
|
-
expect.objectContaining(properties),
|
|
509
|
-
);
|
|
510
|
-
},
|
|
511
|
-
shouldNotStringContaining: (selector, substring) => {
|
|
512
|
-
expect(elementInteractions.textContent(selector)).not.toEqual(
|
|
513
|
-
expect.stringContaining(substring),
|
|
514
|
-
);
|
|
515
|
-
},
|
|
516
|
-
shouldNotStringMatching: (selector, regex) => {
|
|
517
|
-
expect(elementInteractions.textContent(selector)).not.toEqual(
|
|
518
|
-
expect.stringMatchingStringMatching(regex),
|
|
519
|
-
);
|
|
520
|
-
},
|
|
521
|
-
};
|
|
522
|
-
|
|
523
|
-
module.exports = { assert };
|
|
1
|
+
const { expect, element, context } = require("../imports/commons");
|
|
2
|
+
const { elementInteractions } = require("./elementInteractions");
|
|
3
|
+
const { frame } = require("../stepFunctions/frameActions");
|
|
4
|
+
|
|
5
|
+
const assert = {
|
|
6
|
+
// Element Assertion
|
|
7
|
+
shouldBeAttached: async (selector) => {
|
|
8
|
+
await expect(
|
|
9
|
+
typeof selector === "string" ? element(selector) : await selector,
|
|
10
|
+
).toBeAttached();
|
|
11
|
+
},
|
|
12
|
+
shouldBeChecked: async (selector) => {
|
|
13
|
+
await expect(
|
|
14
|
+
typeof selector === "string" ? element(selector) : await selector,
|
|
15
|
+
).toBeChecked();
|
|
16
|
+
},
|
|
17
|
+
shouldBeDisabled: async (selector) => {
|
|
18
|
+
await expect(
|
|
19
|
+
typeof selector === "string" ? element(selector) : await selector,
|
|
20
|
+
).toBeDisabled();
|
|
21
|
+
},
|
|
22
|
+
shouldBeEditable: async (selector) => {
|
|
23
|
+
await expect(
|
|
24
|
+
typeof selector === "string" ? element(selector) : await selector,
|
|
25
|
+
).toBeEditable();
|
|
26
|
+
},
|
|
27
|
+
shouldBeEmpty: async (selector) => {
|
|
28
|
+
await expect(
|
|
29
|
+
typeof selector === "string" ? element(selector) : await selector,
|
|
30
|
+
).toBeEmpty();
|
|
31
|
+
},
|
|
32
|
+
shouldBeEnabled: async (selector) => {
|
|
33
|
+
await expect(
|
|
34
|
+
typeof selector === "string" ? element(selector) : await selector,
|
|
35
|
+
).toBeEnabled();
|
|
36
|
+
},
|
|
37
|
+
shouldBeFocused: async (selector) => {
|
|
38
|
+
await expect(
|
|
39
|
+
typeof selector === "string" ? element(selector) : await selector,
|
|
40
|
+
).toBeFocused();
|
|
41
|
+
},
|
|
42
|
+
shouldBeHidden: async (selector) => {
|
|
43
|
+
await expect(
|
|
44
|
+
typeof selector === "string" ? element(selector) : await selector,
|
|
45
|
+
).toBeHidden();
|
|
46
|
+
},
|
|
47
|
+
shouldBeInViewport: async (selector) => {
|
|
48
|
+
await expect(
|
|
49
|
+
typeof selector === "string" ? element(selector) : await selector,
|
|
50
|
+
).toBeInViewport();
|
|
51
|
+
},
|
|
52
|
+
shouldBeVisible: async (selector) => {
|
|
53
|
+
await expect(
|
|
54
|
+
typeof selector === "string" ? element(selector) : await selector,
|
|
55
|
+
).toBeVisible();
|
|
56
|
+
},
|
|
57
|
+
shouldContainText: async (selector, text) => {
|
|
58
|
+
await expect(
|
|
59
|
+
typeof selector === "string" ? element(selector) : await selector,
|
|
60
|
+
).toContainText(text);
|
|
61
|
+
},
|
|
62
|
+
multipleElementsShouldContainText: async (elements, expectedText) => {
|
|
63
|
+
const count = await frame.count(elements);
|
|
64
|
+
|
|
65
|
+
for (let i = 0; i < count; i++) {
|
|
66
|
+
await assert.shouldContainText(frame.nth(elements, i), expectedText);
|
|
67
|
+
}
|
|
68
|
+
},
|
|
69
|
+
shouldHaveAccessibleDescription: async (selector, description) => {
|
|
70
|
+
await expect(
|
|
71
|
+
typeof selector === "string" ? element(selector) : await selector,
|
|
72
|
+
).toHaveAccessibleDescription(description);
|
|
73
|
+
},
|
|
74
|
+
shouldHaveAccessibleName: async (selector, name) => {
|
|
75
|
+
await expect(
|
|
76
|
+
typeof selector === "string" ? element(selector) : await selector,
|
|
77
|
+
).toHaveAccessibleName(name);
|
|
78
|
+
},
|
|
79
|
+
shouldHaveAttribute: async (selector, attribute, value) => {
|
|
80
|
+
await expect(
|
|
81
|
+
typeof selector === "string" ? element(selector) : await selector,
|
|
82
|
+
).toHaveAttribute(attribute, value);
|
|
83
|
+
},
|
|
84
|
+
shouldHaveClass: async (selector, className) => {
|
|
85
|
+
await expect(
|
|
86
|
+
typeof selector === "string" ? element(selector) : await selector,
|
|
87
|
+
).toHaveClass(className);
|
|
88
|
+
},
|
|
89
|
+
shouldHaveCount: async (selector, count) => {
|
|
90
|
+
await expect(
|
|
91
|
+
typeof selector === "string" ? element(selector) : await selector,
|
|
92
|
+
).toHaveCount(count);
|
|
93
|
+
},
|
|
94
|
+
shouldHaveCSS: async (selector, property, value) => {
|
|
95
|
+
await expect(
|
|
96
|
+
typeof selector === "string" ? element(selector) : await selector,
|
|
97
|
+
).toHaveCSS(property, value);
|
|
98
|
+
},
|
|
99
|
+
shouldHaveId: async (selector, id) => {
|
|
100
|
+
await expect(
|
|
101
|
+
typeof selector === "string" ? element(selector) : await selector,
|
|
102
|
+
).toHaveId(id);
|
|
103
|
+
},
|
|
104
|
+
shouldHaveJSProperty: async (selector, property, value) => {
|
|
105
|
+
await expect(
|
|
106
|
+
typeof selector === "string" ? element(selector) : await selector,
|
|
107
|
+
).toHaveJSProperty(property, value);
|
|
108
|
+
},
|
|
109
|
+
shouldHaveRole: async (selector, role) => {
|
|
110
|
+
await expect(
|
|
111
|
+
typeof selector === "string" ? element(selector) : await selector,
|
|
112
|
+
).toHaveRole(role);
|
|
113
|
+
},
|
|
114
|
+
shouldHaveScreenshot: async (selector) => {
|
|
115
|
+
await expect(
|
|
116
|
+
typeof selector === "string" ? element(selector) : await selector,
|
|
117
|
+
).toHaveScreenshot();
|
|
118
|
+
},
|
|
119
|
+
shouldHaveText: async (selector, text) => {
|
|
120
|
+
await expect(
|
|
121
|
+
typeof selector === "string" ? element(selector) : await selector,
|
|
122
|
+
).toHaveText(text);
|
|
123
|
+
},
|
|
124
|
+
shouldHaveValue: async (selector, value) => {
|
|
125
|
+
await expect(
|
|
126
|
+
typeof selector === "string" ? element(selector) : await selector,
|
|
127
|
+
).toHaveValue(value);
|
|
128
|
+
},
|
|
129
|
+
shouldHaveValues: async (selector, values) => {
|
|
130
|
+
await expect(
|
|
131
|
+
typeof selector === "string" ? element(selector) : await selector,
|
|
132
|
+
).toHaveValues(values);
|
|
133
|
+
},
|
|
134
|
+
shouldPageHaveScreenshot: async () => {
|
|
135
|
+
await expect(context.page).toHaveScreenshot();
|
|
136
|
+
},
|
|
137
|
+
shouldPageHaveTitle: async (title) => {
|
|
138
|
+
await expect(context.page).toHaveTitle(title);
|
|
139
|
+
},
|
|
140
|
+
shouldPageHaveURL: async (url) => {
|
|
141
|
+
await expect(context.page).toHaveURL(url);
|
|
142
|
+
},
|
|
143
|
+
shouldResponseBeOK: async (response) => {
|
|
144
|
+
await expect(response).toBeOK();
|
|
145
|
+
},
|
|
146
|
+
|
|
147
|
+
// Negative Element Assertion
|
|
148
|
+
shouldNotBeAttached: async (selector) => {
|
|
149
|
+
await expect(
|
|
150
|
+
typeof selector === "string" ? element(selector) : await selector,
|
|
151
|
+
).not.toBeAttached();
|
|
152
|
+
},
|
|
153
|
+
shouldNotBeChecked: async (selector) => {
|
|
154
|
+
await expect(
|
|
155
|
+
typeof selector === "string" ? element(selector) : await selector,
|
|
156
|
+
).not.toBeChecked();
|
|
157
|
+
},
|
|
158
|
+
shouldNotBeDisabled: async (selector) => {
|
|
159
|
+
await expect(
|
|
160
|
+
typeof selector === "string" ? element(selector) : await selector,
|
|
161
|
+
).not.toBeDisabled();
|
|
162
|
+
},
|
|
163
|
+
shouldNotBeEditable: async (selector) => {
|
|
164
|
+
await expect(
|
|
165
|
+
typeof selector === "string" ? element(selector) : await selector,
|
|
166
|
+
).not.toBeEditable();
|
|
167
|
+
},
|
|
168
|
+
shouldNotBeEmpty: async (selector) => {
|
|
169
|
+
await expect(
|
|
170
|
+
typeof selector === "string" ? element(selector) : await selector,
|
|
171
|
+
).not.toBeEmpty();
|
|
172
|
+
},
|
|
173
|
+
shouldNotBeEnabled: async (selector) => {
|
|
174
|
+
await expect(
|
|
175
|
+
typeof selector === "string" ? element(selector) : await selector,
|
|
176
|
+
).not.toBeEnabled();
|
|
177
|
+
},
|
|
178
|
+
shouldNotBeFocused: async (selector) => {
|
|
179
|
+
await expect(
|
|
180
|
+
typeof selector === "string" ? element(selector) : await selector,
|
|
181
|
+
).not.toBeFocused();
|
|
182
|
+
},
|
|
183
|
+
shouldNotBeHidden: async (selector) => {
|
|
184
|
+
await expect(
|
|
185
|
+
typeof selector === "string" ? element(selector) : await selector,
|
|
186
|
+
).not.toBeHidden();
|
|
187
|
+
},
|
|
188
|
+
shouldNotBeInViewport: async (selector) => {
|
|
189
|
+
await expect(
|
|
190
|
+
typeof selector === "string" ? element(selector) : await selector,
|
|
191
|
+
).not.toBeInViewport();
|
|
192
|
+
},
|
|
193
|
+
shouldNotBeVisible: async (selector) => {
|
|
194
|
+
await expect(
|
|
195
|
+
typeof selector === "string" ? element(selector) : await selector,
|
|
196
|
+
).not.toBeVisible();
|
|
197
|
+
},
|
|
198
|
+
shouldNotContainText: async (selector, text) => {
|
|
199
|
+
await expect(
|
|
200
|
+
typeof selector === "string" ? element(selector) : await selector,
|
|
201
|
+
).not.toContainText(text);
|
|
202
|
+
},
|
|
203
|
+
shouldNotHaveAccessibleDescription: async (selector, description) => {
|
|
204
|
+
await expect(
|
|
205
|
+
typeof selector === "string" ? element(selector) : await selector,
|
|
206
|
+
).not.toHaveAccessibleDescription(description);
|
|
207
|
+
},
|
|
208
|
+
shouldNotHaveAccessibleName: async (selector, name) => {
|
|
209
|
+
await expect(
|
|
210
|
+
typeof selector === "string" ? element(selector) : await selector,
|
|
211
|
+
).not.toHaveAccessibleName(name);
|
|
212
|
+
},
|
|
213
|
+
shouldNotHaveAttribute: async (selector, attribute, value) => {
|
|
214
|
+
await expect(
|
|
215
|
+
typeof selector === "string" ? element(selector) : await selector,
|
|
216
|
+
).not.toHaveAttribute(attribute, value);
|
|
217
|
+
},
|
|
218
|
+
shouldNotHaveClass: async (selector, className) => {
|
|
219
|
+
await expect(
|
|
220
|
+
typeof selector === "string" ? element(selector) : await selector,
|
|
221
|
+
).not.toHaveClass(className);
|
|
222
|
+
},
|
|
223
|
+
shouldNotHaveCount: async (selector, count) => {
|
|
224
|
+
await expect(
|
|
225
|
+
typeof selector === "string" ? element(selector) : await selector,
|
|
226
|
+
).not.toHaveCount(count);
|
|
227
|
+
},
|
|
228
|
+
shouldNotHaveCSS: async (selector, property, value) => {
|
|
229
|
+
await expect(
|
|
230
|
+
typeof selector === "string" ? element(selector) : await selector,
|
|
231
|
+
).not.toHaveCSS(property, value);
|
|
232
|
+
},
|
|
233
|
+
shouldNotHaveId: async (selector, id) => {
|
|
234
|
+
await expect(
|
|
235
|
+
typeof selector === "string" ? element(selector) : await selector,
|
|
236
|
+
).not.toHaveId(id);
|
|
237
|
+
},
|
|
238
|
+
shouldNotHaveJSProperty: async (selector, property, value) => {
|
|
239
|
+
await expect(
|
|
240
|
+
typeof selector === "string" ? element(selector) : await selector,
|
|
241
|
+
).not.toHaveJSProperty(property, value);
|
|
242
|
+
},
|
|
243
|
+
shouldNotHaveRole: async (selector, role) => {
|
|
244
|
+
await expect(
|
|
245
|
+
typeof selector === "string" ? element(selector) : await selector,
|
|
246
|
+
).not.toHaveRole(role);
|
|
247
|
+
},
|
|
248
|
+
shouldNotHaveScreenshot: async (selector) => {
|
|
249
|
+
await expect(
|
|
250
|
+
typeof selector === "string" ? element(selector) : await selector,
|
|
251
|
+
).not.toHaveScreenshot();
|
|
252
|
+
},
|
|
253
|
+
shouldNotHaveText: async (selector, text) => {
|
|
254
|
+
await expect(
|
|
255
|
+
typeof selector === "string" ? element(selector) : await selector,
|
|
256
|
+
).not.toHaveText(text);
|
|
257
|
+
},
|
|
258
|
+
shouldNotHaveValue: async (selector, value) => {
|
|
259
|
+
await expect(
|
|
260
|
+
typeof selector === "string" ? element(selector) : await selector,
|
|
261
|
+
).not.toHaveValue(value);
|
|
262
|
+
},
|
|
263
|
+
shouldNotHaveValues: async (selector, values) => {
|
|
264
|
+
await expect(
|
|
265
|
+
typeof selector === "string" ? element(selector) : await selector,
|
|
266
|
+
).not.toHaveValues(values);
|
|
267
|
+
},
|
|
268
|
+
shouldNotPageHaveScreenshot: async () => {
|
|
269
|
+
await expect(context.page).not.toHaveScreenshot();
|
|
270
|
+
},
|
|
271
|
+
shouldNotPageHaveTitle: async (title) => {
|
|
272
|
+
await expect(context.page).not.toHaveTitle(title);
|
|
273
|
+
},
|
|
274
|
+
shouldNotPageHaveURL: async (url) => {
|
|
275
|
+
await expect(context.page).not.toHaveURL(url);
|
|
276
|
+
},
|
|
277
|
+
shouldNotResponseBeOK: async (response) => {
|
|
278
|
+
await expect(response).not.toBeOK();
|
|
279
|
+
},
|
|
280
|
+
|
|
281
|
+
// Value Assertion
|
|
282
|
+
|
|
283
|
+
shouldBe: (selector, expected) => {
|
|
284
|
+
expect(elementInteractions.textContent(selector)).toBe(expected);
|
|
285
|
+
},
|
|
286
|
+
shouldBeCloseTo: (selector, expected, precision) => {
|
|
287
|
+
expect(Number(elementInteractions.textContent(selector))).toBeCloseTo(
|
|
288
|
+
expected,
|
|
289
|
+
precision,
|
|
290
|
+
);
|
|
291
|
+
},
|
|
292
|
+
shouldBeDefined: (selector) => {
|
|
293
|
+
expect(elementInteractions.textContent(selector)).toBeDefined();
|
|
294
|
+
},
|
|
295
|
+
shouldBeFalsy: (selector) => {
|
|
296
|
+
expect(elementInteractions.textContent(selector)).toBeFalsy();
|
|
297
|
+
},
|
|
298
|
+
shouldBeGreaterThan: (selector, expected) => {
|
|
299
|
+
expect(Number(elementInteractions.textContent(selector))).toBeGreaterThan(
|
|
300
|
+
expected,
|
|
301
|
+
);
|
|
302
|
+
},
|
|
303
|
+
shouldBeGreaterThanOrEqual: (selector, expected) => {
|
|
304
|
+
expect(
|
|
305
|
+
Number(elementInteractions.textContent(selector)),
|
|
306
|
+
).toBeGreaterThanOrEqual(expected);
|
|
307
|
+
},
|
|
308
|
+
shouldBeInstanceOf: (selector, constructor) => {
|
|
309
|
+
expect(elementInteractions.textContent(selector)).toBeInstanceOf(
|
|
310
|
+
constructor,
|
|
311
|
+
);
|
|
312
|
+
},
|
|
313
|
+
shouldBeLessThan: (selector, expected) => {
|
|
314
|
+
expect(Number(elementInteractions.textContent(selector))).toBeLessThan(
|
|
315
|
+
expected,
|
|
316
|
+
);
|
|
317
|
+
},
|
|
318
|
+
shouldBeLessThanOrEqual: (selector, expected) => {
|
|
319
|
+
expect(
|
|
320
|
+
Number(elementInteractions.textContent(selector)),
|
|
321
|
+
).toBeLessThanOrEqual(expected);
|
|
322
|
+
},
|
|
323
|
+
shouldBeNaN: (selector) => {
|
|
324
|
+
expect(Number(elementInteractions.textContent(selector))).toBeNaN();
|
|
325
|
+
},
|
|
326
|
+
shouldBeNull: (selector) => {
|
|
327
|
+
expect(elementInteractions.textContent(selector)).toBeNull();
|
|
328
|
+
},
|
|
329
|
+
shouldBeTruthy: (selector) => {
|
|
330
|
+
expect(elementInteractions.textContent(selector)).toBeTruthy();
|
|
331
|
+
},
|
|
332
|
+
shouldBeUndefined: (selector) => {
|
|
333
|
+
expect(elementInteractions.textContent(selector)).toBeUndefined();
|
|
334
|
+
},
|
|
335
|
+
shouldContain: (selector, substring) => {
|
|
336
|
+
expect(elementInteractions.textContent(selector)).toContain(substring);
|
|
337
|
+
},
|
|
338
|
+
shouldContainEqual: (selector, expected) => {
|
|
339
|
+
expect(elementInteractions.textContent(selector)).toContainEqual(element);
|
|
340
|
+
},
|
|
341
|
+
shouldEqual: (selector, expected) => {
|
|
342
|
+
expect(Number(elementInteractions.textContent(selector))).toEqual(expected);
|
|
343
|
+
},
|
|
344
|
+
shouldHaveLength: (selector, length) => {
|
|
345
|
+
expect(elementInteractions.textContent(selector)).toHaveLength(length);
|
|
346
|
+
},
|
|
347
|
+
shouldHaveProperty: (selector, property) => {
|
|
348
|
+
expect(elementInteractions.textContent(selector)).toHaveProperty(property);
|
|
349
|
+
},
|
|
350
|
+
shouldMatch: (selector, regex) => {
|
|
351
|
+
expect(elementInteractions.textContent(selector)).toMatch(regex);
|
|
352
|
+
},
|
|
353
|
+
shouldMatchObject: (selector, object) => {
|
|
354
|
+
expect(elementInteractions.textContent(selector)).toMatchObject(object);
|
|
355
|
+
},
|
|
356
|
+
shouldStrictEqual: (selector, expected) => {
|
|
357
|
+
expect(Number(elementInteractions.textContent(selector))).toStrictEqual(
|
|
358
|
+
expected,
|
|
359
|
+
);
|
|
360
|
+
},
|
|
361
|
+
shouldThrow: (fn) => {
|
|
362
|
+
expect(fn).toThrow();
|
|
363
|
+
},
|
|
364
|
+
shouldAny: (selector, constructor) => {
|
|
365
|
+
expect(elementInteractions.textContent(selector)).any.toBeInstanceOf(
|
|
366
|
+
constructor,
|
|
367
|
+
);
|
|
368
|
+
},
|
|
369
|
+
shouldAnything: (selector) => {
|
|
370
|
+
expect(elementInteractions.textContent(selector)).anything();
|
|
371
|
+
},
|
|
372
|
+
shouldArrayContaining: (selector, elements) => {
|
|
373
|
+
expect(elementInteractions.textContent(selector)).toEqual(
|
|
374
|
+
expect.arrayContaining(elements),
|
|
375
|
+
);
|
|
376
|
+
},
|
|
377
|
+
shouldCloseTo: (selector, expected, precision) => {
|
|
378
|
+
expect(Number(elementInteractions.textContent(selector))).toBeCloseTo(
|
|
379
|
+
expected,
|
|
380
|
+
precision,
|
|
381
|
+
);
|
|
382
|
+
},
|
|
383
|
+
shouldObjectContaining: (selector, properties) => {
|
|
384
|
+
expect(elementInteractions.textContent(selector)).toEqual(
|
|
385
|
+
expect.objectContaining(properties),
|
|
386
|
+
);
|
|
387
|
+
},
|
|
388
|
+
shouldStringContaining: (selector, substring) => {
|
|
389
|
+
expect(elementInteractions.textContent(selector)).toEqual(
|
|
390
|
+
expect.stringContaining(substring),
|
|
391
|
+
);
|
|
392
|
+
},
|
|
393
|
+
shouldStringMatching: (selector, regex) => {
|
|
394
|
+
expect(elementInteractions.textContent(selector)).toEqual(
|
|
395
|
+
expect.stringMatching(regex),
|
|
396
|
+
);
|
|
397
|
+
},
|
|
398
|
+
|
|
399
|
+
// Negative Value Assertion
|
|
400
|
+
shouldNotBe: (selector, expected) => {
|
|
401
|
+
expect(elementInteractions.textContent(selector)).not.toBe(expected);
|
|
402
|
+
},
|
|
403
|
+
shouldNotBeCloseTo: (selector, expected, precision) => {
|
|
404
|
+
expect(Number(elementInteractions.textContent(selector))).not.toBeCloseTo(
|
|
405
|
+
expected,
|
|
406
|
+
precision,
|
|
407
|
+
);
|
|
408
|
+
},
|
|
409
|
+
shouldNotBeDefined: (selector) => {
|
|
410
|
+
expect(elementInteractions.textContent(selector)).not.toBeDefined();
|
|
411
|
+
},
|
|
412
|
+
shouldNotBeFalsy: (selector) => {
|
|
413
|
+
expect(elementInteractions.textContent(selector)).not.toBeFalsy();
|
|
414
|
+
},
|
|
415
|
+
shouldNotBeGreaterThan: (selector, expected) => {
|
|
416
|
+
expect(elementInteractions.textContent(selector)).not.toBeGreaterThan(
|
|
417
|
+
expected,
|
|
418
|
+
);
|
|
419
|
+
},
|
|
420
|
+
shouldNotBeGreaterThanOrEqual: (selector, expected) => {
|
|
421
|
+
expect(
|
|
422
|
+
Number(elementInteractions.textContent(selector)),
|
|
423
|
+
).not.toBeGreaterThanOrEqual(expected);
|
|
424
|
+
},
|
|
425
|
+
shouldNotBeInstanceOf: (selector, constructor) => {
|
|
426
|
+
expect(elementInteractions.textContent(selector)).not.toBeInstanceOf(
|
|
427
|
+
constructor,
|
|
428
|
+
);
|
|
429
|
+
},
|
|
430
|
+
shouldNotBeLessThan: (selector, expected) => {
|
|
431
|
+
expect(Number(elementInteractions.textContent(selector))).not.toBeLessThan(
|
|
432
|
+
expected,
|
|
433
|
+
);
|
|
434
|
+
},
|
|
435
|
+
shouldNotBeLessThanOrEqual: (selector, expected) => {
|
|
436
|
+
expect(
|
|
437
|
+
Number(elementInteractions.textContent(selector)),
|
|
438
|
+
).not.toBeLessThanOrEqual(expected);
|
|
439
|
+
},
|
|
440
|
+
shouldNotBeNaN: (selector) => {
|
|
441
|
+
expect(Number(elementInteractions.textContent(selector))).not.toBeNaN();
|
|
442
|
+
},
|
|
443
|
+
shouldNotBeNull: (selector) => {
|
|
444
|
+
expect(elementInteractions.textContent(selector)).not.toBeNull();
|
|
445
|
+
},
|
|
446
|
+
shouldNotBeTruthy: (selector) => {
|
|
447
|
+
expect(elementInteractions.textContent(selector)).not.toBeTruthy();
|
|
448
|
+
},
|
|
449
|
+
shouldNotBeUndefined: (selector) => {
|
|
450
|
+
expect(elementInteractions.textContent(selector)).not.toBeUndefined();
|
|
451
|
+
},
|
|
452
|
+
shouldNotContain: (selector, substring) => {
|
|
453
|
+
expect(elementInteractions.textContent(selector)).not.toContain(substring);
|
|
454
|
+
},
|
|
455
|
+
shouldNotContainEqual: (selector, expected) => {
|
|
456
|
+
expect(
|
|
457
|
+
Number(elementInteractions.textContent(selector)),
|
|
458
|
+
).not.toContainEqual(element);
|
|
459
|
+
},
|
|
460
|
+
shouldNotEqual: (selector, expected) => {
|
|
461
|
+
expect(Number(elementInteractions.textContent(selector))).not.toEqual(
|
|
462
|
+
expected,
|
|
463
|
+
);
|
|
464
|
+
},
|
|
465
|
+
shouldNotHaveLength: (selector, length) => {
|
|
466
|
+
expect(elementInteractions.textContent(selector)).not.toHaveLength(length);
|
|
467
|
+
},
|
|
468
|
+
shouldNotHaveProperty: (selector, property) => {
|
|
469
|
+
expect(elementInteractions.textContent(selector)).not.toHaveProperty(
|
|
470
|
+
property,
|
|
471
|
+
);
|
|
472
|
+
},
|
|
473
|
+
shouldNotMatch: (selector, regex) => {
|
|
474
|
+
expect(elementInteractions.textContent(selector)).not.toMatch(regex);
|
|
475
|
+
},
|
|
476
|
+
shouldNotMatchObject: (selector, object) => {
|
|
477
|
+
expect(elementInteractions.textContent(selector)).not.toMatchObject(object);
|
|
478
|
+
},
|
|
479
|
+
shouldNotStrictEqual: (selector, expected) => {
|
|
480
|
+
expect(Number(elementInteractions.textContent(selector))).not.toStrictEqual(
|
|
481
|
+
expected,
|
|
482
|
+
);
|
|
483
|
+
},
|
|
484
|
+
shouldNotThrow: (fn) => {
|
|
485
|
+
expect(fn).not.toThrow();
|
|
486
|
+
},
|
|
487
|
+
shouldNotAny: (selector, constructor) => {
|
|
488
|
+
expect(elementInteractions.textContent(selector)).any.toBeInstanceOf(
|
|
489
|
+
constructor,
|
|
490
|
+
);
|
|
491
|
+
},
|
|
492
|
+
shouldNotAnything: (selector) => {
|
|
493
|
+
expect(elementInteractions.textContent(selector)).not.anything();
|
|
494
|
+
},
|
|
495
|
+
shouldNotArrayContaining: (selector, elements) => {
|
|
496
|
+
expect(elementInteractions.textContent(selector)).not.toEqual(
|
|
497
|
+
expect.arrayContaining(elements),
|
|
498
|
+
);
|
|
499
|
+
},
|
|
500
|
+
shouldNotCloseTo: (selector, expected, precision) => {
|
|
501
|
+
expect(Number(elementInteractions.textContent(selector))).not.toBeCloseTo(
|
|
502
|
+
expected,
|
|
503
|
+
precision,
|
|
504
|
+
);
|
|
505
|
+
},
|
|
506
|
+
shouldNotObjectContaining: (selector, properties) => {
|
|
507
|
+
expect(elementInteractions.textContent(selector)).not.toEqual(
|
|
508
|
+
expect.objectContaining(properties),
|
|
509
|
+
);
|
|
510
|
+
},
|
|
511
|
+
shouldNotStringContaining: (selector, substring) => {
|
|
512
|
+
expect(elementInteractions.textContent(selector)).not.toEqual(
|
|
513
|
+
expect.stringContaining(substring),
|
|
514
|
+
);
|
|
515
|
+
},
|
|
516
|
+
shouldNotStringMatching: (selector, regex) => {
|
|
517
|
+
expect(elementInteractions.textContent(selector)).not.toEqual(
|
|
518
|
+
expect.stringMatchingStringMatching(regex),
|
|
519
|
+
);
|
|
520
|
+
},
|
|
521
|
+
};
|
|
522
|
+
|
|
523
|
+
module.exports = { assert };
|