@testim/testim-cli 3.289.0 → 3.290.0-beta
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 +8 -29129
- package/package.json +16 -10
- 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/runOptions.js
DELETED
|
@@ -1,1288 +0,0 @@
|
|
|
1
|
-
/* eslint-disable no-console */
|
|
2
|
-
|
|
3
|
-
'use strict';
|
|
4
|
-
|
|
5
|
-
const fs = require('fs');
|
|
6
|
-
const ms = require('ms');
|
|
7
|
-
const url = require('url');
|
|
8
|
-
const _ = require('lodash');
|
|
9
|
-
const path = require('path');
|
|
10
|
-
const chalk = require('chalk');
|
|
11
|
-
const program = require('commander');
|
|
12
|
-
const utils = require('./utils');
|
|
13
|
-
const runOptionsUtils = require('./runOptionsUtils');
|
|
14
|
-
const runOptionsAgentFlow = require('./runOptionsAgentFlow');
|
|
15
|
-
const localRunnerCache = require('./commons/runnerFileCache');
|
|
16
|
-
const { CLI_MODE } = require('./commons/constants');
|
|
17
|
-
const { NoArgsError, ArgError } = require('./errors');
|
|
18
|
-
const { EDGE_CHROMIUM_MIN_VERSION } = require('./player/constants');
|
|
19
|
-
|
|
20
|
-
const camelizeHyphenValues = (prop) => prop.replace(/-([a-z])/g, (m, w) => w.toUpperCase());
|
|
21
|
-
|
|
22
|
-
const collect = (val, col) => {
|
|
23
|
-
col.push(val);
|
|
24
|
-
return col;
|
|
25
|
-
};
|
|
26
|
-
|
|
27
|
-
const list = (val) => val.split(',');
|
|
28
|
-
|
|
29
|
-
const mergeValues = (first, second) => ((!first || first.length === 0) ? second : first);
|
|
30
|
-
|
|
31
|
-
const setHostAndPortForSauceLab = () => {
|
|
32
|
-
if (program.grid || program.gridId) {
|
|
33
|
-
return;
|
|
34
|
-
}
|
|
35
|
-
if (!program.host) {
|
|
36
|
-
program.host = 'ondemand.saucelabs.com';
|
|
37
|
-
}
|
|
38
|
-
if (!program.port) {
|
|
39
|
-
program.port = 80;
|
|
40
|
-
}
|
|
41
|
-
};
|
|
42
|
-
|
|
43
|
-
const setHostAndPortForBrowserStack = () => {
|
|
44
|
-
if (program.grid || program.gridId) {
|
|
45
|
-
return;
|
|
46
|
-
}
|
|
47
|
-
if (!program.host) {
|
|
48
|
-
program.host = 'hub-cloud.browserstack.com';
|
|
49
|
-
}
|
|
50
|
-
if (!program.port) {
|
|
51
|
-
program.port = 80;
|
|
52
|
-
}
|
|
53
|
-
};
|
|
54
|
-
|
|
55
|
-
const allowedChromeFlags = ['enable-heavy-ad-intervention', 'heavy-ad-privacy-mitigations', 'use-fake-device-for-media-stream', 'use-fake-ui-for-media-stream', 'proxy-server'];
|
|
56
|
-
|
|
57
|
-
const printUsage = () => {
|
|
58
|
-
function isDefaultHelpLine(line) {
|
|
59
|
-
return line.includes('-h, --help');
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
function isParamsJsonOption(line) {
|
|
63
|
-
return line.includes('--params [params-json-string]');
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
function isExtOnlyOption(line) {
|
|
67
|
-
return line.includes('--ext') || line.includes('--extension-path');
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
function isPlayerOption(line) {
|
|
71
|
-
return line.includes('--player-path') || line.includes('--player-require-path');
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
function isScheduler(line) {
|
|
75
|
-
return (
|
|
76
|
-
line.includes('--executionId') ||
|
|
77
|
-
line.includes('--source') ||
|
|
78
|
-
line.includes('--resultId') ||
|
|
79
|
-
line.includes('--remoteRunId') ||
|
|
80
|
-
line.includes('--schedulerId')
|
|
81
|
-
);
|
|
82
|
-
}
|
|
83
|
-
|
|
84
|
-
function isWebdriverTimeout(line) {
|
|
85
|
-
return (
|
|
86
|
-
line.includes('--get-browser-timeout') ||
|
|
87
|
-
line.includes('--get-browser-retries') ||
|
|
88
|
-
line.includes('--get-session-timeout') ||
|
|
89
|
-
line.includes('--get-session-retries') ||
|
|
90
|
-
line.includes('--driver-request-timeout') ||
|
|
91
|
-
line.includes('--driver-request-retries')
|
|
92
|
-
);
|
|
93
|
-
}
|
|
94
|
-
|
|
95
|
-
function isUserId(line) {
|
|
96
|
-
return line.includes('--user');
|
|
97
|
-
}
|
|
98
|
-
|
|
99
|
-
function isMonitorPerformance(line) {
|
|
100
|
-
return line.includes('shouldMonitorPerformance');
|
|
101
|
-
}
|
|
102
|
-
|
|
103
|
-
function isSaveRCALocally(line) {
|
|
104
|
-
return line.includes('--save-rca-locally');
|
|
105
|
-
}
|
|
106
|
-
|
|
107
|
-
function isExitCodeIgnoreFailingTests(line) {
|
|
108
|
-
return line.includes('--exit-code-ignore-failing-tests');
|
|
109
|
-
}
|
|
110
|
-
|
|
111
|
-
function isDeprecatedHighSpeed(line) {
|
|
112
|
-
return line.includes('--high-speed'); // high speed mode was renamed to turbo mode
|
|
113
|
-
}
|
|
114
|
-
|
|
115
|
-
function isUrls(line) {
|
|
116
|
-
return line.includes('--urls');
|
|
117
|
-
}
|
|
118
|
-
|
|
119
|
-
function isTestStartTimeout(line) {
|
|
120
|
-
return line.includes('--test-start-timeout');
|
|
121
|
-
}
|
|
122
|
-
|
|
123
|
-
function isInstallLazyDeps(line) {
|
|
124
|
-
return line.includes('--install-lazy-deps');
|
|
125
|
-
}
|
|
126
|
-
|
|
127
|
-
program.help((txt) => {
|
|
128
|
-
const lines = txt.split('\n');
|
|
129
|
-
return lines
|
|
130
|
-
.filter( // hide CLI options
|
|
131
|
-
(ln) =>
|
|
132
|
-
!isExtOnlyOption(ln) &&
|
|
133
|
-
!isParamsJsonOption(ln) &&
|
|
134
|
-
!isDefaultHelpLine(ln) &&
|
|
135
|
-
!isPlayerOption(ln) &&
|
|
136
|
-
!isScheduler(ln) &&
|
|
137
|
-
!isMonitorPerformance(ln) &&
|
|
138
|
-
!isUserId(ln) &&
|
|
139
|
-
!isWebdriverTimeout(ln) &&
|
|
140
|
-
!isSaveRCALocally(ln) &&
|
|
141
|
-
!isExitCodeIgnoreFailingTests(ln) &&
|
|
142
|
-
!isDeprecatedHighSpeed(ln) &&
|
|
143
|
-
!isUrls(ln) &&
|
|
144
|
-
!isTestStartTimeout(ln) &&
|
|
145
|
-
!isInstallLazyDeps(ln),
|
|
146
|
-
)
|
|
147
|
-
.join('\n');
|
|
148
|
-
});
|
|
149
|
-
};
|
|
150
|
-
|
|
151
|
-
const printDeprecationWarning = (deprecatedUsage, newUsage) => {
|
|
152
|
-
const newUsageString = newUsage ? `Please use ${newUsage} instead.` : '';
|
|
153
|
-
console.log(chalk.yellow(`\nWARNING: ${deprecatedUsage} is deprecated. ${newUsageString}\n`));
|
|
154
|
-
};
|
|
155
|
-
|
|
156
|
-
const CODE_COVERAGE_REPORTER_OPTIONS = [
|
|
157
|
-
'clover',
|
|
158
|
-
'html',
|
|
159
|
-
'json-summary',
|
|
160
|
-
'json',
|
|
161
|
-
'lcov',
|
|
162
|
-
'lcovonly',
|
|
163
|
-
'teamcity',
|
|
164
|
-
'text-lcov',
|
|
165
|
-
'text-summary',
|
|
166
|
-
'text',
|
|
167
|
-
];
|
|
168
|
-
|
|
169
|
-
const LOG_LEVEL_OPTIONS = ['trace', 'debug', 'info', 'warn', 'error', 'silent'];
|
|
170
|
-
program
|
|
171
|
-
.description('Testim.io CLI')
|
|
172
|
-
.option('-h --help', 'output usage information', printUsage)
|
|
173
|
-
.option('-o --options-file [options-file.json]', '')
|
|
174
|
-
.option('-c --config-file [config-file.js]', '')
|
|
175
|
-
.option('--test-config [test-config]', 'test config name to override for all tests in current execution', collect, [])
|
|
176
|
-
.option('--test-config-id [test-config-id]', 'test config ID to override for all tests in current execution', collect, [])
|
|
177
|
-
.option('--params-file [params-file.json]', '')
|
|
178
|
-
.option('--params [params-json-string]', '')
|
|
179
|
-
.option('-t, --testId [test-id]', 'test ID to run', collect, [])
|
|
180
|
-
.option('run [file-glob-pattern]', 'codeful test files to run', collect, [])
|
|
181
|
-
.option('-w, --webpackConfig [webpack-configuration]', 'webpack configuration used to build the code based project')
|
|
182
|
-
.option('--test-id [test-id]', 'test ID to run', collect, [])
|
|
183
|
-
.option('-l, --label [label]', 'labels to search test by', collect, [])
|
|
184
|
-
.option('-n, --name [test-name]', 'test name to run', collect, [])
|
|
185
|
-
.option('--project [project-id]', 'project ID')
|
|
186
|
-
.option('-r, --report-file [report junit xml path]', 'where to save junit xml results file')
|
|
187
|
-
.option('--urls', 'add step urls to the junit report')
|
|
188
|
-
.option('--override-report-file-classname [override-report-file-classname]', 'custom junit class name for the junit reporter')
|
|
189
|
-
.option('--reporters [names]', 'report types', list)
|
|
190
|
-
.option('-h, --host [host-name]', 'host name or ip containing the selenium grid')
|
|
191
|
-
.option('-p, --port [host-port]', 'host port')
|
|
192
|
-
.option('-g, --grid [grid-name]', 'grid name')
|
|
193
|
-
.option('--path [grid-path]', 'grid path')
|
|
194
|
-
.option('--protocol [grid-protocol]', 'grid protocol http or https')
|
|
195
|
-
.option('--grid-username [grid-username]', 'grid http basic auth username')
|
|
196
|
-
.option('--grid-password [grid-password]', 'grid http basic auth password')
|
|
197
|
-
.option('-gi --grid-id [grid-id]', 'grid ID')
|
|
198
|
-
.option('-b, --browser [browser-type]', 'browser type (chrome/firefox)')
|
|
199
|
-
.option('-h, --headless [headless]', 'run in headless mode')
|
|
200
|
-
.option('-m, --mode [runner-mode]', 'use extension or selenium mode (extension/selenium/appium)')
|
|
201
|
-
.option('--branch [branch]', 'branch name', null)
|
|
202
|
-
.option('--base-url [base-url]', 'change base-url to a specified url for all tests in current execution')
|
|
203
|
-
.option('--token [token]', 'identification token to testim')
|
|
204
|
-
.option('--is-regression-baseline-run', 'save doms and run results as regression baseline data')
|
|
205
|
-
.option('--parallel [number-of-tests]', 'number of tests to run in parallel')
|
|
206
|
-
.option('--before-parallel [number-of-tests]', 'number of tests to run in parallel during the before phase of a test plan')
|
|
207
|
-
.option('--after-parallel [number-of-tests]', 'number of tests to run in parallel during the after phase of a test plan')
|
|
208
|
-
.option('--canary [canary-mode]', 'enable canary mode', false)
|
|
209
|
-
.option('--test-plan [test-plan-name]', 'test plan to run', collect, [])
|
|
210
|
-
.option('--test-plan-id [test-plan-id]', 'test plan to run', collect, [])
|
|
211
|
-
.option('--suite [suite-name]', 'suite to run', collect, [])
|
|
212
|
-
.option('--suite-id [suite-id]', 'suite ID to run', collect, [])
|
|
213
|
-
.option('--rerun-failed-by-run-id [run-id]', 'allows re-running failed tests from a specific run ID')
|
|
214
|
-
.option('--disable-grid-check [boolean]', 'disable checking if selenium grid is available', false)
|
|
215
|
-
.option('--disable-native-events [boolean]', 'pass nativeEvents=false capability to the selenium browser (in selenium mode)', false)
|
|
216
|
-
.option('--disable-timeout-retry [boolean]', 'disable retry after test pass test timeout', false)
|
|
217
|
-
.option('--ca-file [ca-file-location]', 'ca certificate file location')
|
|
218
|
-
.option('--proxy [proxy-url]', 'proxy url to all requests')
|
|
219
|
-
.option('--proxy-for-grid [proxy-for-grid]', 'used together with --proxy to also router grid traffic through a proxy')
|
|
220
|
-
.option('--result-label [result-label]', 'result label', collect, [])
|
|
221
|
-
.option('-oen --override-execution-name [execution-name]', 'override the default execution name', '')
|
|
222
|
-
.option('--retries [max_num_of_retries]', 'number of retries on test failure, defaults to 0 (no retries)', 0)
|
|
223
|
-
.option('--set-retention [retention-in-days]', 'set the number of days for results retention')
|
|
224
|
-
.option('--user [user-id]', 'user ID for local Testim-CLI')
|
|
225
|
-
.option('--pass-zero-tests', 'don\'t fail the run if no tests were found')
|
|
226
|
-
//Mobile options
|
|
227
|
-
.option('--device-model [device-model]', 'The device model to use, iPhone 12, Nexus 5X, SM-G900P etc....')
|
|
228
|
-
.option('--device-udid [device-udid]', 'the device unique id')
|
|
229
|
-
.option('--os-version [os-version]', 'The operating system version number')
|
|
230
|
-
.option('--app-id [app-id]', 'The application id from app library on Testim Editor App')
|
|
231
|
-
.option('--appium-log-level [appium-log-level]', 'Level of logging verbosity')
|
|
232
|
-
|
|
233
|
-
.option('-str --suppress-tms-reporting [suppress-tms-reporting]', 'disable test management reporting', false)
|
|
234
|
-
.option('-tsr --tms-suppress-reporting [tms-suppress-reporting]', 'disable test management reporting', false)
|
|
235
|
-
.option('-tid --tms-run-id [tms-run-id]', 'update existing result in test management', '')
|
|
236
|
-
.option('-tff --tms-field-file [tms-field-file.json]', 'pass field file location to add custom result field to the tms result report', '')
|
|
237
|
-
|
|
238
|
-
.option('--disable-file-cache', 'disable internal CLI file caching')
|
|
239
|
-
.option('--file-cache-location [directory]', ' internal CLI file caching location')
|
|
240
|
-
|
|
241
|
-
// Timeout
|
|
242
|
-
.option('--test-start-timeout [test-start-timeout]', 'The time to wait for a test to start after getting a browser session', Number, Number(process.env.TESTIM_TEST_START_TIMEOUT) || (2 * 60 * 1000))
|
|
243
|
-
.option('--timeout [test-timeout]', 'Test run timeout in milliseconds', Number)
|
|
244
|
-
.option('--browser-timeout [open-browser-timeout]', 'Get browser from grid timeout in milliseconds', Number)
|
|
245
|
-
.option('--new-browser-wait-timeout [max-wait-to-browser]', 'Maximum get browser wait in minutes', Number)
|
|
246
|
-
|
|
247
|
-
// New Timeouts
|
|
248
|
-
.option('--get-browser-timeout [get-browser-timeout]', 'Timeout for a single attempt to get browser from the grid configured in the project\'s plan', Number) // getBrowserTimeout
|
|
249
|
-
.option('--get-browser-retries [get-browser-retries]', 'Number of attempts to get browser from the grid configured in the project\'s plan', Number) // getBrowserRetries
|
|
250
|
-
.option('--get-session-timeout [get-session-timeout]', 'Timeout for "/session" request to the selenium server', Number, ms('90s')) // getSessionTimeout
|
|
251
|
-
.option('--get-session-retries [get-session-retries]', 'Retries for "/session" request to the selenium server', Number, 3) // getSessionRetries
|
|
252
|
-
.option('--driver-request-timeout [driver-request-timeout]', 'Timeout for any WebDriver request to the grid server', Number, ms('90s')) // driverRequestTimeout
|
|
253
|
-
.option('--driver-request-retries [driver-request-retries]', 'Retries for any WebDriver request to the grid server', Number, 3) // driverRequestRetries
|
|
254
|
-
|
|
255
|
-
// Run chrome ext mode locally
|
|
256
|
-
.option('--use-local-chrome-driver [use-local-chrome-driver]', 'use a local ChromeDriver instance instead of a selenium grid')
|
|
257
|
-
.option('--chrome-binary-location [chrome-binary-location]', 'Chrome binary location')
|
|
258
|
-
|
|
259
|
-
// Run chrome ext mode locally using chrome launcher
|
|
260
|
-
.option('--use-chrome-launcher', 'use a local Chrome installation without selenium')
|
|
261
|
-
|
|
262
|
-
// Mock network
|
|
263
|
-
.option('-mnh --mock-network-har', 'use the HAR file configured in the Testim editor to mock network traffic')
|
|
264
|
-
.option('-mnp --mock-network-pattern [local file location path]', 'use a JSON rule file to mock network traffic (Rule file schema: https://help.testim.io/page/mocking-network-traffic)')
|
|
265
|
-
.option(
|
|
266
|
-
'-omf --override-mapping-file [local file location path]',
|
|
267
|
-
'pass map file location to override mock network (see schema: https://help.testim.io/page/mocking-network-traffic)',
|
|
268
|
-
)
|
|
269
|
-
.option('-dmn --disable-mock-network', 'Disable mock mode for the entire CLI run')
|
|
270
|
-
.option('--run-quarantined-tests', 'Run quarantine tests')
|
|
271
|
-
|
|
272
|
-
// Code coverage
|
|
273
|
-
.option('--collect-code-coverage', 'collect code coverage for all js files under base url')
|
|
274
|
-
.option('--code-coverage-url-filter [url pattern]', 'collect code coverage for all js files matching url filter (url including asterisk)')
|
|
275
|
-
.option('--code-coverage-report-path [path]', 'where to save coverage report (default ./coverage)')
|
|
276
|
-
.option('--code-coverage-source-map-path [path]', 'path of source code')
|
|
277
|
-
.option('--code-coverage-reporter [reporter]', `set code coverage reporter (default html and text), options: ${CODE_COVERAGE_REPORTER_OPTIONS.join('/')}`, collect, [])
|
|
278
|
-
.option('--code-coverage-include [pattern]', 'set selecting files for coverage (default src/**)', collect, [])
|
|
279
|
-
|
|
280
|
-
// SauceLab
|
|
281
|
-
.option('--sauce-user [sauce-lab-user]', 'user to connect to sauce labs')
|
|
282
|
-
.option('--sauce-key [sauce-lab-key]', 'key to use when connecting to sauce labs')
|
|
283
|
-
.option('--sauce-options [sauce-options]', 'json file of browser and os options for sauce')
|
|
284
|
-
|
|
285
|
-
// Browserstack
|
|
286
|
-
.option('--browserstack-user [browserstack-user]', 'user to connect to browserStack')
|
|
287
|
-
.option('--browserstack-key [browserstack-key]', 'key to use when connecting to browserStack')
|
|
288
|
-
.option('--browserstack-options [browserstack-options]', 'json file of browser and os options for browserStack')
|
|
289
|
-
|
|
290
|
-
// Perfecto
|
|
291
|
-
.option('--perfecto-token [perfecto-token]', 'security token to use when connecting to perfecto')
|
|
292
|
-
.option('--perfecto-options [perfecto-options]', 'json file of browser and os options for perfecto')
|
|
293
|
-
|
|
294
|
-
// Experitest
|
|
295
|
-
.option('--experitest-token [experitest-token]', 'security token to use when connecting to experitest')
|
|
296
|
-
|
|
297
|
-
// TestObject
|
|
298
|
-
.option('--testobject-key [testobject-key]', 'api key to use when connecting to testobject')
|
|
299
|
-
.option('--testobject-options [testobject-options]', 'json file of options for testobject')
|
|
300
|
-
|
|
301
|
-
// Extension
|
|
302
|
-
.option('--ext [extension src path]', 'use extension from path (default it \'/..\')')
|
|
303
|
-
.option('--extension-path [path to extension archived file]', 'override the used extension')
|
|
304
|
-
|
|
305
|
-
//Customer Extension
|
|
306
|
-
.option('--install-custom-extension [chrome extension zipped file url or local path]', 'chrome extension to be installed in the browser')
|
|
307
|
-
|
|
308
|
-
// Player
|
|
309
|
-
.option('--player-path [path to player file]')
|
|
310
|
-
.option('--player-require-path [path to unminified player - development only]')
|
|
311
|
-
|
|
312
|
-
// Codim Init
|
|
313
|
-
.option('init [init]', 'Path for an initial test app')
|
|
314
|
-
|
|
315
|
-
// Node Inspect as a flag
|
|
316
|
-
.option('--inspect [port]', 'Opens node inspector at given port', Number)
|
|
317
|
-
|
|
318
|
-
// Logging in - saving token and projectId
|
|
319
|
-
.option('--login', 'Log in to Testim')
|
|
320
|
-
.option('--require-credentials', 'Log in to Testim if not already logged in')
|
|
321
|
-
|
|
322
|
-
// Tunnel
|
|
323
|
-
.option('tunneld', 'run a tunnel daemon only')
|
|
324
|
-
.option('--tunnel [tunnel]', 'enable tunnel')
|
|
325
|
-
.option('--tunnel-routes [routes]', 'tunnel routes for cloudflare tunnels')
|
|
326
|
-
.option('--tunnel-port [tunnel-port]', 'tunnel port address')
|
|
327
|
-
.option('--tunnel-host-header [tunnel-host-header]', 'tunnel host header')
|
|
328
|
-
.option('--tunnel-region [tunnel-region]', 'ngrok tunnel region')
|
|
329
|
-
.option('--tunnel-diagnostics', 'collect ngrok tunnel diagnostics')
|
|
330
|
-
.option('--tunnel-use-http-address [tunnel-use-http-address]', 'use http:// address instead of https://', false)
|
|
331
|
-
.option('--external-lambdatest-tunnel-id [tunnel-id]', 'use existing lambdatest tunnel ID')
|
|
332
|
-
.option('--external-lambdatest-use-wss', 'use wss instead of ssh for LT', false)
|
|
333
|
-
.option('--external-lambdatest-disable-automation-tunneling', 'don\'t tunnel Testim calls in LT tunnel', true)
|
|
334
|
-
.option('--external-lambdatest-mitm', 'Turn on LT Man in the middle', false)
|
|
335
|
-
|
|
336
|
-
.option('--w3c-capabilities [enable-w3c-caps-mode]', 'enable/disable w3c capabilities format (default enable)', JSON.parse, true)
|
|
337
|
-
.option('--old-capabilities [enable-old-caps-mode]', 'enable/disable old capabilities format (default enable)', JSON.parse, true)
|
|
338
|
-
.option('--disable-sockets', 'Disable CLI sockets', false)
|
|
339
|
-
|
|
340
|
-
// Remote run options
|
|
341
|
-
.option('--executionId [execution-id]', '', '')
|
|
342
|
-
.option('--remoteRunId [remote-run-id]', '', '')
|
|
343
|
-
.option('--schedulerId [scheduler-id]', '', '')
|
|
344
|
-
.option('--source [source]', '', 'cli')
|
|
345
|
-
.option('--resultId [result-id]', '', '')
|
|
346
|
-
|
|
347
|
-
// Agent mode
|
|
348
|
-
.option('connect, --agent [enable-agent-mode]', 'enable Testim CLI agent mode', false)
|
|
349
|
-
.option('start [enable-start]', 'Connect to testim and open the editor in a standalone browser', false)
|
|
350
|
-
.option('--download-browser', 'when used with the start option, downloads a fixed version to run Testim editor in', false)
|
|
351
|
-
.option('--agent-port [agent-port]', 'set agent port', Number, 42543)
|
|
352
|
-
.option('--agent-bind [agent-host-bind]', 'set agent host bind', '127.0.0.1')
|
|
353
|
-
|
|
354
|
-
.option('--chrome-extra-prefs [chrome-extra-prefs]', 'add extra chrome preferences', '')
|
|
355
|
-
.option('--chrome-extra-args [chrome-extra-args]', 'add extra chrome arguments separated by \',\'', '')
|
|
356
|
-
.option('--chrome-block-location [chrome-block-location]', 'block chrome geolocation', false)
|
|
357
|
-
.option('--chrome-user-data-dir [chrome-user-data-dir]', 'use custom chrome user date dir', false)
|
|
358
|
-
|
|
359
|
-
.option('--disable-cookies-same-site-none-requires-secure [disable-same-site-none-requires-secure]', 'Disable cookies without SameSite must be secure', false)
|
|
360
|
-
|
|
361
|
-
.option('--selenium-caps-file [selenium-caps-file.json]', 'json file to merge into Testim selenium desired capabilities')
|
|
362
|
-
|
|
363
|
-
.option('--version [version]', 'print the current version of the Testim CLI and exit', false)
|
|
364
|
-
.option('--monitor-performance', 'collect test playback performance data')
|
|
365
|
-
|
|
366
|
-
.option('--high-speed', 'DEPRECATED: use --turbo-mode instead') // When removing, remove from the program.help output filter
|
|
367
|
-
.option('--turbo-mode', 'run in turbo mode')
|
|
368
|
-
.option('--lightweight-mode [settings]', 'run lightweight mode')
|
|
369
|
-
.option('--create-prefeched-data [location]', 'prefetch data into local cache file')
|
|
370
|
-
.option('--use-prefeched-data [location]', 'use prefetched data from local cache file, and force using only cached data')
|
|
371
|
-
.option('--save-rca-locally [path]', 'save root cause analysis assets locally')
|
|
372
|
-
|
|
373
|
-
.option('--exit-code-ignore-failing-tests', 'return exit code of zero when tests fail. non zero exit code will mean a real error occurred')
|
|
374
|
-
|
|
375
|
-
.option('--intersect-with-label [label]', 'Out of the execution\'s test list, run only those tests that have the specified label', collect, [])
|
|
376
|
-
.option('--intersect-with-suite [suiteName]', 'Out of the execution\'s test list, run only those tests that are included in the specified suite (by suite name)', collect, [])
|
|
377
|
-
.option('--intersect-with-suite-id [suiteId]', 'Out of the execution\'s test list, run only those tests that are included in the specified suite (by suite ID)', collect, [])
|
|
378
|
-
|
|
379
|
-
.option('--install-lazy-deps [install-lazy-deps]', 'Install all lazy dependencies from package.json', false)
|
|
380
|
-
.parse(process.argv);
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
module.exports = {
|
|
384
|
-
async process() {
|
|
385
|
-
if (program.inspect) {
|
|
386
|
-
const inspector = require('inspector');
|
|
387
|
-
inspector.open(program.inspect);
|
|
388
|
-
}
|
|
389
|
-
|
|
390
|
-
let userParamsData = {};
|
|
391
|
-
let chromeExtraPrefs = {};
|
|
392
|
-
const chromeExtraArgs = [];
|
|
393
|
-
let seleniumCapsFileContent = {};
|
|
394
|
-
|
|
395
|
-
if (!process.argv.slice(2).length) {
|
|
396
|
-
printUsage();
|
|
397
|
-
throw new NoArgsError();
|
|
398
|
-
}
|
|
399
|
-
|
|
400
|
-
if (program.requireCredentials) {
|
|
401
|
-
const credentialsManager = require('./credentialsManager');
|
|
402
|
-
const projectId = await credentialsManager.getProjectId();
|
|
403
|
-
const token = await credentialsManager.getToken();
|
|
404
|
-
|
|
405
|
-
if (!projectId || !token) {
|
|
406
|
-
await credentialsManager.doLogin();
|
|
407
|
-
}
|
|
408
|
-
}
|
|
409
|
-
|
|
410
|
-
if (program.login) {
|
|
411
|
-
const credentialsManager = require('./credentialsManager');
|
|
412
|
-
await credentialsManager.doLogin();
|
|
413
|
-
|
|
414
|
-
return { loginMode: true };
|
|
415
|
-
}
|
|
416
|
-
|
|
417
|
-
if (program.init) {
|
|
418
|
-
return {
|
|
419
|
-
initCodimMode: true,
|
|
420
|
-
initTestProject: program.init,
|
|
421
|
-
};
|
|
422
|
-
}
|
|
423
|
-
|
|
424
|
-
if (program.version) {
|
|
425
|
-
const message = 'Testim CLI Version: ';
|
|
426
|
-
if (process.env.npm_package_version) {
|
|
427
|
-
console.log(message, process.env.npm_package_version);
|
|
428
|
-
process.exit(0);
|
|
429
|
-
}
|
|
430
|
-
try {
|
|
431
|
-
// [NOTE] in production they are in the same folder
|
|
432
|
-
// eslint-disable-next-line import/no-unresolved
|
|
433
|
-
console.log(message, require('./package.json').version);
|
|
434
|
-
process.exit(0);
|
|
435
|
-
} catch (e) {
|
|
436
|
-
//pass
|
|
437
|
-
}
|
|
438
|
-
try {
|
|
439
|
-
// in dev, they are one level up
|
|
440
|
-
console.log(message, require('../package.json').version);
|
|
441
|
-
process.exit(0);
|
|
442
|
-
} catch (e) {
|
|
443
|
-
//pass
|
|
444
|
-
}
|
|
445
|
-
console.log('Could not find version, please check the package.json manually');
|
|
446
|
-
process.exit(0);
|
|
447
|
-
}
|
|
448
|
-
|
|
449
|
-
if (program.installLazyDeps) {
|
|
450
|
-
return { installLazyDepsMode: true };
|
|
451
|
-
}
|
|
452
|
-
|
|
453
|
-
if (program.disableFileCache) {
|
|
454
|
-
localRunnerCache.disable();
|
|
455
|
-
}
|
|
456
|
-
|
|
457
|
-
const cacheLocationProvided = program.fileCacheLocation || program.usePrefechedData || program.createPrefechedData;
|
|
458
|
-
|
|
459
|
-
if (cacheLocationProvided) {
|
|
460
|
-
const location = path.resolve(cacheLocationProvided);
|
|
461
|
-
localRunnerCache.setCacheLocation(location);
|
|
462
|
-
}
|
|
463
|
-
|
|
464
|
-
if (program.usePrefechedData) {
|
|
465
|
-
localRunnerCache.disableCacheMiss();
|
|
466
|
-
}
|
|
467
|
-
|
|
468
|
-
if (program.playerRequirePath) {
|
|
469
|
-
const fullPlayerPath = path.resolve(program.playerRequirePath);
|
|
470
|
-
console.log('Using Local Clickim for Player Require Path =', fullPlayerPath);
|
|
471
|
-
const projectFile = path.join(fullPlayerPath, 'tsconfig.node.json');
|
|
472
|
-
|
|
473
|
-
// [NOTE] playerRequirePath is a dev flag
|
|
474
|
-
// eslint-disable-next-line import/no-extraneous-dependencies
|
|
475
|
-
const tsnodeApi = require('ts-node');
|
|
476
|
-
const tsNodeRegisterInstance = tsnodeApi.register({
|
|
477
|
-
project: projectFile,
|
|
478
|
-
ignore: [
|
|
479
|
-
// restore default value
|
|
480
|
-
/node_modules/,
|
|
481
|
-
// based on that code:
|
|
482
|
-
// https://github.com/TypeStrong/ts-node/blob/c1ae9a069a824368c9aaf89f4454b131af44a92f/src/index.ts#L368
|
|
483
|
-
// it will not touch this project files, but will work on clickim code
|
|
484
|
-
new RegExp(`^${_.escapeRegExp(path.relative(process.cwd(), __dirname))}`),
|
|
485
|
-
],
|
|
486
|
-
transpileOnly: true,
|
|
487
|
-
});
|
|
488
|
-
|
|
489
|
-
// [NOTE] playerRequirePath is a dev flag
|
|
490
|
-
// eslint-disable-next-line import/no-extraneous-dependencies
|
|
491
|
-
const tsConfigPathsApi = require('tsconfig-paths');
|
|
492
|
-
tsConfigPathsApi.register({
|
|
493
|
-
paths: tsNodeRegisterInstance.config.options.paths,
|
|
494
|
-
baseUrl: tsNodeRegisterInstance.config.options.baseUrl,
|
|
495
|
-
});
|
|
496
|
-
|
|
497
|
-
require('./commons/getSessionPlayerRequire').options.playerPath = fullPlayerPath;
|
|
498
|
-
const Module = require('module');
|
|
499
|
-
const originalRequire = Module.prototype.require;
|
|
500
|
-
Module.prototype.require = function requireThatOverridesSessionPlayer(id) {
|
|
501
|
-
if (id === 'rox-alias') {
|
|
502
|
-
return originalRequire.call(this, 'rox-node');
|
|
503
|
-
}
|
|
504
|
-
// eslint-disable-next-line prefer-rest-params
|
|
505
|
-
return originalRequire.apply(this, arguments);
|
|
506
|
-
};
|
|
507
|
-
}
|
|
508
|
-
|
|
509
|
-
if (program.caFile) {
|
|
510
|
-
global.caFileContent = fs.readFileSync(program.caFile);
|
|
511
|
-
}
|
|
512
|
-
|
|
513
|
-
if (program.proxy) {
|
|
514
|
-
global.proxyUri = program.proxy;
|
|
515
|
-
// used by Clickim internally and by the runner, included here lazily to not make things slower for the
|
|
516
|
-
// non-proxy case
|
|
517
|
-
global.SuperagentProxy = require('superagent-proxy');
|
|
518
|
-
global.ProxyAgent = require('proxy-agent');
|
|
519
|
-
global.HttpsProxyAgent = require('https-proxy-agent');
|
|
520
|
-
}
|
|
521
|
-
|
|
522
|
-
if (program.proxyForGrid && !program.proxy) {
|
|
523
|
-
throw new ArgError('missing --proxy option');
|
|
524
|
-
}
|
|
525
|
-
|
|
526
|
-
if (runOptionsAgentFlow.isAgentFlow(program)) {
|
|
527
|
-
return runOptionsAgentFlow.runAgentFlow(program);
|
|
528
|
-
}
|
|
529
|
-
|
|
530
|
-
// merge options from file
|
|
531
|
-
try {
|
|
532
|
-
let options = {};
|
|
533
|
-
if (program.configFile) {
|
|
534
|
-
// eslint-disable-next-line import/no-dynamic-require
|
|
535
|
-
options = require(path.join(process.cwd(), program.configFile)).config;
|
|
536
|
-
} else if (program.optionsFile) {
|
|
537
|
-
// eslint-disable-next-line import/no-dynamic-require
|
|
538
|
-
options = require(path.join(process.cwd(), program.optionsFile));
|
|
539
|
-
}
|
|
540
|
-
|
|
541
|
-
// technically would work on anything, but no reason to add a tick for nothing.
|
|
542
|
-
if (options && typeof options.then === 'function') {
|
|
543
|
-
options = await options;
|
|
544
|
-
}
|
|
545
|
-
|
|
546
|
-
Object.keys(options).forEach((prop) => {
|
|
547
|
-
const safePropName = camelizeHyphenValues(prop);
|
|
548
|
-
program[safePropName] = mergeValues(program[safePropName], options[prop]);
|
|
549
|
-
});
|
|
550
|
-
} catch (err) {
|
|
551
|
-
err.message = `Unable to read options file: ${err.message}`;
|
|
552
|
-
throw err;
|
|
553
|
-
}
|
|
554
|
-
|
|
555
|
-
if (program.tunneld) {
|
|
556
|
-
return {
|
|
557
|
-
tunnel: true,
|
|
558
|
-
tunnelPort: program.tunnelPort,
|
|
559
|
-
tunnelRoutes: program.tunnelRoutes,
|
|
560
|
-
tunnelRoutesOutput: program.tunnelRoutesOutput,
|
|
561
|
-
tunnelHostHeader: program.tunnelHostHeader,
|
|
562
|
-
tunnelRegion: program.tunnelRegion,
|
|
563
|
-
tunnelDiagnostics: program.tunnelDiagnostics,
|
|
564
|
-
tunnelUseHttpAddress: program.tunnelUseHttpAddress,
|
|
565
|
-
tunnelOnlyMode: true,
|
|
566
|
-
token: program.token,
|
|
567
|
-
project: program.project,
|
|
568
|
-
};
|
|
569
|
-
}
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
const isTestConfigSpecified = program.testConfig?.length || program.testConfigId?.length;
|
|
573
|
-
const isTestPlanSpecified = program.testPlan?.length || program.testPlanId?.length;
|
|
574
|
-
const isSuiteSpecified = program.suite?.length || program.suiteId?.length;
|
|
575
|
-
|
|
576
|
-
if (program.seleniumCapsFile) {
|
|
577
|
-
try {
|
|
578
|
-
// eslint-disable-next-line import/no-dynamic-require
|
|
579
|
-
seleniumCapsFileContent = require(path.join(process.cwd(), program.seleniumCapsFile));
|
|
580
|
-
} catch (err) {
|
|
581
|
-
throw new ArgError(`Failed to parse selenium caps file file error: ${err.message}`);
|
|
582
|
-
}
|
|
583
|
-
}
|
|
584
|
-
|
|
585
|
-
if (program.reporters?.includes('junit') && !program.reportFile) {
|
|
586
|
-
console.log('Warning: please define --report-file option for JUnit reporter');
|
|
587
|
-
}
|
|
588
|
-
|
|
589
|
-
if (!program.tunnel && program.externalLambdatestTunnelId) {
|
|
590
|
-
throw new ArgError('missing --tunnel parameter');
|
|
591
|
-
}
|
|
592
|
-
|
|
593
|
-
if (!program.tunnel && program.externalLambdatestUseWss) {
|
|
594
|
-
throw new ArgError('missing --tunnel parameter');
|
|
595
|
-
}
|
|
596
|
-
|
|
597
|
-
if (!program.tunnel && [program.tunnelPort, program.tunnelHostHeader, program.tunnelRegion, program.tunnelDiagnostics].some(Boolean)) {
|
|
598
|
-
throw new ArgError('missing --tunnel parameter');
|
|
599
|
-
}
|
|
600
|
-
if (program.chromeExtraPrefs) {
|
|
601
|
-
try {
|
|
602
|
-
// eslint-disable-next-line import/no-dynamic-require
|
|
603
|
-
chromeExtraPrefs = require(path.join(process.cwd(), program.chromeExtraPrefs));
|
|
604
|
-
} catch (err) {
|
|
605
|
-
throw new ArgError(`Failed to read/open chrome extra prefs file error: ${err.message}`);
|
|
606
|
-
}
|
|
607
|
-
}
|
|
608
|
-
|
|
609
|
-
if (program.chromeExtraArgs) {
|
|
610
|
-
const args = program.chromeExtraArgs.split(',');
|
|
611
|
-
for (const arg of args) {
|
|
612
|
-
const [argName] = arg.split('=');
|
|
613
|
-
if (allowedChromeFlags.includes(argName) || program.useLocalChromeDriver || program.useChromeLauncher) {
|
|
614
|
-
chromeExtraArgs.push(arg);
|
|
615
|
-
if (argName === 'proxy-server') {
|
|
616
|
-
chromeExtraArgs.push('proxy-bypass-list=*.testim.io;*.coralogix.com;*.cloudinary.com;*.rollout.io');
|
|
617
|
-
}
|
|
618
|
-
} else {
|
|
619
|
-
console.warn(`Ignoring an unsupported chrome arg (${argName}), allowed values: ${JSON.stringify(allowedChromeFlags)}`);
|
|
620
|
-
}
|
|
621
|
-
}
|
|
622
|
-
}
|
|
623
|
-
|
|
624
|
-
if (program.paramsFile) {
|
|
625
|
-
try {
|
|
626
|
-
// eslint-disable-next-line import/no-dynamic-require
|
|
627
|
-
userParamsData = Object.assign({}, userParamsData, require(path.join(process.cwd(), program.paramsFile)));
|
|
628
|
-
} catch (err) {
|
|
629
|
-
throw new ArgError(`Failed to read/open params file error: ${err.message}`);
|
|
630
|
-
}
|
|
631
|
-
}
|
|
632
|
-
|
|
633
|
-
if (program.params) {
|
|
634
|
-
try {
|
|
635
|
-
userParamsData = Object.assign({}, userParamsData, JSON.parse(program.params));
|
|
636
|
-
} catch (err) {
|
|
637
|
-
throw new ArgError(`Failed to parse params string error: ${err.message}`);
|
|
638
|
-
}
|
|
639
|
-
}
|
|
640
|
-
|
|
641
|
-
// SauceLabs Options
|
|
642
|
-
if ((program.sauceUser && !program.sauceKey) || (!program.sauceUser && program.sauceKey)) {
|
|
643
|
-
throw new ArgError('missing --sauce-user <sauce-user> or --sauce-key <sauce-key>');
|
|
644
|
-
}
|
|
645
|
-
|
|
646
|
-
if (program.sauceUser && program.sauceKey) {
|
|
647
|
-
setHostAndPortForSauceLab();
|
|
648
|
-
program.saucelabs = {};
|
|
649
|
-
|
|
650
|
-
program.saucelabs.username = program.sauceUser;
|
|
651
|
-
program.saucelabs.accessKey = program.sauceKey;
|
|
652
|
-
}
|
|
653
|
-
|
|
654
|
-
if (program.sauceOptions) {
|
|
655
|
-
try {
|
|
656
|
-
// eslint-disable-next-line import/no-dynamic-require
|
|
657
|
-
const sOptions = require(path.join(process.cwd(), program.sauceOptions));
|
|
658
|
-
const isMobile = sOptions.platformName && ['ios', 'android'].includes(sOptions.platformName.toLowerCase());
|
|
659
|
-
if (sOptions.browserName) {
|
|
660
|
-
const browserName = sOptions.browserName.toLowerCase();
|
|
661
|
-
switch (browserName) {
|
|
662
|
-
case 'microsoftedge':
|
|
663
|
-
program.browser = 'edge';
|
|
664
|
-
break;
|
|
665
|
-
default:
|
|
666
|
-
program.browser = browserName;
|
|
667
|
-
}
|
|
668
|
-
}
|
|
669
|
-
|
|
670
|
-
if (program.browser === 'edge' && parseFloat(sOptions.version) >= EDGE_CHROMIUM_MIN_VERSION) {
|
|
671
|
-
program.browser = 'edge-chromium';
|
|
672
|
-
}
|
|
673
|
-
|
|
674
|
-
const isBadVersion = parseFloat(sOptions.version) < 50 && !['dev', 'beta'].includes(sOptions.version);
|
|
675
|
-
if (!isMobile && program.browser === 'chrome' && isBadVersion) {
|
|
676
|
-
throw new ArgError('The minimum chrome supported version is 50.0');
|
|
677
|
-
}
|
|
678
|
-
|
|
679
|
-
program.saucelabs = Object.assign({}, program.saucelabs, sOptions);
|
|
680
|
-
} catch (err) {
|
|
681
|
-
throw new ArgError(`Failed to parse saucelabs options file error: ${err.message}`);
|
|
682
|
-
}
|
|
683
|
-
}
|
|
684
|
-
|
|
685
|
-
// BrowserStack options
|
|
686
|
-
if ((program.browserstackUser && !program.browserstackKey) || (!program.browserstackUser && program.browserstackKey)) {
|
|
687
|
-
throw new ArgError('missing --browserstack-user <browserstack-user> or --browserstack-key <browserstack-key>');
|
|
688
|
-
}
|
|
689
|
-
if (program.browserstackUser && program.browserstackKey) {
|
|
690
|
-
setHostAndPortForBrowserStack();
|
|
691
|
-
program.browserstack = {};
|
|
692
|
-
|
|
693
|
-
program.browserstack['browserstack.user'] = program.browserstackUser;
|
|
694
|
-
program.browserstack['browserstack.key'] = program.browserstackKey;
|
|
695
|
-
}
|
|
696
|
-
|
|
697
|
-
if (program.browserstackOptions) {
|
|
698
|
-
try {
|
|
699
|
-
// eslint-disable-next-line import/no-dynamic-require
|
|
700
|
-
const bsOptions = require(path.join(process.cwd(), program.browserstackOptions));
|
|
701
|
-
const isMobile = bsOptions.platform && ['mac', 'android'].includes(bsOptions.platform.toLowerCase());
|
|
702
|
-
if (bsOptions.browserName) {
|
|
703
|
-
program.browser = bsOptions.browserName.toLowerCase();
|
|
704
|
-
}
|
|
705
|
-
|
|
706
|
-
if (program.browser === 'edge' && parseFloat(bsOptions.browser_version) >= EDGE_CHROMIUM_MIN_VERSION) {
|
|
707
|
-
program.browser = 'edge-chromium';
|
|
708
|
-
}
|
|
709
|
-
|
|
710
|
-
if (!isMobile && parseFloat(bsOptions.browser_version) < 50 && program.browser === 'chrome') {
|
|
711
|
-
throw new ArgError('The minimum chrome supported version is 50.0');
|
|
712
|
-
}
|
|
713
|
-
|
|
714
|
-
program.browserstack = Object.assign({}, program.browserstack, bsOptions);
|
|
715
|
-
} catch (err) {
|
|
716
|
-
throw new ArgError(`Failed to parse browserstack options file error: ${err.message}`);
|
|
717
|
-
}
|
|
718
|
-
}
|
|
719
|
-
|
|
720
|
-
program.perfecto = {};
|
|
721
|
-
|
|
722
|
-
if (program.perfectoToken) {
|
|
723
|
-
program.perfecto.securityToken = program.perfectoToken;
|
|
724
|
-
}
|
|
725
|
-
|
|
726
|
-
if (program.perfectoOptions) {
|
|
727
|
-
try {
|
|
728
|
-
// eslint-disable-next-line import/no-dynamic-require
|
|
729
|
-
const perfectoOptions = require(path.join(process.cwd(), program.perfectoOptions));
|
|
730
|
-
const DEFAULTS = { location: 'US East', securityToken: program.perfectoToken };
|
|
731
|
-
program.perfecto = Object.assign({}, DEFAULTS, perfectoOptions);
|
|
732
|
-
} catch (err) {
|
|
733
|
-
throw new ArgError(`Failed to parse perfecto options file error: ${err.message}`);
|
|
734
|
-
}
|
|
735
|
-
}
|
|
736
|
-
|
|
737
|
-
program.testobjectSauce = {};
|
|
738
|
-
|
|
739
|
-
if (program.testobjectKey) {
|
|
740
|
-
program.testobjectSauce.testobjectApiKey = program.testobjectKey;
|
|
741
|
-
}
|
|
742
|
-
|
|
743
|
-
if (program.testobjectOptions) {
|
|
744
|
-
try {
|
|
745
|
-
// eslint-disable-next-line import/no-dynamic-require
|
|
746
|
-
const testobjectOptions = require(path.join(process.cwd(), program.testobjectOptions));
|
|
747
|
-
const DEFAULTS = { testobjectApiKey: program.testobjectKey };
|
|
748
|
-
program.testobjectSauce = Object.assign({}, DEFAULTS, testobjectOptions);
|
|
749
|
-
} catch (err) {
|
|
750
|
-
throw new ArgError(`Failed to parse test object options file error: ${err.message}`);
|
|
751
|
-
}
|
|
752
|
-
}
|
|
753
|
-
|
|
754
|
-
if (!program.project) {
|
|
755
|
-
const credentialsManager = require('./credentialsManager');
|
|
756
|
-
const projectId = await credentialsManager.getProjectId();
|
|
757
|
-
|
|
758
|
-
if (projectId) {
|
|
759
|
-
program.project = projectId;
|
|
760
|
-
} else {
|
|
761
|
-
throw new ArgError('missing project-id info, either --login to provide new credentials or use --project <project-id>');
|
|
762
|
-
}
|
|
763
|
-
}
|
|
764
|
-
|
|
765
|
-
if (!program.mode) {
|
|
766
|
-
// we default to selenium mode in Codim for debuggability
|
|
767
|
-
program.mode = program.run.length ? 'selenium' : 'extension';
|
|
768
|
-
}
|
|
769
|
-
|
|
770
|
-
if (program.testConfig) {
|
|
771
|
-
// convert single test config inputs to array (e.g. from configFile)
|
|
772
|
-
program.testConfig = [program.testConfig].flat();
|
|
773
|
-
}
|
|
774
|
-
|
|
775
|
-
if (program.testConfigId) {
|
|
776
|
-
// convert single test config inputs to array (e.g. from configFile)
|
|
777
|
-
program.testConfigId = [program.testConfigId].flat();
|
|
778
|
-
}
|
|
779
|
-
|
|
780
|
-
program.retries = !program.retries || typeof program.retries === 'boolean' ? 1 : Number(program.retries) + 1;
|
|
781
|
-
program.browserTimeout = !program.browserTimeout || typeof program.browserTimeout === 'boolean' ? 60 * 1000 : program.browserTimeout;
|
|
782
|
-
program.newBrowserWaitTimeout = !program.newBrowserWaitTimeout || typeof program.newBrowserWaitTimeout === 'boolean' ? 10 * 60 * 1000 : program.newBrowserWaitTimeout * 60 * 1000;
|
|
783
|
-
|
|
784
|
-
if (!program.getBrowserTimeout) {
|
|
785
|
-
program.getBrowserTimeout = program.browserTimeout;
|
|
786
|
-
}
|
|
787
|
-
if (!program.getBrowserRetries) {
|
|
788
|
-
program.getBrowserRetries = Math.round(program.newBrowserWaitTimeout / program.browserTimeout);
|
|
789
|
-
}
|
|
790
|
-
program.getSessionTimeout = program.browserTimeout < program.getSessionTimeout ? program.getSessionTimeout : program.browserTimeout;
|
|
791
|
-
program.driverRequestTimeout = program.browserTimeout < program.driverRequestTimeout ? program.driverRequestTimeout : program.browserTimeout;
|
|
792
|
-
|
|
793
|
-
const timeoutWasGiven = Boolean(program.timeout);
|
|
794
|
-
program.timeout = !program.timeout || typeof program.timeout === 'boolean' ? 10 * 60 * 1000 : program.timeout;
|
|
795
|
-
program.beforeParallel = !program.beforeParallel || typeof program.beforeParallel === 'boolean' ? 1 : Number(program.beforeParallel);
|
|
796
|
-
program.parallel = !program.parallel || typeof program.parallel === 'boolean' ? 1 : Number(program.parallel);
|
|
797
|
-
program.afterParallel = !program.afterParallel || typeof program.afterParallel === 'boolean' ? 1 : Number(program.afterParallel);
|
|
798
|
-
|
|
799
|
-
|
|
800
|
-
if (program.parallel > 1 && program.run && !program.gridId && !program.grid &&
|
|
801
|
-
((!program.testPlan || program.testPlan.length === 0) && (!program.testPlanId || !program.testPlanId.length)) && process.stdout.isTTY && !program.headless && !process.env.TERM) {
|
|
802
|
-
const prompts = require('prompts');
|
|
803
|
-
const response = await prompts({
|
|
804
|
-
type: 'toggle',
|
|
805
|
-
name: 'isSure',
|
|
806
|
-
message: 'Running in parallel without --headless flag will open several browsers on your computer. Are you sure?',
|
|
807
|
-
initial: false,
|
|
808
|
-
active: 'yes',
|
|
809
|
-
inactive: 'no',
|
|
810
|
-
});
|
|
811
|
-
|
|
812
|
-
if (!response.isSure) {
|
|
813
|
-
process.exit(0);
|
|
814
|
-
}
|
|
815
|
-
}
|
|
816
|
-
|
|
817
|
-
program.tunnelPort = !program.tunnelPort || typeof program.tunnelPort === 'boolean' ? '80' : program.tunnelPort;
|
|
818
|
-
|
|
819
|
-
program.port = program.port && Number(program.port);
|
|
820
|
-
|
|
821
|
-
if (program.retries <= 0 || Number.isNaN(program.retries)) {
|
|
822
|
-
throw new ArgError('test failure retry count could not be a negative number or string, --retries <max_num_of_retries>');
|
|
823
|
-
}
|
|
824
|
-
|
|
825
|
-
if (program.retries > 21) {
|
|
826
|
-
throw new ArgError('Max number of retries exceeded. Number cannot be greater than 20, --retries <max_num_of_retries>');
|
|
827
|
-
}
|
|
828
|
-
|
|
829
|
-
if (!program.token) {
|
|
830
|
-
const credentialsManager = require('./credentialsManager');
|
|
831
|
-
const credentialToken = await credentialsManager.getToken();
|
|
832
|
-
|
|
833
|
-
if (credentialToken) {
|
|
834
|
-
program.token = credentialToken;
|
|
835
|
-
} else {
|
|
836
|
-
throw new ArgError('missing Testim Access Token, either --login to provide new credentials or use --token <testim-access-token>, contact info@testim.io if you need a new one.');
|
|
837
|
-
}
|
|
838
|
-
}
|
|
839
|
-
|
|
840
|
-
if (program.browserTimeout <= 0 || Number.isNaN(program.browserTimeout)) {
|
|
841
|
-
throw new ArgError('get browser timeout could not be a negative number, --browser-timeout <get-browser-timeout>');
|
|
842
|
-
}
|
|
843
|
-
|
|
844
|
-
if (program.newBrowserWaitTimeout <= 0 || Number.isNaN(program.newBrowserWaitTimeout)) {
|
|
845
|
-
throw new ArgError('max new browser wait timeout could not be a negative number, --new-browser-wait-timeout <max-wait-to-browser>');
|
|
846
|
-
}
|
|
847
|
-
|
|
848
|
-
if (program.timeout <= 0 || Number.isNaN(program.timeout)) {
|
|
849
|
-
throw new ArgError('test run timeout could not be a negative number, --timeout <run-timeout>');
|
|
850
|
-
}
|
|
851
|
-
|
|
852
|
-
if (program.beforeParallel <= 0 || Number.isNaN(program.beforeParallel)) {
|
|
853
|
-
throw new ArgError('before-parallel could not be a negative number or not number, --before-parallel <number-of-tests>');
|
|
854
|
-
}
|
|
855
|
-
|
|
856
|
-
if (program.parallel <= 0 || Number.isNaN(program.parallel)) {
|
|
857
|
-
throw new ArgError('parallel could not be a negative number or not number, --parallel <number-of-tests>');
|
|
858
|
-
}
|
|
859
|
-
|
|
860
|
-
if (program.afterParallel <= 0 || Number.isNaN(program.afterParallel)) {
|
|
861
|
-
throw new ArgError('after-parallel could not be a negative number or not number, --after-parallel <number-of-tests>');
|
|
862
|
-
}
|
|
863
|
-
|
|
864
|
-
if (![CLI_MODE.EXTENSION, CLI_MODE.SELENIUM, CLI_MODE.APPIUM].includes(program.mode)) {
|
|
865
|
-
throw new ArgError(`runner mode <${program.mode}> is not supported`);
|
|
866
|
-
}
|
|
867
|
-
|
|
868
|
-
if ((program.mode !== CLI_MODE.SELENIUM) && program.disableNativeEvents) {
|
|
869
|
-
throw new ArgError('disable-native-events is only applicable in selenium mode');
|
|
870
|
-
}
|
|
871
|
-
|
|
872
|
-
if (
|
|
873
|
-
!program.browser &&
|
|
874
|
-
!isTestConfigSpecified &&
|
|
875
|
-
!isTestPlanSpecified
|
|
876
|
-
) {
|
|
877
|
-
program.browser = 'chrome';
|
|
878
|
-
}
|
|
879
|
-
|
|
880
|
-
if (!program.appiumLogLevel) {
|
|
881
|
-
program.appiumLogLevel = 'silent';
|
|
882
|
-
}
|
|
883
|
-
|
|
884
|
-
if (!LOG_LEVEL_OPTIONS.includes(program.appiumLogLevel)) {
|
|
885
|
-
throw new ArgError(`runner appium-log-level <${program.appiumLogLevel}> is not supported`);
|
|
886
|
-
}
|
|
887
|
-
|
|
888
|
-
if (program.testPlan && program.testPlan.length === 0 && program.testPlanId && program.testPlanId.length === 0) {
|
|
889
|
-
if (
|
|
890
|
-
typeof program.host !== 'string' &&
|
|
891
|
-
typeof program.grid !== 'string' &&
|
|
892
|
-
typeof program.gridId !== 'string' &&
|
|
893
|
-
program.run.length === 0 &&
|
|
894
|
-
!program.useLocalChromeDriver &&
|
|
895
|
-
!program.useChromeLauncher &&
|
|
896
|
-
!program.createPrefechedData
|
|
897
|
-
) {
|
|
898
|
-
throw new ArgError(
|
|
899
|
-
'missing remote grid address parameter, specify --host <host-name-or-ip> or --grid <grid-name> or --grid-id <grid-id>',
|
|
900
|
-
);
|
|
901
|
-
}
|
|
902
|
-
} else if (
|
|
903
|
-
program.testId.length ||
|
|
904
|
-
program.label.length ||
|
|
905
|
-
program.name.length ||
|
|
906
|
-
isTestConfigSpecified ||
|
|
907
|
-
program.browser ||
|
|
908
|
-
isSuiteSpecified ||
|
|
909
|
-
program.useLocalChromeDriver ||
|
|
910
|
-
program.useChromeLauncher
|
|
911
|
-
) {
|
|
912
|
-
throw new ArgError(
|
|
913
|
-
'cannot set --testId, --label, --name, --browser, --test-config, --test-config-id, --use-local-chrome-driver --use-chrome-launcher or --suite with --test-plan option',
|
|
914
|
-
);
|
|
915
|
-
}
|
|
916
|
-
|
|
917
|
-
if (!isTestPlanSpecified && (program.beforeParallel !== 1 || program.afterParallel !== 1)) {
|
|
918
|
-
throw new ArgError('cannot set --before-parallel or --after-parallel without --test-plan option');
|
|
919
|
-
}
|
|
920
|
-
|
|
921
|
-
if (
|
|
922
|
-
(program.testId.length ||
|
|
923
|
-
isTestPlanSpecified ||
|
|
924
|
-
program.label.length ||
|
|
925
|
-
program.name.length ||
|
|
926
|
-
isSuiteSpecified) &&
|
|
927
|
-
program.file
|
|
928
|
-
) {
|
|
929
|
-
throw new ArgError(
|
|
930
|
-
'Cannot pass codeful automation tests with --testId --label --name or --suite',
|
|
931
|
-
);
|
|
932
|
-
}
|
|
933
|
-
|
|
934
|
-
const numberOfDefinedHosts = [program.host, program.grid, program.gridId].filter(Boolean).length;
|
|
935
|
-
if (numberOfDefinedHosts > 1) {
|
|
936
|
-
throw new ArgError('please define exactly one of --grid or --grid-id or --host');
|
|
937
|
-
}
|
|
938
|
-
|
|
939
|
-
if (program.host?.includes('/')) {
|
|
940
|
-
if (!/^(f|ht)tps?:\/\//i.test(program.host)) {
|
|
941
|
-
program.host = `http://${program.host}`;
|
|
942
|
-
}
|
|
943
|
-
program.host = url.parse(program.host).hostname;
|
|
944
|
-
}
|
|
945
|
-
|
|
946
|
-
if (program.resultLabel.length) {
|
|
947
|
-
program.resultLabel = program.resultLabel.map(label => label.trim()).filter(Boolean);
|
|
948
|
-
const invalidLabels = program.resultLabel.filter(label => label.length >= 250).filter(Boolean);
|
|
949
|
-
if (program.branch === 'auto-detect' && program.resultLabel.includes('auto-detect-branch') && utils.getEnvironmentGitBranch()) {
|
|
950
|
-
program.resultLabel.unshift(utils.getEnvironmentGitBranch());
|
|
951
|
-
}
|
|
952
|
-
if (invalidLabels.length) {
|
|
953
|
-
throw new ArgError('A result label cannot exceed 250 characters');
|
|
954
|
-
}
|
|
955
|
-
}
|
|
956
|
-
|
|
957
|
-
const extHeadlessUrl = runOptionsUtils.getResolvedExtensionUrl(program);
|
|
958
|
-
const playerUrl = runOptionsUtils.getPlayerUrl(program);
|
|
959
|
-
|
|
960
|
-
if (!program.w3cCapabilities && !program.oldCapabilities) {
|
|
961
|
-
throw new ArgError('cannot set --w3c-capabilities and --old-capabilities options as false');
|
|
962
|
-
}
|
|
963
|
-
program.protocol = program.protocol || (program.port === 443 ? 'https' : 'http');
|
|
964
|
-
if (!['http', 'https'].includes(program.protocol)) {
|
|
965
|
-
throw new ArgError('invalid --protocol value, allow --protocol http or https');
|
|
966
|
-
}
|
|
967
|
-
|
|
968
|
-
if (program.rerunFailedByRunId && program.branch) {
|
|
969
|
-
throw new ArgError('It is not possible to use --branch with --rerun-failed-by-run-id. Tests will automatically run on the same branch that was used in the original run');
|
|
970
|
-
}
|
|
971
|
-
|
|
972
|
-
if (program.rerunFailedByRunId &&
|
|
973
|
-
(isSuiteSpecified || program.name.length ||
|
|
974
|
-
program.testId.length || program.label.length || isTestPlanSpecified)) {
|
|
975
|
-
throw new ArgError('Re-running failed tests is not possible when suite (--suite),' +
|
|
976
|
-
' label (--label), plan (--test-plan), or other test flags (--test) are provided. Please remove these flags and try again');
|
|
977
|
-
}
|
|
978
|
-
|
|
979
|
-
if (program.run.length) {
|
|
980
|
-
const glob = require('glob');
|
|
981
|
-
program.files = _.flatMap(program.run, files => glob.sync(files));
|
|
982
|
-
if (program.files.length === 0) {
|
|
983
|
-
throw new ArgError(`No files found at path '${program.run}'.`);
|
|
984
|
-
}
|
|
985
|
-
} else {
|
|
986
|
-
program.files = [];
|
|
987
|
-
}
|
|
988
|
-
|
|
989
|
-
if (program.setRetention && !_.inRange(_.parseInt(program.setRetention), 1, 11)) {
|
|
990
|
-
throw new ArgError('Please provide the number of days that the test results will be retained for (--set-retention must be a whole number between 1 to 10)');
|
|
991
|
-
}
|
|
992
|
-
program.setRetention = program.setRetention && Number(program.setRetention);
|
|
993
|
-
|
|
994
|
-
const mockNetworkDeprecationMsg = 'is no longer supported, please use --override-mapping-file';
|
|
995
|
-
if (program.mockNetworkHar) {
|
|
996
|
-
throw new ArgError(`--mock-network-har ${mockNetworkDeprecationMsg}`);
|
|
997
|
-
}
|
|
998
|
-
if (program.mockNetworkPattern) {
|
|
999
|
-
throw new ArgError(`--mock-network-pattern ${mockNetworkDeprecationMsg}`);
|
|
1000
|
-
}
|
|
1001
|
-
|
|
1002
|
-
if (program.disableMockNetwork && program.overrideMappingFile) {
|
|
1003
|
-
throw new ArgError('You can either use --disable-mock-network or --override-mapping-file');
|
|
1004
|
-
}
|
|
1005
|
-
|
|
1006
|
-
if (!program.collectCodeCoverage && program.codeCoverageSourceMapPath) {
|
|
1007
|
-
throw new ArgError('cannot set --code-coverage-source-map-path without passing --collect-code-coverage');
|
|
1008
|
-
}
|
|
1009
|
-
|
|
1010
|
-
if (!program.collectCodeCoverage && program.codeCoverageReporter.length) {
|
|
1011
|
-
throw new ArgError('cannot set --code-coverage-reporter without passing --collect-code-coverage');
|
|
1012
|
-
}
|
|
1013
|
-
|
|
1014
|
-
if (!program.collectCodeCoverage && program.codeCoverageInclude.length) {
|
|
1015
|
-
throw new ArgError('cannot set --code-coverage-include without passing --collect-code-coverage');
|
|
1016
|
-
}
|
|
1017
|
-
|
|
1018
|
-
if (program.collectCodeCoverage && program.codeCoverageReporter && _.difference(program.codeCoverageReporter, CODE_COVERAGE_REPORTER_OPTIONS).length) {
|
|
1019
|
-
const diff = _.difference(program.codeCoverageReporter, CODE_COVERAGE_REPORTER_OPTIONS);
|
|
1020
|
-
throw new ArgError(`invalid --code-coverage-reporter parameters ${diff.join('/')}`);
|
|
1021
|
-
}
|
|
1022
|
-
|
|
1023
|
-
program.codeCoverageReporter = program.codeCoverageReporter.length === 0 ? ['html', 'text'] : program.codeCoverageReporter;
|
|
1024
|
-
program.codeCoverageInclude = program.codeCoverageInclude.length === 0 ? ['src/**'] : program.codeCoverageInclude;
|
|
1025
|
-
|
|
1026
|
-
const extensionOnlyOptions = {
|
|
1027
|
-
mockNetworkHar: '--mock-network-har',
|
|
1028
|
-
mockNetworkPattern: '--mock-network-pattern',
|
|
1029
|
-
overrideMappingFile: '--override-mapping-file',
|
|
1030
|
-
codeCoverageUrlFilter: '--code-coverage-url-filter',
|
|
1031
|
-
collectCodeCoverage: '--collect-code-coverage',
|
|
1032
|
-
disableMockNetwork: '--disable-mock-network',
|
|
1033
|
-
useChromeLauncher: '--use-chrome-launcher',
|
|
1034
|
-
};
|
|
1035
|
-
const usedExtensionOptions = Object.keys(extensionOnlyOptions).filter(key => Boolean(program[key]));
|
|
1036
|
-
|
|
1037
|
-
if (program.mode !== CLI_MODE.EXTENSION && usedExtensionOptions.length) {
|
|
1038
|
-
const multi = usedExtensionOptions.length > 1 ? 'are' : 'is';
|
|
1039
|
-
throw new ArgError(`${usedExtensionOptions.map(key => extensionOnlyOptions[key]).join(' and ')} ${multi} only applicable in extension mode`);
|
|
1040
|
-
}
|
|
1041
|
-
|
|
1042
|
-
if (program.tmsFieldFile) {
|
|
1043
|
-
try {
|
|
1044
|
-
const fileContent = fs.readFileSync(program.tmsFieldFile);
|
|
1045
|
-
program.tmsCustomFields = JSON.parse(fileContent);
|
|
1046
|
-
} catch (err) {
|
|
1047
|
-
throw new ArgError(`failed to parse field file error: ${err.message}`);
|
|
1048
|
-
}
|
|
1049
|
-
}
|
|
1050
|
-
|
|
1051
|
-
/** Handling deprecation of High speed mode (renamed to Turbo mode) */
|
|
1052
|
-
if (program.highSpeed) {
|
|
1053
|
-
printDeprecationWarning('--high-speed', ' --turbo-mode');
|
|
1054
|
-
program.turboMode = true;
|
|
1055
|
-
}
|
|
1056
|
-
|
|
1057
|
-
if (program.deviceUdid && (program.deviceModel || program.osVersion)) {
|
|
1058
|
-
throw new ArgError('It is not possible to use --osVersion or --deviceModel with --device-udid. device-udid is unique and cannot be combined with another flag');
|
|
1059
|
-
}
|
|
1060
|
-
if (program.lightweightMode) {
|
|
1061
|
-
try {
|
|
1062
|
-
const DEFAULTS = {
|
|
1063
|
-
general: true,
|
|
1064
|
-
disableLabs: true,
|
|
1065
|
-
disableFeatureFlags: true,
|
|
1066
|
-
disableAssets: true,
|
|
1067
|
-
disablePixelValidation: true,
|
|
1068
|
-
disableResults: true,
|
|
1069
|
-
disableStepDelay: true,
|
|
1070
|
-
disableRemoteStep: true,
|
|
1071
|
-
assumePreloadedSharedSteps: true,
|
|
1072
|
-
disableVisibilityCheck: false,
|
|
1073
|
-
disableLocators: false,
|
|
1074
|
-
bypassSetup: false,
|
|
1075
|
-
disableAutoImprove: true,
|
|
1076
|
-
disableQuotaBlocking: true,
|
|
1077
|
-
onlyTestIdsNoSuite: true,
|
|
1078
|
-
uploadAssetsAndResultsOnFailure: true,
|
|
1079
|
-
preloadTests: true,
|
|
1080
|
-
disableProjectDefaults: true,
|
|
1081
|
-
type: 'lightweight',
|
|
1082
|
-
};
|
|
1083
|
-
|
|
1084
|
-
const lightweightModeOptions = typeof program.lightweightMode === 'string' ? JSON.parse(program.lightweightMode) : {};
|
|
1085
|
-
program.lightweightMode = Object.assign({}, DEFAULTS, lightweightModeOptions);
|
|
1086
|
-
} catch (err) {
|
|
1087
|
-
throw new ArgError(`failed to parse lightweightMode settings error: ${err.message}`);
|
|
1088
|
-
}
|
|
1089
|
-
} else if (program.turboMode && program.mode === CLI_MODE.EXTENSION) {
|
|
1090
|
-
program.lightweightMode = {
|
|
1091
|
-
general: true,
|
|
1092
|
-
disableLabs: false,
|
|
1093
|
-
disableFeatureFlags: false,
|
|
1094
|
-
disableAssets: true,
|
|
1095
|
-
disablePixelValidation: false,
|
|
1096
|
-
disableResults: true,
|
|
1097
|
-
disableStepDelay: true,
|
|
1098
|
-
disableRemoteStep: false,
|
|
1099
|
-
assumePreloadedSharedSteps: false,
|
|
1100
|
-
disableVisibilityCheck: false,
|
|
1101
|
-
disableLocators: false,
|
|
1102
|
-
bypassSetup: false,
|
|
1103
|
-
disableQuotaBlocking: false,
|
|
1104
|
-
disableAutoImprove: false,
|
|
1105
|
-
onlyTestIdsNoSuite: false,
|
|
1106
|
-
uploadAssetsAndResultsOnFailure: true,
|
|
1107
|
-
preloadTests: false,
|
|
1108
|
-
disableProjectDefaults: false,
|
|
1109
|
-
type: 'turboMode',
|
|
1110
|
-
};
|
|
1111
|
-
}
|
|
1112
|
-
|
|
1113
|
-
if (typeof program.baseUrl === 'boolean') {
|
|
1114
|
-
throw new ArgError('base url cannot be used as a flag, and must contain a string value');
|
|
1115
|
-
}
|
|
1116
|
-
|
|
1117
|
-
return ({
|
|
1118
|
-
testId: [program.testId].flat(),
|
|
1119
|
-
name: [program.name].flat(),
|
|
1120
|
-
label: [program.label].flat(),
|
|
1121
|
-
suites: [program.suite].flat(),
|
|
1122
|
-
suiteIds: [program.suiteId].flat(),
|
|
1123
|
-
testPlan: [program.testPlan].flat(),
|
|
1124
|
-
testPlanIds: [program.testPlanId].flat(),
|
|
1125
|
-
files: [program.files].flat(),
|
|
1126
|
-
webpackConfig: program.webpackConfig,
|
|
1127
|
-
reportFile: program.reportFile,
|
|
1128
|
-
urls: program.urls,
|
|
1129
|
-
reportFileClassname: program.overrideReportFileClassname,
|
|
1130
|
-
reporters: program.reporters,
|
|
1131
|
-
project: program.project,
|
|
1132
|
-
host: program.host,
|
|
1133
|
-
headless: program.headless,
|
|
1134
|
-
useLocalChromeDriver: program.useLocalChromeDriver,
|
|
1135
|
-
chromeBinaryLocation: program.chromeBinaryLocation,
|
|
1136
|
-
useChromeLauncher: program.useChromeLauncher,
|
|
1137
|
-
port: program.port,
|
|
1138
|
-
grid: program.grid,
|
|
1139
|
-
gridId: program.gridId,
|
|
1140
|
-
disableNativeEvents: program.disableNativeEvents,
|
|
1141
|
-
saucelabs: program.saucelabs,
|
|
1142
|
-
browserstack: program.browserstack,
|
|
1143
|
-
baseUrl: program.baseUrl,
|
|
1144
|
-
branch: (program.branch === 'auto-detect' ? utils.getEnvironmentGitBranch() : program.branch) || 'master',
|
|
1145
|
-
autoDetect: program.branch === 'auto-detect',
|
|
1146
|
-
token: program.token,
|
|
1147
|
-
userParamsData,
|
|
1148
|
-
mode: program.mode,
|
|
1149
|
-
isRegressionBaselineRun: program.isRegressionBaselineRun,
|
|
1150
|
-
browser: program.browser,
|
|
1151
|
-
beforeParallel: program.beforeParallel,
|
|
1152
|
-
parallel: program.parallel,
|
|
1153
|
-
afterParallel: program.afterParallel,
|
|
1154
|
-
canary: program.canary,
|
|
1155
|
-
rerunFailedByRunId: program.rerunFailedByRunId,
|
|
1156
|
-
disableGridCheck: program.disableGridCheck,
|
|
1157
|
-
disableTimeoutRetry: program.disableTimeoutRetry,
|
|
1158
|
-
resultLabels: program.resultLabel,
|
|
1159
|
-
path: program.path,
|
|
1160
|
-
protocol: program.protocol,
|
|
1161
|
-
perfecto: program.perfecto,
|
|
1162
|
-
experitestToken: program.experitestToken,
|
|
1163
|
-
testobjectSauce: program.testobjectSauce,
|
|
1164
|
-
gridUsername: program.gridUsername,
|
|
1165
|
-
gridPassword: program.gridPassword,
|
|
1166
|
-
overrideExecutionName: program.overrideExecutionName,
|
|
1167
|
-
|
|
1168
|
-
tmsSuppressReporting: Boolean(program.suppressTmsReporting) || Boolean(program.tmsSuppressReporting),
|
|
1169
|
-
tmsRunId: program.tmsRunId,
|
|
1170
|
-
tmsCustomFields: program.tmsCustomFields,
|
|
1171
|
-
|
|
1172
|
-
proxyForGrid: program.proxyForGrid,
|
|
1173
|
-
retentionDays: program.setRetention,
|
|
1174
|
-
passZeroTests: Boolean(program.passZeroTests),
|
|
1175
|
-
runQuarantinedTests: Boolean(program.runQuarantinedTests),
|
|
1176
|
-
//Mobile-Flags
|
|
1177
|
-
deviceModel: program.deviceModel,
|
|
1178
|
-
deviceUdid: program.deviceUdid,
|
|
1179
|
-
osVersion: program.osVersion,
|
|
1180
|
-
appId: program.appId,
|
|
1181
|
-
appiumLogLevel: program.appiumLogLevel,
|
|
1182
|
-
|
|
1183
|
-
// Extension
|
|
1184
|
-
ext: program.ext,
|
|
1185
|
-
extensionLocation: [program.extensionPath || extHeadlessUrl].flat(),
|
|
1186
|
-
extensionPath: program.extensionPath,
|
|
1187
|
-
|
|
1188
|
-
// Player
|
|
1189
|
-
playerLocation: program.playerPath || playerUrl,
|
|
1190
|
-
playerPath: program.playerPath,
|
|
1191
|
-
playerRequirePath: program.playerRequirePath,
|
|
1192
|
-
|
|
1193
|
-
// Tunnel
|
|
1194
|
-
tunnel: program.tunnel,
|
|
1195
|
-
tunnelPort: program.tunnelPort,
|
|
1196
|
-
tunnelRoutes: program.tunnelRoutes,
|
|
1197
|
-
tunnelRoutesOutput: program.tunnelRoutesOutput,
|
|
1198
|
-
tunnelHostHeader: program.tunnelHostHeader,
|
|
1199
|
-
tunnelRegion: program.tunnelRegion,
|
|
1200
|
-
tunnelDiagnostics: program.tunnelDiagnostics,
|
|
1201
|
-
tunnelUseHttpAddress: program.tunnelUseHttpAddress,
|
|
1202
|
-
externalLambdatestTunnelId: program.externalLambdatestTunnelId,
|
|
1203
|
-
externalLambdatestUseWss: program.externalLambdatestUseWss || false,
|
|
1204
|
-
externalLambdatestDisableAutomationTunneling: Boolean(program.externalLambdatestDisableAutomationTunneling),
|
|
1205
|
-
externalLambdatestMitm: Boolean(program.externalLambdatestMitm),
|
|
1206
|
-
|
|
1207
|
-
// Hooks
|
|
1208
|
-
beforeTest: program.beforeTest,
|
|
1209
|
-
afterTest: program.afterTest,
|
|
1210
|
-
beforeSuite: program.beforeSuite,
|
|
1211
|
-
afterSuite: program.afterSuite,
|
|
1212
|
-
|
|
1213
|
-
// Timeout
|
|
1214
|
-
timeout: program.timeout,
|
|
1215
|
-
timeoutWasGiven,
|
|
1216
|
-
browserTimeout: program.browserTimeout,
|
|
1217
|
-
newBrowserWaitTimeout: program.newBrowserWaitTimeout,
|
|
1218
|
-
|
|
1219
|
-
// New Timeouts
|
|
1220
|
-
getBrowserTimeout: program.getBrowserTimeout,
|
|
1221
|
-
getBrowserRetries: program.getBrowserRetries,
|
|
1222
|
-
getSessionTimeout: program.getSessionTimeout,
|
|
1223
|
-
getSessionRetries: program.getSessionRetries,
|
|
1224
|
-
driverRequestTimeout: program.driverRequestTimeout,
|
|
1225
|
-
driverRequestRetries: program.driverRequestRetries,
|
|
1226
|
-
|
|
1227
|
-
testStartTimeout: program.testStartTimeout,
|
|
1228
|
-
|
|
1229
|
-
testConfigNames: program.testConfig,
|
|
1230
|
-
testConfigIds: program.testConfigId,
|
|
1231
|
-
|
|
1232
|
-
// Mock network
|
|
1233
|
-
overrideMappingFile: program.overrideMappingFile,
|
|
1234
|
-
disableMockNetwork: program.disableMockNetwork,
|
|
1235
|
-
|
|
1236
|
-
// Code coverage
|
|
1237
|
-
codeCoverageUrlFilter: program.codeCoverageUrlFilter,
|
|
1238
|
-
collectCodeCoverage: program.collectCodeCoverage,
|
|
1239
|
-
codeCoverageReportPath: program.codeCoverageReportPath,
|
|
1240
|
-
codeCoverageSourceMapPath: program.codeCoverageSourceMapPath,
|
|
1241
|
-
codeCoverageReporter: program.codeCoverageReporter,
|
|
1242
|
-
codeCoverageInclude: program.codeCoverageInclude,
|
|
1243
|
-
|
|
1244
|
-
// Remote run options
|
|
1245
|
-
executionId: program.executionId,
|
|
1246
|
-
remoteRunId: program.remoteRunId,
|
|
1247
|
-
schedulerId: program.schedulerId,
|
|
1248
|
-
source: program.source,
|
|
1249
|
-
resultId: program.resultId,
|
|
1250
|
-
|
|
1251
|
-
//Customer Extension
|
|
1252
|
-
installCustomExtension: program.installCustomExtension,
|
|
1253
|
-
|
|
1254
|
-
w3cCapabilities: program.w3cCapabilities,
|
|
1255
|
-
oldCapabilities: program.oldCapabilities,
|
|
1256
|
-
|
|
1257
|
-
chromeBlockLocation: program.chromeBlockLocation,
|
|
1258
|
-
chromeUserDataDir: program.chromeUserDataDir,
|
|
1259
|
-
retries: program.retries,
|
|
1260
|
-
chromeExtraPrefs,
|
|
1261
|
-
chromeExtraArgs,
|
|
1262
|
-
|
|
1263
|
-
disableCookiesSameSiteNoneRequiresSecure: program.disableCookiesSameSiteNoneRequiresSecure,
|
|
1264
|
-
|
|
1265
|
-
seleniumCapsFileContent,
|
|
1266
|
-
shouldMonitorPerformance: program.monitorPerformance,
|
|
1267
|
-
|
|
1268
|
-
user: program.user,
|
|
1269
|
-
|
|
1270
|
-
lightweightMode: program.lightweightMode,
|
|
1271
|
-
createPrefechedData: program.createPrefechedData,
|
|
1272
|
-
|
|
1273
|
-
saveRCALocally: program.saveRcaLocally,
|
|
1274
|
-
exitCodeIgnoreFailingTests: program.exitCodeIgnoreFailingTests,
|
|
1275
|
-
|
|
1276
|
-
disableSockets: program.disableSockets,
|
|
1277
|
-
|
|
1278
|
-
// intersections
|
|
1279
|
-
intersections: {
|
|
1280
|
-
labels: program.intersectWithLabel.length ? [program.intersectWithLabel].flat() : undefined,
|
|
1281
|
-
suiteNames: program.intersectWithSuite.length ? [program.intersectWithSuite].flat() : undefined,
|
|
1282
|
-
suiteIds: program.intersectWithSuiteId.length ? [program.intersectWithSuiteId].flat() : undefined,
|
|
1283
|
-
},
|
|
1284
|
-
|
|
1285
|
-
downloadBrowser: program.downloadBrowser,
|
|
1286
|
-
});
|
|
1287
|
-
},
|
|
1288
|
-
};
|