@camperaid/watest 2.3.1 → 2.3.5
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/core/series.js +26 -8
- package/package.json +2 -2
- package/tests/e2e/samples/folder/node_modules/.package-lock.json +1 -2
- package/tests/e2e/samples/folder/package-lock.json +1 -2
- package/tests/e2e/samples/loader/node_modules/.package-lock.json +1 -2
- package/tests/e2e/samples/loader/package-lock.json +1 -2
- package/tests/e2e/samples/loader_mixed/node_modules/.package-lock.json +1 -2
- package/tests/e2e/samples/loader_mixed/package-lock.json +1 -2
- package/tests/e2e/samples/loader_multiple/node_modules/.package-lock.json +1 -2
- package/tests/e2e/samples/loader_multiple/package-lock.json +1 -2
- package/tests/e2e/samples/single/node_modules/.package-lock.json +1 -2
- package/tests/e2e/samples/single/package-lock.json +1 -2
- package/tests/e2e/samples/wd_mixed/node_modules/.package-lock.json +1 -2
- package/tests/e2e/samples/wd_mixed/package-lock.json +1 -2
- package/tests/e2e/samples/wd_single/node_modules/.package-lock.json +1 -2
- package/tests/e2e/samples/wd_single/package-lock.json +1 -2
- package/tests/series/build/t_expected_failures.js +111 -0
- package/tests/series/perform/t_intermittent_global.js +80 -0
- package/webdriver/driver.js +36 -6
package/core/series.js
CHANGED
|
@@ -185,7 +185,13 @@ class Series {
|
|
|
185
185
|
/**
|
|
186
186
|
* Returns tests as an array of { name, func, ... } objects.
|
|
187
187
|
*/
|
|
188
|
-
async build({
|
|
188
|
+
async build({
|
|
189
|
+
patterns,
|
|
190
|
+
folder,
|
|
191
|
+
virtual_folder,
|
|
192
|
+
webdriver = '',
|
|
193
|
+
inherited_expected_failures = [],
|
|
194
|
+
}) {
|
|
189
195
|
let tests = [];
|
|
190
196
|
try {
|
|
191
197
|
let test_module = await this.loadTestMeta(folder);
|
|
@@ -195,6 +201,12 @@ class Series {
|
|
|
195
201
|
throw new Error(`No tests found in ${folder}`);
|
|
196
202
|
}
|
|
197
203
|
|
|
204
|
+
if (test_module.expected_failures) {
|
|
205
|
+
inherited_expected_failures = inherited_expected_failures.concat(
|
|
206
|
+
test_module.expected_failures.filter(v => v[0] == '**')
|
|
207
|
+
);
|
|
208
|
+
}
|
|
209
|
+
|
|
198
210
|
if (
|
|
199
211
|
!this.childProcess &&
|
|
200
212
|
!this.suppressChildProcessInitiation &&
|
|
@@ -227,7 +239,9 @@ class Series {
|
|
|
227
239
|
virtual_folder,
|
|
228
240
|
subfolders,
|
|
229
241
|
webdriver,
|
|
242
|
+
inherited_expected_failures,
|
|
230
243
|
}),
|
|
244
|
+
inherited_expected_failures,
|
|
231
245
|
});
|
|
232
246
|
}
|
|
233
247
|
|
|
@@ -271,7 +285,9 @@ class Series {
|
|
|
271
285
|
virtual_folder: wd_virtual_folder,
|
|
272
286
|
subfolders,
|
|
273
287
|
webdriver,
|
|
288
|
+
inherited_expected_failures,
|
|
274
289
|
}),
|
|
290
|
+
inherited_expected_failures,
|
|
275
291
|
});
|
|
276
292
|
if (wdtests.length > 0) {
|
|
277
293
|
tests.push({
|
|
@@ -342,6 +358,7 @@ class Series {
|
|
|
342
358
|
virtual_folder,
|
|
343
359
|
subfolders,
|
|
344
360
|
webdriver,
|
|
361
|
+
inherited_expected_failures,
|
|
345
362
|
}) {
|
|
346
363
|
if (!subfolders) {
|
|
347
364
|
return [];
|
|
@@ -354,6 +371,7 @@ class Series {
|
|
|
354
371
|
folder: `${folder}/${subfolder}`,
|
|
355
372
|
virtual_folder: `${virtual_folder}/${subfolder}`,
|
|
356
373
|
webdriver,
|
|
374
|
+
inherited_expected_failures,
|
|
357
375
|
}).then(subtests => ({
|
|
358
376
|
subfolder,
|
|
359
377
|
subtests,
|
|
@@ -385,6 +403,7 @@ class Series {
|
|
|
385
403
|
patterns,
|
|
386
404
|
webdriver,
|
|
387
405
|
subtests,
|
|
406
|
+
inherited_expected_failures,
|
|
388
407
|
}) {
|
|
389
408
|
const { include_list, exclude_list } = test_module;
|
|
390
409
|
let list = this.buildList({
|
|
@@ -402,7 +421,9 @@ class Series {
|
|
|
402
421
|
return tests;
|
|
403
422
|
}
|
|
404
423
|
|
|
405
|
-
const expected_failures =
|
|
424
|
+
const expected_failures = inherited_expected_failures.concat(
|
|
425
|
+
test_module.expected_failures || []
|
|
426
|
+
);
|
|
406
427
|
|
|
407
428
|
// Initialize
|
|
408
429
|
if (test_module.services || test_module.init) {
|
|
@@ -591,9 +612,7 @@ class Series {
|
|
|
591
612
|
} = test;
|
|
592
613
|
|
|
593
614
|
if (stop && !name.endsWith('uninit')) {
|
|
594
|
-
log(
|
|
595
|
-
`\x1b[31m!Skipped:\x1b[0m ${name}, because of previous failures\n`
|
|
596
|
-
);
|
|
615
|
+
log(`\x1b[31m!Skipped:\x1b[0m ${name}, because of previous failures\n`);
|
|
597
616
|
continue;
|
|
598
617
|
}
|
|
599
618
|
|
|
@@ -782,7 +801,7 @@ class Series {
|
|
|
782
801
|
|
|
783
802
|
static failuresInfo({ failures, webdriver, platform, testname }) {
|
|
784
803
|
let filtered_failures = failures.filter(
|
|
785
|
-
v => testname.includes(v[0]) || v[0] == '*'
|
|
804
|
+
v => testname.includes(v[0]) || v[0] == '*' || v[0] == '**'
|
|
786
805
|
);
|
|
787
806
|
|
|
788
807
|
return (
|
|
@@ -882,8 +901,7 @@ class Series {
|
|
|
882
901
|
continue;
|
|
883
902
|
}
|
|
884
903
|
|
|
885
|
-
let log_func = msg =>
|
|
886
|
-
is_stdout ? log(msg) : log_error(msg);
|
|
904
|
+
let log_func = msg => (is_stdout ? log(msg) : log_error(msg));
|
|
887
905
|
|
|
888
906
|
if (line.startsWith('console.debug')) {
|
|
889
907
|
line = line.replace(
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@camperaid/watest",
|
|
3
|
-
"version": "2.3.
|
|
3
|
+
"version": "2.3.5",
|
|
4
4
|
"description": "Web Application Testsuite",
|
|
5
5
|
"engines": {
|
|
6
6
|
"node": ">=14.15.1"
|
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
"watest": "./bin/watest.js"
|
|
12
12
|
},
|
|
13
13
|
"scripts": {
|
|
14
|
-
"
|
|
14
|
+
"prepare": "bash tests/install.sh",
|
|
15
15
|
"lint": "eslint '**/*.js'",
|
|
16
16
|
"lint:staged": "eslint --",
|
|
17
17
|
"pretty": "prettier --write",
|
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
const { is, MockSeries } = require('../test.js');
|
|
4
|
+
|
|
5
|
+
module.exports.test = async () => {
|
|
6
|
+
const test = got => got.name == 'test_wrap';
|
|
7
|
+
const failures_info = [
|
|
8
|
+
{
|
|
9
|
+
type: 'intermittent',
|
|
10
|
+
group: '*',
|
|
11
|
+
list: ['Server terminates connection'],
|
|
12
|
+
msg: 'Server terminates connection 421 error',
|
|
13
|
+
},
|
|
14
|
+
];
|
|
15
|
+
const ts = {
|
|
16
|
+
'unit': {
|
|
17
|
+
meta: {
|
|
18
|
+
folders: ['base', 'core'],
|
|
19
|
+
expected_failures: [
|
|
20
|
+
[
|
|
21
|
+
'**',
|
|
22
|
+
[
|
|
23
|
+
[
|
|
24
|
+
'all',
|
|
25
|
+
'intermittent',
|
|
26
|
+
'*',
|
|
27
|
+
[`Server terminates connection`],
|
|
28
|
+
`Server terminates connection 421 error`,
|
|
29
|
+
],
|
|
30
|
+
],
|
|
31
|
+
],
|
|
32
|
+
],
|
|
33
|
+
},
|
|
34
|
+
},
|
|
35
|
+
'unit/base': {
|
|
36
|
+
meta: {
|
|
37
|
+
folders: ['generic'],
|
|
38
|
+
},
|
|
39
|
+
files: ['t_testo.js'],
|
|
40
|
+
},
|
|
41
|
+
'unit/base/t_testo.js': {
|
|
42
|
+
test() {},
|
|
43
|
+
},
|
|
44
|
+
'unit/base/generic': {
|
|
45
|
+
files: ['t_nahimov.js'],
|
|
46
|
+
},
|
|
47
|
+
'unit/base/generic/t_nahimov.js': {
|
|
48
|
+
test() {},
|
|
49
|
+
},
|
|
50
|
+
'unit/core': {
|
|
51
|
+
files: ['t_presto.js'],
|
|
52
|
+
},
|
|
53
|
+
'unit/core/t_presto.js': {
|
|
54
|
+
test() {},
|
|
55
|
+
},
|
|
56
|
+
};
|
|
57
|
+
|
|
58
|
+
const series = new MockSeries('', { ts });
|
|
59
|
+
const tests = await series.build({
|
|
60
|
+
patterns: [],
|
|
61
|
+
folder: 'unit',
|
|
62
|
+
virtual_folder: 'unit',
|
|
63
|
+
});
|
|
64
|
+
series.shutdown();
|
|
65
|
+
|
|
66
|
+
is(
|
|
67
|
+
tests,
|
|
68
|
+
[
|
|
69
|
+
{
|
|
70
|
+
name: 'unit/base',
|
|
71
|
+
path: 'unit/base/',
|
|
72
|
+
subtests: [
|
|
73
|
+
{
|
|
74
|
+
name: 'unit/base/t_testo.js',
|
|
75
|
+
path: 'unit/base/t_testo.js',
|
|
76
|
+
func: test,
|
|
77
|
+
failures_info,
|
|
78
|
+
webdriver: '',
|
|
79
|
+
},
|
|
80
|
+
{
|
|
81
|
+
name: 'unit/base/generic',
|
|
82
|
+
path: 'unit/base/generic/',
|
|
83
|
+
subtests: [
|
|
84
|
+
{
|
|
85
|
+
name: 'unit/base/generic/t_nahimov.js',
|
|
86
|
+
path: 'unit/base/generic/t_nahimov.js',
|
|
87
|
+
func: test,
|
|
88
|
+
failures_info,
|
|
89
|
+
webdriver: '',
|
|
90
|
+
},
|
|
91
|
+
],
|
|
92
|
+
},
|
|
93
|
+
],
|
|
94
|
+
},
|
|
95
|
+
{
|
|
96
|
+
name: 'unit/core',
|
|
97
|
+
path: 'unit/core/',
|
|
98
|
+
subtests: [
|
|
99
|
+
{
|
|
100
|
+
name: 'unit/core/t_presto.js',
|
|
101
|
+
path: 'unit/core/t_presto.js',
|
|
102
|
+
func: test,
|
|
103
|
+
failures_info,
|
|
104
|
+
webdriver: '',
|
|
105
|
+
},
|
|
106
|
+
],
|
|
107
|
+
},
|
|
108
|
+
],
|
|
109
|
+
'build'
|
|
110
|
+
);
|
|
111
|
+
};
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
const { is_test_output, make_perform_function, fail } = require('../test.js');
|
|
4
|
+
|
|
5
|
+
module.exports.test = async () => {
|
|
6
|
+
let failures = [
|
|
7
|
+
[
|
|
8
|
+
'**',
|
|
9
|
+
[
|
|
10
|
+
[
|
|
11
|
+
'all',
|
|
12
|
+
'intermittent',
|
|
13
|
+
'*',
|
|
14
|
+
[`Server terminates connection`],
|
|
15
|
+
`Server terminates connection 421 error`,
|
|
16
|
+
],
|
|
17
|
+
],
|
|
18
|
+
],
|
|
19
|
+
];
|
|
20
|
+
|
|
21
|
+
await is_test_output(
|
|
22
|
+
make_perform_function([
|
|
23
|
+
{
|
|
24
|
+
name: 'unit',
|
|
25
|
+
subtests: [
|
|
26
|
+
{
|
|
27
|
+
name: 'unit/base',
|
|
28
|
+
subtests: [
|
|
29
|
+
{
|
|
30
|
+
name: 't_testo.js',
|
|
31
|
+
path: 't_testo.js',
|
|
32
|
+
failures,
|
|
33
|
+
func() {
|
|
34
|
+
fail('Server terminates connection');
|
|
35
|
+
},
|
|
36
|
+
},
|
|
37
|
+
],
|
|
38
|
+
},
|
|
39
|
+
{
|
|
40
|
+
name: 'unit/core',
|
|
41
|
+
subtests: [
|
|
42
|
+
{
|
|
43
|
+
name: 't_pesto.js',
|
|
44
|
+
path: 't_pesto.js',
|
|
45
|
+
failures,
|
|
46
|
+
func() {
|
|
47
|
+
fail('Server terminates connection');
|
|
48
|
+
},
|
|
49
|
+
},
|
|
50
|
+
],
|
|
51
|
+
},
|
|
52
|
+
],
|
|
53
|
+
},
|
|
54
|
+
]),
|
|
55
|
+
[
|
|
56
|
+
'\x1B[38;5;99mStarted\x1B[0m tests/',
|
|
57
|
+
'\x1B[38;5;99mStarted\x1B[0m unit',
|
|
58
|
+
'\x1B[38;5;99mStarted\x1B[0m unit/base',
|
|
59
|
+
'!Running: t_testo.js, path: t_testo.js',
|
|
60
|
+
'\x1B[33mWarning:\x1B[0m Server terminates connection',
|
|
61
|
+
'\x1B[35mIntermittent:\x1B[0m Server terminates connection 421 error',
|
|
62
|
+
'>t_testo.js has 1 intermittent(s)',
|
|
63
|
+
'>t_testo.js has 1 warnings(s)',
|
|
64
|
+
'>t_testo.js completed in',
|
|
65
|
+
'\x1B[38;5;243mCompleted\x1B[0m unit/base',
|
|
66
|
+
'\x1B[38;5;99mStarted\x1B[0m unit/core',
|
|
67
|
+
'!Running: t_pesto.js, path: t_pesto.js',
|
|
68
|
+
'\x1B[33mWarning:\x1B[0m Server terminates connection',
|
|
69
|
+
'\x1B[35mIntermittent:\x1B[0m Server terminates connection 421 error',
|
|
70
|
+
'>t_pesto.js has 1 intermittent(s)',
|
|
71
|
+
'>t_pesto.js has 1 warnings(s)',
|
|
72
|
+
'>t_pesto.js completed in',
|
|
73
|
+
'\x1B[38;5;243mCompleted\x1B[0m unit/core',
|
|
74
|
+
'\x1B[38;5;243mCompleted\x1B[0m unit',
|
|
75
|
+
'\x1B[38;5;243mCompleted\x1B[0m tests/',
|
|
76
|
+
],
|
|
77
|
+
[],
|
|
78
|
+
'global intermittents'
|
|
79
|
+
);
|
|
80
|
+
};
|
package/webdriver/driver.js
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
const { By, Condition, Key, until } = require('selenium-webdriver');
|
|
4
4
|
|
|
5
5
|
const { test_is, test_contains, is, contains, ok } = require('../core/base.js');
|
|
6
|
-
const { assert } = require('../core/core.js');
|
|
6
|
+
const { assert, fail } = require('../core/core.js');
|
|
7
7
|
const { is_mac, stringify, toDataURL } = require('../core/util.js');
|
|
8
8
|
const { log } = require('../logging/logging.js');
|
|
9
9
|
const { getTimeout, DriverBase } = require('./driver_base.js');
|
|
@@ -187,6 +187,29 @@ class Driver extends DriverBase {
|
|
|
187
187
|
});
|
|
188
188
|
}
|
|
189
189
|
|
|
190
|
+
/**
|
|
191
|
+
* Waits untils an element defined by a selector has attribute of a given value.
|
|
192
|
+
*/
|
|
193
|
+
attributeIsAll(selector, attr, values, msg) {
|
|
194
|
+
assert(selector, `attributeIsAll: no selector`);
|
|
195
|
+
assert(attr, `attributeIsAll: no attr`);
|
|
196
|
+
assert(values, `attributeIsAll: no values`);
|
|
197
|
+
assert(msg, `attributeIsAll: no msg`);
|
|
198
|
+
|
|
199
|
+
return this.matchAttributeAll({
|
|
200
|
+
selector,
|
|
201
|
+
attr,
|
|
202
|
+
values,
|
|
203
|
+
msg,
|
|
204
|
+
test: got =>
|
|
205
|
+
test_is(
|
|
206
|
+
got,
|
|
207
|
+
values.map(value => got => got == value)
|
|
208
|
+
),
|
|
209
|
+
expected_stringified: stringify(values),
|
|
210
|
+
});
|
|
211
|
+
}
|
|
212
|
+
|
|
190
213
|
/**
|
|
191
214
|
* Waits untils an element defined by a selector has attribute of a given value.
|
|
192
215
|
*/
|
|
@@ -316,9 +339,9 @@ class Driver extends DriverBase {
|
|
|
316
339
|
* Checks elements text whether it matches the given text.
|
|
317
340
|
*/
|
|
318
341
|
textIsAll(selector, text, msg) {
|
|
319
|
-
assert(selector, `
|
|
320
|
-
assert(text instanceof Array, `
|
|
321
|
-
assert(msg, `
|
|
342
|
+
assert(selector, `textIsAll: no selector`);
|
|
343
|
+
assert(text instanceof Array, `textIsAll: no text`);
|
|
344
|
+
assert(msg, `textIsAll: no msg`);
|
|
322
345
|
|
|
323
346
|
return this.matchTextAll({
|
|
324
347
|
selector,
|
|
@@ -789,7 +812,7 @@ class Driver extends DriverBase {
|
|
|
789
812
|
|
|
790
813
|
// ctlr+A doens't work OS X in Chrome.
|
|
791
814
|
let script = `
|
|
792
|
-
let el = document.querySelector(
|
|
815
|
+
let el = document.querySelector(\`${selector}\`);
|
|
793
816
|
if (el instanceof HTMLInputElement || el instanceof HTMLTextAreaElement) {
|
|
794
817
|
el.select();
|
|
795
818
|
}
|
|
@@ -800,7 +823,14 @@ else {
|
|
|
800
823
|
window.getSelection().addRange(r);
|
|
801
824
|
}
|
|
802
825
|
`;
|
|
803
|
-
return this.run(
|
|
826
|
+
return this.run(
|
|
827
|
+
() =>
|
|
828
|
+
this.dvr.executeScript(script).catch(e => {
|
|
829
|
+
fail(`Failed to execute selectAll script: ${script}`);
|
|
830
|
+
throw e;
|
|
831
|
+
}),
|
|
832
|
+
msg
|
|
833
|
+
);
|
|
804
834
|
}
|
|
805
835
|
|
|
806
836
|
/**
|