@camperaid/watest 2.2.4 → 2.3.3
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/base.js +12 -11
- package/core/core.js +10 -9
- package/core/series.js +51 -32
- package/core/spawn.js +4 -2
- package/core/util.js +2 -1
- package/index.js +2 -1
- package/logging/logging.js +27 -0
- package/logging/logpipe.js +6 -5
- 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/tests/webdriver/t_app_driver.js +45 -13
- package/tests/webdriver/t_attribute.js +1 -0
- package/tests/webdriver/t_attribute_all.js +1 -0
- package/tests/webdriver/t_properties.js +3 -0
- package/tests/webdriver/t_script.js +2 -0
- package/tests/webdriver/t_select_all.js +67 -0
- package/tests/webdriver/t_selection.js +1 -0
- package/tests/webdriver/t_text.js +4 -0
- package/tests/webdriver/t_text_all.js +3 -0
- package/tests/webdriver/test.js +7 -1
- package/webdriver/app_driver.js +3 -21
- package/webdriver/control_driver.js +32 -0
- package/webdriver/driver.js +20 -14
- package/webdriver/driver_base.js +24 -10
- package/webdriver/session.js +9 -12
package/webdriver/driver_base.js
CHANGED
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
const settings = require('../core/settings.js');
|
|
4
4
|
|
|
5
|
+
const { is } = require('../core/base.js');
|
|
5
6
|
const {
|
|
6
7
|
core,
|
|
7
8
|
fail,
|
|
@@ -13,11 +14,9 @@ const {
|
|
|
13
14
|
} = require('../core/core.js');
|
|
14
15
|
|
|
15
16
|
const { stringify } = require('../core/util.js');
|
|
16
|
-
|
|
17
|
-
const { is } = require('../core/base.js');
|
|
18
|
-
|
|
19
|
-
const { define_class_promise } = require('./util.js');
|
|
17
|
+
const { log, log_error } = require('../logging/logging.js');
|
|
20
18
|
const { LogPipe } = require('../logging/logpipe.js');
|
|
19
|
+
const { define_class_promise } = require('./util.js');
|
|
21
20
|
|
|
22
21
|
const {
|
|
23
22
|
Browser,
|
|
@@ -75,7 +74,7 @@ class DriverBase {
|
|
|
75
74
|
* Creates an instance of web driver.
|
|
76
75
|
*/
|
|
77
76
|
static async build() {
|
|
78
|
-
|
|
77
|
+
log(`Build WebDriver for '${settings.webdriver}'`);
|
|
79
78
|
|
|
80
79
|
switch (settings.webdriver) {
|
|
81
80
|
case 'chrome': {
|
|
@@ -767,7 +766,7 @@ class DriverBase {
|
|
|
767
766
|
/(data:\S+?)(\s|:)(\d+):(\d+)/g,
|
|
768
767
|
(match, p1, p2, p3, p4) => `dataurl-placeholder:${p3}:${p4}`
|
|
769
768
|
);
|
|
770
|
-
|
|
769
|
+
log(`[${entry.level.name}] ${message}`);
|
|
771
770
|
}
|
|
772
771
|
|
|
773
772
|
let errors = entries.filter(entry => entry.level.name == 'SEVERE');
|
|
@@ -805,7 +804,7 @@ class DriverBase {
|
|
|
805
804
|
return this.chain(() =>
|
|
806
805
|
Promise.resolve()
|
|
807
806
|
.then(() =>
|
|
808
|
-
|
|
807
|
+
log(`Test: ${msg}${(details && `. ${details}`) || ''}`)
|
|
809
808
|
)
|
|
810
809
|
.then(() => chain())
|
|
811
810
|
.then(v => this.browserLogs().then(() => v))
|
|
@@ -834,14 +833,14 @@ class DriverBase {
|
|
|
834
833
|
})
|
|
835
834
|
.then(() => this.captureScreenshot())
|
|
836
835
|
.catch(e => {
|
|
837
|
-
|
|
836
|
+
log_error(e);
|
|
838
837
|
fail(e.message);
|
|
839
838
|
})
|
|
840
839
|
.then(() => {
|
|
841
840
|
let timeoutOnFailure = getTimeoutOnFailure();
|
|
842
841
|
let promise = Promise.resolve();
|
|
843
842
|
if (timeoutOnFailure > 0) {
|
|
844
|
-
|
|
843
|
+
log(`Sleeping for ${timeoutOnFailure} ms`);
|
|
845
844
|
promise = this.dvr.sleep(timeoutOnFailure);
|
|
846
845
|
}
|
|
847
846
|
return promise.then(() => {
|
|
@@ -859,11 +858,26 @@ class DriverBase {
|
|
|
859
858
|
* Chains a function to the execution flow.
|
|
860
859
|
*/
|
|
861
860
|
chain(link) {
|
|
862
|
-
|
|
861
|
+
let chainLink = new this.constructor.CtorPromise(
|
|
863
862
|
this.p.then(link),
|
|
864
863
|
this.dvr,
|
|
865
864
|
this.options
|
|
866
865
|
);
|
|
866
|
+
|
|
867
|
+
this.dvr.lastChainLink = chainLink;
|
|
868
|
+
chainLink.then(
|
|
869
|
+
() => {
|
|
870
|
+
if (this.dvr.lastChainLink == chainLink) {
|
|
871
|
+
this.dvr.lastChainLink = null;
|
|
872
|
+
}
|
|
873
|
+
},
|
|
874
|
+
() => {
|
|
875
|
+
if (this.dvr.lastChainLink == chainLink) {
|
|
876
|
+
this.dvr.lastChainLink = null;
|
|
877
|
+
}
|
|
878
|
+
}
|
|
879
|
+
);
|
|
880
|
+
return chainLink;
|
|
867
881
|
}
|
|
868
882
|
|
|
869
883
|
wrapScript(func) {
|
package/webdriver/session.js
CHANGED
|
@@ -1,12 +1,9 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
const { assert, group, info } = require('../core/core.js');
|
|
3
|
+
const { assert, group, fail, info } = require('../core/core.js');
|
|
4
|
+
const { log, log_error } = require('../logging/logging.js');
|
|
4
5
|
const { Driver } = require('./driver.js');
|
|
5
6
|
|
|
6
|
-
const {
|
|
7
|
-
fail,
|
|
8
|
-
} = require('../core/core.js');
|
|
9
|
-
|
|
10
7
|
let active_sessions = [];
|
|
11
8
|
|
|
12
9
|
/**
|
|
@@ -27,10 +24,10 @@ class Session {
|
|
|
27
24
|
return session;
|
|
28
25
|
}
|
|
29
26
|
|
|
30
|
-
constructor(
|
|
31
|
-
assert(
|
|
27
|
+
constructor(driver) {
|
|
28
|
+
assert(driver, `Session: no driver`);
|
|
32
29
|
this.session_id = Math.floor(Math.random() * Math.pow(10, 8));
|
|
33
|
-
this.driver =
|
|
30
|
+
this.driver = driver;
|
|
34
31
|
info(`Session ${this.session_id} open`);
|
|
35
32
|
}
|
|
36
33
|
|
|
@@ -38,11 +35,11 @@ class Session {
|
|
|
38
35
|
* Denotes a test task in console, a number of logically grouped test actions.
|
|
39
36
|
*/
|
|
40
37
|
task(msg) {
|
|
41
|
-
|
|
38
|
+
log(`\x1b[34mTask:\x1b[0m ${msg}`);
|
|
42
39
|
}
|
|
43
40
|
|
|
44
41
|
subtask(msg) {
|
|
45
|
-
|
|
42
|
+
log(`\x1b[34mSubtask:\x1b[0m ${msg}`);
|
|
46
43
|
}
|
|
47
44
|
|
|
48
45
|
/**
|
|
@@ -167,10 +164,10 @@ const scope = (arg1, arg2, arg3) => async () => {
|
|
|
167
164
|
}
|
|
168
165
|
await tests(session);
|
|
169
166
|
} catch (e) {
|
|
170
|
-
|
|
167
|
+
log_error(e);
|
|
171
168
|
fail(e.message);
|
|
172
169
|
} finally {
|
|
173
|
-
|
|
170
|
+
log(`Quit ${active_sessions.length} wd session(s)`);
|
|
174
171
|
|
|
175
172
|
while (active_sessions.length > 1) {
|
|
176
173
|
await active_sessions[1].close();
|