@testim/testim-cli 3.251.0 → 3.253.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/agent/routers/index.js +2 -1
- package/agent/routers/playground/router.js +1 -1
- package/commons/chrome-launcher.js +6 -6
- package/commons/constants.js +2 -0
- package/commons/getSessionPlayerRequire.js +2 -20
- package/commons/initializeUserWithAuth.js +2 -2
- package/commons/mockNetworkRuleFileSchema.json +40 -38
- package/commons/testimDesiredCapabilitiesBuilder.js +43 -0
- package/commons/testimServicesApi.js +11 -2
- package/credentialsManager.js +17 -20
- package/npm-shrinkwrap.json +2104 -444
- package/package.json +4 -2
- package/player/WebdriverioWebDriverApi.js +7 -2
- package/player/appiumTestPlayer.js +102 -0
- package/player/seleniumTestPlayer.js +3 -2
- package/player/services/frameLocator.js +2 -1
- package/player/services/mobileFrameLocatorMock.js +32 -0
- package/player/services/playbackTimeoutCalculator.js +1 -0
- package/player/services/portSelector.js +10 -8
- package/player/services/tabService.js +29 -0
- package/player/stepActions/sfdcRecordedStepAction.js +2 -2
- package/player/stepActions/sfdcStepAction.js +2 -2
- package/player/stepActions/stepAction.js +15 -1
- package/player/utils/stepActionUtils.js +4 -2
- package/player/utils/windowUtils.js +138 -125
- package/player/webdriver.js +39 -25
- package/reports/debugReporter.js +41 -39
- package/reports/jsonReporter.js +53 -50
- package/reports/reporter.js +135 -136
- package/runOptions.js +2 -1
- package/runners/ParallelWorkerManager.js +2 -0
- package/testRunStatus.js +457 -459
- package/workers/BaseWorker.js +13 -6
- package/workers/WorkerAppium.js +123 -0
package/reports/jsonReporter.js
CHANGED
|
@@ -1,52 +1,55 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
1
|
+
/* eslint-disable no-console */
|
|
2
|
+
class JsonReporter {
|
|
3
|
+
constructor(options) {
|
|
4
|
+
this.options = options;
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
onTestStarted(test, workerId) {
|
|
8
|
+
const event = {
|
|
9
|
+
name: 'testStarted',
|
|
10
|
+
data: {
|
|
11
|
+
test,
|
|
12
|
+
workerId,
|
|
13
|
+
},
|
|
14
|
+
};
|
|
15
|
+
|
|
16
|
+
console.log(JSON.stringify(event));
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
onTestFinished(test, workerId) {
|
|
20
|
+
const event = {
|
|
21
|
+
name: 'testFinished',
|
|
22
|
+
data: {
|
|
23
|
+
test,
|
|
24
|
+
workerId,
|
|
25
|
+
},
|
|
26
|
+
};
|
|
27
|
+
|
|
28
|
+
console.log(JSON.stringify(event));
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
onTestPlanStarted(beforeTests, tests, afterTests, testPlanName, executionId) {
|
|
32
|
+
const event = {
|
|
33
|
+
name: 'suiteStarted',
|
|
34
|
+
data: {
|
|
35
|
+
projectId: this.options.project,
|
|
36
|
+
executionId,
|
|
37
|
+
},
|
|
38
|
+
};
|
|
39
|
+
|
|
40
|
+
console.log(JSON.stringify(event));
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
onTestPlanFinished(testResults) {
|
|
44
|
+
const event = {
|
|
45
|
+
name: 'suiteFinished',
|
|
46
|
+
data: {
|
|
47
|
+
testResults,
|
|
48
|
+
},
|
|
49
|
+
};
|
|
50
|
+
|
|
51
|
+
console.log(JSON.stringify(event));
|
|
52
|
+
}
|
|
53
|
+
}
|
|
51
54
|
|
|
52
55
|
module.exports = JsonReporter;
|
package/reports/reporter.js
CHANGED
|
@@ -3,53 +3,155 @@
|
|
|
3
3
|
const logger = require('../commons/logger').getLogger('reporter');
|
|
4
4
|
const Promise = require('bluebird');
|
|
5
5
|
|
|
6
|
-
|
|
6
|
+
class Reporter {
|
|
7
|
+
setOptions(options, branchToUse) {
|
|
8
|
+
this.reporters = [];
|
|
9
|
+
const optReporters = options.reporters;
|
|
7
10
|
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
const optReporters = options.reporters;
|
|
11
|
+
const DebugReporter = require('./debugReporter');
|
|
12
|
+
this.reporters.push(new DebugReporter(options));
|
|
11
13
|
|
|
12
|
-
|
|
13
|
-
this.reporters.push(new DebugReporter(options));
|
|
14
|
-
|
|
15
|
-
if (optReporters === undefined || optReporters.length === 0) {
|
|
16
|
-
const ConsoleReporter = require('./consoleReporter');
|
|
17
|
-
this.reporters.push(new ConsoleReporter(options, branchToUse));
|
|
18
|
-
if (options !== undefined && options.reportFile !== undefined) {
|
|
19
|
-
const JunitReporter = require('./junitReporter');
|
|
20
|
-
this.reporters.push(new JunitReporter(options, branchToUse));
|
|
21
|
-
}
|
|
22
|
-
} else {
|
|
23
|
-
if (optReporters.indexOf('teamcity') > -1) {
|
|
24
|
-
const TeamCityReporter = require('./teamCityReporter');
|
|
25
|
-
this.reporters.push(new TeamCityReporter(options));
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
if (optReporters.indexOf('console') > -1) {
|
|
14
|
+
if (optReporters === undefined || optReporters.length === 0) {
|
|
29
15
|
const ConsoleReporter = require('./consoleReporter');
|
|
30
16
|
this.reporters.push(new ConsoleReporter(options, branchToUse));
|
|
31
|
-
|
|
17
|
+
if (options?.reportFile !== undefined) {
|
|
18
|
+
const JunitReporter = require('./junitReporter');
|
|
19
|
+
this.reporters.push(new JunitReporter(options, branchToUse));
|
|
20
|
+
}
|
|
21
|
+
} else {
|
|
22
|
+
if (optReporters.includes('teamcity')) {
|
|
23
|
+
const TeamCityReporter = require('./teamCityReporter');
|
|
24
|
+
this.reporters.push(new TeamCityReporter(options));
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
if (optReporters.includes('console')) {
|
|
28
|
+
const ConsoleReporter = require('./consoleReporter');
|
|
29
|
+
this.reporters.push(new ConsoleReporter(options, branchToUse));
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
if (optReporters.includes('junit')) {
|
|
33
|
+
const JunitReporter = require('./junitReporter');
|
|
34
|
+
this.reporters.push(new JunitReporter(options, branchToUse));
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
if (optReporters.includes('json')) {
|
|
38
|
+
const JsonReporter = require('./jsonReporter');
|
|
39
|
+
this.reporters.push(new JsonReporter(options));
|
|
40
|
+
}
|
|
32
41
|
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
42
|
+
if (optReporters.includes('chrome')) {
|
|
43
|
+
const { ChromeReporter } = require('./chromeReporter');
|
|
44
|
+
this.reporters.push(new ChromeReporter(options, branchToUse));
|
|
45
|
+
}
|
|
36
46
|
}
|
|
47
|
+
}
|
|
37
48
|
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
49
|
+
onTestPlanFinished(testResults, testPlanName, startTime, executionId, isAnonymous, isCodeMode, childTestResults) {
|
|
50
|
+
let results = {};
|
|
51
|
+
|
|
52
|
+
// TODO: remove mutation of testResults from the Reporter
|
|
53
|
+
if (childTestResults) {
|
|
54
|
+
const childValues = Object.values(childTestResults);
|
|
55
|
+
if (childValues.length > 0) {
|
|
56
|
+
for (const child of Object.values(childTestResults)) {
|
|
57
|
+
results[child.id] = child;
|
|
58
|
+
}
|
|
59
|
+
for (const parent of Object.keys(testResults)) {
|
|
60
|
+
if (!childValues.some(c => c.parentResultId !== parent)) {
|
|
61
|
+
results[parent] = testResults[parent];
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
} else {
|
|
65
|
+
logger.warn('childTestResults is not array');
|
|
66
|
+
results = testResults;
|
|
67
|
+
}
|
|
68
|
+
} else {
|
|
69
|
+
results = testResults;
|
|
41
70
|
}
|
|
42
71
|
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
72
|
+
return Promise.each(this.reporters, reporter => {
|
|
73
|
+
if (reporter?.onTestPlanFinished) {
|
|
74
|
+
const duration = Date.now() - (startTime || 0);
|
|
75
|
+
return reporter.onTestPlanFinished(results, testPlanName, duration, executionId, isAnonymous, isCodeMode);
|
|
76
|
+
}
|
|
77
|
+
return undefined;
|
|
78
|
+
});
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
onTestPlanStarted(beforeTests, tests, afterTests, testPlanName, executionId, isAnonymous, configName, isCodeMode) {
|
|
82
|
+
return Promise.each(this.reporters, reporter => {
|
|
83
|
+
if (reporter?.onTestPlanStarted) {
|
|
84
|
+
return reporter.onTestPlanStarted(beforeTests, tests, afterTests, testPlanName, executionId, isAnonymous, configName, isCodeMode);
|
|
85
|
+
}
|
|
86
|
+
return undefined;
|
|
87
|
+
});
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
onGetSlot(workerId, browser) {
|
|
91
|
+
return Promise.each(this.reporters, reporter => {
|
|
92
|
+
if (reporter?.onGetSlot) {
|
|
93
|
+
return reporter.onGetSlot(workerId, browser);
|
|
94
|
+
}
|
|
95
|
+
return undefined;
|
|
96
|
+
});
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
onGetSession(workerId, testName, mode) {
|
|
100
|
+
return Promise.each(this.reporters, reporter => {
|
|
101
|
+
if (reporter?.onGetSession) {
|
|
102
|
+
return reporter.onGetSession(workerId, testName, mode);
|
|
103
|
+
}
|
|
104
|
+
return undefined;
|
|
105
|
+
});
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
onWaitToTestComplete(workerId, isCodeMode, debuggerAddress) {
|
|
109
|
+
return Promise.each(this.reporters, reporter => {
|
|
110
|
+
if (reporter?.onWaitToTestComplete) {
|
|
111
|
+
return reporter.onWaitToTestComplete(workerId, isCodeMode, debuggerAddress);
|
|
112
|
+
}
|
|
113
|
+
return undefined;
|
|
114
|
+
});
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
onWaitToTestStart(workerId) {
|
|
118
|
+
return Promise.each(this.reporters, reporter => {
|
|
119
|
+
if (reporter?.onWaitToTestStart) {
|
|
120
|
+
return reporter.onWaitToTestStart(workerId);
|
|
121
|
+
}
|
|
122
|
+
return undefined;
|
|
123
|
+
});
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
onAllTestPlansFinished(testPlanResults) {
|
|
127
|
+
// TODO: remove mutation of testPlanResults from the Reporter
|
|
128
|
+
for (const result of testPlanResults) {
|
|
129
|
+
if (result.childTestResults) {
|
|
130
|
+
result.results = {};
|
|
131
|
+
const childValues = Object.values(result.childTestResults);
|
|
132
|
+
for (const child of childValues) {
|
|
133
|
+
result.results[child.id] = child;
|
|
134
|
+
}
|
|
135
|
+
for (const parent of Object.keys(testPlanResults)) {
|
|
136
|
+
if (!childValues.some(c => c.parentResultId !== parent)) {
|
|
137
|
+
result.results[parent] = testPlanResults[parent];
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
}
|
|
46
141
|
}
|
|
142
|
+
|
|
143
|
+
return Promise.each(this.reporters, reporter => {
|
|
144
|
+
if (reporter?.onAllTestPlansFinished) {
|
|
145
|
+
return reporter.onAllTestPlansFinished(testPlanResults);
|
|
146
|
+
}
|
|
147
|
+
return undefined;
|
|
148
|
+
});
|
|
47
149
|
}
|
|
48
|
-
}
|
|
150
|
+
}
|
|
49
151
|
|
|
50
152
|
function addHook(name) {
|
|
51
153
|
Reporter.prototype[name] = function (...args) {
|
|
52
|
-
return Promise.filter(this.reporters, reporter => reporter
|
|
154
|
+
return Promise.filter(this.reporters, reporter => reporter?.[name]).each(reporter => reporter[name](...args));
|
|
53
155
|
};
|
|
54
156
|
}
|
|
55
157
|
|
|
@@ -66,107 +168,4 @@ addHook('onTestIgnored');
|
|
|
66
168
|
addHook('onWaitToTestStart');
|
|
67
169
|
addHook('onWaitToTestComplete');
|
|
68
170
|
|
|
69
|
-
Reporter.prototype.onTestPlanFinished = function (testResults, testPlanName, startTime, executionId, isAnonymous, isCodeMode, childTestResults) {
|
|
70
|
-
let results = {};
|
|
71
|
-
|
|
72
|
-
// TODO: remove mutation of testResults from the Reporter
|
|
73
|
-
if (childTestResults) {
|
|
74
|
-
const childValues = Object.values(childTestResults);
|
|
75
|
-
if (childValues.length > 0) {
|
|
76
|
-
for (const child of Object.values(childTestResults)) {
|
|
77
|
-
results[child.id] = child;
|
|
78
|
-
}
|
|
79
|
-
for (const parent of Object.keys(testResults)) {
|
|
80
|
-
if (!childValues.some(c => c.parentResultId !== parent)) {
|
|
81
|
-
results[parent] = testResults[parent];
|
|
82
|
-
}
|
|
83
|
-
}
|
|
84
|
-
} else {
|
|
85
|
-
logger.warn('childTestResults is not array');
|
|
86
|
-
results = testResults;
|
|
87
|
-
}
|
|
88
|
-
} else {
|
|
89
|
-
results = testResults;
|
|
90
|
-
}
|
|
91
|
-
|
|
92
|
-
return Promise.each(this.reporters, reporter => {
|
|
93
|
-
if (reporter && reporter.onTestPlanFinished) {
|
|
94
|
-
const duration = Date.now() - (startTime || 0);
|
|
95
|
-
return reporter.onTestPlanFinished(results, testPlanName, duration, executionId, isAnonymous, isCodeMode);
|
|
96
|
-
}
|
|
97
|
-
return undefined;
|
|
98
|
-
});
|
|
99
|
-
};
|
|
100
|
-
|
|
101
|
-
Reporter.prototype.onTestPlanStarted = function (beforeTests, tests, afterTests, testPlanName, executionId, isAnonymous, configName, isCodeMode) {
|
|
102
|
-
return Promise.each(this.reporters, reporter => {
|
|
103
|
-
if (reporter && reporter.onTestPlanStarted) {
|
|
104
|
-
return reporter.onTestPlanStarted(beforeTests, tests, afterTests, testPlanName, executionId, isAnonymous, configName, isCodeMode);
|
|
105
|
-
}
|
|
106
|
-
return undefined;
|
|
107
|
-
});
|
|
108
|
-
};
|
|
109
|
-
|
|
110
|
-
Reporter.prototype.onGetSlot = function (workerId, browser) {
|
|
111
|
-
return Promise.each(this.reporters, reporter => {
|
|
112
|
-
if (reporter && reporter.onGetSlot) {
|
|
113
|
-
return reporter.onGetSlot(workerId, browser);
|
|
114
|
-
}
|
|
115
|
-
return undefined;
|
|
116
|
-
});
|
|
117
|
-
};
|
|
118
|
-
|
|
119
|
-
Reporter.prototype.onGetSession = function (workerId, testName, mode) {
|
|
120
|
-
return Promise.each(this.reporters, reporter => {
|
|
121
|
-
if (reporter && reporter.onGetSession) {
|
|
122
|
-
return reporter.onGetSession(workerId, testName, mode);
|
|
123
|
-
}
|
|
124
|
-
return undefined;
|
|
125
|
-
});
|
|
126
|
-
};
|
|
127
|
-
|
|
128
|
-
Reporter.prototype.onWaitToTestComplete = function (workerId, isCodeMode, debuggerAddress) {
|
|
129
|
-
return Promise.each(this.reporters, reporter => {
|
|
130
|
-
if (reporter && reporter.onWaitToTestComplete) {
|
|
131
|
-
return reporter.onWaitToTestComplete(workerId, isCodeMode, debuggerAddress);
|
|
132
|
-
}
|
|
133
|
-
return undefined;
|
|
134
|
-
});
|
|
135
|
-
};
|
|
136
|
-
|
|
137
|
-
Reporter.prototype.onWaitToTestStart = function (workerId) {
|
|
138
|
-
return Promise.each(this.reporters, reporter => {
|
|
139
|
-
if (reporter && reporter.onWaitToTestStart) {
|
|
140
|
-
return reporter.onWaitToTestStart(workerId);
|
|
141
|
-
}
|
|
142
|
-
return undefined;
|
|
143
|
-
});
|
|
144
|
-
};
|
|
145
|
-
|
|
146
|
-
Reporter.prototype.onAllTestPlansFinished = function (testPlanResults) {
|
|
147
|
-
// TODO: remove mutation of testPlanResults from the Reporter
|
|
148
|
-
for (const result of testPlanResults) {
|
|
149
|
-
if (result.childTestResults) {
|
|
150
|
-
result.results = {};
|
|
151
|
-
const childValues = Object.values(result.childTestResults);
|
|
152
|
-
for (const child of childValues) {
|
|
153
|
-
result.results[child.id] = child;
|
|
154
|
-
}
|
|
155
|
-
for (const parent of Object.keys(testPlanResults)) {
|
|
156
|
-
if (!childValues.some(c => c.parentResultId !== parent)) {
|
|
157
|
-
result.results[parent] = testPlanResults[parent];
|
|
158
|
-
}
|
|
159
|
-
}
|
|
160
|
-
}
|
|
161
|
-
}
|
|
162
|
-
|
|
163
|
-
return Promise.each(this.reporters, reporter => {
|
|
164
|
-
if (reporter && reporter.onAllTestPlansFinished) {
|
|
165
|
-
return reporter.onAllTestPlansFinished(testPlanResults);
|
|
166
|
-
}
|
|
167
|
-
return undefined;
|
|
168
|
-
});
|
|
169
|
-
};
|
|
170
|
-
|
|
171
|
-
|
|
172
171
|
module.exports = new Reporter();
|
package/runOptions.js
CHANGED
|
@@ -495,6 +495,7 @@ module.exports = {
|
|
|
495
495
|
// non-proxy case
|
|
496
496
|
global.SuperagentProxy = require('superagent-proxy');
|
|
497
497
|
global.ProxyAgent = require('proxy-agent');
|
|
498
|
+
global.HttpsProxyAgent = require('https-proxy-agent');
|
|
498
499
|
}
|
|
499
500
|
|
|
500
501
|
if (program.proxyForGrid && !program.proxy) {
|
|
@@ -833,7 +834,7 @@ module.exports = {
|
|
|
833
834
|
throw new ArgError('after-parallel could not be a negative number or not number, --after-parallel <number-of-tests>');
|
|
834
835
|
}
|
|
835
836
|
|
|
836
|
-
if (![CLI_MODE.EXTENSION, CLI_MODE.SELENIUM].includes(program.mode)) {
|
|
837
|
+
if (![CLI_MODE.EXTENSION, CLI_MODE.SELENIUM, CLI_MODE.APPIUM].includes(program.mode)) {
|
|
837
838
|
throw new ArgError(`runner mode <${program.mode}> is not supported`);
|
|
838
839
|
}
|
|
839
840
|
|
|
@@ -23,6 +23,8 @@ class ParallelWorkerManager {
|
|
|
23
23
|
switch (mode) {
|
|
24
24
|
case CLI_MODE.SELENIUM:
|
|
25
25
|
return require('../workers/WorkerSelenium');
|
|
26
|
+
case CLI_MODE.APPIUM:
|
|
27
|
+
return require('../workers/WorkerAppium');
|
|
26
28
|
default:
|
|
27
29
|
if (labFeaturesService.isFeatureAvailableForProject('useSameBrowserForMultiTests')) {
|
|
28
30
|
return require('../workers/WorkerExtensionSingleBrowser');
|