@testim/testim-cli 3.289.0 → 3.290.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/cli.js +22390 -122
- package/cli.js.map +1 -0
- package/npm-shrinkwrap.json +1951 -203
- package/package.json +9 -5
- package/OverrideTestDataBuilder.js +0 -117
- package/agent/routers/cliJsCode/index.js +0 -13
- package/agent/routers/cliJsCode/router.js +0 -63
- package/agent/routers/cliJsCode/service.js +0 -705
- package/agent/routers/codim/router.js +0 -69
- package/agent/routers/codim/router.test.js +0 -60
- package/agent/routers/codim/service.js +0 -193
- package/agent/routers/general/index.js +0 -36
- package/agent/routers/hybrid/registerRoutes.js +0 -81
- package/agent/routers/index.js +0 -56
- package/agent/routers/playground/router.js +0 -77
- package/agent/routers/playground/service.js +0 -96
- package/agent/routers/standalone-browser/registerRoutes.js +0 -47
- package/agent/server.js +0 -150
- package/cdpTestRunner.js +0 -86
- package/chromiumInstaller.js +0 -91
- package/cli/isCiRun.js +0 -10
- package/cli/onExit.js +0 -65
- package/cli/writeStackTrace.js +0 -27
- package/cliAgentMode.js +0 -384
- package/codim/codim-cli.js +0 -91
- package/codim/codim-npm-package/index.ts +0 -427
- package/codim/codim-npm-package/package-lock.json +0 -14
- package/codim/codim-npm-package/package.json +0 -14
- package/codim/hybrid-utils.js +0 -28
- package/codim/measure-perf.js +0 -41
- package/codim/template.js/.idea/workspace.xml +0 -57
- package/codim/template.js/.vscode/launch.json +0 -53
- package/codim/template.ts/.idea/workspace.xml +0 -57
- package/codim/template.ts/.vscode/launch.json +0 -55
- package/commons/AbortError.js +0 -12
- package/commons/SeleniumPerfStats.js +0 -58
- package/commons/chrome-launcher.js +0 -15
- package/commons/chromedriverWrapper.js +0 -70
- package/commons/config.js +0 -39
- package/commons/constants.js +0 -67
- package/commons/detectDebugger.js +0 -19
- package/commons/featureAvailabilityService.js +0 -26
- package/commons/featureFlags.js +0 -132
- package/commons/getSessionPlayerRequire.js +0 -28
- package/commons/httpRequest.js +0 -261
- package/commons/httpRequestCounters.js +0 -98
- package/commons/httpRequestCounters.test.js +0 -38
- package/commons/initializeUserWithAuth.js +0 -55
- package/commons/lazyRequire.js +0 -105
- package/commons/logUtils.js +0 -15
- package/commons/logUtils.test.js +0 -21
- package/commons/logger.js +0 -178
- package/commons/mockNetworkRuleFileSchema.json +0 -140
- package/commons/npmWrapper.js +0 -174
- package/commons/npmWrapper.test.js +0 -374
- package/commons/performance-logger.js +0 -71
- package/commons/preloadTests.js +0 -29
- package/commons/prepareRunner.js +0 -85
- package/commons/prepareRunner.test.js +0 -144
- package/commons/prepareRunnerAndTestimStartUtils.js +0 -198
- package/commons/prepareRunnerAndTestimStartUtils.test.js +0 -73
- package/commons/requireWithFallback.js +0 -25
- package/commons/runnerFileCache.js +0 -204
- package/commons/socket/baseSocketServiceSocketIO.js +0 -197
- package/commons/socket/realDataService.js +0 -59
- package/commons/socket/realDataServiceSocketIO.js +0 -33
- package/commons/socket/remoteStepService.js +0 -55
- package/commons/socket/remoteStepServiceSocketIO.js +0 -61
- package/commons/socket/socketService.js +0 -175
- package/commons/socket/testResultService.js +0 -62
- package/commons/socket/testResultServiceSocketIO.js +0 -64
- package/commons/testimAnalytics.js +0 -40
- package/commons/testimCloudflare.js +0 -83
- package/commons/testimCloudflare.test.js +0 -185
- package/commons/testimCustomToken.js +0 -124
- package/commons/testimDesiredCapabilitiesBuilder.js +0 -647
- package/commons/testimNgrok.js +0 -90
- package/commons/testimNgrok.test.js +0 -140
- package/commons/testimServicesApi.js +0 -631
- package/commons/testimTunnel.js +0 -73
- package/commons/testimTunnel.test.js +0 -172
- package/commons/xhr2.js +0 -897
- package/coverage/SummaryToObjectReport.js +0 -19
- package/coverage/jsCoverage.js +0 -252
- package/credentialsManager.js +0 -142
- package/errors.js +0 -161
- package/executionQueue.js +0 -37
- package/fixLocalBuild.js +0 -24
- package/inputFileUtils.js +0 -103
- package/lib/coralogix-winston.transport.js +0 -99
- package/player/SeleniumProtocolError.js +0 -100
- package/player/WebDriverHttpRequest.js +0 -177
- package/player/WebdriverioWebDriverApi.js +0 -671
- package/player/appiumTestPlayer.js +0 -90
- package/player/chromeLauncherTestPlayer.js +0 -67
- package/player/constants.js +0 -332
- package/player/extensionTestPlayer.js +0 -32
- package/player/findElementStrategy.js +0 -154
- package/player/scripts/isElementDisplayed.js +0 -252
- package/player/seleniumTestPlayer.js +0 -140
- package/player/services/frameLocator.js +0 -170
- package/player/services/mobileFrameLocatorMock.js +0 -32
- package/player/services/playbackTimeoutCalculator.js +0 -175
- package/player/services/portSelector.js +0 -19
- package/player/services/tabService.js +0 -551
- package/player/services/tabServiceMock.js +0 -167
- package/player/services/windowCreationListener.js +0 -8
- package/player/stepActions/RefreshStepAction.js +0 -16
- package/player/stepActions/apiStepAction.js +0 -89
- package/player/stepActions/baseCliJsStepAction.js +0 -51
- package/player/stepActions/baseJsStepAction.js +0 -277
- package/player/stepActions/cliConditionStepAction.js +0 -11
- package/player/stepActions/cliJsStepAction.js +0 -11
- package/player/stepActions/dropFileStepAction.js +0 -34
- package/player/stepActions/evaluateExpressionStepAction.js +0 -52
- package/player/stepActions/extensionOnlyStepAction.js +0 -12
- package/player/stepActions/extractTextStepAction.js +0 -19
- package/player/stepActions/hoverStepAction.js +0 -55
- package/player/stepActions/inputFileStepAction.js +0 -199
- package/player/stepActions/jsCodeStepAction.js +0 -11
- package/player/stepActions/jsConditionStepAction.js +0 -11
- package/player/stepActions/locateStepAction.js +0 -159
- package/player/stepActions/mouseStepAction.js +0 -370
- package/player/stepActions/navigationStepAction.js +0 -29
- package/player/stepActions/nodePackageStepAction.js +0 -47
- package/player/stepActions/pixelValidationStepAction.js +0 -39
- package/player/stepActions/scripts/dispatchEvents.js +0 -282
- package/player/stepActions/scripts/doClick.js +0 -221
- package/player/stepActions/scripts/doDragPath.js +0 -225
- package/player/stepActions/scripts/doubleClick.js +0 -119
- package/player/stepActions/scripts/dropEvent.js +0 -63
- package/player/stepActions/scripts/focusElement.js +0 -46
- package/player/stepActions/scripts/html5dragAction.js +0 -56
- package/player/stepActions/scripts/html5dragActionV2.js +0 -312
- package/player/stepActions/scripts/runCode.js +0 -147
- package/player/stepActions/scripts/scroll.js +0 -90
- package/player/stepActions/scripts/selectOption.js +0 -51
- package/player/stepActions/scripts/setText.js +0 -415
- package/player/stepActions/scripts/wheel.js +0 -61
- package/player/stepActions/scrollStepAction.js +0 -96
- package/player/stepActions/selectOptionStepAction.js +0 -49
- package/player/stepActions/sfdcRecordedStepAction.js +0 -24
- package/player/stepActions/sfdcStepAction.js +0 -28
- package/player/stepActions/sleepStepAction.js +0 -12
- package/player/stepActions/specialKeyStepAction.js +0 -52
- package/player/stepActions/stepAction.js +0 -73
- package/player/stepActions/stepActionRegistrar.js +0 -111
- package/player/stepActions/submitStepAction.js +0 -12
- package/player/stepActions/tdkHybridStepAction.js +0 -18
- package/player/stepActions/textStepAction.js +0 -110
- package/player/stepActions/textValidationStepAction.js +0 -64
- package/player/stepActions/wheelStepAction.js +0 -41
- package/player/utils/cookieUtils.js +0 -39
- package/player/utils/eyeSdkService.js +0 -250
- package/player/utils/imageCaptureUtils.js +0 -267
- package/player/utils/screenshotUtils.js +0 -68
- package/player/utils/stepActionUtils.js +0 -90
- package/player/utils/windowUtils.js +0 -195
- package/player/webDriverUtils.js +0 -40
- package/player/webDriverUtils.test.js +0 -116
- package/player/webdriver.js +0 -976
- package/polyfills/Array.prototype.at.js +0 -13
- package/polyfills/index.js +0 -13
- package/processHandler.js +0 -79
- package/processHandler.test.js +0 -55
- package/reports/chromeReporter.js +0 -17
- package/reports/consoleReporter.js +0 -190
- package/reports/debugReporter.js +0 -82
- package/reports/jsonReporter.js +0 -55
- package/reports/junitReporter.js +0 -183
- package/reports/reporter.js +0 -166
- package/reports/reporterUtils.js +0 -54
- package/reports/teamCityReporter.js +0 -73
- package/runOptions.d.ts +0 -305
- package/runOptions.js +0 -1288
- package/runOptionsAgentFlow.js +0 -87
- package/runOptionsUtils.js +0 -60
- package/runner.js +0 -355
- package/runners/ParallelWorkerManager.js +0 -284
- package/runners/TestPlanRunner.js +0 -419
- package/runners/buildCodeTests.js +0 -159
- package/runners/runnerUtils.js +0 -81
- package/services/analyticsService.js +0 -96
- package/services/branchService.js +0 -29
- package/services/gridService.js +0 -357
- package/services/gridService.test.js +0 -357
- package/services/labFeaturesService.js +0 -64
- package/services/lambdatestService.js +0 -227
- package/services/lambdatestService.test.js +0 -353
- package/services/localRCASaver.js +0 -124
- package/stepPlayers/cliJsStepPlayback.js +0 -40
- package/stepPlayers/hybridStepPlayback.js +0 -140
- package/stepPlayers/nodePackageStepPlayback.js +0 -28
- package/stepPlayers/playwrightHybridStepPlayback.js +0 -61
- package/stepPlayers/puppeteerHybridStepPlayback.js +0 -76
- package/stepPlayers/remoteStepPlayback.js +0 -80
- package/stepPlayers/seleniumHybridStepPlayback.js +0 -84
- package/stepPlayers/tdkHybridStepPlayback.js +0 -112
- package/testRunHandler.js +0 -603
- package/testRunStatus.js +0 -567
- package/testimNpmDriver.js +0 -52
- package/utils/argsUtils.js +0 -91
- package/utils/argsUtils.test.js +0 -32
- package/utils/fsUtils.js +0 -174
- package/utils/index.js +0 -197
- package/utils/promiseUtils.js +0 -85
- package/utils/stringUtils.js +0 -98
- package/utils/stringUtils.test.js +0 -22
- package/utils/timeUtils.js +0 -25
- package/utils/utils.test.js +0 -27
- package/workers/BaseWorker.js +0 -498
- package/workers/BaseWorker.test.js +0 -186
- package/workers/WorkerAppium.js +0 -180
- package/workers/WorkerExtension.js +0 -192
- package/workers/WorkerExtensionSingleBrowser.js +0 -77
- package/workers/WorkerSelenium.js +0 -253
- package/workers/workerUtils.js +0 -20
package/reports/junitReporter.js
DELETED
|
@@ -1,183 +0,0 @@
|
|
|
1
|
-
/* eslint-disable no-console */
|
|
2
|
-
|
|
3
|
-
'use strict';
|
|
4
|
-
|
|
5
|
-
const xml2js = require('xml2js');
|
|
6
|
-
const fsPromises = require('fs/promises');
|
|
7
|
-
const utils = require('../utils');
|
|
8
|
-
const {
|
|
9
|
-
isAbortedTest, isSkippedTest, getFailedTests, isFailedTest, getFailureEvaluatingCount, getSkippedCount, getAbortedTests,
|
|
10
|
-
} = require('./reporterUtils');
|
|
11
|
-
const featureAvailabilityService = require('../commons/featureAvailabilityService');
|
|
12
|
-
|
|
13
|
-
class JunitReporter {
|
|
14
|
-
constructor(options, branchToUse) {
|
|
15
|
-
this.options = options;
|
|
16
|
-
this.classname = 'testim.io.test';
|
|
17
|
-
if (options.reportFileClassname) {
|
|
18
|
-
this.classname = options.reportFileClassname;
|
|
19
|
-
}
|
|
20
|
-
if (options.reportFileClassname === true) {
|
|
21
|
-
this.classname = ''; // specific case for passing empty string which makes junit-viewer display test name
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
this.branchToUse = branchToUse;
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
async createResultsReport(testResults) {
|
|
28
|
-
const reportFile = this.options.reportFile;
|
|
29
|
-
const projectId = this.options.project;
|
|
30
|
-
|
|
31
|
-
const reportText = await report(this.options.editorUrl, testResults, projectId, this.branchToUse, this.classname, this.options);
|
|
32
|
-
if (!reportFile) {
|
|
33
|
-
return undefined;
|
|
34
|
-
}
|
|
35
|
-
try {
|
|
36
|
-
await fsPromises.writeFile(reportFile, reportText);
|
|
37
|
-
console.log('JUnit XML file saved to', reportFile);
|
|
38
|
-
return testResults;
|
|
39
|
-
} catch (err) {
|
|
40
|
-
console.error('could not save report file', reportFile, err);
|
|
41
|
-
return testResults;
|
|
42
|
-
}
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
onAllTestPlansFinished(testPlanResults) {
|
|
46
|
-
return this.createResultsReport(testPlanResults);
|
|
47
|
-
}
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
function getPrintName(testResult) {
|
|
51
|
-
const testData = testResult.testData || {};
|
|
52
|
-
const testDataNumber = typeof testData.total === 'number' ? ` - ${testData.index} / ${testData.total} Data set` : '';
|
|
53
|
-
return `${testResult.name}${testDataNumber}`;
|
|
54
|
-
}
|
|
55
|
-
function getVisitedUrlsList(testResult) {
|
|
56
|
-
if (!testResult.visitedUrlsList) {
|
|
57
|
-
console.log('No URLs found:', 'Please contact our support team or remove the --urls flag from the CLI command');
|
|
58
|
-
}
|
|
59
|
-
const visitedUrls = testResult.visitedUrlsList || '';
|
|
60
|
-
return `${visitedUrls}`;
|
|
61
|
-
}
|
|
62
|
-
function getVisitedUrlsJson(testResult) {
|
|
63
|
-
const visitedUrls = testResult.visitedUrlsJson || '';
|
|
64
|
-
return `${visitedUrls}`;
|
|
65
|
-
}
|
|
66
|
-
async function report(editorUrl, testPlanResults, projectId, branch, classname, options) {
|
|
67
|
-
function createTestCaseObject(testResult) {
|
|
68
|
-
const testResultUrl = utils.getTestUrl(editorUrl, projectId, testResult.testId, testResult.resultId, branch);
|
|
69
|
-
const testResultObject = {
|
|
70
|
-
$: {
|
|
71
|
-
name: getPrintName(testResult),
|
|
72
|
-
classname,
|
|
73
|
-
time: utils.getDurationSec(testResult.duration),
|
|
74
|
-
},
|
|
75
|
-
};
|
|
76
|
-
|
|
77
|
-
testResultObject.$.ownedBy = testResult.testOwnerName;
|
|
78
|
-
testResultObject.$.ownerEmail = testResult.testOwnerEmail;
|
|
79
|
-
|
|
80
|
-
if (isFailedTest(testResult) || isAbortedTest(testResult)) {
|
|
81
|
-
const prefixMessage = `Step Failed: ${testResult.failureReason || testResult.reason}`;
|
|
82
|
-
const message = isFailedTest(testResult) ? `${prefixMessage} More info at: ${testResultUrl}` : prefixMessage;
|
|
83
|
-
testResultObject.failure = {
|
|
84
|
-
$: {
|
|
85
|
-
message,
|
|
86
|
-
},
|
|
87
|
-
};
|
|
88
|
-
}
|
|
89
|
-
if (isSkippedTest(testResult) && utils.isQuarantineAndNotRemoteRun(testResult, options) && featureAvailabilityService.isTestStatusEnabled) {
|
|
90
|
-
testResultObject.skipped = {};
|
|
91
|
-
}
|
|
92
|
-
|
|
93
|
-
testResultObject['system-out'] = testResultUrl;
|
|
94
|
-
|
|
95
|
-
if (options.urls) {
|
|
96
|
-
testResultObject['visited-urls-list'] = getVisitedUrlsList(testResult);
|
|
97
|
-
testResultObject['visited-urls-json'] = getVisitedUrlsJson(testResult);
|
|
98
|
-
}
|
|
99
|
-
|
|
100
|
-
return testResultObject;
|
|
101
|
-
}
|
|
102
|
-
|
|
103
|
-
function createTestSuiteObject(testPlanResult) {
|
|
104
|
-
const { results, testPlanName, configName } = testPlanResult;
|
|
105
|
-
const testResults = results || {};
|
|
106
|
-
const suiteName = configName && testPlanName ? `${testPlanName} with config '${configName}'` : testPlanName;
|
|
107
|
-
const testSuiteAttributes = {
|
|
108
|
-
name: suiteName || 'selenium run',
|
|
109
|
-
tests: getTestCount(testResults),
|
|
110
|
-
failure: getFailedCount(testResults),
|
|
111
|
-
timestamp: getSuiteTimestamp(testPlanResults),
|
|
112
|
-
};
|
|
113
|
-
if (featureAvailabilityService.isTestStatusEnabled) {
|
|
114
|
-
testSuiteAttributes.skipped = getSkippedCount(testResults, options);
|
|
115
|
-
const failureEvaluatingCount = getFailureEvaluatingCount(testResults);
|
|
116
|
-
testSuiteAttributes.failure -= failureEvaluatingCount;
|
|
117
|
-
testSuiteAttributes['failure-evaluating'] = failureEvaluatingCount;
|
|
118
|
-
}
|
|
119
|
-
return {
|
|
120
|
-
$: testSuiteAttributes,
|
|
121
|
-
testcase: Object.keys(testResults).map(resultId => createTestCaseObject(testResults[resultId])),
|
|
122
|
-
};
|
|
123
|
-
}
|
|
124
|
-
|
|
125
|
-
function getSuiteTimestamp(testResults) {
|
|
126
|
-
const startTimeArr = Object.keys(testResults).map(resultId => testResults[resultId].startTime);
|
|
127
|
-
const minTestStartTime = Math.min.apply(null, startTimeArr);
|
|
128
|
-
return minTestStartTime ? new Date(minTestStartTime).toISOString() : new Date().toISOString();
|
|
129
|
-
}
|
|
130
|
-
|
|
131
|
-
function getTestCount(testResults) {
|
|
132
|
-
return Object.keys(testResults).length;
|
|
133
|
-
}
|
|
134
|
-
|
|
135
|
-
function getFailedCount(testResults) {
|
|
136
|
-
return getFailedTests(testResults).length + getAbortedTests(testResults).length;
|
|
137
|
-
}
|
|
138
|
-
|
|
139
|
-
const testResultObject = {
|
|
140
|
-
testsuites: {
|
|
141
|
-
testsuite: testPlanResults.map(testPlanResult => createTestSuiteObject(testPlanResult)),
|
|
142
|
-
},
|
|
143
|
-
};
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
try {
|
|
147
|
-
const builder = new xml2js.Builder();
|
|
148
|
-
const jUnitXmlReporter = builder.buildObject(testResultObject);
|
|
149
|
-
return jUnitXmlReporter;
|
|
150
|
-
} catch (err) {
|
|
151
|
-
return createErrorjUnitReporter(err);
|
|
152
|
-
}
|
|
153
|
-
}
|
|
154
|
-
|
|
155
|
-
function createErrorjUnitReporter(err) {
|
|
156
|
-
const builder = new xml2js.Builder();
|
|
157
|
-
const errorJunitObject = {
|
|
158
|
-
testsuites: {
|
|
159
|
-
testsuite: {
|
|
160
|
-
$: {
|
|
161
|
-
name: 'selenium run',
|
|
162
|
-
tests: 1,
|
|
163
|
-
failure: 1,
|
|
164
|
-
timestamp: Date.now(),
|
|
165
|
-
},
|
|
166
|
-
testcase: {
|
|
167
|
-
$: {
|
|
168
|
-
name: 'junit reporter generator failed',
|
|
169
|
-
classname: 'testim.io.jUnitXmlReporter',
|
|
170
|
-
},
|
|
171
|
-
error: {
|
|
172
|
-
$: {
|
|
173
|
-
message: err.message,
|
|
174
|
-
},
|
|
175
|
-
},
|
|
176
|
-
},
|
|
177
|
-
},
|
|
178
|
-
},
|
|
179
|
-
};
|
|
180
|
-
return builder.buildObject(errorJunitObject);
|
|
181
|
-
}
|
|
182
|
-
|
|
183
|
-
module.exports = JunitReporter;
|
package/reports/reporter.js
DELETED
|
@@ -1,166 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
const logger = require('../commons/logger').getLogger('reporter');
|
|
4
|
-
|
|
5
|
-
class Reporter {
|
|
6
|
-
setOptions(options, branchToUse) {
|
|
7
|
-
this.reporters = [];
|
|
8
|
-
const optReporters = options.reporters;
|
|
9
|
-
|
|
10
|
-
const DebugReporter = require('./debugReporter');
|
|
11
|
-
this.reporters.push(new DebugReporter(options));
|
|
12
|
-
|
|
13
|
-
if (optReporters === undefined || optReporters.length === 0) {
|
|
14
|
-
const ConsoleReporter = require('./consoleReporter');
|
|
15
|
-
this.reporters.push(new ConsoleReporter(options, branchToUse));
|
|
16
|
-
if (options?.reportFile !== undefined) {
|
|
17
|
-
const JunitReporter = require('./junitReporter');
|
|
18
|
-
this.reporters.push(new JunitReporter(options, branchToUse));
|
|
19
|
-
}
|
|
20
|
-
} else {
|
|
21
|
-
if (optReporters.includes('teamcity')) {
|
|
22
|
-
const TeamCityReporter = require('./teamCityReporter');
|
|
23
|
-
this.reporters.push(new TeamCityReporter(options));
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
if (optReporters.includes('console')) {
|
|
27
|
-
const ConsoleReporter = require('./consoleReporter');
|
|
28
|
-
this.reporters.push(new ConsoleReporter(options, branchToUse));
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
if (optReporters.includes('junit')) {
|
|
32
|
-
const JunitReporter = require('./junitReporter');
|
|
33
|
-
this.reporters.push(new JunitReporter(options, branchToUse));
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
if (optReporters.includes('json')) {
|
|
37
|
-
const JsonReporter = require('./jsonReporter');
|
|
38
|
-
this.reporters.push(new JsonReporter(options));
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
if (optReporters.includes('chrome')) {
|
|
42
|
-
const { ChromeReporter } = require('./chromeReporter');
|
|
43
|
-
this.reporters.push(new ChromeReporter(options, branchToUse));
|
|
44
|
-
}
|
|
45
|
-
}
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
async onTestPlanFinished(testResults, testPlanName, startTime, executionId, isAnonymous, isCodeMode, childTestResults) {
|
|
49
|
-
let results = {};
|
|
50
|
-
|
|
51
|
-
// TODO: remove mutation of testResults from the Reporter
|
|
52
|
-
if (childTestResults) {
|
|
53
|
-
const childValues = Object.values(childTestResults);
|
|
54
|
-
if (childValues.length > 0) {
|
|
55
|
-
for (const child of Object.values(childTestResults)) {
|
|
56
|
-
results[child.id] = child;
|
|
57
|
-
}
|
|
58
|
-
for (const parent of Object.keys(testResults)) {
|
|
59
|
-
if (!childValues.some(c => c.parentResultId !== parent)) {
|
|
60
|
-
results[parent] = testResults[parent];
|
|
61
|
-
}
|
|
62
|
-
}
|
|
63
|
-
} else {
|
|
64
|
-
logger.warn('childTestResults is not array');
|
|
65
|
-
results = testResults;
|
|
66
|
-
}
|
|
67
|
-
} else {
|
|
68
|
-
results = testResults;
|
|
69
|
-
}
|
|
70
|
-
for (const reporter of this.reporters) {
|
|
71
|
-
if (reporter?.onTestPlanFinished) {
|
|
72
|
-
const duration = Date.now() - (startTime || 0);
|
|
73
|
-
await reporter.onTestPlanFinished(results, testPlanName, duration, executionId, isAnonymous, isCodeMode);
|
|
74
|
-
}
|
|
75
|
-
}
|
|
76
|
-
}
|
|
77
|
-
|
|
78
|
-
async onTestPlanStarted(beforeTests, tests, afterTests, testPlanName, executionId, isAnonymous, configName, isCodeMode) {
|
|
79
|
-
for (const reporter of this.reporters) {
|
|
80
|
-
if (reporter?.onTestPlanStarted) {
|
|
81
|
-
await reporter.onTestPlanStarted(beforeTests, tests, afterTests, testPlanName, executionId, isAnonymous, configName, isCodeMode);
|
|
82
|
-
}
|
|
83
|
-
}
|
|
84
|
-
}
|
|
85
|
-
|
|
86
|
-
async onGetSlot(workerId, browser) {
|
|
87
|
-
for (const reporter of this.reporters) {
|
|
88
|
-
if (reporter?.onGetSlot) {
|
|
89
|
-
await reporter.onGetSlot(workerId, browser);
|
|
90
|
-
}
|
|
91
|
-
}
|
|
92
|
-
}
|
|
93
|
-
|
|
94
|
-
async onGetSession(workerId, testName, mode) {
|
|
95
|
-
for (const reporter of this.reporters) {
|
|
96
|
-
if (reporter?.onGetSession) {
|
|
97
|
-
await reporter.onGetSession(workerId, testName, mode);
|
|
98
|
-
}
|
|
99
|
-
}
|
|
100
|
-
}
|
|
101
|
-
|
|
102
|
-
async onWaitToTestComplete(workerId, isCodeMode, debuggerAddress) {
|
|
103
|
-
for (const reporter of this.reporters) {
|
|
104
|
-
if (reporter?.onWaitToTestComplete) {
|
|
105
|
-
await reporter.onWaitToTestComplete(workerId, isCodeMode, debuggerAddress);
|
|
106
|
-
}
|
|
107
|
-
}
|
|
108
|
-
}
|
|
109
|
-
|
|
110
|
-
async onWaitToTestStart(workerId) {
|
|
111
|
-
for (const reporter of this.reporters) {
|
|
112
|
-
if (reporter?.onWaitToTestStart) {
|
|
113
|
-
await reporter.onWaitToTestStart(workerId);
|
|
114
|
-
}
|
|
115
|
-
}
|
|
116
|
-
}
|
|
117
|
-
|
|
118
|
-
async onAllTestPlansFinished(testPlanResults) {
|
|
119
|
-
// TODO: remove mutation of testPlanResults from the Reporter
|
|
120
|
-
for (const result of testPlanResults) {
|
|
121
|
-
if (result.childTestResults) {
|
|
122
|
-
result.results = {};
|
|
123
|
-
const childValues = Object.values(result.childTestResults);
|
|
124
|
-
for (const child of childValues) {
|
|
125
|
-
result.results[child.id] = child;
|
|
126
|
-
}
|
|
127
|
-
for (const parent of Object.keys(testPlanResults)) {
|
|
128
|
-
if (!childValues.some(c => c.parentResultId !== parent)) {
|
|
129
|
-
result.results[parent] = testPlanResults[parent];
|
|
130
|
-
}
|
|
131
|
-
}
|
|
132
|
-
}
|
|
133
|
-
}
|
|
134
|
-
|
|
135
|
-
for (const reporter of this.reporters) {
|
|
136
|
-
if (reporter?.onAllTestPlansFinished) {
|
|
137
|
-
await reporter.onAllTestPlansFinished(testPlanResults);
|
|
138
|
-
}
|
|
139
|
-
}
|
|
140
|
-
}
|
|
141
|
-
}
|
|
142
|
-
|
|
143
|
-
function addHook(name) {
|
|
144
|
-
Reporter.prototype[name] = async function (...args) {
|
|
145
|
-
for (const reporter of this.reporters) {
|
|
146
|
-
if (reporter?.[name]) {
|
|
147
|
-
await reporter[name](...args);
|
|
148
|
-
}
|
|
149
|
-
}
|
|
150
|
-
};
|
|
151
|
-
}
|
|
152
|
-
|
|
153
|
-
addHook('onGetBrowserFailure');
|
|
154
|
-
addHook('onGetBrowserSuccess');
|
|
155
|
-
addHook('onTestPlanStarted');
|
|
156
|
-
addHook('onGetSlot');
|
|
157
|
-
addHook('onGetSession');
|
|
158
|
-
addHook('onTestFinished');
|
|
159
|
-
addHook('onTestFailed');
|
|
160
|
-
addHook('onTestPassed');
|
|
161
|
-
addHook('onTestStarted');
|
|
162
|
-
addHook('onTestIgnored');
|
|
163
|
-
addHook('onWaitToTestStart');
|
|
164
|
-
addHook('onWaitToTestComplete');
|
|
165
|
-
|
|
166
|
-
module.exports = new Reporter();
|
package/reports/reporterUtils.js
DELETED
|
@@ -1,54 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
const utils = require('../utils');
|
|
4
|
-
const constants = require('../commons/constants');
|
|
5
|
-
|
|
6
|
-
const isFailedTest = (testResult) => {
|
|
7
|
-
const { status, sessionType, success } = testResult;
|
|
8
|
-
return status === constants.runnerTestStatus.FAILED || (sessionType === constants.sessionType.CODEFUL && success === false);
|
|
9
|
-
};
|
|
10
|
-
|
|
11
|
-
const isAbortedTest = (testResult) => {
|
|
12
|
-
const { status } = testResult;
|
|
13
|
-
return status === constants.runnerTestStatus.ABORTED;
|
|
14
|
-
};
|
|
15
|
-
|
|
16
|
-
const isPassedTest = (testResult) => {
|
|
17
|
-
const { status, sessionType, success } = testResult;
|
|
18
|
-
return status === constants.runnerTestStatus.PASSED || (sessionType === constants.sessionType.CODEFUL && success === true);
|
|
19
|
-
};
|
|
20
|
-
|
|
21
|
-
const isSkippedTest = (testResult) => testResult.runnerStatus === constants.runnerTestStatus.SKIPPED;
|
|
22
|
-
|
|
23
|
-
const isContainer = (testResult, isCodeMode) => {
|
|
24
|
-
if (!isCodeMode) {
|
|
25
|
-
return false;
|
|
26
|
-
}
|
|
27
|
-
return !testResult.runConfig;
|
|
28
|
-
};
|
|
29
|
-
|
|
30
|
-
const isEvaluatingTest = (testResult) => testResult.testStatus === constants.testStatus.EVALUATING;
|
|
31
|
-
|
|
32
|
-
const getSkippedCount = (testResults, options) => Object.values(testResults).filter(testResult => isSkippedTest(testResult) && utils.isQuarantineAndNotRemoteRun(testResult, options)).length;
|
|
33
|
-
|
|
34
|
-
const getFailureEvaluatingCount = (testResults) => Object.values(testResults).filter(testResult => isFailedTest(testResult) && isEvaluatingTest(testResult)).length;
|
|
35
|
-
|
|
36
|
-
const getFailedTests = (testResults, isCodeMode) => Object.values(testResults).filter(testResult => isFailedTest(testResult) && !isContainer(testResult, isCodeMode));
|
|
37
|
-
|
|
38
|
-
const getPassedTests = (testResults, isCodeMode) => Object.values(testResults).filter(testResult => isPassedTest(testResult) && !isContainer(testResult, isCodeMode));
|
|
39
|
-
|
|
40
|
-
const getAbortedTests = (testResults, isCodeMode) => Object.values(testResults).filter(testResult => isAbortedTest(testResult) && !isContainer(testResult, isCodeMode));
|
|
41
|
-
|
|
42
|
-
module.exports = {
|
|
43
|
-
isFailedTest,
|
|
44
|
-
isAbortedTest,
|
|
45
|
-
isPassedTest,
|
|
46
|
-
isEvaluatingTest,
|
|
47
|
-
isSkippedTest,
|
|
48
|
-
|
|
49
|
-
getFailedTests,
|
|
50
|
-
getPassedTests,
|
|
51
|
-
getAbortedTests,
|
|
52
|
-
getSkippedCount,
|
|
53
|
-
getFailureEvaluatingCount,
|
|
54
|
-
};
|
|
@@ -1,73 +0,0 @@
|
|
|
1
|
-
/* eslint-disable no-console */
|
|
2
|
-
const logger = require('../commons/logger').getLogger('team-city-reporter');
|
|
3
|
-
|
|
4
|
-
function tidy(text) {
|
|
5
|
-
if (!text) {
|
|
6
|
-
return '';
|
|
7
|
-
}
|
|
8
|
-
return text
|
|
9
|
-
.replace(/\|/g, '||')
|
|
10
|
-
.replace(/'/g, "|'")
|
|
11
|
-
.replace(/\n/g, '|n')
|
|
12
|
-
.replace(/\r/g, '|r')
|
|
13
|
-
.replace(/\u0085/g, '|x')
|
|
14
|
-
.replace(/\u2028/g, '|l')
|
|
15
|
-
.replace(/\u2029/g, '|p')
|
|
16
|
-
.replace(/\[/g, '|[')
|
|
17
|
-
.replace(/\]/g, '|]');
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
class TeamCityReporter {
|
|
21
|
-
constructor(options) {
|
|
22
|
-
this.options = options;
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
getPrintName(test) {
|
|
26
|
-
const testConfig = test.config || {};
|
|
27
|
-
const testDataNumber = typeof testConfig.testDataTotal === 'number' ? ` - ${testConfig.testDataIndex} / ${testConfig.testDataTotal} Data set` : '';
|
|
28
|
-
const teamCityName = `${test.name} (${test.testId})${testDataNumber}`;
|
|
29
|
-
return tidy(teamCityName);
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
onTestStarted(test, workerId, isRerun, isCodeMode, resultId) {
|
|
33
|
-
if (isRerun) {
|
|
34
|
-
logger.debug('skip report test started because is rerun');
|
|
35
|
-
return;
|
|
36
|
-
}
|
|
37
|
-
const name = this.getPrintName(test);
|
|
38
|
-
console.log(`##teamcity[testStarted name='${name}' captureStandardOutput='true' flowId='${resultId}']`);
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
onTestFailed(test, failureReason, testurl, testId, isRerun, resultId) {
|
|
42
|
-
if (isRerun) {
|
|
43
|
-
logger.debug('skip report test failed because is rerun');
|
|
44
|
-
return;
|
|
45
|
-
}
|
|
46
|
-
const name = this.getPrintName(test);
|
|
47
|
-
console.log(`##teamcity[testFailed name='${name}' message='${tidy(failureReason)}' details='${tidy(testurl)}' flowId='${resultId}']`);
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
onTestFinished(test, workerId, isRerun) {
|
|
51
|
-
if (isRerun) {
|
|
52
|
-
logger.debug('skip report test finished because is rerun');
|
|
53
|
-
return;
|
|
54
|
-
}
|
|
55
|
-
const name = this.getPrintName(test);
|
|
56
|
-
console.log(`##teamcity[testFinished name='${name}' duration='${test.duration}' flowId='${test.resultId}']`);
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
onTestIgnored(workerId, test, message = 'ignore') {
|
|
60
|
-
const name = this.getPrintName(test);
|
|
61
|
-
console.log(`##teamcity[testIgnored name='${name}' message='${tidy(message)}']`);
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
onTestPlanStarted(beforeTests, tests, afterTests, testPlanName) {
|
|
65
|
-
console.log(`##teamcity[testSuiteStarted name='${tidy(testPlanName)}']`);
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
onTestPlanFinished(testResults, testPlanName) {
|
|
69
|
-
console.log(`##teamcity[testSuiteFinished name='${tidy(testPlanName)}']`);
|
|
70
|
-
}
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
module.exports = TeamCityReporter;
|