@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
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
/* eslint-disable no-extend-native */
|
|
2
|
-
|
|
3
|
-
Array.prototype.at = Array.prototype.at || function (index) {
|
|
4
|
-
const relativeIndex = Number.isInteger(index) ? index : 0;
|
|
5
|
-
|
|
6
|
-
const indexToRead = relativeIndex >= 0 ? relativeIndex : this.length + relativeIndex;
|
|
7
|
-
|
|
8
|
-
if (indexToRead < 0 || indexToRead >= this.length) {
|
|
9
|
-
return undefined;
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
return this[indexToRead];
|
|
13
|
-
};
|
package/polyfills/index.js
DELETED
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
require('./Array.prototype.at');
|
|
2
|
-
const xhr2 = require('../commons/xhr2');
|
|
3
|
-
const { performance } = require('perf_hooks');
|
|
4
|
-
|
|
5
|
-
global.xhr2 = xhr2;
|
|
6
|
-
global.XMLHttpRequest = xhr2;
|
|
7
|
-
|
|
8
|
-
// TODO [engine:node@>=16.6.0]: can be removed once we support 16+
|
|
9
|
-
global.performance = performance;
|
|
10
|
-
|
|
11
|
-
if (typeof Blob === 'undefined') {
|
|
12
|
-
global.Blob = require('buffer').Blob;
|
|
13
|
-
}
|
package/processHandler.js
DELETED
|
@@ -1,79 +0,0 @@
|
|
|
1
|
-
/* eslint-disable no-console */
|
|
2
|
-
|
|
3
|
-
'use strict';
|
|
4
|
-
|
|
5
|
-
const { getLogger } = require('./commons/logger');
|
|
6
|
-
const { promiseTimeout, promiseMap } = require('./utils');
|
|
7
|
-
|
|
8
|
-
const logger = getLogger('process-handler');
|
|
9
|
-
/** @type {Array<() => PromiseLike<void>>} */
|
|
10
|
-
const exitHooks = [];
|
|
11
|
-
|
|
12
|
-
/**
|
|
13
|
-
* @param {(e: any) => void} onExit
|
|
14
|
-
* @param {NodeJS.Process=} _process
|
|
15
|
-
*/
|
|
16
|
-
module.exports.registerProcessForCleanup = function (onExit, _process = process) {
|
|
17
|
-
async function cleanup(err) {
|
|
18
|
-
// give cleanup and socket reports a chance to run
|
|
19
|
-
await promiseTimeout(promiseMap(exitHooks, hook => hook()), 10000).catch(() => null);
|
|
20
|
-
onExit(err);
|
|
21
|
-
}
|
|
22
|
-
_process.on('uncaughtException', async (err) => {
|
|
23
|
-
logger.error('Caught exception', { err });
|
|
24
|
-
console.log('Uncaught exception');
|
|
25
|
-
if (err.message) {
|
|
26
|
-
console.log('Message =', err.message);
|
|
27
|
-
}
|
|
28
|
-
if (err.reason) {
|
|
29
|
-
console.log('Reason =', err.reason);
|
|
30
|
-
}
|
|
31
|
-
await cleanup(err);
|
|
32
|
-
});
|
|
33
|
-
|
|
34
|
-
_process.on('unhandledRejection', (reason) => {
|
|
35
|
-
// rollout manages promises incorrectly and generates unhandled rejections from within their code
|
|
36
|
-
logger.fatal('Caught unhandled promise rejection', reason);
|
|
37
|
-
//TODO(benji) - this is a pretty shitty way to detect this error since rollout can change their API endpoint
|
|
38
|
-
if (reason?.message?.includes('ENOTFOUND x-api.rollout.io')) {
|
|
39
|
-
// this is not a fatal error - we recover from this in feature-flags service
|
|
40
|
-
return;
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
throw reason;
|
|
44
|
-
});
|
|
45
|
-
|
|
46
|
-
_process.on('rejectionHandled', () => {
|
|
47
|
-
logger.error('Caught rejection handled');
|
|
48
|
-
});
|
|
49
|
-
|
|
50
|
-
_process.once('SIGTERM', () => {
|
|
51
|
-
const msg = 'Runner aborted - SIGTERM event';
|
|
52
|
-
const err = new Error(msg);
|
|
53
|
-
logger.error(msg);
|
|
54
|
-
cleanup(err);
|
|
55
|
-
throw err;
|
|
56
|
-
});
|
|
57
|
-
|
|
58
|
-
_process.once('SIGINT', () => {
|
|
59
|
-
const msg = 'Runner aborted - SIGINT event';
|
|
60
|
-
const err = new Error(msg);
|
|
61
|
-
logger.error(msg);
|
|
62
|
-
cleanup(err);
|
|
63
|
-
throw err;
|
|
64
|
-
});
|
|
65
|
-
|
|
66
|
-
// One time self-call is expected :(
|
|
67
|
-
_process.once('exit', (e) => {
|
|
68
|
-
onExit(e);
|
|
69
|
-
});
|
|
70
|
-
};
|
|
71
|
-
|
|
72
|
-
/** @param {() => PromiseLike<void>} hook */
|
|
73
|
-
module.exports.registerExitHook = function (hook) {
|
|
74
|
-
exitHooks.push(hook);
|
|
75
|
-
};
|
|
76
|
-
|
|
77
|
-
module.exports.reset = function () {
|
|
78
|
-
exitHooks.splice(0, exitHooks.length);
|
|
79
|
-
};
|
package/processHandler.test.js
DELETED
|
@@ -1,55 +0,0 @@
|
|
|
1
|
-
const EventEmitter = require('events');
|
|
2
|
-
const processHandler = require('./processHandler');
|
|
3
|
-
const { delay } = require('./utils');
|
|
4
|
-
const { expect, sinon } = require('../test/utils/testUtils');
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
class Process extends EventEmitter {
|
|
8
|
-
constructor() {
|
|
9
|
-
super();
|
|
10
|
-
this.stdout = new EventEmitter();
|
|
11
|
-
this.stderr = new EventEmitter();
|
|
12
|
-
}
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
describe('testimTunnel', () => {
|
|
16
|
-
let process;
|
|
17
|
-
let onExitMock;
|
|
18
|
-
|
|
19
|
-
beforeEach(() => {
|
|
20
|
-
process = new Process();
|
|
21
|
-
onExitMock = sinon.spy();
|
|
22
|
-
processHandler.registerProcessForCleanup(onExitMock, process);
|
|
23
|
-
});
|
|
24
|
-
|
|
25
|
-
afterEach(async () => {
|
|
26
|
-
await delay(10);
|
|
27
|
-
expect(onExitMock).to.have.been.calledOnce;
|
|
28
|
-
processHandler.reset();
|
|
29
|
-
});
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
it('should register a SIGTERM handler', (done) => {
|
|
33
|
-
processHandler.registerExitHook(done);
|
|
34
|
-
expect(() => process.emit('SIGTERM')).to.throw('Runner aborted - SIGTERM event');
|
|
35
|
-
});
|
|
36
|
-
it('should register a SIGINT handler', (done) => {
|
|
37
|
-
processHandler.registerExitHook(done);
|
|
38
|
-
expect(() => process.emit('SIGINT')).to.throw('Runner aborted - SIGINT event');
|
|
39
|
-
});
|
|
40
|
-
it('should register a unhandledRejection handler', () => {
|
|
41
|
-
expect(() => process.emit('unhandledRejection', new Error('reason'))).to.throw('reason');
|
|
42
|
-
onExitMock();
|
|
43
|
-
});
|
|
44
|
-
it('should register a uncaughtException handler', (done) => {
|
|
45
|
-
processHandler.registerExitHook(done);
|
|
46
|
-
expect(() => process.emit('uncaughtException', new Error())).not.to.throw();
|
|
47
|
-
});
|
|
48
|
-
it('should do nothing on rejectionHandled', () => {
|
|
49
|
-
expect(() => process.emit('rejectionHandled')).not.to.throw();
|
|
50
|
-
onExitMock();
|
|
51
|
-
});
|
|
52
|
-
it('should register a exit handler', () => {
|
|
53
|
-
expect(() => process.emit('exit')).not.to.throw();
|
|
54
|
-
});
|
|
55
|
-
});
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
const utils = require('../utils');
|
|
2
|
-
const { launchChrome } = require('../commons/chrome-launcher');
|
|
3
|
-
|
|
4
|
-
module.exports.ChromeReporter = class ChromeReporter {
|
|
5
|
-
constructor(options, branchToUse) {
|
|
6
|
-
this.options = options;
|
|
7
|
-
this.branchToUse = branchToUse;
|
|
8
|
-
}
|
|
9
|
-
|
|
10
|
-
onTestStarted(test, workerId, isRerun, isCodeMode) {
|
|
11
|
-
if(isCodeMode) {
|
|
12
|
-
return
|
|
13
|
-
}
|
|
14
|
-
const testUrl = utils.getTestUrl(this.options.editorUrl, this.options.project, test.testId, test.resultId, this.branchToUse);
|
|
15
|
-
return launchChrome(testUrl);
|
|
16
|
-
}
|
|
17
|
-
};
|
|
@@ -1,190 +0,0 @@
|
|
|
1
|
-
/* eslint-disable no-console */
|
|
2
|
-
const chalk = require('chalk');
|
|
3
|
-
const _ = require('lodash');
|
|
4
|
-
|
|
5
|
-
const utils = require('../utils');
|
|
6
|
-
const constants = require('../commons/constants');
|
|
7
|
-
const featureAvailabilityService = require('../commons/featureAvailabilityService');
|
|
8
|
-
const { getAbortedTests, getFailedTests, getPassedTests, getFailureEvaluatingCount, getSkippedCount } = require('./reporterUtils');
|
|
9
|
-
|
|
10
|
-
const colorize = { success: chalk.green, warn: chalk.yellow, error: chalk.red };
|
|
11
|
-
const { CLI_MODE } = constants;
|
|
12
|
-
const DEVICE = 'device';
|
|
13
|
-
|
|
14
|
-
class ConsoleReporter {
|
|
15
|
-
constructor(options, branchToUse) {
|
|
16
|
-
this.options = options;
|
|
17
|
-
this.config = {
|
|
18
|
-
showWorkerNames: options.parallel > 1, // we show worker names when there is more than one worker
|
|
19
|
-
};
|
|
20
|
-
this.branchToUse = branchToUse;
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
toWorkerIdPrefix(workerId) {
|
|
24
|
-
return this.config.showWorkerNames ? `W:${workerId}` : '';
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
printWorkerDivider() {
|
|
28
|
-
console.log('-'.repeat(process.stdout.columns || 83));
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
onTestStarted(test, workerId, isRerun, isCodeMode) {
|
|
32
|
-
const type = isCodeMode ? 'File' : 'Test';
|
|
33
|
-
const testIdLabel = test.isTestsContainer ? '' : `(${test.testId})`;
|
|
34
|
-
const testUrlLabel = test.isTestsContainer ? '' : `url: ${chalk.underline(utils.getTestUrl(this.options.editorUrl, this.options.project, test.testId, test.resultId, this.branchToUse))}`;
|
|
35
|
-
console.log(this.toWorkerIdPrefix(workerId), `${type} "${test.name}" started ${testIdLabel} ${testUrlLabel}`.trim());
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
onTestFinished(test, workerId, isRerun, isCodeMode) {
|
|
39
|
-
if (isCodeMode) {
|
|
40
|
-
// ignore print of file run done
|
|
41
|
-
return;
|
|
42
|
-
}
|
|
43
|
-
const testStatus = test.success ? constants.runnerTestStatus.PASSED : constants.runnerTestStatus.FAILED;
|
|
44
|
-
const testIdLabel = test.isTestsContainer ? ' ' : `(${test.testId})`;
|
|
45
|
-
const color = colorize[test.success ? 'success' : 'error'];
|
|
46
|
-
|
|
47
|
-
console.log(color(this.toWorkerIdPrefix(workerId), `Test "${test.name}" finished status: ${testStatus} ${testIdLabel} duration: ${utils.getDuration(test.duration)}`));
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
printAllFailedTests(failedTests) {
|
|
51
|
-
if (failedTests.length > 0) {
|
|
52
|
-
const failedTestStrings = failedTests.map(failedTest => {
|
|
53
|
-
const testUrl = utils.getTestUrl(this.options.editorUrl, this.options.project, failedTest.testId, failedTest.resultId, this.branchToUse);
|
|
54
|
-
if (failedTest.isTestsContainer) {
|
|
55
|
-
return failedTest.name; // no working url
|
|
56
|
-
}
|
|
57
|
-
return `${failedTest.name} : ${testUrl}`;
|
|
58
|
-
});
|
|
59
|
-
console.log(colorize.error('Failed runs are:'));
|
|
60
|
-
console.log(colorize.error(failedTestStrings.join('\n\r')));
|
|
61
|
-
}
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
onTestPlanFinished(testResults, testPlanName, duration, executionId, isAnonymous, isCodeMode) {
|
|
65
|
-
const failedTests = getFailedTests(testResults, isCodeMode);
|
|
66
|
-
const passedTests = getPassedTests(testResults, isCodeMode);
|
|
67
|
-
const abortedTests = getAbortedTests(testResults, isCodeMode);
|
|
68
|
-
|
|
69
|
-
const passed = passedTests.length;
|
|
70
|
-
const aborted = abortedTests.length;
|
|
71
|
-
let failed = failedTests.length;
|
|
72
|
-
let failedEvaluatingString = '';
|
|
73
|
-
let skippedString = '';
|
|
74
|
-
if (featureAvailabilityService.isTestStatusEnabled) {
|
|
75
|
-
const failureEvaluatingCount = getFailureEvaluatingCount(testResults);
|
|
76
|
-
failedEvaluatingString = ` FAILED-EVALUATING: ${failureEvaluatingCount}`;
|
|
77
|
-
failed -= failureEvaluatingCount;
|
|
78
|
-
|
|
79
|
-
const skippedCount = getSkippedCount(testResults, this.options);
|
|
80
|
-
skippedString = ` SKIPPED: ${skippedCount}`;
|
|
81
|
-
}
|
|
82
|
-
|
|
83
|
-
const planName = this.buildTestPlanName(isAnonymous, testPlanName, isCodeMode);
|
|
84
|
-
|
|
85
|
-
let message;
|
|
86
|
-
const color = colorize[failed ? 'error' : 'success'];
|
|
87
|
-
|
|
88
|
-
if (isCodeMode || planName.trim() === '' || planName.trim() === 'Anonymous') {
|
|
89
|
-
message = `Tests completed. PASSED: ${passed} FAILED: ${failed}${failedEvaluatingString} ABORTED: ${aborted}${skippedString} Duration: ${utils.getDuration(duration)} (Execution ID: ${executionId})`;
|
|
90
|
-
} else {
|
|
91
|
-
message = `Test plan${planName} completed PASSED: ${passed} FAILED: ${failed}${failedEvaluatingString} ABORTED: ${aborted}${skippedString} Duration: ${utils.getDuration(duration)} (${executionId})`;
|
|
92
|
-
}
|
|
93
|
-
|
|
94
|
-
this.printWorkerDivider();
|
|
95
|
-
console.log(color(message));
|
|
96
|
-
this.printWorkerDivider();
|
|
97
|
-
|
|
98
|
-
this.printAllFailedTests(failedTests);
|
|
99
|
-
}
|
|
100
|
-
|
|
101
|
-
buildTestPlanName(isAnonymous, testPlanName, isCodeMode) {
|
|
102
|
-
if (isCodeMode) {
|
|
103
|
-
return '';
|
|
104
|
-
}
|
|
105
|
-
const suitesString = _.isEmpty(this.options.suites) ? '' : `Suite: ${this.options.suites}`;
|
|
106
|
-
const labelsString = _.isEmpty(this.options.label) ? '' : `Label: ${this.options.label}`;
|
|
107
|
-
const namesString = _.isEmpty(this.options.name) ? '' : `Name: ${this.options.name}`;
|
|
108
|
-
const testIdString = _.isEmpty(this.options.testId) ? '' : `Test Id: ${this.options.testId}`;
|
|
109
|
-
return isAnonymous ? ` anonymous (${namesString}${namesString && labelsString ? ', ' : ''}${labelsString}${suitesString && labelsString ? ', ' : ''}${suitesString}${testIdString && suitesString ? ', ' : ''}${testIdString})` : ` '${testPlanName}'`;
|
|
110
|
-
}
|
|
111
|
-
|
|
112
|
-
onTestPlanStarted(beforeTests, tests, afterTests, testPlanName, executionId, isAnonymous, configName, isCodeMode) {
|
|
113
|
-
const writeTestList = (testList) => {
|
|
114
|
-
testList.forEach((test, index) => {
|
|
115
|
-
const ds = test.testData && test.testData.index ? `- ${test.testData.index} / ${test.testData.total} Data set` : '';
|
|
116
|
-
const testIdLabel = isCodeMode ? '' : `(${test.testId})`;
|
|
117
|
-
console.log('\t', index + 1, ':', `${test.name}${utils.isQuarantineAndNotRemoteRun(test, this.options) ? '-quarantine' : ''}`, testIdLabel, ds);
|
|
118
|
-
});
|
|
119
|
-
};
|
|
120
|
-
const configString = configName ? `config '${configName}'` : 'default configs';
|
|
121
|
-
|
|
122
|
-
if (isCodeMode) {
|
|
123
|
-
console.log(`Run test plan, Project: ${this.options.project} (Execution ID: ${executionId}):`);
|
|
124
|
-
} else {
|
|
125
|
-
const sfdcCredentialLog = this.options.sfdcCredential ? ` SfdcCredential: ${this.options.sfdcCredential}` : '';
|
|
126
|
-
console.log(`Run${this.buildTestPlanName(isAnonymous, testPlanName)} test plan with ${configString}, Project: ${this.options.project}, Branch: ${this.branchToUse}${sfdcCredentialLog} (${executionId})`);
|
|
127
|
-
}
|
|
128
|
-
this.printWorkerDivider();
|
|
129
|
-
|
|
130
|
-
if (beforeTests.length > 0) {
|
|
131
|
-
console.log('Before all:');
|
|
132
|
-
writeTestList(beforeTests);
|
|
133
|
-
}
|
|
134
|
-
|
|
135
|
-
const listName = isCodeMode ? 'File list:' : 'Test list:';
|
|
136
|
-
console.log(listName);
|
|
137
|
-
writeTestList(tests);
|
|
138
|
-
|
|
139
|
-
if (afterTests.length > 0) {
|
|
140
|
-
console.log('After all:');
|
|
141
|
-
writeTestList(afterTests);
|
|
142
|
-
}
|
|
143
|
-
this.printWorkerDivider();
|
|
144
|
-
}
|
|
145
|
-
|
|
146
|
-
onGetSlot(workerId, browser) {
|
|
147
|
-
const gridNameOrId = this.options.grid || this.options.gridId;
|
|
148
|
-
const instanceType = this.options.mode === CLI_MODE.APPIUM ? DEVICE : browser;
|
|
149
|
-
if (gridNameOrId) {
|
|
150
|
-
console.log(this.toWorkerIdPrefix(workerId), `Get ${chalk.underline(instanceType)} slot from ${chalk.underline(gridNameOrId)}`);
|
|
151
|
-
}
|
|
152
|
-
}
|
|
153
|
-
|
|
154
|
-
onGetSession(workerId, testName, mode) {
|
|
155
|
-
const instanceType = mode === CLI_MODE.APPIUM ? DEVICE : 'browser';
|
|
156
|
-
console.log(this.toWorkerIdPrefix(workerId), `Get ${instanceType} to run ${chalk.underline(testName)}`);
|
|
157
|
-
}
|
|
158
|
-
|
|
159
|
-
onWaitToTestStart(workerId) {
|
|
160
|
-
console.log(this.toWorkerIdPrefix(workerId), 'Wait for test start');
|
|
161
|
-
}
|
|
162
|
-
|
|
163
|
-
onWaitToTestComplete(workerId, isCodeMode, debuggerAddress) {
|
|
164
|
-
const type = isCodeMode ? 'file' : 'test';
|
|
165
|
-
console.log(this.toWorkerIdPrefix(workerId), `Wait for ${type} complete`);
|
|
166
|
-
if (debuggerAddress && isCodeMode) {
|
|
167
|
-
// TODO(Benji) decide with Amitai what we want to do with this
|
|
168
|
-
console.log(this.toWorkerIdPrefix(workerId), `Chrome Debugger available at ${debuggerAddress}`);
|
|
169
|
-
}
|
|
170
|
-
}
|
|
171
|
-
|
|
172
|
-
onGetBrowserFailure(workerId, projectId, attempt) {
|
|
173
|
-
if (attempt !== 2) {
|
|
174
|
-
return; // we want to try 2 times before showing the message once
|
|
175
|
-
}
|
|
176
|
-
// heuristic, show the message on the same attempt
|
|
177
|
-
const gridNameOrId = this.options.grid || this.options.gridId;
|
|
178
|
-
if (gridNameOrId) { // if the user passes a grid or a gridId - show those
|
|
179
|
-
console.log(colorize.warn(this.toWorkerIdPrefix(workerId), `It is taking us some time to get a browser from the grid ${gridNameOrId}`));
|
|
180
|
-
} else if (this.options.usingLocalChromeDriver) {
|
|
181
|
-
console.log(colorize.warn(this.toWorkerIdPrefix(workerId), 'We are having issues starting ChromeDriver for you locally'));
|
|
182
|
-
} else if (this.options.host) {
|
|
183
|
-
console.log(colorize.warn(this.toWorkerIdPrefix(workerId), `We are having issues reaching your Selenium grid at ${this.options.host}:${this.options.port || 4444}`));
|
|
184
|
-
} else {
|
|
185
|
-
// in other cases - print nothing
|
|
186
|
-
}
|
|
187
|
-
}
|
|
188
|
-
}
|
|
189
|
-
|
|
190
|
-
module.exports = ConsoleReporter;
|
package/reports/debugReporter.js
DELETED
|
@@ -1,82 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
const constants = require('../commons/constants');
|
|
4
|
-
const logger = require('../commons/logger').getLogger('debug-reporter');
|
|
5
|
-
|
|
6
|
-
const MASK_OPTIONS = {
|
|
7
|
-
token: undefined,
|
|
8
|
-
userParamsData: undefined,
|
|
9
|
-
projectData: undefined,
|
|
10
|
-
allGrids: undefined,
|
|
11
|
-
gridData: undefined,
|
|
12
|
-
awsAccessKeyId: undefined,
|
|
13
|
-
awsSecretAccessKey: undefined,
|
|
14
|
-
runParams: undefined,
|
|
15
|
-
perfecto: undefined,
|
|
16
|
-
testobjectSauce: undefined,
|
|
17
|
-
};
|
|
18
|
-
|
|
19
|
-
class DebugReporter {
|
|
20
|
-
constructor(options) {
|
|
21
|
-
this.options = options;
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
onTestStarted(test, workerId) {
|
|
25
|
-
logger.info('Test Started', { testId: test.testId, testName: test.name, resultId: test.resultId, workerId });
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
onTestFinished(test, workerId) {
|
|
29
|
-
const gridData = this.options.gridData || {};
|
|
30
|
-
const provider = gridData.provider;
|
|
31
|
-
const host = gridData.host;
|
|
32
|
-
const gridId = gridData.gridId;
|
|
33
|
-
const gridType = gridData.type;
|
|
34
|
-
const failedGetBrowserAttempts = gridData.failedGetBrowserAttempts;
|
|
35
|
-
logger.info('Test Finished', {
|
|
36
|
-
testId: test.testId,
|
|
37
|
-
testName: test.name,
|
|
38
|
-
resultId: test.resultId,
|
|
39
|
-
success: test.success,
|
|
40
|
-
duration: test.duration,
|
|
41
|
-
browser: this.options.browser,
|
|
42
|
-
companyId: this.options.company.companyId,
|
|
43
|
-
grid: { provider, host, failedGetBrowserAttempts, id: gridId, type: gridType },
|
|
44
|
-
workerId,
|
|
45
|
-
});
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
onTestPlanStarted(beforeTests, tests, afterTests, testPlanName, executionId, isAnonymous, configName) {
|
|
49
|
-
const args = stripTokenFromConsoleArguments(process.argv);
|
|
50
|
-
|
|
51
|
-
logger.info('Test Plan Started', { executionId, testPlanName, isAnonymous, configName, options: Object.assign({}, this.options, MASK_OPTIONS), args });
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
onTestPlanFinished(testResults, testPlanName, duration, executionId, isAnonymous) {
|
|
55
|
-
const passed = Object.keys(testResults).filter(resultId => testResults[resultId].status === constants.runnerTestStatus.PASSED).length;
|
|
56
|
-
const failed = Object.keys(testResults).length - passed;
|
|
57
|
-
|
|
58
|
-
logger.info('Test Plan Finished', { isAnonymous, passed, failed, testPlanName, options: Object.assign({}, this.options, MASK_OPTIONS), duration, executionId });
|
|
59
|
-
}
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
function stripTokenFromConsoleArguments(args) {
|
|
63
|
-
let indexOfTokenFlag = args.indexOf('--token');
|
|
64
|
-
if (indexOfTokenFlag === -1) {
|
|
65
|
-
indexOfTokenFlag = args.indexOf('--t');
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
if (indexOfTokenFlag !== -1) {
|
|
69
|
-
try {
|
|
70
|
-
const newArgs = args.slice();
|
|
71
|
-
newArgs.splice(indexOfTokenFlag, 2);
|
|
72
|
-
|
|
73
|
-
return newArgs;
|
|
74
|
-
} catch (e) {
|
|
75
|
-
/* empty */
|
|
76
|
-
}
|
|
77
|
-
}
|
|
78
|
-
|
|
79
|
-
return args;
|
|
80
|
-
}
|
|
81
|
-
|
|
82
|
-
module.exports = DebugReporter;
|
package/reports/jsonReporter.js
DELETED
|
@@ -1,55 +0,0 @@
|
|
|
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
|
-
}
|
|
54
|
-
|
|
55
|
-
module.exports = JsonReporter;
|