@testim/testim-cli 3.234.0 → 3.235.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 +4 -38
- package/npm-shrinkwrap.json +14 -25
- package/package.json +1 -2
- package/runOptions.js +69 -70
- package/services/lambdatestService.js +5 -0
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
3
|
const path = require('path');
|
|
4
|
-
const
|
|
4
|
+
const os = require('os');
|
|
5
5
|
const dataUriToBuffer = require('data-uri-to-buffer');
|
|
6
6
|
const { spawn: threadSpawn, config } = require('threads');
|
|
7
7
|
const Promise = require('bluebird');
|
|
@@ -20,8 +20,6 @@ config.set({
|
|
|
20
20
|
},
|
|
21
21
|
});
|
|
22
22
|
|
|
23
|
-
const transactions = {};
|
|
24
|
-
|
|
25
23
|
function convertWindowsBackslash(input) {
|
|
26
24
|
const isExtendedLengthPath = /^\\\\\?\\/.test(input);
|
|
27
25
|
const hasNonAscii = /[^\u0000-\u0080]+/.test(input); // eslint-disable-line no-control-regex
|
|
@@ -549,35 +547,13 @@ function removeFolder(installFolder) {
|
|
|
549
547
|
}));
|
|
550
548
|
}
|
|
551
549
|
|
|
552
|
-
function cleanPackages(transactionId) {
|
|
553
|
-
function cleanInstallFolder() {
|
|
554
|
-
const { installFolder } = transactions[transactionId];
|
|
555
|
-
if (!installFolder) {
|
|
556
|
-
return Promise.resolve();
|
|
557
|
-
}
|
|
558
|
-
return removeFolder(installFolder);
|
|
559
|
-
}
|
|
560
|
-
|
|
561
|
-
if (!transactions[transactionId]) {
|
|
562
|
-
return Promise.resolve();
|
|
563
|
-
}
|
|
564
|
-
|
|
565
|
-
return cleanInstallFolder()
|
|
566
|
-
.finally(() => delete transactions[transactionId]);
|
|
567
|
-
}
|
|
568
|
-
|
|
569
550
|
function getTransactionId(stepResultId, testResultId, stepId, retryIndex) {
|
|
570
551
|
return `${testResultId}_${stepId}_${stepResultId}_${retryIndex}`;
|
|
571
552
|
}
|
|
572
553
|
|
|
573
554
|
function installPackage(stepId, testResultId, retryIndex, packageData, stepResultId, timeout) {
|
|
574
555
|
const transactionId = getTransactionId(stepResultId, testResultId, stepId, retryIndex);
|
|
575
|
-
return runNpmInstall(transactionId, packageData, timeout)
|
|
576
|
-
.then(({ data, installFolder }) => {
|
|
577
|
-
transactions[transactionId] = transactions[transactionId] || {};
|
|
578
|
-
transactions[transactionId].installFolder = installFolder;
|
|
579
|
-
return data;
|
|
580
|
-
});
|
|
556
|
+
return runNpmInstall(transactionId, packageData, timeout).then(({ data }) => data);
|
|
581
557
|
}
|
|
582
558
|
|
|
583
559
|
function runCodeWithPackages(code, stepId, incomingParams, context, testResultId, retryIndex, stepResultId, timeout, fileDataUrl, s3filepath) {
|
|
@@ -608,8 +584,7 @@ function runCodeWithPackages(code, stepId, incomingParams, context, testResultId
|
|
|
608
584
|
return runCodeWithWorkerThread(transactionId, incomingParams, context, code, packageLocalLocations, timeout, fileDataUrl);
|
|
609
585
|
}
|
|
610
586
|
return runCode(transactionId, incomingParams, context, code, packageLocalLocations, timeout, fileDataUrl);
|
|
611
|
-
}).then(res => Object.assign({}, res, { nodeVersion: process.version }))
|
|
612
|
-
.finally(() => cleanPackages(transactionId));
|
|
587
|
+
}).then(res => Object.assign({}, res, { nodeVersion: process.version }));
|
|
613
588
|
}
|
|
614
589
|
|
|
615
590
|
function runNpmInstall(transactionId, packageData, timeout) {
|
|
@@ -653,16 +628,7 @@ function runNpmInstall(transactionId, packageData, timeout) {
|
|
|
653
628
|
}
|
|
654
629
|
|
|
655
630
|
function getLocalPackageInstallFolder() {
|
|
656
|
-
|
|
657
|
-
try {
|
|
658
|
-
return findRoot(process.cwd());
|
|
659
|
-
} catch (err) {
|
|
660
|
-
return process.cwd();
|
|
661
|
-
}
|
|
662
|
-
}
|
|
663
|
-
|
|
664
|
-
const root = getRoot();
|
|
665
|
-
return path.join(root, '/testim_local_packages');
|
|
631
|
+
return path.join(os.tmpdir(), '/testim_local_packages');
|
|
666
632
|
}
|
|
667
633
|
|
|
668
634
|
function cleanLocalPackageInstallFolder() {
|
package/npm-shrinkwrap.json
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@testim/testim-cli",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.235.0",
|
|
4
4
|
"lockfileVersion": 2,
|
|
5
5
|
"requires": true,
|
|
6
6
|
"packages": {
|
|
7
7
|
"": {
|
|
8
8
|
"name": "@testim/testim-cli",
|
|
9
|
-
"version": "3.
|
|
9
|
+
"version": "3.235.0",
|
|
10
10
|
"license": "Proprietary",
|
|
11
11
|
"dependencies": {
|
|
12
12
|
"@applitools/eyes-sdk-core": "13.2.0",
|
|
@@ -31,7 +31,6 @@
|
|
|
31
31
|
"data-uri-to-buffer": "2.0.2",
|
|
32
32
|
"decompress": "4.2.1",
|
|
33
33
|
"express": "4.17.3",
|
|
34
|
-
"find-root": "1.1.0",
|
|
35
34
|
"fkill": "7.2.1",
|
|
36
35
|
"form-data": "3.0.0",
|
|
37
36
|
"fs-extra": "10.0.1",
|
|
@@ -1446,9 +1445,9 @@
|
|
|
1446
1445
|
}
|
|
1447
1446
|
},
|
|
1448
1447
|
"node_modules/@jridgewell/sourcemap-codec": {
|
|
1449
|
-
"version": "1.4.
|
|
1450
|
-
"resolved": "https://registry.npmjs.org/@jridgewell/sourcemap-codec/-/sourcemap-codec-1.4.
|
|
1451
|
-
"integrity": "sha512-
|
|
1448
|
+
"version": "1.4.12",
|
|
1449
|
+
"resolved": "https://registry.npmjs.org/@jridgewell/sourcemap-codec/-/sourcemap-codec-1.4.12.tgz",
|
|
1450
|
+
"integrity": "sha512-az/NhpIwP3K33ILr0T2bso+k2E/SLf8Yidd8mHl0n6sCQ4YdyC8qDhZA6kOPDNDBA56ZnIjngVl0U3jREA0BUA==",
|
|
1452
1451
|
"dev": true
|
|
1453
1452
|
},
|
|
1454
1453
|
"node_modules/@jridgewell/trace-mapping": {
|
|
@@ -4881,9 +4880,9 @@
|
|
|
4881
4880
|
}
|
|
4882
4881
|
},
|
|
4883
4882
|
"node_modules/electron-to-chromium": {
|
|
4884
|
-
"version": "1.4.
|
|
4885
|
-
"resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.4.
|
|
4886
|
-
"integrity": "sha512-
|
|
4883
|
+
"version": "1.4.131",
|
|
4884
|
+
"resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.4.131.tgz",
|
|
4885
|
+
"integrity": "sha512-oi3YPmaP87hiHn0c4ePB67tXaF+ldGhxvZnT19tW9zX6/Ej+pLN0Afja5rQ6S+TND7I9EuwQTT8JYn1k7R7rrw==",
|
|
4887
4886
|
"dev": true
|
|
4888
4887
|
},
|
|
4889
4888
|
"node_modules/emoji-regex": {
|
|
@@ -5714,11 +5713,6 @@
|
|
|
5714
5713
|
"semver": "bin/semver.js"
|
|
5715
5714
|
}
|
|
5716
5715
|
},
|
|
5717
|
-
"node_modules/find-root": {
|
|
5718
|
-
"version": "1.1.0",
|
|
5719
|
-
"resolved": "https://registry.npmjs.org/find-root/-/find-root-1.1.0.tgz",
|
|
5720
|
-
"integrity": "sha512-NKfW6bec6GfKc0SGx1e07QZY9PE99u0Bft/0rzSD5k3sO/vwkVUpDUKVm5Gpp5Ue3YfShPFTX2070tDs5kB9Ng=="
|
|
5721
|
-
},
|
|
5722
5716
|
"node_modules/find-up": {
|
|
5723
5717
|
"version": "5.0.0",
|
|
5724
5718
|
"resolved": "https://registry.npmjs.org/find-up/-/find-up-5.0.0.tgz",
|
|
@@ -17475,9 +17469,9 @@
|
|
|
17475
17469
|
"dev": true
|
|
17476
17470
|
},
|
|
17477
17471
|
"@jridgewell/sourcemap-codec": {
|
|
17478
|
-
"version": "1.4.
|
|
17479
|
-
"resolved": "https://registry.npmjs.org/@jridgewell/sourcemap-codec/-/sourcemap-codec-1.4.
|
|
17480
|
-
"integrity": "sha512-
|
|
17472
|
+
"version": "1.4.12",
|
|
17473
|
+
"resolved": "https://registry.npmjs.org/@jridgewell/sourcemap-codec/-/sourcemap-codec-1.4.12.tgz",
|
|
17474
|
+
"integrity": "sha512-az/NhpIwP3K33ILr0T2bso+k2E/SLf8Yidd8mHl0n6sCQ4YdyC8qDhZA6kOPDNDBA56ZnIjngVl0U3jREA0BUA==",
|
|
17481
17475
|
"dev": true
|
|
17482
17476
|
},
|
|
17483
17477
|
"@jridgewell/trace-mapping": {
|
|
@@ -20260,9 +20254,9 @@
|
|
|
20260
20254
|
}
|
|
20261
20255
|
},
|
|
20262
20256
|
"electron-to-chromium": {
|
|
20263
|
-
"version": "1.4.
|
|
20264
|
-
"resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.4.
|
|
20265
|
-
"integrity": "sha512-
|
|
20257
|
+
"version": "1.4.131",
|
|
20258
|
+
"resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.4.131.tgz",
|
|
20259
|
+
"integrity": "sha512-oi3YPmaP87hiHn0c4ePB67tXaF+ldGhxvZnT19tW9zX6/Ej+pLN0Afja5rQ6S+TND7I9EuwQTT8JYn1k7R7rrw==",
|
|
20266
20260
|
"dev": true
|
|
20267
20261
|
},
|
|
20268
20262
|
"emoji-regex": {
|
|
@@ -20924,11 +20918,6 @@
|
|
|
20924
20918
|
}
|
|
20925
20919
|
}
|
|
20926
20920
|
},
|
|
20927
|
-
"find-root": {
|
|
20928
|
-
"version": "1.1.0",
|
|
20929
|
-
"resolved": "https://registry.npmjs.org/find-root/-/find-root-1.1.0.tgz",
|
|
20930
|
-
"integrity": "sha512-NKfW6bec6GfKc0SGx1e07QZY9PE99u0Bft/0rzSD5k3sO/vwkVUpDUKVm5Gpp5Ue3YfShPFTX2070tDs5kB9Ng=="
|
|
20931
|
-
},
|
|
20932
20921
|
"find-up": {
|
|
20933
20922
|
"version": "5.0.0",
|
|
20934
20923
|
"resolved": "https://registry.npmjs.org/find-up/-/find-up-5.0.0.tgz",
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@testim/testim-cli",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.235.0",
|
|
4
4
|
"description": "Command line interface for running Testing on your CI",
|
|
5
5
|
"author": "Oren Rubin",
|
|
6
6
|
"contributors": [{
|
|
@@ -69,7 +69,6 @@
|
|
|
69
69
|
"data-uri-to-buffer": "2.0.2",
|
|
70
70
|
"decompress": "4.2.1",
|
|
71
71
|
"express": "4.17.3",
|
|
72
|
-
"find-root": "1.1.0",
|
|
73
72
|
"fkill": "7.2.1",
|
|
74
73
|
"form-data": "3.0.0",
|
|
75
74
|
"fs-extra": "10.0.1",
|
package/runOptions.js
CHANGED
|
@@ -306,6 +306,7 @@ program
|
|
|
306
306
|
.option('--external-lambdatest-tunnel-id [tunnel-id]', 'use existing lambdatest tunnel ID')
|
|
307
307
|
.option('--external-lambdatest-use-wss', 'use wss instead of ssh for LT', false)
|
|
308
308
|
.option('--external-lambdatest-disable-automation-tunneling', 'don\'t tunnel Testim calls in LT tunnel', true)
|
|
309
|
+
.option('--external-lambdatest-mitm', 'Turn on LT Man in the middle', false)
|
|
309
310
|
|
|
310
311
|
.option('--w3c-capabilities [enable-w3c-caps-mode]', 'enable/disable w3c capabilities format (default enable)', JSON.parse, true)
|
|
311
312
|
.option('--old-capabilities [enable-old-caps-mode]', 'enable/disable old capabilities format (default enable)', JSON.parse, true)
|
|
@@ -494,7 +495,7 @@ module.exports = {
|
|
|
494
495
|
}
|
|
495
496
|
|
|
496
497
|
if (program.proxyForGrid && !program.proxy) {
|
|
497
|
-
|
|
498
|
+
throw new ArgError('missing --proxy option');
|
|
498
499
|
}
|
|
499
500
|
|
|
500
501
|
if (runOptionsAgentFlow.isAgentFlow(program)) {
|
|
@@ -553,20 +554,20 @@ module.exports = {
|
|
|
553
554
|
}
|
|
554
555
|
}
|
|
555
556
|
|
|
556
|
-
if (program.reporters && program.reporters.
|
|
557
|
+
if (program.reporters && program.reporters.includes('junit') && !program.reportFile) {
|
|
557
558
|
console.log('Warning: please define --report-file option for JUnit reporter');
|
|
558
559
|
}
|
|
559
560
|
|
|
560
561
|
if (!program.tunnel && program.externalLambdatestTunnelId) {
|
|
561
|
-
|
|
562
|
+
throw new ArgError('missing --tunnel parameter');
|
|
562
563
|
}
|
|
563
564
|
|
|
564
565
|
if (!program.tunnel && program.externalLambdatestUseWss) {
|
|
565
|
-
|
|
566
|
+
throw new ArgError('missing --tunnel parameter');
|
|
566
567
|
}
|
|
567
568
|
|
|
568
569
|
if (!program.tunnel && [program.tunnelPort, program.tunnelHostHeader, program.tunnelRegion, program.tunnelDiagnostics].some(Boolean)) {
|
|
569
|
-
|
|
570
|
+
throw new ArgError('missing --tunnel parameter');
|
|
570
571
|
}
|
|
571
572
|
if (program.chromeExtraPrefs) {
|
|
572
573
|
try {
|
|
@@ -609,7 +610,7 @@ module.exports = {
|
|
|
609
610
|
|
|
610
611
|
// SauceLabs Options
|
|
611
612
|
if ((program.sauceUser && !program.sauceKey) || (!program.sauceUser && program.sauceKey)) {
|
|
612
|
-
|
|
613
|
+
throw new ArgError('missing --sauce-user <sauce-user> or --sauce-key <sauce-key>');
|
|
613
614
|
}
|
|
614
615
|
|
|
615
616
|
if (program.sauceUser && program.sauceKey) {
|
|
@@ -655,7 +656,7 @@ module.exports = {
|
|
|
655
656
|
|
|
656
657
|
// BrowserStack options
|
|
657
658
|
if ((program.browserstackUser && !program.browserstackKey) || (!program.browserstackUser && program.browserstackKey)) {
|
|
658
|
-
|
|
659
|
+
throw new ArgError('missing --browserstack-user <browserstack-user> or --browserstack-key <browserstack-key>');
|
|
659
660
|
}
|
|
660
661
|
if (program.browserstackUser && program.browserstackKey) {
|
|
661
662
|
setHostAndPortForBrowserStack();
|
|
@@ -726,7 +727,7 @@ module.exports = {
|
|
|
726
727
|
if (projectId) {
|
|
727
728
|
program.project = projectId;
|
|
728
729
|
} else {
|
|
729
|
-
|
|
730
|
+
throw new ArgError('missing project-id info, either --login to provide new credentials or use --project <project-id>');
|
|
730
731
|
}
|
|
731
732
|
}
|
|
732
733
|
|
|
@@ -737,12 +738,12 @@ module.exports = {
|
|
|
737
738
|
|
|
738
739
|
if (program.testConfig) {
|
|
739
740
|
// convert single test config inputs to array (e.g. from configFile)
|
|
740
|
-
program.testConfig = [].
|
|
741
|
+
program.testConfig = [program.testConfig].flat();
|
|
741
742
|
}
|
|
742
743
|
|
|
743
744
|
if (program.testConfigId) {
|
|
744
745
|
// convert single test config inputs to array (e.g. from configFile)
|
|
745
|
-
program.testConfigId = [].
|
|
746
|
+
program.testConfigId = [program.testConfigId].flat();
|
|
746
747
|
}
|
|
747
748
|
|
|
748
749
|
program.retries = !program.retries || typeof program.retries === 'boolean' ? 1 : Number(program.retries) + 1;
|
|
@@ -764,21 +765,19 @@ module.exports = {
|
|
|
764
765
|
|
|
765
766
|
|
|
766
767
|
if (program.parallel > 1 && program.run && !program.gridId && !program.grid &&
|
|
767
|
-
((!program.testPlan || program.testPlan.length === 0) && (!program.testPlanId || !program.testPlanId.length))) {
|
|
768
|
-
|
|
769
|
-
|
|
770
|
-
|
|
771
|
-
|
|
772
|
-
|
|
773
|
-
|
|
774
|
-
|
|
775
|
-
|
|
776
|
-
|
|
777
|
-
|
|
778
|
-
|
|
779
|
-
|
|
780
|
-
process.exit(0);
|
|
781
|
-
}
|
|
768
|
+
((!program.testPlan || program.testPlan.length === 0) && (!program.testPlanId || !program.testPlanId.length)) && process.stdout.isTTY && !program.headless && !process.env.TERM) {
|
|
769
|
+
const prompts = require('prompts');
|
|
770
|
+
const response = await prompts({
|
|
771
|
+
type: 'toggle',
|
|
772
|
+
name: 'isSure',
|
|
773
|
+
message: 'Running in parallel without --headless flag will open several browsers on your computer. Are you sure?',
|
|
774
|
+
initial: false,
|
|
775
|
+
active: 'yes',
|
|
776
|
+
inactive: 'no',
|
|
777
|
+
});
|
|
778
|
+
|
|
779
|
+
if (!response.isSure) {
|
|
780
|
+
process.exit(0);
|
|
782
781
|
}
|
|
783
782
|
}
|
|
784
783
|
|
|
@@ -787,11 +786,11 @@ module.exports = {
|
|
|
787
786
|
program.port = program.port && Number(program.port);
|
|
788
787
|
|
|
789
788
|
if (program.retries <= 0 || _.isNaN(program.retries)) {
|
|
790
|
-
|
|
789
|
+
throw new ArgError('test failure retry count could not be a negative number or string, --retries <max_num_of_retries>');
|
|
791
790
|
}
|
|
792
791
|
|
|
793
792
|
if (program.retries > 21) {
|
|
794
|
-
|
|
793
|
+
throw new ArgError('Max number of retries exceeded. Number cannot be greater than 20, --retries <max_num_of_retries>');
|
|
795
794
|
}
|
|
796
795
|
|
|
797
796
|
if (!program.token) {
|
|
@@ -801,33 +800,32 @@ module.exports = {
|
|
|
801
800
|
if (credentialToken) {
|
|
802
801
|
program.token = credentialToken;
|
|
803
802
|
} else {
|
|
804
|
-
|
|
805
|
-
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.'));
|
|
803
|
+
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.');
|
|
806
804
|
}
|
|
807
805
|
}
|
|
808
806
|
|
|
809
807
|
if (program.browserTimeout <= 0 || _.isNaN(program.browserTimeout)) {
|
|
810
|
-
|
|
808
|
+
throw new ArgError('get browser timeout could not be a negative number, --browser-timeout <get-browser-timeout>');
|
|
811
809
|
}
|
|
812
810
|
|
|
813
811
|
if (program.newBrowserWaitTimeout <= 0 || _.isNaN(program.newBrowserWaitTimeout)) {
|
|
814
|
-
|
|
812
|
+
throw new ArgError('max new browser wait timeout could not be a negative number, --new-browser-wait-timeout <max-wait-to-browser>');
|
|
815
813
|
}
|
|
816
814
|
|
|
817
815
|
if (program.timeout <= 0 || _.isNaN(program.timeout)) {
|
|
818
|
-
|
|
816
|
+
throw new ArgError('test run timeout could not be a negative number, --timeout <run-timeout>');
|
|
819
817
|
}
|
|
820
818
|
|
|
821
819
|
if (program.parallel <= 0 || _.isNaN(program.parallel)) {
|
|
822
|
-
|
|
820
|
+
throw new ArgError('parallel could not be a negative number or not number, --parallel <number-of-tests>');
|
|
823
821
|
}
|
|
824
822
|
|
|
825
|
-
if ([CLI_MODE.EXTENSION, CLI_MODE.SELENIUM].
|
|
826
|
-
|
|
823
|
+
if (![CLI_MODE.EXTENSION, CLI_MODE.SELENIUM].includes(program.mode)) {
|
|
824
|
+
throw new ArgError(`runner mode <${program.mode}> is not supported`);
|
|
827
825
|
}
|
|
828
826
|
|
|
829
827
|
if ((program.mode !== CLI_MODE.SELENIUM) && program.disableNativeEvents) {
|
|
830
|
-
|
|
828
|
+
throw new ArgError('disable-native-events is only applicable in selenium mode');
|
|
831
829
|
}
|
|
832
830
|
|
|
833
831
|
if (
|
|
@@ -848,9 +846,9 @@ module.exports = {
|
|
|
848
846
|
!program.useChromeLauncher &&
|
|
849
847
|
!program.createPrefechedData
|
|
850
848
|
) {
|
|
851
|
-
|
|
849
|
+
throw new ArgError(
|
|
852
850
|
'missing remote grid address parameter, specify --host <host-name-or-ip> or --grid <grid-name> or --grid-id <grid-id>'
|
|
853
|
-
)
|
|
851
|
+
);
|
|
854
852
|
}
|
|
855
853
|
} else if (
|
|
856
854
|
program.testId.length ||
|
|
@@ -862,9 +860,9 @@ module.exports = {
|
|
|
862
860
|
program.useLocalChromeDriver ||
|
|
863
861
|
program.useChromeLauncher
|
|
864
862
|
) {
|
|
865
|
-
|
|
863
|
+
throw new ArgError(
|
|
866
864
|
'cannot set --testId, --label, --name, --browser, --test-config, --test-config-id, --use-local-chrome-driver --use-chrome-launcher or --suite with --test-plan option'
|
|
867
|
-
)
|
|
865
|
+
);
|
|
868
866
|
}
|
|
869
867
|
|
|
870
868
|
if (
|
|
@@ -875,17 +873,17 @@ module.exports = {
|
|
|
875
873
|
isSuiteSpecified) &&
|
|
876
874
|
program.file
|
|
877
875
|
) {
|
|
878
|
-
|
|
876
|
+
throw new ArgError(
|
|
879
877
|
'Cannot pass codeful automation tests with --testId --label --name or --suite'
|
|
880
|
-
)
|
|
878
|
+
);
|
|
881
879
|
}
|
|
882
880
|
|
|
883
881
|
const numberOfDefinedHosts = [program.host, program.grid, program.gridId].filter(Boolean).length;
|
|
884
882
|
if (numberOfDefinedHosts > 1) {
|
|
885
|
-
|
|
883
|
+
throw new ArgError('please define exactly one of --grid or --grid-id or --host');
|
|
886
884
|
}
|
|
887
885
|
|
|
888
|
-
if (program.host && program.host.
|
|
886
|
+
if (program.host && program.host.includes('/')) {
|
|
889
887
|
if (!/^(f|ht)tps?:\/\//i.test(program.host)) {
|
|
890
888
|
program.host = `http://${program.host}`;
|
|
891
889
|
}
|
|
@@ -896,7 +894,7 @@ module.exports = {
|
|
|
896
894
|
program.resultLabel = program.resultLabel.map(label => label.trim()).filter(Boolean);
|
|
897
895
|
const invalidLabels = program.resultLabel.filter(label => label.length >= 250).filter(Boolean);
|
|
898
896
|
if (invalidLabels.length) {
|
|
899
|
-
|
|
897
|
+
throw new ArgError('A result label cannot exceed 250 characters');
|
|
900
898
|
}
|
|
901
899
|
}
|
|
902
900
|
|
|
@@ -904,66 +902,66 @@ module.exports = {
|
|
|
904
902
|
const playerUrl = runOptionsUtils.getPlayerUrl(program);
|
|
905
903
|
|
|
906
904
|
if (!program.w3cCapabilities && !program.oldCapabilities) {
|
|
907
|
-
|
|
905
|
+
throw new ArgError('cannot set --w3c-capabilities and --old-capabilities options as false');
|
|
908
906
|
}
|
|
909
907
|
program.protocol = program.protocol || (program.port === 443 ? 'https' : 'http');
|
|
910
908
|
if (!['http', 'https'].includes(program.protocol)) {
|
|
911
|
-
|
|
909
|
+
throw new ArgError('invalid --protocol value, allow --protocol http or https');
|
|
912
910
|
}
|
|
913
911
|
|
|
914
912
|
if (program.rerunFailedByRunId && program.branch) {
|
|
915
|
-
|
|
913
|
+
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');
|
|
916
914
|
}
|
|
917
915
|
|
|
918
916
|
if (program.rerunFailedByRunId &&
|
|
919
917
|
(isSuiteSpecified || program.name.length ||
|
|
920
918
|
program.testId.length || program.label.length || isTestPlanSpecified)) {
|
|
921
|
-
|
|
922
|
-
' label (--label), plan (--test-plan), or other test flags (--test) are provided. Please remove these flags and try again')
|
|
919
|
+
throw new ArgError('Re-running failed tests is not possible when suite (--suite),' +
|
|
920
|
+
' label (--label), plan (--test-plan), or other test flags (--test) are provided. Please remove these flags and try again');
|
|
923
921
|
}
|
|
924
922
|
|
|
925
923
|
if (program.run.length) {
|
|
926
924
|
const glob = require('glob');
|
|
927
925
|
program.files = _.flatMap(program.run, files => glob.sync(files));
|
|
928
926
|
if (program.files.length === 0) {
|
|
929
|
-
|
|
927
|
+
throw new ArgError(`No files found at path '${program.run}'.`);
|
|
930
928
|
}
|
|
931
929
|
} else {
|
|
932
930
|
program.files = [];
|
|
933
931
|
}
|
|
934
932
|
|
|
935
933
|
if (program.setRetention && !_.inRange(_.parseInt(program.setRetention), 1, 11)) {
|
|
936
|
-
|
|
934
|
+
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)');
|
|
937
935
|
}
|
|
938
936
|
program.setRetention = program.setRetention && Number(program.setRetention);
|
|
939
937
|
|
|
940
938
|
const mockNetworkDeprecationMsg = 'is no longer supported, please use --override-mapping-file';
|
|
941
939
|
if (program.mockNetworkHar) {
|
|
942
|
-
|
|
940
|
+
throw new ArgError(`--mock-network-har ${mockNetworkDeprecationMsg}`);
|
|
943
941
|
}
|
|
944
942
|
if (program.mockNetworkPattern) {
|
|
945
|
-
|
|
943
|
+
throw new ArgError(`--mock-network-pattern ${mockNetworkDeprecationMsg}`);
|
|
946
944
|
}
|
|
947
945
|
|
|
948
946
|
if (program.disableMockNetwork && program.overrideMappingFile) {
|
|
949
|
-
|
|
947
|
+
throw new ArgError('You can either use --disable-mock-network or --override-mapping-file');
|
|
950
948
|
}
|
|
951
949
|
|
|
952
950
|
if (!program.collectCodeCoverage && program.codeCoverageSourceMapPath) {
|
|
953
|
-
|
|
951
|
+
throw new ArgError('cannot set --code-coverage-source-map-path without passing --collect-code-coverage');
|
|
954
952
|
}
|
|
955
953
|
|
|
956
954
|
if (!program.collectCodeCoverage && program.codeCoverageReporter.length) {
|
|
957
|
-
|
|
955
|
+
throw new ArgError('cannot set --code-coverage-reporter without passing --collect-code-coverage');
|
|
958
956
|
}
|
|
959
957
|
|
|
960
958
|
if (!program.collectCodeCoverage && program.codeCoverageInclude.length) {
|
|
961
|
-
|
|
959
|
+
throw new ArgError('cannot set --code-coverage-include without passing --collect-code-coverage');
|
|
962
960
|
}
|
|
963
961
|
|
|
964
962
|
if (program.collectCodeCoverage && program.codeCoverageReporter && _.difference(program.codeCoverageReporter, CODE_COVERAGE_REPORTER_OPTIONS).length) {
|
|
965
963
|
const diff = _.difference(program.codeCoverageReporter, CODE_COVERAGE_REPORTER_OPTIONS);
|
|
966
|
-
|
|
964
|
+
throw new ArgError(`invalid --code-coverage-reporter parameters ${diff.join('/')}`);
|
|
967
965
|
}
|
|
968
966
|
|
|
969
967
|
program.codeCoverageReporter = program.codeCoverageReporter.length === 0 ? ['html', 'text'] : program.codeCoverageReporter;
|
|
@@ -982,7 +980,7 @@ module.exports = {
|
|
|
982
980
|
|
|
983
981
|
if (program.mode !== CLI_MODE.EXTENSION && usedExtensionOptions.length) {
|
|
984
982
|
const multi = usedExtensionOptions.length > 1 ? 'are' : 'is';
|
|
985
|
-
|
|
983
|
+
throw new ArgError(`${usedExtensionOptions.map(key => extensionOnlyOptions[key]).join(' and ')} ${multi} only applicable in extension mode`);
|
|
986
984
|
}
|
|
987
985
|
|
|
988
986
|
if (program.tmsFieldFile) {
|
|
@@ -1054,18 +1052,18 @@ module.exports = {
|
|
|
1054
1052
|
}
|
|
1055
1053
|
|
|
1056
1054
|
if (typeof program.baseUrl === 'boolean') {
|
|
1057
|
-
|
|
1055
|
+
throw new ArgError('base url cannot be used as a flag, and must contain a string value');
|
|
1058
1056
|
}
|
|
1059
1057
|
|
|
1060
1058
|
return ({
|
|
1061
|
-
testId: [].
|
|
1062
|
-
name: [].
|
|
1063
|
-
label: [].
|
|
1064
|
-
suites: [].
|
|
1065
|
-
suiteIds: [].
|
|
1066
|
-
testPlan: [].
|
|
1067
|
-
testPlanIds: [].
|
|
1068
|
-
files: [].
|
|
1059
|
+
testId: [program.testId].flat(),
|
|
1060
|
+
name: [program.name].flat(),
|
|
1061
|
+
label: [program.label].flat(),
|
|
1062
|
+
suites: [program.suite].flat(),
|
|
1063
|
+
suiteIds: [program.suiteId].flat(),
|
|
1064
|
+
testPlan: [program.testPlan].flat(),
|
|
1065
|
+
testPlanIds: [program.testPlanId].flat(),
|
|
1066
|
+
files: [program.files].flat(),
|
|
1069
1067
|
webpackConfig: program.webpackConfig,
|
|
1070
1068
|
reportFile: program.reportFile,
|
|
1071
1069
|
reportFileClassname: program.overrideReportFileClassname,
|
|
@@ -1116,7 +1114,7 @@ module.exports = {
|
|
|
1116
1114
|
|
|
1117
1115
|
// Extension
|
|
1118
1116
|
ext: program.ext,
|
|
1119
|
-
extensionLocation: [
|
|
1117
|
+
extensionLocation: [program.extensionPath || extHeadlessUrl].flat(),
|
|
1120
1118
|
extensionPath: program.extensionPath,
|
|
1121
1119
|
|
|
1122
1120
|
// Player
|
|
@@ -1136,6 +1134,7 @@ module.exports = {
|
|
|
1136
1134
|
externalLambdatestTunnelId: program.externalLambdatestTunnelId,
|
|
1137
1135
|
externalLambdatestUseWss: program.externalLambdatestUseWss || false,
|
|
1138
1136
|
externalLambdatestDisableAutomationTunneling: Boolean(program.externalLambdatestDisableAutomationTunneling),
|
|
1137
|
+
externalLambdatestMitm: Boolean(program.externalLambdatestMitm),
|
|
1139
1138
|
|
|
1140
1139
|
// Hooks
|
|
1141
1140
|
beforeTest: program.beforeTest,
|
|
@@ -136,6 +136,10 @@ class LambdatestService {
|
|
|
136
136
|
}
|
|
137
137
|
}
|
|
138
138
|
|
|
139
|
+
if (runnerOptions.externalLambdatestMitm) {
|
|
140
|
+
tunnelArgs = [...tunnelArgs, '--mitm'];
|
|
141
|
+
}
|
|
142
|
+
|
|
139
143
|
LambdatestService.tunnel = spawn('./LT', tunnelArgs, { cwd: LT_TUNNEL_BINARY_DIRECTORY });
|
|
140
144
|
|
|
141
145
|
let stdoutResult = '';
|
|
@@ -207,6 +211,7 @@ class LambdatestService {
|
|
|
207
211
|
build: executionId,
|
|
208
212
|
name: `${testResultId} - ${testName}`,
|
|
209
213
|
platform: LambdatestService.lambdatestConfig.PLATFORM,
|
|
214
|
+
// eslint-disable-next-line camelcase
|
|
210
215
|
selenium_version: LambdatestService.lambdatestConfig.SELENIUM_VERSION,
|
|
211
216
|
resolution: LambdatestService.lambdatestConfig.RESOLUTION,
|
|
212
217
|
timezone: LambdatestService.lambdatestConfig.TIMEZONE,
|