@testim/testim-cli 3.255.0 → 3.256.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/agent/routers/cliJsCode/service.js +11 -8
- package/cli.js +2 -2
- package/cliAgentMode.js +7 -7
- package/codim/codim-cli.js +4 -1
- package/commons/featureFlags.js +21 -7
- package/commons/httpRequest.js +1 -1
- package/commons/initializeUserWithAuth.js +7 -4
- package/commons/preloadTests.js +5 -2
- package/commons/prepareRunner.js +5 -5
- package/commons/prepareRunnerAndTestimStartUtils.js +11 -4
- package/commons/runnerFileCache.js +9 -1
- package/commons/testimServicesApi.js +36 -5
- package/npm-shrinkwrap.json +41 -41
- package/package.json +1 -1
- package/player/stepActions/apiStepAction.js +49 -43
- package/player/stepActions/baseCliJsStepAction.js +19 -14
- package/player/stepActions/baseJsStepAction.js +9 -8
- package/player/stepActions/dropFileStepAction.js +1 -3
- package/player/stepActions/inputFileStepAction.js +10 -8
- package/player/stepActions/mouseStepAction.js +21 -22
- package/player/stepActions/nodePackageStepAction.js +34 -35
- package/player/stepActions/stepAction.js +1 -0
- package/player/utils/imageCaptureUtils.js +63 -63
- package/player/utils/screenshotUtils.js +16 -13
- package/player/utils/windowUtils.js +20 -8
- package/processHandler.js +4 -0
- package/runOptions.d.ts +27 -1
- package/runOptions.js +7 -7
- package/runner.js +62 -23
- package/runners/ParallelWorkerManager.js +3 -2
- package/runners/TestPlanRunner.js +9 -6
- package/runners/buildCodeTests.js +1 -0
- package/runners/runnerUtils.js +11 -2
- package/services/branchService.js +11 -5
- package/services/localRCASaver.js +4 -0
|
@@ -54,10 +54,11 @@ class ParallelWorkerManager {
|
|
|
54
54
|
|
|
55
55
|
let stoppedOnError = false;
|
|
56
56
|
let runningTests = 0;
|
|
57
|
-
const runAndWaitToComplete = token => new Promise((resolve
|
|
57
|
+
const runAndWaitToComplete = token => new Promise((resolve) => {
|
|
58
58
|
const projectId = options.project;
|
|
59
59
|
const executionQueue = new ExecutionQueue(executionId, executionName, testList, options, branchToUse, testStatus);
|
|
60
60
|
|
|
61
|
+
/** @type {{ [testResultId: string]: any; }} */
|
|
61
62
|
const combinedTestResults = {};
|
|
62
63
|
const testCount = testList.length;
|
|
63
64
|
|
|
@@ -177,7 +178,7 @@ class ParallelWorkerManager {
|
|
|
177
178
|
}
|
|
178
179
|
};
|
|
179
180
|
|
|
180
|
-
const onGridSlot = (
|
|
181
|
+
const onGridSlot = (_executionId, resultId, gridInfo) => testStatus.onGridSlot(_executionId, resultId, gridInfo);
|
|
181
182
|
|
|
182
183
|
options.userData = {
|
|
183
184
|
loginData: Object.assign({}, testimCustomToken.getTokenV3UserData(), {
|
|
@@ -39,12 +39,13 @@ class TestPlanRunner {
|
|
|
39
39
|
* @param {any[]} tests
|
|
40
40
|
* @param {any[]} afterTests
|
|
41
41
|
* @param {string} branchToUse
|
|
42
|
-
* @param {
|
|
42
|
+
* @param {import('../runOptions').RunnerOptions} tpOptions
|
|
43
43
|
* @param {string} executionId
|
|
44
44
|
* @param {string} executionName
|
|
45
45
|
* @param {TestRunStatus} testStatus
|
|
46
46
|
*/
|
|
47
47
|
async runTestAllPhases(beforeTests, tests, afterTests, branchToUse, tpOptions, executionId, executionName, testStatus) {
|
|
48
|
+
/** @type {{ [testResultId: string]: any; }} */
|
|
48
49
|
const executionResults = {};
|
|
49
50
|
const authData = testimCustomToken.getTokenV3UserData();
|
|
50
51
|
|
|
@@ -145,6 +146,7 @@ class TestPlanRunner {
|
|
|
145
146
|
const childTestResults = {};
|
|
146
147
|
realDataService.joinToTestResultsByRunId(runId, projectId);
|
|
147
148
|
let isPromisePending = true;
|
|
149
|
+
/** @type {Promise<any[]>} */
|
|
148
150
|
const promise = new Promise(_resolve => {
|
|
149
151
|
const resolve = (val) => {
|
|
150
152
|
isPromisePending = false;
|
|
@@ -226,17 +228,18 @@ class TestPlanRunner {
|
|
|
226
228
|
Logger.setExecutionId(executionId);
|
|
227
229
|
beforeTests.forEach(test => { test.isBeforeTestPlan = true; });
|
|
228
230
|
afterTests.forEach(test => { test.isAfterTestPlan = true; });
|
|
229
|
-
const testStatus = new TestRunStatus(
|
|
231
|
+
const testStatus = new TestRunStatus([].concat(beforeTests, tests, afterTests), tpOptions, testPlanId, branch);
|
|
230
232
|
|
|
231
|
-
const configs = _.chain(
|
|
233
|
+
const configs = _.chain([].concat(beforeTests, tests, afterTests))
|
|
232
234
|
.map(test => test.overrideTestConfig?.name || '')
|
|
233
235
|
.uniq()
|
|
234
236
|
.compact()
|
|
235
237
|
.value();
|
|
238
|
+
/** @type {string | null} */
|
|
236
239
|
const configName = configs?.length === 1 ? configs[0] : null;
|
|
237
240
|
|
|
238
241
|
const isCodeMode = tpOptions.files.length > 0;
|
|
239
|
-
const testNames = tpOptions.lightweightMode?.onlyTestIdsNoSuite ? [] :
|
|
242
|
+
const testNames = tpOptions.lightweightMode?.onlyTestIdsNoSuite ? [] : [].concat(beforeTests, tests, afterTests).map(test => test.name);
|
|
240
243
|
|
|
241
244
|
const testListInfoPromise = tpOptions.lightweightMode?.onlyTestIdsNoSuite ?
|
|
242
245
|
{ beforeTests, tests, afterTests } :
|
|
@@ -375,13 +378,13 @@ class TestPlanRunner {
|
|
|
375
378
|
suiteResult.runName = `rerun-${options.rerunFailedByRunId}`;
|
|
376
379
|
}
|
|
377
380
|
}
|
|
378
|
-
const testPlanName = options.overrideExecutionName || suiteResult.runName ||
|
|
381
|
+
const testPlanName = options.overrideExecutionName || suiteResult.runName || [].concat(options.label, options.name, options.suites).join(' ');
|
|
379
382
|
const isAnonymous = true;
|
|
380
383
|
perf.log('Right before validateConfig + runAnonymousTestPlan tests map');
|
|
381
384
|
return await utils.promiseMap(suiteResult.tests, async suiteTests => { // array of results per execution
|
|
382
385
|
//override result id for remote run mode and run only the first test data
|
|
383
386
|
if (options.resultId) {
|
|
384
|
-
const firstTest =
|
|
387
|
+
const firstTest = suiteTests[0];
|
|
385
388
|
firstTest.resultId = options.resultId;
|
|
386
389
|
suiteTests = [firstTest];
|
|
387
390
|
}
|
|
@@ -122,6 +122,7 @@ async function buildCodeTests(files, webpackConfig = { mode: 'development' }, ru
|
|
|
122
122
|
throw new ArgError(`Compilation Webpack Error in tests: ${e.message}`);
|
|
123
123
|
}
|
|
124
124
|
|
|
125
|
+
/** @type {{ code: string; name: string; }[]} */
|
|
125
126
|
const fileResults = files.map((file, i) => ({ code: mfs.readFileSync(path.resolve('./dist', `${fileHashes[i]}.bundle.js`)), name: file })); // read all files
|
|
126
127
|
|
|
127
128
|
suite.tests = [fileResults.map(({ code, name }) => ({
|
package/runners/runnerUtils.js
CHANGED
|
@@ -7,9 +7,14 @@ const analytics = require('../commons/testimAnalytics');
|
|
|
7
7
|
const { ArgError } = require('../errors');
|
|
8
8
|
|
|
9
9
|
|
|
10
|
+
/**
|
|
11
|
+
* @param {import('../runOptions').RunnerOptions} options
|
|
12
|
+
* @param {string} branchToUse
|
|
13
|
+
* @returns
|
|
14
|
+
*/
|
|
10
15
|
async function getSuite(options, branchToUse) {
|
|
11
16
|
if (options.lightweightMode?.onlyTestIdsNoSuite && options.testId) {
|
|
12
|
-
return { tests: [options.testId.map(testId => ({ testId, testConfig: {
|
|
17
|
+
return { tests: [options.testId.map(testId => ({ testId, testConfig: {}, resultId: utils.guid() }))] };
|
|
13
18
|
}
|
|
14
19
|
// local code test
|
|
15
20
|
if (options.files.length > 0) {
|
|
@@ -47,7 +52,11 @@ function calcTestResultStatus(tests) {
|
|
|
47
52
|
}
|
|
48
53
|
|
|
49
54
|
|
|
50
|
-
|
|
55
|
+
/**
|
|
56
|
+
* @template T
|
|
57
|
+
* @param {import('../runOptions').RunnerOptions} options
|
|
58
|
+
* @param {T[]} testList
|
|
59
|
+
*/
|
|
51
60
|
async function validateConfig(options, testList) {
|
|
52
61
|
const supportedBrowsers = options.mode === 'extension' ? [
|
|
53
62
|
'edge-chromium', 'chrome',
|
|
@@ -1,12 +1,18 @@
|
|
|
1
|
-
|
|
1
|
+
'use strict';
|
|
2
2
|
|
|
3
|
+
/** @type {string | undefined} */
|
|
3
4
|
let currentBranch;
|
|
4
5
|
|
|
5
6
|
function getCurrentBranch() {
|
|
6
|
-
return currentBranch ||
|
|
7
|
+
return currentBranch || 'master';
|
|
7
8
|
}
|
|
8
|
-
|
|
9
|
-
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* @param {Awaited<ReturnType<import('../commons/initializeUserWithAuth')['initializeUserWithAuth']>>['branchName']} branchData
|
|
12
|
+
* @param {boolean | string} acknowledgeAutoDetect
|
|
13
|
+
*/
|
|
14
|
+
function setCurrentBranch(branchData = 'master', acknowledgeAutoDetect = 'false') {
|
|
15
|
+
if (branchData?.branch && branchData.branch === 'master') {
|
|
10
16
|
currentBranch = 'master';
|
|
11
17
|
return;
|
|
12
18
|
}
|
|
@@ -19,5 +25,5 @@ function setCurrentBranch(branchData = "master", acknowledgeAutoDetect = "false"
|
|
|
19
25
|
|
|
20
26
|
module.exports = {
|
|
21
27
|
getCurrentBranch,
|
|
22
|
-
setCurrentBranch
|
|
28
|
+
setCurrentBranch,
|
|
23
29
|
};
|
|
@@ -37,6 +37,10 @@ function mapFilesToLocalDrive(test, logger) {
|
|
|
37
37
|
}
|
|
38
38
|
}
|
|
39
39
|
|
|
40
|
+
/**
|
|
41
|
+
* @param {Partial<Pick<import('../runOptions').AgentModeOptions, 'agentPort' | 'agentBind'> & Pick<import('../runOptions').RunnerOptions, 'saveRCALocally'>>} param0
|
|
42
|
+
* @returns {Promise<import('net').AddressInfo>}
|
|
43
|
+
*/
|
|
40
44
|
async function initServer({ agentPort, agentBind, saveRCALocally }) {
|
|
41
45
|
const multer = await lazyRequire('multer');
|
|
42
46
|
saveRCALocally = typeof saveRCALocally === 'string' ? saveRCALocally : DEFUALT_PATH;
|