@testim/testim-cli 3.260.0 → 3.262.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/commons/testimServicesApi.js +10 -7
- package/executionQueue.js +9 -1
- package/npm-shrinkwrap.json +2 -2
- package/package.json +1 -1
- package/player/stepActions/RefreshStepAction.js +7 -4
- package/player/stepActions/baseJsStepAction.js +45 -46
- package/player/stepActions/dropFileStepAction.js +11 -12
- package/player/stepActions/evaluateExpressionStepAction.js +32 -33
- package/player/stepActions/extensionOnlyStepAction.js +3 -4
- package/player/stepActions/extractTextStepAction.js +8 -10
- package/player/stepActions/hoverStepAction.js +3 -3
- package/player/stepActions/locateStepAction.js +39 -34
- package/player/stepActions/mouseStepAction.js +36 -34
- package/player/stepActions/navigationStepAction.js +7 -8
- package/player/stepActions/scrollStepAction.js +22 -22
- package/player/stepActions/stepAction.js +21 -21
- package/player/stepActions/stepActionRegistrar.js +63 -58
- package/player/stepActions/submitStepAction.js +2 -3
- package/player/stepActions/textStepAction.js +14 -14
- package/player/stepActions/textValidationStepAction.js +50 -38
- package/player/stepActions/wheelStepAction.js +5 -11
- package/processHandler.js +2 -0
- package/reports/junitReporter.js +18 -1
- package/runOptions.d.ts +4 -0
- package/runOptions.js +8 -1
- package/runners/TestPlanRunner.js +20 -19
- package/runners/runnerUtils.js +1 -2
- package/testRunHandler.js +18 -9
- package/testRunStatus.js +205 -157
- package/workers/BaseWorker.js +11 -0
- package/workers/WorkerExtension.js +117 -91
- package/workers/WorkerSelenium.js +8 -3
package/runOptions.js
CHANGED
|
@@ -112,6 +112,10 @@ const printUsage = () => {
|
|
|
112
112
|
return line.includes('--high-speed'); // high speed mode was renamed to turbo mode
|
|
113
113
|
}
|
|
114
114
|
|
|
115
|
+
function isUrls(line) {
|
|
116
|
+
return line.includes('--urls');
|
|
117
|
+
}
|
|
118
|
+
|
|
115
119
|
function isTestStartTimeout(line) {
|
|
116
120
|
return line.includes('--test-start-timeout');
|
|
117
121
|
}
|
|
@@ -119,7 +123,7 @@ const printUsage = () => {
|
|
|
119
123
|
program.help((txt) => {
|
|
120
124
|
const lines = txt.split('\n');
|
|
121
125
|
return lines
|
|
122
|
-
.filter(
|
|
126
|
+
.filter( // hide CLI options
|
|
123
127
|
(ln) =>
|
|
124
128
|
!isExtOnlyOption(ln) &&
|
|
125
129
|
!isParamsJsonOption(ln) &&
|
|
@@ -132,6 +136,7 @@ const printUsage = () => {
|
|
|
132
136
|
!isSaveRCALocally(ln) &&
|
|
133
137
|
!isExitCodeIgnoreFailingTests(ln) &&
|
|
134
138
|
!isDeprecatedHighSpeed(ln) &&
|
|
139
|
+
!isUrls(ln) &&
|
|
135
140
|
!isTestStartTimeout(ln)
|
|
136
141
|
)
|
|
137
142
|
.join('\n');
|
|
@@ -172,6 +177,7 @@ program
|
|
|
172
177
|
.option('-n, --name [test-name]', 'test name to run', collect, [])
|
|
173
178
|
.option('--project [project-id]', 'project ID')
|
|
174
179
|
.option('-r, --report-file [report junit xml path]', 'where to save junit xml results file')
|
|
180
|
+
.option('--urls', 'add step urls to the junit report')
|
|
175
181
|
.option('--override-report-file-classname [override-report-file-classname]', 'custom junit class name for the junit reporter')
|
|
176
182
|
.option('--reporters [names]', 'report types', list)
|
|
177
183
|
.option('-h, --host [host-name]', 'host name or ip containing the selenium grid')
|
|
@@ -1108,6 +1114,7 @@ module.exports = {
|
|
|
1108
1114
|
files: [program.files].flat(),
|
|
1109
1115
|
webpackConfig: program.webpackConfig,
|
|
1110
1116
|
reportFile: program.reportFile,
|
|
1117
|
+
urls: program.urls,
|
|
1111
1118
|
reportFileClassname: program.overrideReportFileClassname,
|
|
1112
1119
|
reporters: program.reporters,
|
|
1113
1120
|
project: program.project,
|
|
@@ -1,29 +1,30 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
3
|
const _ = require('lodash');
|
|
4
|
-
const
|
|
5
|
-
|
|
6
|
-
const
|
|
4
|
+
const utils = require('../utils');
|
|
5
|
+
const Logger = require('../commons/logger');
|
|
6
|
+
const config = require('../commons/config');
|
|
7
7
|
const reporter = require('../reports/reporter');
|
|
8
|
-
const
|
|
9
|
-
const testimServicesApi = require('../commons/testimServicesApi');
|
|
10
|
-
const testimCustomToken = require('../commons/testimCustomToken');
|
|
8
|
+
const constants = require('../commons/constants');
|
|
11
9
|
const TestRunStatus = require('../testRunStatus');
|
|
12
|
-
const
|
|
10
|
+
const perf = require('../commons/performance-logger');
|
|
13
11
|
const gridService = require('../services/gridService');
|
|
14
12
|
const branchService = require('../services/branchService');
|
|
15
|
-
const config = require('../commons/config');
|
|
16
13
|
const ParallelWorkerManager = require('./ParallelWorkerManager');
|
|
17
|
-
const
|
|
18
|
-
const
|
|
14
|
+
const analyticsService = require('../services/analyticsService');
|
|
15
|
+
const testimServicesApi = require('../commons/testimServicesApi');
|
|
16
|
+
const testimCustomToken = require('../commons/testimCustomToken');
|
|
17
|
+
const RealDataService = require('../commons/socket/realDataService');
|
|
19
18
|
const { StopRunOnError, ArgError } = require('../errors');
|
|
20
|
-
const
|
|
21
|
-
const perf = require('../commons/performance-logger');
|
|
19
|
+
const { getSuite, calcTestResultStatus, validateConfig } = require('./runnerUtils');
|
|
22
20
|
|
|
23
21
|
const guid = utils.guid;
|
|
22
|
+
const TESTIM_RUN_STATUS = constants.testRunStatus;
|
|
24
23
|
const logger = Logger.getLogger('test-plan-runner');
|
|
25
24
|
const TDK_CHILD_RESULTS_TIMEOUT = 1000 * 60 * 5;
|
|
26
25
|
|
|
26
|
+
/** @typedef {Awaited<ReturnType<typeof getSuite>>['tests'][number]} ExecutionList */
|
|
27
|
+
|
|
27
28
|
class TestPlanRunner {
|
|
28
29
|
/**
|
|
29
30
|
* @param {string=} customExtensionLocalLocation
|
|
@@ -35,9 +36,9 @@ class TestPlanRunner {
|
|
|
35
36
|
|
|
36
37
|
/**
|
|
37
38
|
* @private
|
|
38
|
-
* @param {
|
|
39
|
-
* @param {
|
|
40
|
-
* @param {
|
|
39
|
+
* @param {ExecutionList} beforeTests
|
|
40
|
+
* @param {ExecutionList} tests
|
|
41
|
+
* @param {ExecutionList} afterTests
|
|
41
42
|
* @param {string} branchToUse
|
|
42
43
|
* @param {import('../runOptions').RunnerOptions} tpOptions
|
|
43
44
|
* @param {string} executionId
|
|
@@ -213,9 +214,9 @@ class TestPlanRunner {
|
|
|
213
214
|
|
|
214
215
|
/**
|
|
215
216
|
* @private
|
|
216
|
-
* @param {
|
|
217
|
-
* @param {
|
|
218
|
-
* @param {
|
|
217
|
+
* @param {ExecutionList} beforeTests
|
|
218
|
+
* @param {ExecutionList} tests
|
|
219
|
+
* @param {ExecutionList} afterTests
|
|
219
220
|
* @param {import('../runOptions').RunnerOptions} tpOptions
|
|
220
221
|
* @param {string} testPlanName
|
|
221
222
|
* @param {string | null} testPlanId
|
|
@@ -285,7 +286,7 @@ class TestPlanRunner {
|
|
|
285
286
|
});
|
|
286
287
|
|
|
287
288
|
function flattenTestListData(testPlansData) {
|
|
288
|
-
return _.flattenDeep(Object.
|
|
289
|
+
return _.flattenDeep(Object.values(testPlansData)).reduce((all, testRun) => all.concat(testRun.beforeTests, testRun.tests, testRun.afterTests), []);
|
|
289
290
|
}
|
|
290
291
|
|
|
291
292
|
const testPlansResults = {};
|
package/runners/runnerUtils.js
CHANGED
|
@@ -53,9 +53,8 @@ function calcTestResultStatus(tests) {
|
|
|
53
53
|
|
|
54
54
|
|
|
55
55
|
/**
|
|
56
|
-
* @template T
|
|
57
56
|
* @param {import('../runOptions').RunnerOptions} options
|
|
58
|
-
* @param {
|
|
57
|
+
* @param {import('./TestPlanRunner').ExecutionList} testList
|
|
59
58
|
*/
|
|
60
59
|
async function validateConfig(options, testList) {
|
|
61
60
|
const supportedBrowsers = options.mode === 'extension' ? [
|
package/testRunHandler.js
CHANGED
|
@@ -23,6 +23,14 @@ const MAX_LIGHTWEIGHT_MODE_RUN_DATA_SIZE = 20 * 1000; // max size, in characters
|
|
|
23
23
|
const canSendRunDataOverUrl = (runData) => JSON.stringify(runData).length < MAX_LIGHTWEIGHT_MODE_RUN_DATA_SIZE;
|
|
24
24
|
|
|
25
25
|
class TestRun {
|
|
26
|
+
/**
|
|
27
|
+
* @param {string} executionId
|
|
28
|
+
* @param {string} executionName
|
|
29
|
+
* @param {*} test
|
|
30
|
+
* @param {import('./runOptions').RunnerOptions} options
|
|
31
|
+
* @param {string} branchToUse
|
|
32
|
+
* @param {import('./testRunStatus')} testRunStatus
|
|
33
|
+
*/
|
|
26
34
|
constructor(executionId, executionName, test, options, branchToUse, testRunStatus) {
|
|
27
35
|
this._executionId = executionId;
|
|
28
36
|
this._executionName = executionName;
|
|
@@ -33,7 +41,7 @@ class TestRun {
|
|
|
33
41
|
this._code = test.code;
|
|
34
42
|
this._baseUrl = options.baseUrl || test.baseUrl || test.testConfig.baseUrl;
|
|
35
43
|
this._nativeApp = test.nativeApp;
|
|
36
|
-
this._overrideTestConfigId = test.overrideTestConfig
|
|
44
|
+
this._overrideTestConfigId = test.overrideTestConfig?.id;
|
|
37
45
|
this._options = options;
|
|
38
46
|
this._branch = branchToUse;
|
|
39
47
|
this._maxRetryCount = options.retries;
|
|
@@ -43,7 +51,7 @@ class TestRun {
|
|
|
43
51
|
this._totalRetryCount = 1;
|
|
44
52
|
|
|
45
53
|
this._testRunStatus = testRunStatus;
|
|
46
|
-
const shouldUpdateConfig = !
|
|
54
|
+
const shouldUpdateConfig = !test.runConfig?.isMobileWeb && options.browser;
|
|
47
55
|
this._runConfig = shouldUpdateConfig ? utils.getRunConfigByBrowserName(options.browser, options.saucelabs, options.browserstack) : test.runConfig;
|
|
48
56
|
this.clearTestResultFinished = Promise.resolve();
|
|
49
57
|
|
|
@@ -181,20 +189,22 @@ class TestRun {
|
|
|
181
189
|
runRequestParams.lightweightMode = this._options.lightweightMode;
|
|
182
190
|
}
|
|
183
191
|
|
|
184
|
-
if (this._options.lightweightMode
|
|
192
|
+
if (this._options.lightweightMode?.general) {
|
|
185
193
|
runRequestParams.company = this._options.company;
|
|
186
194
|
const runData = this.getRunData();
|
|
187
195
|
runRequestParams.lightweightMode.isRunDataSentInUrl = canSendRunDataOverUrl(runData);
|
|
196
|
+
const stringifiedLength = JSON.stringify(runData).length;
|
|
197
|
+
const testId = this.getTestId();
|
|
188
198
|
if (runRequestParams.lightweightMode.isRunDataSentInUrl) {
|
|
189
199
|
runRequestParams.runData = runData;
|
|
190
|
-
logger.info(`Run data sent as URL param, test id: ${
|
|
200
|
+
logger.info(`Run data sent as URL param, test id: ${testId} run data length: ${stringifiedLength}`);
|
|
191
201
|
} else {
|
|
192
|
-
logger.warn(`Run data is too big to be sent as a URL param. Test id: ${
|
|
202
|
+
logger.warn(`Run data is too big to be sent as a URL param. Test id: ${testId}, run data size: ${stringifiedLength} (limit: ${MAX_LIGHTWEIGHT_MODE_RUN_DATA_SIZE} characters)`);
|
|
193
203
|
}
|
|
194
204
|
runRequestParams.isLocalRun = Boolean(this._options.useLocalChromeDriver || this._options.useChromeLauncher);
|
|
195
205
|
}
|
|
196
206
|
|
|
197
|
-
if (this._options.lightweightMode
|
|
207
|
+
if (this._options.lightweightMode?.preloadTests && this._options.useChromeLauncher) {
|
|
198
208
|
const preloadedTests = await preloadTests(this._options);
|
|
199
209
|
runRequestParams.preloadedTest = preloadedTests[runRequestParams.testId];
|
|
200
210
|
}
|
|
@@ -259,8 +269,7 @@ class TestRun {
|
|
|
259
269
|
}
|
|
260
270
|
const mustClearPreviousStepResults = (this._timeoutRetryCount > 1 || this._retryCount > 1);
|
|
261
271
|
|
|
262
|
-
if (this._options.lightweightMode &&
|
|
263
|
-
!mustClearPreviousStepResults && canSendRunDataOverUrl(runData)) {
|
|
272
|
+
if (this._options.lightweightMode?.disableResults && !mustClearPreviousStepResults && canSendRunDataOverUrl(runData)) {
|
|
264
273
|
return Promise.resolve();
|
|
265
274
|
}
|
|
266
275
|
|
|
@@ -574,7 +583,7 @@ class TestRun {
|
|
|
574
583
|
this._originalTestResultId = this._originalTestResultId || this._previousTestResultId;
|
|
575
584
|
this._testResultId = utils.guid();
|
|
576
585
|
|
|
577
|
-
if (this._options.lightweightMode
|
|
586
|
+
if (this._options.lightweightMode?.onlyTestIdsNoSuite) {
|
|
578
587
|
return;
|
|
579
588
|
}
|
|
580
589
|
|