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,769 @@
|
|
|
1
|
+
const { Then } = require("../../helper/imports/commons");
|
|
2
|
+
const { assert } = require("../../helper/stepFunctions/actionCommons");
|
|
3
|
+
|
|
4
|
+
// Check if a selector should be attached
|
|
5
|
+
Then("User expects {string} should be attached", function (selector) {
|
|
6
|
+
assert.shouldBeAttached(selector);
|
|
7
|
+
});
|
|
8
|
+
|
|
9
|
+
// Check if a selector should be checked
|
|
10
|
+
Then("User expects {string} should be checked", function (selector) {
|
|
11
|
+
assert.shouldBeChecked(selector);
|
|
12
|
+
});
|
|
13
|
+
|
|
14
|
+
// Check if a selector should be disabled
|
|
15
|
+
Then("User expects {string} should be disabled", function (selector) {
|
|
16
|
+
assert.shouldBeDisabled(selector);
|
|
17
|
+
});
|
|
18
|
+
|
|
19
|
+
// Check if a selector should be editable
|
|
20
|
+
Then("User expects {string} should be editable", function (selector) {
|
|
21
|
+
assert.shouldBeEditable(selector);
|
|
22
|
+
});
|
|
23
|
+
|
|
24
|
+
// Check if a selector should be empty
|
|
25
|
+
Then("User expects {string} should be empty", function (selector) {
|
|
26
|
+
assert.shouldBeEmpty(selector);
|
|
27
|
+
});
|
|
28
|
+
|
|
29
|
+
// Check if a selector should be enabled
|
|
30
|
+
Then("User expects {string} should be enabled", function (selector) {
|
|
31
|
+
assert.shouldBeEnabled(selector);
|
|
32
|
+
});
|
|
33
|
+
|
|
34
|
+
// Check if a selector should be focused
|
|
35
|
+
Then("User expects {string} should be focused", function (selector) {
|
|
36
|
+
assert.shouldBeFocused(selector);
|
|
37
|
+
});
|
|
38
|
+
|
|
39
|
+
// Check if a selector should be hidden
|
|
40
|
+
Then("User expects {string} should be hidden", function (selector) {
|
|
41
|
+
assert.shouldBeHidden(selector);
|
|
42
|
+
});
|
|
43
|
+
|
|
44
|
+
// Check if a selector should be in the viewport
|
|
45
|
+
Then("User expects {string} should be on the screen", function (selector) {
|
|
46
|
+
assert.shouldBeInViewport(selector);
|
|
47
|
+
});
|
|
48
|
+
|
|
49
|
+
// Check if a selector should be visible
|
|
50
|
+
Then("User expects {string} should be visible", function (selector) {
|
|
51
|
+
assert.shouldBeVisible(selector);
|
|
52
|
+
});
|
|
53
|
+
|
|
54
|
+
// Check if a selector should contain specific text
|
|
55
|
+
Then(
|
|
56
|
+
"User expects {string} should have {string} text",
|
|
57
|
+
function (selector, text) {
|
|
58
|
+
assert.shouldContainText(selector, text);
|
|
59
|
+
},
|
|
60
|
+
);
|
|
61
|
+
|
|
62
|
+
// Check if a selector should have an accessible description
|
|
63
|
+
Then(
|
|
64
|
+
"User expects {string} should have {string} description",
|
|
65
|
+
function (selector, description) {
|
|
66
|
+
assert.shouldHaveAccessibleDescription(selector, description);
|
|
67
|
+
},
|
|
68
|
+
);
|
|
69
|
+
|
|
70
|
+
// Check if a selector should have an accessible name
|
|
71
|
+
Then(
|
|
72
|
+
"User expects {string} should have {string} name",
|
|
73
|
+
function (selector, name) {
|
|
74
|
+
assert.shouldHaveAccessibleName(selector, name);
|
|
75
|
+
},
|
|
76
|
+
);
|
|
77
|
+
|
|
78
|
+
// Check if a selector should have a specific attribute with a given value
|
|
79
|
+
Then(
|
|
80
|
+
"User expects {string} should have {string} attribute with {string} value",
|
|
81
|
+
function (selector, attribute, value) {
|
|
82
|
+
assert.shouldHaveAttribute(selector, attribute, value);
|
|
83
|
+
},
|
|
84
|
+
);
|
|
85
|
+
|
|
86
|
+
// Check if a selector should have a specific class
|
|
87
|
+
Then(
|
|
88
|
+
"User expects {string} should have {string} class",
|
|
89
|
+
function (selector, className) {
|
|
90
|
+
assert.shouldHaveClass(selector, className);
|
|
91
|
+
},
|
|
92
|
+
);
|
|
93
|
+
|
|
94
|
+
// Check if a selector should have a specific count
|
|
95
|
+
Then(
|
|
96
|
+
"User expects count of {string} should be {int}",
|
|
97
|
+
function (selector, count) {
|
|
98
|
+
assert.shouldHaveCount(selector, count);
|
|
99
|
+
},
|
|
100
|
+
);
|
|
101
|
+
|
|
102
|
+
// Check if a selector should have a specific CSS property with a given value
|
|
103
|
+
Then(
|
|
104
|
+
"User expects {string} should have {string} CSS property with {string} value",
|
|
105
|
+
function (selector, property, value) {
|
|
106
|
+
assert.shouldHaveCSS(selector, property, value);
|
|
107
|
+
},
|
|
108
|
+
);
|
|
109
|
+
|
|
110
|
+
// Check if a selector should have a specific id
|
|
111
|
+
Then("User expects {string} should have {string} id", function (selector, id) {
|
|
112
|
+
assert.shouldHaveId(selector, id);
|
|
113
|
+
});
|
|
114
|
+
|
|
115
|
+
// Check if a selector should have a specific JavaScript property with a given value
|
|
116
|
+
Then(
|
|
117
|
+
"User expects {string} should have {string} JavaScript property with {string} value",
|
|
118
|
+
function (selector, property, value) {
|
|
119
|
+
assert.shouldHaveJSProperty(selector, property, value);
|
|
120
|
+
},
|
|
121
|
+
);
|
|
122
|
+
|
|
123
|
+
// Check if a selector should have a specific role
|
|
124
|
+
Then(
|
|
125
|
+
"User expects {string} should have {string} role",
|
|
126
|
+
function (selector, role) {
|
|
127
|
+
assert.shouldHaveRole(selector, role);
|
|
128
|
+
},
|
|
129
|
+
);
|
|
130
|
+
|
|
131
|
+
// Check if a selector should have a screenshot
|
|
132
|
+
Then("User expects {string} should have a screenshot", function (selector) {
|
|
133
|
+
assert.shouldHaveScreenshot(selector);
|
|
134
|
+
});
|
|
135
|
+
|
|
136
|
+
// Check if a selector should have specific text
|
|
137
|
+
Then(
|
|
138
|
+
"User expects {string} should match {string} text",
|
|
139
|
+
function (selector, text) {
|
|
140
|
+
assert.shouldHaveText(selector, text);
|
|
141
|
+
},
|
|
142
|
+
);
|
|
143
|
+
|
|
144
|
+
// Check if a selector should have a specific value
|
|
145
|
+
Then(
|
|
146
|
+
"User expects {string} should have {string} value",
|
|
147
|
+
function (selector, value) {
|
|
148
|
+
assert.shouldHaveValue(selector, value);
|
|
149
|
+
},
|
|
150
|
+
);
|
|
151
|
+
|
|
152
|
+
// Check if a selector should have specific values
|
|
153
|
+
Then(
|
|
154
|
+
"User expects {string} should have {string} values",
|
|
155
|
+
function (selector, values) {
|
|
156
|
+
assert.shouldHaveValues(selector, values.split(","));
|
|
157
|
+
},
|
|
158
|
+
);
|
|
159
|
+
|
|
160
|
+
// Check if the page should have a screenshot
|
|
161
|
+
Then("User expects the page should have a screenshot", function () {
|
|
162
|
+
assert.shouldPageHaveScreenshot();
|
|
163
|
+
});
|
|
164
|
+
|
|
165
|
+
// Check if the page should have a specific title
|
|
166
|
+
Then("User expects the page should have {string} title", function (title) {
|
|
167
|
+
assert.shouldPageHaveTitle(title);
|
|
168
|
+
});
|
|
169
|
+
|
|
170
|
+
// Check if the page should have a specific URL
|
|
171
|
+
Then("User expects the page url should be {string}", function (url) {
|
|
172
|
+
assert.shouldPageHaveURL(url);
|
|
173
|
+
});
|
|
174
|
+
|
|
175
|
+
Then("User is on {string} page", function (url) {
|
|
176
|
+
assert.shouldPageHaveURL(url);
|
|
177
|
+
});
|
|
178
|
+
|
|
179
|
+
// Check if the response should be OK
|
|
180
|
+
Then("The response should be OK", function (response) {
|
|
181
|
+
assert.shouldResponseBeOK(response);
|
|
182
|
+
});
|
|
183
|
+
|
|
184
|
+
// Check if a selector should not be attached
|
|
185
|
+
Then("User expects {string} should not be attached", function (selector) {
|
|
186
|
+
assert.shouldNotBeAttached(selector);
|
|
187
|
+
});
|
|
188
|
+
|
|
189
|
+
// Check if a selector should not be checked
|
|
190
|
+
Then("User expects {string} should not be checked", function (selector) {
|
|
191
|
+
assert.shouldNotBeChecked(selector);
|
|
192
|
+
});
|
|
193
|
+
|
|
194
|
+
// Check if a selector should not be disabled
|
|
195
|
+
Then("User expects {string} should not be disabled", function (selector) {
|
|
196
|
+
assert.shouldNotBeDisabled(selector);
|
|
197
|
+
});
|
|
198
|
+
|
|
199
|
+
// Check if a selector should not be editable
|
|
200
|
+
Then("User expects {string} should not be editable", function (selector) {
|
|
201
|
+
assert.shouldNotBeEditable(selector);
|
|
202
|
+
});
|
|
203
|
+
|
|
204
|
+
// Check if a selector should not be empty
|
|
205
|
+
Then("User expects {string} should not be empty", function (selector) {
|
|
206
|
+
assert.shouldNotBeEmpty(selector);
|
|
207
|
+
});
|
|
208
|
+
|
|
209
|
+
// Check if a selector should not be enabled
|
|
210
|
+
Then("User expects {string} should not be enabled", function (selector) {
|
|
211
|
+
assert.shouldNotBeEnabled(selector);
|
|
212
|
+
});
|
|
213
|
+
|
|
214
|
+
// Check if a selector should not be focused
|
|
215
|
+
Then("User expects {string} should not be focused", function (selector) {
|
|
216
|
+
assert.shouldNotBeFocused(selector);
|
|
217
|
+
});
|
|
218
|
+
|
|
219
|
+
// Check if a selector should not be hidden
|
|
220
|
+
Then("User expects {string} should not be hidden", function (selector) {
|
|
221
|
+
assert.shouldNotBeHidden(selector);
|
|
222
|
+
});
|
|
223
|
+
|
|
224
|
+
// Check if a selector should not be in the viewport
|
|
225
|
+
Then("User expects {string} should not be on screen", function (selector) {
|
|
226
|
+
assert.shouldNotBeInViewport(selector);
|
|
227
|
+
});
|
|
228
|
+
|
|
229
|
+
// Check if a selector should not be visible
|
|
230
|
+
Then("User expects {string} should not be visible", function (selector) {
|
|
231
|
+
assert.shouldNotBeVisible(selector);
|
|
232
|
+
});
|
|
233
|
+
|
|
234
|
+
// Check if a selector should not contain specific text
|
|
235
|
+
Then(
|
|
236
|
+
"User expects {string} should not have {string} text",
|
|
237
|
+
function (selector, text) {
|
|
238
|
+
assert.shouldNotContainText(selector, text);
|
|
239
|
+
},
|
|
240
|
+
);
|
|
241
|
+
|
|
242
|
+
// Check if a selector should not have an accessible description
|
|
243
|
+
Then(
|
|
244
|
+
"User expects {string} should not have {string} description",
|
|
245
|
+
function (selector, description) {
|
|
246
|
+
assert.shouldNotHaveAccessibleDescription(selector, description);
|
|
247
|
+
},
|
|
248
|
+
);
|
|
249
|
+
|
|
250
|
+
// Check if a selector should not have an accessible name
|
|
251
|
+
Then(
|
|
252
|
+
"User expects {string} should not have {string} name",
|
|
253
|
+
function (selector, name) {
|
|
254
|
+
assert.shouldNotHaveAccessibleName(selector, name);
|
|
255
|
+
},
|
|
256
|
+
);
|
|
257
|
+
|
|
258
|
+
// Check if a selector should not have a specific attribute with a given value
|
|
259
|
+
Then(
|
|
260
|
+
"User expects {string} should not have {string} attribute with {string} value",
|
|
261
|
+
function (selector, attribute, value) {
|
|
262
|
+
assert.shouldNotHaveAttribute(selector, attribute, value);
|
|
263
|
+
},
|
|
264
|
+
);
|
|
265
|
+
|
|
266
|
+
// Check if a selector should not have a specific class
|
|
267
|
+
Then(
|
|
268
|
+
"User expects {string} should not have {string} class",
|
|
269
|
+
function (selector, className) {
|
|
270
|
+
assert.shouldNotHaveClass(selector, className);
|
|
271
|
+
},
|
|
272
|
+
);
|
|
273
|
+
|
|
274
|
+
// Check if a selector should not have a specific count
|
|
275
|
+
Then(
|
|
276
|
+
"User expects count of {string} should not be {int}",
|
|
277
|
+
function (selector, count) {
|
|
278
|
+
assert.shouldNotHaveCount(selector, count);
|
|
279
|
+
},
|
|
280
|
+
);
|
|
281
|
+
|
|
282
|
+
// Check if a selector should not have a specific CSS property with a given value
|
|
283
|
+
Then(
|
|
284
|
+
"User expects {string} should not have {string} CSS property with {string} value",
|
|
285
|
+
function (selector, property, value) {
|
|
286
|
+
assert.shouldNotHaveCSS(selector, property, value);
|
|
287
|
+
},
|
|
288
|
+
);
|
|
289
|
+
|
|
290
|
+
// Check if a selector should not have a specific ID
|
|
291
|
+
Then(
|
|
292
|
+
"User expects {string} should not have {string} id",
|
|
293
|
+
function (selector, id) {
|
|
294
|
+
assert.shouldNotHaveId(selector, id);
|
|
295
|
+
},
|
|
296
|
+
);
|
|
297
|
+
|
|
298
|
+
// Check if a selector should not have a specific JavaScript property with a given value
|
|
299
|
+
Then(
|
|
300
|
+
"User expects {string} should not have {string} JavaScript property with {string} value",
|
|
301
|
+
function (selector, property, value) {
|
|
302
|
+
assert.shouldNotHaveJSProperty(selector, property, value);
|
|
303
|
+
},
|
|
304
|
+
);
|
|
305
|
+
|
|
306
|
+
// Check if a selector should not have a specific role
|
|
307
|
+
Then(
|
|
308
|
+
"User expects {string} should not have {string} role",
|
|
309
|
+
function (selector, role) {
|
|
310
|
+
assert.shouldNotHaveRole(selector, role);
|
|
311
|
+
},
|
|
312
|
+
);
|
|
313
|
+
|
|
314
|
+
// Check if a selector should not have specific text
|
|
315
|
+
Then(
|
|
316
|
+
"User expects {string} should not match {string} text",
|
|
317
|
+
function (selector, text) {
|
|
318
|
+
assert.shouldNotHaveText(selector, text);
|
|
319
|
+
},
|
|
320
|
+
);
|
|
321
|
+
|
|
322
|
+
// Check if a selector should not have a specific value
|
|
323
|
+
Then(
|
|
324
|
+
"User expects {string} should not have {string} value",
|
|
325
|
+
function (selector, value) {
|
|
326
|
+
assert.shouldNotHaveValue(selector, value);
|
|
327
|
+
},
|
|
328
|
+
);
|
|
329
|
+
|
|
330
|
+
// Check if a selector should not have specific values
|
|
331
|
+
Then(
|
|
332
|
+
"User expects {string} should not have {string} values",
|
|
333
|
+
function (selector, values) {
|
|
334
|
+
assert.shouldNotHaveValues(selector, values.split(","));
|
|
335
|
+
},
|
|
336
|
+
);
|
|
337
|
+
|
|
338
|
+
// Check if the page should not have a screenshot
|
|
339
|
+
Then("User expects the page should not have a screenshot", function () {
|
|
340
|
+
assert.shouldNotPageHaveScreenshot();
|
|
341
|
+
});
|
|
342
|
+
|
|
343
|
+
// Check if the page should not have a specific title
|
|
344
|
+
Then("User expects the page should not have {string} title", function (title) {
|
|
345
|
+
assert.shouldNotPageHaveTitle(title);
|
|
346
|
+
});
|
|
347
|
+
|
|
348
|
+
// Check if the page should not have a specific URL
|
|
349
|
+
Then("User expects the page url should not be {string}", function (url) {
|
|
350
|
+
assert.shouldNotPageHaveURL(url);
|
|
351
|
+
});
|
|
352
|
+
|
|
353
|
+
Then("User is not on {string} page", function (url) {
|
|
354
|
+
assert.shouldNotPageHaveURL(url);
|
|
355
|
+
});
|
|
356
|
+
|
|
357
|
+
// Check if a response should not be OK
|
|
358
|
+
Then("The response should not be OK", function (response) {
|
|
359
|
+
assert.shouldNotResponseBeOK(response);
|
|
360
|
+
});
|
|
361
|
+
|
|
362
|
+
// Check if a selector's value should be equal to the expected value
|
|
363
|
+
Then(
|
|
364
|
+
"User expects {string} should be {string} text",
|
|
365
|
+
function (selector, expected) {
|
|
366
|
+
assert.shouldBe(selector, expected);
|
|
367
|
+
},
|
|
368
|
+
);
|
|
369
|
+
|
|
370
|
+
// Check if a selector's value should be close to the expected value within a precision
|
|
371
|
+
Then(
|
|
372
|
+
"User expects {string} should be close to {float} with precision {int}",
|
|
373
|
+
function (selector, expected, precision) {
|
|
374
|
+
assert.shouldBeCloseTo(selector, expected, precision);
|
|
375
|
+
},
|
|
376
|
+
);
|
|
377
|
+
|
|
378
|
+
// Check if a selector's value should be defined
|
|
379
|
+
Then("User expects {string} should be defined", function (selector) {
|
|
380
|
+
assert.shouldBeDefined(selector);
|
|
381
|
+
});
|
|
382
|
+
|
|
383
|
+
// Check if a selector's text content should be falsy
|
|
384
|
+
Then("User expects {string} should be falsy", function (selector) {
|
|
385
|
+
assert.shouldBeFalsy(selector);
|
|
386
|
+
});
|
|
387
|
+
|
|
388
|
+
// Check if a selector's value should be greater than the expected value
|
|
389
|
+
Then(
|
|
390
|
+
"User expects {string} should be greater than {float}",
|
|
391
|
+
function (selector, expected) {
|
|
392
|
+
assert.shouldBeGreaterThan(selector, expected);
|
|
393
|
+
},
|
|
394
|
+
);
|
|
395
|
+
|
|
396
|
+
// Check if a selector's value should be greater than or equal to the expected value
|
|
397
|
+
Then(
|
|
398
|
+
"User expects {string} should be greater than or equal to {float}",
|
|
399
|
+
function (selector, expected) {
|
|
400
|
+
assert.shouldBeGreaterThanOrEqual(selector, expected);
|
|
401
|
+
},
|
|
402
|
+
);
|
|
403
|
+
|
|
404
|
+
// Check if a selector's value should be an instance of a specific constructor
|
|
405
|
+
Then(
|
|
406
|
+
"User expects {string} should be an instance of {string}",
|
|
407
|
+
function (selector, constructor) {
|
|
408
|
+
assert.shouldBeInstanceOf(selector, constructor);
|
|
409
|
+
},
|
|
410
|
+
);
|
|
411
|
+
|
|
412
|
+
// Check if a selector's value should be less than the expected value
|
|
413
|
+
Then(
|
|
414
|
+
"User expects {string} should be less than {float}",
|
|
415
|
+
function (selector, expected) {
|
|
416
|
+
assert.shouldBeLessThan(selector, expected);
|
|
417
|
+
},
|
|
418
|
+
);
|
|
419
|
+
|
|
420
|
+
// Check if a selector's value should be less than or equal to the expected value
|
|
421
|
+
Then(
|
|
422
|
+
"User expects {string} should be less than or equal to {float}",
|
|
423
|
+
function (selector, expected) {
|
|
424
|
+
assert.shouldBeLessThanOrEqual(selector, expected);
|
|
425
|
+
},
|
|
426
|
+
);
|
|
427
|
+
|
|
428
|
+
// Check if a selector's value should be NaN
|
|
429
|
+
Then("User expects {string} should be NaN", function (selector) {
|
|
430
|
+
assert.shouldBeNaN(selector);
|
|
431
|
+
});
|
|
432
|
+
|
|
433
|
+
// Check if a selector's value should be null
|
|
434
|
+
Then("User expects {string} should be null", function (selector) {
|
|
435
|
+
assert.shouldBeNull(selector);
|
|
436
|
+
});
|
|
437
|
+
|
|
438
|
+
// Check if a selector's value should be truthy
|
|
439
|
+
Then("User expects {string} should be truthy", function (selector) {
|
|
440
|
+
assert.shouldBeTruthy(selector);
|
|
441
|
+
});
|
|
442
|
+
|
|
443
|
+
// Check if a selector's value should be undefined
|
|
444
|
+
Then("User expects {string} should be undefined", function (selector) {
|
|
445
|
+
assert.shouldBeUndefined(selector);
|
|
446
|
+
});
|
|
447
|
+
|
|
448
|
+
// Check if a selector's value should contain a specific substring
|
|
449
|
+
Then(
|
|
450
|
+
"User expects {string} should have {string} substring",
|
|
451
|
+
function (selector, substring) {
|
|
452
|
+
assert.shouldContain(selector, substring);
|
|
453
|
+
},
|
|
454
|
+
);
|
|
455
|
+
|
|
456
|
+
// Check if a selector's value should contain an equal value
|
|
457
|
+
Then(
|
|
458
|
+
"User expects {string} should contain equal {string}",
|
|
459
|
+
function (selector, expected) {
|
|
460
|
+
assert.shouldContainEqual(selector, expected);
|
|
461
|
+
},
|
|
462
|
+
);
|
|
463
|
+
|
|
464
|
+
// Check if a selector's value should equal the expected value
|
|
465
|
+
Then("User expects {string} should equal {int}", function (selector, expected) {
|
|
466
|
+
assert.shouldEqual(selector, expected);
|
|
467
|
+
});
|
|
468
|
+
|
|
469
|
+
// Check if a selector's text content should have a specific length
|
|
470
|
+
Then(
|
|
471
|
+
"User expects length of {string} should be {int}",
|
|
472
|
+
function (selector, length) {
|
|
473
|
+
assert.shouldHaveLength(selector, length);
|
|
474
|
+
},
|
|
475
|
+
);
|
|
476
|
+
|
|
477
|
+
// Check if a selector's text content should have a specific property
|
|
478
|
+
Then(
|
|
479
|
+
"User expects {string} should have {string} property",
|
|
480
|
+
function (selector, property) {
|
|
481
|
+
assert.shouldHaveProperty(selector, property);
|
|
482
|
+
},
|
|
483
|
+
);
|
|
484
|
+
|
|
485
|
+
// Check if a selector's text content should match a specific regex
|
|
486
|
+
Then(
|
|
487
|
+
"User expects {string} should match {string} regex",
|
|
488
|
+
function (selector, regex) {
|
|
489
|
+
assert.shouldMatch(selector, new RegExp(regex));
|
|
490
|
+
},
|
|
491
|
+
);
|
|
492
|
+
|
|
493
|
+
// Check if a selector's text content should match a specific object
|
|
494
|
+
Then(
|
|
495
|
+
"User expects {string} should match {string} object",
|
|
496
|
+
function (selector, object) {
|
|
497
|
+
assert.shouldMatchObject(selector, JSON.parse(object));
|
|
498
|
+
},
|
|
499
|
+
);
|
|
500
|
+
|
|
501
|
+
// Check if a selector's text content should strictly equal the expected value
|
|
502
|
+
Then(
|
|
503
|
+
"User expects {string} should strictly equal {string}",
|
|
504
|
+
function (selector, expected) {
|
|
505
|
+
assert.shouldStrictEqual(selector, expected);
|
|
506
|
+
},
|
|
507
|
+
);
|
|
508
|
+
|
|
509
|
+
// Check if a function should throw an error
|
|
510
|
+
Then("The function should throw", function (fn) {
|
|
511
|
+
assert.shouldThrow(fn);
|
|
512
|
+
});
|
|
513
|
+
|
|
514
|
+
// Check if the text content of a selector should be an instance of a specific constructor
|
|
515
|
+
Then(
|
|
516
|
+
"User expects {string} should be any instance of {string}",
|
|
517
|
+
function (selector, constructor) {
|
|
518
|
+
assert.shouldAny(selector, constructor);
|
|
519
|
+
},
|
|
520
|
+
);
|
|
521
|
+
|
|
522
|
+
// Check if the text content of a selector may be anything (truthy)
|
|
523
|
+
Then("User expects {string} may be anything", function (selector) {
|
|
524
|
+
assert.shouldAnything(selector);
|
|
525
|
+
});
|
|
526
|
+
|
|
527
|
+
// Check if the text content of a selector should contain any of the specified elements in an array
|
|
528
|
+
Then(
|
|
529
|
+
"User expects {string} should contain {string} array elements",
|
|
530
|
+
function (selector, elements) {
|
|
531
|
+
const parsedElements = elements.split(",");
|
|
532
|
+
assert.shouldArrayContaining(selector, parsedElements);
|
|
533
|
+
},
|
|
534
|
+
);
|
|
535
|
+
|
|
536
|
+
// Check if the text content of a selector should be close to the expected value within a precision
|
|
537
|
+
Then(
|
|
538
|
+
"User expects {string} should be close to {float} with precision {int}",
|
|
539
|
+
function (selector, expected, precision) {
|
|
540
|
+
assert.shouldCloseTo(selector, expected, precision);
|
|
541
|
+
},
|
|
542
|
+
);
|
|
543
|
+
|
|
544
|
+
// Check if the text content of a selector should contain the specified properties in an object
|
|
545
|
+
Then(
|
|
546
|
+
"User expects {string} should contain {string} object properties",
|
|
547
|
+
function (selector, properties) {
|
|
548
|
+
const parsedProperties = properties.split(",");
|
|
549
|
+
assert.shouldObjectContaining(selector, parsedProperties);
|
|
550
|
+
},
|
|
551
|
+
);
|
|
552
|
+
|
|
553
|
+
// Check if the text content of a selector should contain a specific substring
|
|
554
|
+
Then(
|
|
555
|
+
"User expects {string} should have {string} substring",
|
|
556
|
+
function (selector, substring) {
|
|
557
|
+
assert.shouldStringContaining(selector, substring);
|
|
558
|
+
},
|
|
559
|
+
);
|
|
560
|
+
|
|
561
|
+
// Check if the text content of a selector should match a specific regex
|
|
562
|
+
Then(
|
|
563
|
+
"User expects {string} should match {string} regex",
|
|
564
|
+
function (selector, regex) {
|
|
565
|
+
assert.shouldStringMatching(selector, new RegExp(regex));
|
|
566
|
+
},
|
|
567
|
+
);
|
|
568
|
+
|
|
569
|
+
// Check if a selector's text content should not be equal to the expected value
|
|
570
|
+
Then(
|
|
571
|
+
"User expects {string} should not have {string} text",
|
|
572
|
+
function (selector, expected) {
|
|
573
|
+
assert.shouldNotBe(selector, expected);
|
|
574
|
+
},
|
|
575
|
+
);
|
|
576
|
+
|
|
577
|
+
// Check if a selector's text content should not be close to the expected value within a precision
|
|
578
|
+
Then(
|
|
579
|
+
"User expects {string} should not be close to {float} with precision {int}",
|
|
580
|
+
function (selector, expected, precision) {
|
|
581
|
+
assert.shouldNotBeCloseTo(selector, expected, precision);
|
|
582
|
+
},
|
|
583
|
+
);
|
|
584
|
+
|
|
585
|
+
// Check if a selector's text content should not be defined
|
|
586
|
+
Then("User expects {string} should not be defined", function (selector) {
|
|
587
|
+
assert.shouldNotBeDefined(selector);
|
|
588
|
+
});
|
|
589
|
+
|
|
590
|
+
// Check if a selector's text content should not be falsy
|
|
591
|
+
Then("User expects {string} should not be falsy", function (selector) {
|
|
592
|
+
assert.shouldNotBeFalsy(selector);
|
|
593
|
+
});
|
|
594
|
+
|
|
595
|
+
// Check if a selector's text content should not be greater than the expected value
|
|
596
|
+
Then(
|
|
597
|
+
"User expects {string} should not be greater than {float}",
|
|
598
|
+
function (selector, expected) {
|
|
599
|
+
assert.shouldNotBeGreaterThan(selector, expected);
|
|
600
|
+
},
|
|
601
|
+
);
|
|
602
|
+
|
|
603
|
+
// Check if a selector's text content should not be greater than or equal to the expected value
|
|
604
|
+
Then(
|
|
605
|
+
"User expects {string} should not be greater than or equal to {float}",
|
|
606
|
+
function (selector, expected) {
|
|
607
|
+
assert.shouldNotBeGreaterThanOrEqual(selector, expected);
|
|
608
|
+
},
|
|
609
|
+
);
|
|
610
|
+
|
|
611
|
+
// Check if a selector's text content should not be an instance of a specific constructor
|
|
612
|
+
Then(
|
|
613
|
+
"User expects {string} should not be an instance of {string}",
|
|
614
|
+
function (selector, constructor) {
|
|
615
|
+
assert.shouldNotBeInstanceOf(selector, constructor);
|
|
616
|
+
},
|
|
617
|
+
);
|
|
618
|
+
|
|
619
|
+
// Check if a selector's text content should not be less than the expected value
|
|
620
|
+
Then(
|
|
621
|
+
"User expects {string} should not be less than {float}",
|
|
622
|
+
function (selector, expected) {
|
|
623
|
+
assert.shouldNotBeLessThan(selector, expected);
|
|
624
|
+
},
|
|
625
|
+
);
|
|
626
|
+
|
|
627
|
+
// Check if a selector's text content should not be less than or equal to the expected value
|
|
628
|
+
Then(
|
|
629
|
+
"User expects {string} should not be less than or equal to {float}",
|
|
630
|
+
function (selector, expected) {
|
|
631
|
+
assert.shouldNotBeLessThanOrEqual(selector, expected);
|
|
632
|
+
},
|
|
633
|
+
);
|
|
634
|
+
|
|
635
|
+
// Check if a selector's text content should not be NaN
|
|
636
|
+
Then("User expects {string} should not be NaN", function (selector) {
|
|
637
|
+
assert.shouldNotBeNaN(selector);
|
|
638
|
+
});
|
|
639
|
+
|
|
640
|
+
// Check if a selector's text content should not be null
|
|
641
|
+
Then("User expects {string} should not be null", function (selector) {
|
|
642
|
+
assert.shouldNotBeNull(selector);
|
|
643
|
+
});
|
|
644
|
+
|
|
645
|
+
// Check if a selector's text content should not be truthy
|
|
646
|
+
Then("User expects {string} should not be truthy", function (selector) {
|
|
647
|
+
assert.shouldNotBeTruthy(selector);
|
|
648
|
+
});
|
|
649
|
+
|
|
650
|
+
// Check if a selector's text content should not be undefined
|
|
651
|
+
Then("User expects {string} should not be undefined", function (selector) {
|
|
652
|
+
assert.shouldNotBeUndefined(selector);
|
|
653
|
+
});
|
|
654
|
+
|
|
655
|
+
// Check if a selector's text content should not contain a specific substring
|
|
656
|
+
Then(
|
|
657
|
+
"User expects {string} should not have {string} substring",
|
|
658
|
+
function (selector, substring) {
|
|
659
|
+
assert.shouldNotContain(selector, substring);
|
|
660
|
+
},
|
|
661
|
+
);
|
|
662
|
+
|
|
663
|
+
// Check if a selector's text content should not contain an equal value
|
|
664
|
+
Then(
|
|
665
|
+
"User expects {string} should not contain equal {string}",
|
|
666
|
+
function (selector, expected) {
|
|
667
|
+
assert.shouldNotContainEqual(selector, expected);
|
|
668
|
+
},
|
|
669
|
+
);
|
|
670
|
+
|
|
671
|
+
// Check if a selector's text content should not equal the expected value
|
|
672
|
+
Then(
|
|
673
|
+
"User expects {string} should not equal {string}",
|
|
674
|
+
function (selector, expected) {
|
|
675
|
+
assert.shouldNotEqual(selector, expected);
|
|
676
|
+
},
|
|
677
|
+
);
|
|
678
|
+
|
|
679
|
+
// Check if a selector's text content should not have a specific length
|
|
680
|
+
Then(
|
|
681
|
+
"User expects length of {string} should not be {int} ",
|
|
682
|
+
function (selector, length) {
|
|
683
|
+
assert.shouldNotHaveLength(selector, length);
|
|
684
|
+
},
|
|
685
|
+
);
|
|
686
|
+
|
|
687
|
+
// Check if a selector's text content should not have a specific property
|
|
688
|
+
Then(
|
|
689
|
+
"User expects {string} should not have {string} property",
|
|
690
|
+
function (selector, property) {
|
|
691
|
+
assert.shouldNotHaveProperty(selector, property);
|
|
692
|
+
},
|
|
693
|
+
);
|
|
694
|
+
|
|
695
|
+
// Check if a selector's text content should not match a specific regex
|
|
696
|
+
Then(
|
|
697
|
+
"User expects {string} should not match {string} regex",
|
|
698
|
+
function (selector, regex) {
|
|
699
|
+
assert.shouldNotMatch(selector, new RegExp(regex));
|
|
700
|
+
},
|
|
701
|
+
);
|
|
702
|
+
|
|
703
|
+
// Check if a selector's text content should not match a specific object
|
|
704
|
+
Then(
|
|
705
|
+
"User expects {string} should not match {string} object",
|
|
706
|
+
function (selector, object) {
|
|
707
|
+
assert.shouldNotMatchObject(selector, JSON.parse(object));
|
|
708
|
+
},
|
|
709
|
+
);
|
|
710
|
+
|
|
711
|
+
// Check if a function should not throw an error
|
|
712
|
+
Then("The function should not throw", function (fn) {
|
|
713
|
+
assert.shouldNotThrow(fn);
|
|
714
|
+
});
|
|
715
|
+
|
|
716
|
+
// Check if a selector's text content should not be any instance of a specific constructor
|
|
717
|
+
Then(
|
|
718
|
+
"User expects {string} should not be any instance of {string}",
|
|
719
|
+
function (selector, constructor) {
|
|
720
|
+
assert.shouldNotAny(selector, constructor);
|
|
721
|
+
},
|
|
722
|
+
);
|
|
723
|
+
|
|
724
|
+
// Check if a selector's text content may not be anything (falsy)
|
|
725
|
+
Then("User expects {string} may not be anything", function (selector) {
|
|
726
|
+
assert.shouldNotAnything(selector);
|
|
727
|
+
});
|
|
728
|
+
|
|
729
|
+
// Check if a selector's text content should not contain any of the specified elements in an array
|
|
730
|
+
Then(
|
|
731
|
+
"User expects {string} should not contain {string} array elements",
|
|
732
|
+
function (selector, elements) {
|
|
733
|
+
const parsedElements = elements.split(",");
|
|
734
|
+
assert.shouldNotArrayContaining(selector, parsedElements);
|
|
735
|
+
},
|
|
736
|
+
);
|
|
737
|
+
|
|
738
|
+
// Check if a selector's text content should not be close to the expected value within a precision
|
|
739
|
+
Then(
|
|
740
|
+
"User expects {string} should not be close to {float} with precision {int}",
|
|
741
|
+
function (selector, expected, precision) {
|
|
742
|
+
assert.shouldNotCloseTo(selector, expected, precision);
|
|
743
|
+
},
|
|
744
|
+
);
|
|
745
|
+
|
|
746
|
+
// Check if a selector's text content should not contain the specified properties in an object
|
|
747
|
+
Then(
|
|
748
|
+
"User expects {string} should not contain {string} object properties",
|
|
749
|
+
function (selector, properties) {
|
|
750
|
+
const parsedProperties = JSON.parse(properties);
|
|
751
|
+
assert.shouldNotObjectContaining(selector, parsedProperties);
|
|
752
|
+
},
|
|
753
|
+
);
|
|
754
|
+
|
|
755
|
+
// Check if a selector's text content should not contain a specific substring
|
|
756
|
+
Then(
|
|
757
|
+
"User expects {string} should not contain {string} substring",
|
|
758
|
+
function (selector, substring) {
|
|
759
|
+
assert.shouldNotStringContaining(selector, substring);
|
|
760
|
+
},
|
|
761
|
+
);
|
|
762
|
+
|
|
763
|
+
// Check if a selector's text content should not match a specific regex
|
|
764
|
+
Then(
|
|
765
|
+
"User expects {string} should not match {string} regex",
|
|
766
|
+
function (selector, regex) {
|
|
767
|
+
assert.shouldNotStringMatching(selector, new RegExp(regex));
|
|
768
|
+
},
|
|
769
|
+
);
|