@testim/testim-cli 3.253.0 → 3.255.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.
Files changed (103) hide show
  1. package/OverrideTestDataBuilder.js +1 -1
  2. package/agent/routers/cliJsCode/index.js +4 -4
  3. package/agent/routers/cliJsCode/router.js +46 -42
  4. package/agent/routers/cliJsCode/service.js +18 -13
  5. package/agent/routers/codim/router.js +14 -17
  6. package/agent/routers/codim/router.test.js +19 -21
  7. package/agent/routers/codim/service.js +16 -16
  8. package/agent/routers/general/index.js +4 -8
  9. package/agent/routers/hybrid/registerRoutes.js +18 -18
  10. package/agent/routers/index.js +7 -7
  11. package/agent/routers/playground/router.js +11 -10
  12. package/agent/routers/playground/service.js +22 -23
  13. package/agent/routers/standalone-browser/registerRoutes.js +10 -10
  14. package/cdpTestRunner.js +4 -3
  15. package/chromiumInstaller.js +4 -5
  16. package/cli/onExit.js +2 -2
  17. package/cli.js +11 -10
  18. package/cliAgentMode.js +8 -8
  19. package/codim/codim-cli.js +20 -17
  20. package/codim/hybrid-utils.js +1 -1
  21. package/codim/measure-perf.js +9 -6
  22. package/codim/template.js/tests/examples/01-simple-text-validation.test.js +6 -6
  23. package/codim/template.js/tests/examples/02-using-locators.test.js +13 -15
  24. package/codim/template.js/tests/examples/03-using-hooks.test.js +17 -19
  25. package/codim/template.js/tests/examples/04-skip-and-only.test.js +16 -17
  26. package/codim/template.js/tests/examples/05-multiple-windows.test.js +16 -17
  27. package/codim/template.js/webpack.config.js +1 -1
  28. package/codim/template.ts/webpack.config.js +3 -3
  29. package/commons/AbortError.js +4 -4
  30. package/commons/detectDebugger.js +4 -2
  31. package/commons/featureFlags.js +8 -0
  32. package/commons/httpRequest.js +5 -1
  33. package/commons/httpRequestCounters.js +21 -10
  34. package/commons/lazyRequire.js +14 -12
  35. package/commons/logger.js +4 -4
  36. package/commons/performance-logger.js +14 -8
  37. package/commons/preloadTests.js +2 -2
  38. package/commons/prepareRunner.js +4 -2
  39. package/commons/prepareRunnerAndTestimStartUtils.js +40 -42
  40. package/commons/runnerFileCache.js +1 -1
  41. package/commons/socket/baseSocketServiceSocketIO.js +32 -34
  42. package/commons/socket/realDataService.js +6 -5
  43. package/commons/socket/realDataServiceSocketIO.js +4 -4
  44. package/commons/socket/remoteStepService.js +4 -3
  45. package/commons/socket/remoteStepServiceSocketIO.js +11 -12
  46. package/commons/socket/socketService.js +50 -52
  47. package/commons/socket/testResultServiceSocketIO.js +11 -11
  48. package/commons/testimDesiredCapabilitiesBuilder.js +3 -2
  49. package/commons/testimNgrok.js +2 -2
  50. package/commons/testimNgrok.test.js +1 -1
  51. package/commons/testimServicesApi.js +27 -20
  52. package/commons/testimTunnel.test.js +2 -1
  53. package/commons/xhr2.js +97 -100
  54. package/coverage/SummaryToObjectReport.js +0 -1
  55. package/coverage/jsCoverage.js +12 -10
  56. package/errors.js +5 -0
  57. package/fixLocalBuild.js +2 -0
  58. package/inputFileUtils.js +11 -9
  59. package/npm-shrinkwrap.json +2286 -1284
  60. package/package.json +9 -8
  61. package/player/appiumTestPlayer.js +1 -1
  62. package/player/chromeLauncherTestPlayer.js +0 -1
  63. package/player/services/tabService.js +15 -1
  64. package/player/services/tabServiceMock.js +166 -0
  65. package/player/stepActions/locateStepAction.js +2 -0
  66. package/player/stepActions/navigationStepAction.js +11 -10
  67. package/player/stepActions/sleepStepAction.js +4 -5
  68. package/player/stepActions/textStepAction.js +4 -11
  69. package/player/utils/imageCaptureUtils.js +81 -120
  70. package/player/utils/windowUtils.js +4 -3
  71. package/player/webdriver.js +26 -23
  72. package/processHandler.js +3 -3
  73. package/processHandler.test.js +1 -1
  74. package/reports/consoleReporter.js +3 -2
  75. package/reports/junitReporter.js +7 -9
  76. package/reports/reporter.js +34 -39
  77. package/runOptions.d.ts +260 -0
  78. package/runOptions.js +59 -44
  79. package/runner.js +14 -0
  80. package/runners/ParallelWorkerManager.js +9 -10
  81. package/runners/TestPlanRunner.js +142 -78
  82. package/runners/buildCodeTests.js +38 -37
  83. package/runners/runnerUtils.js +3 -3
  84. package/services/gridService.js +36 -40
  85. package/services/lambdatestService.js +3 -5
  86. package/stepPlayers/cliJsStepPlayback.js +22 -17
  87. package/testRunHandler.js +8 -0
  88. package/testRunStatus.js +9 -6
  89. package/utils/argsUtils.js +86 -0
  90. package/utils/argsUtils.test.js +32 -0
  91. package/utils/fsUtils.js +154 -0
  92. package/{utils.js → utils/index.js} +19 -262
  93. package/utils/promiseUtils.js +89 -0
  94. package/utils/stringUtils.js +98 -0
  95. package/utils/stringUtils.test.js +22 -0
  96. package/utils/timeUtils.js +25 -0
  97. package/utils/utils.test.js +27 -0
  98. package/workers/BaseWorker.js +16 -14
  99. package/workers/WorkerAppium.js +1 -1
  100. package/workers/WorkerExtension.js +6 -7
  101. package/workers/WorkerExtensionSingleBrowser.js +4 -4
  102. package/workers/WorkerSelenium.js +5 -2
  103. package/utils.test.js +0 -68
package/runOptions.js CHANGED
@@ -2,22 +2,20 @@
2
2
 
3
3
  'use strict';
4
4
 
5
- const { CLI_MODE } = require('./commons/constants');
6
- const { EDGE_CHROMIUM_MIN_VERSION } = require('./player/constants');
7
- const program = require('commander');
8
5
  const fs = require('fs');
9
6
  const ms = require('ms');
10
- const Promise = require('bluebird');
11
- const NoArgsError = require('./errors.js').NoArgsError;
12
- const ArgError = require('./errors.js').ArgError;
13
7
  const url = require('url');
14
8
  const _ = require('lodash');
15
9
  const path = require('path');
10
+ const chalk = require('chalk');
11
+ const program = require('commander');
16
12
  const utils = require('./utils');
17
- const runOptionsAgentFlow = require('./runOptionsAgentFlow');
18
13
  const runOptionsUtils = require('./runOptionsUtils');
14
+ const runOptionsAgentFlow = require('./runOptionsAgentFlow');
19
15
  const localRunnerCache = require('./commons/runnerFileCache');
20
- const chalk = require('chalk');
16
+ const { CLI_MODE } = require('./commons/constants');
17
+ const { NoArgsError, ArgError } = require('./errors');
18
+ const { EDGE_CHROMIUM_MIN_VERSION } = require('./player/constants');
21
19
 
22
20
  const camelizeHyphenValues = (prop) => prop.replace(/-([a-z])/g, (m, w) => w.toUpperCase());
23
21
 
@@ -114,6 +112,10 @@ const printUsage = () => {
114
112
  return line.includes('--high-speed'); // high speed mode was renamed to turbo mode
115
113
  }
116
114
 
115
+ function isTestStartTimeout(line) {
116
+ return line.includes('--test-start-timeout');
117
+ }
118
+
117
119
  program.help((txt) => {
118
120
  const lines = txt.split('\n');
119
121
  return lines
@@ -129,7 +131,8 @@ const printUsage = () => {
129
131
  !isWebdriverTimeout(ln) &&
130
132
  !isSaveRCALocally(ln) &&
131
133
  !isExitCodeIgnoreFailingTests(ln) &&
132
- !isDeprecatedHighSpeed(ln)
134
+ !isDeprecatedHighSpeed(ln) &&
135
+ !isTestStartTimeout(ln)
133
136
  )
134
137
  .join('\n');
135
138
  });
@@ -183,12 +186,12 @@ program
183
186
  .option('-h, --headless [headless]', 'run in headless mode')
184
187
  .option('-m, --mode [runner-mode]', 'use extension or selenium mode (extension/selenium/appium)')
185
188
  .option('--branch [branch]', 'branch name', null)
186
- .option('--base-url [base-url]', 'change al test base-url to a specified url')
189
+ .option('--base-url [base-url]', 'change base-url to a specified url for all tests in current execution')
187
190
  .option('--token [token]', 'identification token to testim')
188
191
  .option('--is-regression-baseline-run', 'save doms and run results as regression baseline data')
189
- .option('--parallel [number-of-tests]', 'number of tests to run on parallel')
190
- .option('--before-parallel [number-of-tests]', 'number of tests to run on parallel in the before phase of a test plan')
191
- .option('--after-parallel [number-of-tests]', 'number of tests to run on parallel in the after phase of a test plan')
192
+ .option('--parallel [number-of-tests]', 'number of tests to run in parallel')
193
+ .option('--before-parallel [number-of-tests]', 'number of tests to run in parallel during the before phase of a test plan')
194
+ .option('--after-parallel [number-of-tests]', 'number of tests to run in parallel during the after phase of a test plan')
192
195
  .option('--canary [canary-mode]', 'enable canary mode', false)
193
196
  .option('--test-plan [test-plan-name]', 'test plan to run', collect, [])
194
197
  .option('--test-plan-id [test-plan-id]', 'test plan to run', collect, [])
@@ -203,7 +206,7 @@ program
203
206
  .option('--proxy-for-grid [proxy-for-grid]', 'used together with --proxy to also router grid traffic through a proxy')
204
207
  .option('--result-label [result-label]', 'result label', collect, [])
205
208
  .option('-oen --override-execution-name [execution-name]', 'override the default execution name', '')
206
- .option('--retries [max_num_of_retries]', 'number of retires failure test defaults to not retrying', 0)
209
+ .option('--retries [max_num_of_retries]', 'number of retries on test failure, defaults to 0 (no retries)', 0)
207
210
  .option('--set-retention [retention-in-days]', 'set the number of days for results retention')
208
211
  .option('--user [user-id]', 'user ID for local Testim-CLI')
209
212
  .option('--pass-zero-tests', 'don\'t fail the run if no tests were found')
@@ -217,17 +220,18 @@ program
217
220
  .option('--file-cache-location [directory]', ' internal CLI file caching location')
218
221
 
219
222
  // Timeout
220
- .option('--timeout [test-timeout]', 'test run timeout in milliseconds')
221
- .option('--browser-timeout [open-browser-timeout]', 'get browser from grid timeout in milliseconds')
222
- .option('--new-browser-wait-timeout [max-wait-to-browser]', 'maximum get browser wait in minutes')
223
+ .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))
224
+ .option('--timeout [test-timeout]', 'Test run timeout in milliseconds', Number)
225
+ .option('--browser-timeout [open-browser-timeout]', 'Get browser from grid timeout in milliseconds', Number)
226
+ .option('--new-browser-wait-timeout [max-wait-to-browser]', 'Maximum get browser wait in minutes', Number)
223
227
 
224
228
  // New Timeouts
225
- .option('--get-browser-timeout [get-browser-timeout]', 'Timeout for a single attempt to get browser from the grid configured in the project\'s plan') // getBrowserTimeout
226
- .option('--get-browser-retries [get-browser-retries]', 'Number of attempts to get browser from the grid configured in the project\'s plan') // getBrowserRetries
227
- .option('--get-session-timeout [get-session-timeout]', 'Timeout for "/session" request to the selenium server', ms('90s')) // getSessionTimeout
228
- .option('--get-session-retries [get-session-retries]', 'Retries for "/session" request to the selenium server', 3) // getSessionRetries
229
- .option('--driver-request-timeout [driver-request-timeout]', 'Timeout for any WebDriver request to the grid server', ms('90s')) // driverRequestTimeout
230
- .option('--driver-request-retries [driver-request-retries]', 'Retries for any WebDriver request to the grid server', 3) // driverRequestRetries
229
+ .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
230
+ .option('--get-browser-retries [get-browser-retries]', 'Number of attempts to get browser from the grid configured in the project\'s plan', Number) // getBrowserRetries
231
+ .option('--get-session-timeout [get-session-timeout]', 'Timeout for "/session" request to the selenium server', Number, ms('90s')) // getSessionTimeout
232
+ .option('--get-session-retries [get-session-retries]', 'Retries for "/session" request to the selenium server', Number, 3) // getSessionRetries
233
+ .option('--driver-request-timeout [driver-request-timeout]', 'Timeout for any WebDriver request to the grid server', Number, ms('90s')) // driverRequestTimeout
234
+ .option('--driver-request-retries [driver-request-retries]', 'Retries for any WebDriver request to the grid server', Number, 3) // driverRequestRetries
231
235
 
232
236
  // Run chrome ext mode locally
233
237
  .option('--use-local-chrome-driver [use-local-chrome-driver]', 'use a local ChromeDriver instance instead of a selenium grid')
@@ -347,7 +351,7 @@ program
347
351
  .option('--use-prefeched-data [location]', 'use prefetched data from local cache file, and force using only cached data')
348
352
  .option('--save-rca-locally [path]', 'save root cause analysis assets locally')
349
353
 
350
- .option('--exit-code-ignore-failing-tests', 'dont return non zero exit code when tests fail. non zero exit code will mean a real error occurred')
354
+ .option('--exit-code-ignore-failing-tests', 'return exit code of zero when tests fail. non zero exit code will mean a real error occurred')
351
355
 
352
356
  .option('--intersect-with-label [label]', 'Out of the execution\'s test list, run only those tests that have the specified label', collect, [])
353
357
  .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, [])
@@ -510,8 +514,10 @@ module.exports = {
510
514
  try {
511
515
  let options = {};
512
516
  if (program.configFile) {
517
+ // eslint-disable-next-line import/no-dynamic-require
513
518
  options = require(path.join(process.cwd(), program.configFile)).config;
514
519
  } else if (program.optionsFile) {
520
+ // eslint-disable-next-line import/no-dynamic-require
515
521
  options = require(path.join(process.cwd(), program.optionsFile));
516
522
  }
517
523
 
@@ -546,19 +552,20 @@ module.exports = {
546
552
  }
547
553
 
548
554
 
549
- const isTestConfigSpecified = (program.testConfig && program.testConfig.length) || (program.testConfigId && program.testConfigId.length);
550
- const isTestPlanSpecified = (program.testPlan && program.testPlan.length) || (program.testPlanId && program.testPlanId.length);
551
- const isSuiteSpecified = (program.suite && program.suite.length) || (program.suiteId && program.suiteId.length);
555
+ const isTestConfigSpecified = program.testConfig?.length || program.testConfigId?.length;
556
+ const isTestPlanSpecified = program.testPlan?.length || program.testPlanId?.length;
557
+ const isSuiteSpecified = program.suite?.length || program.suiteId?.length;
552
558
 
553
559
  if (program.seleniumCapsFile) {
554
560
  try {
561
+ // eslint-disable-next-line import/no-dynamic-require
555
562
  seleniumCapsFileContent = require(path.join(process.cwd(), program.seleniumCapsFile));
556
563
  } catch (err) {
557
- return Promise.reject(new ArgError(`Failed to parse selenium caps file file error: ${err.message}`));
564
+ throw new ArgError(`Failed to parse selenium caps file file error: ${err.message}`);
558
565
  }
559
566
  }
560
567
 
561
- if (program.reporters && program.reporters.includes('junit') && !program.reportFile) {
568
+ if (program.reporters?.includes('junit') && !program.reportFile) {
562
569
  console.log('Warning: please define --report-file option for JUnit reporter');
563
570
  }
564
571
 
@@ -575,9 +582,10 @@ module.exports = {
575
582
  }
576
583
  if (program.chromeExtraPrefs) {
577
584
  try {
585
+ // eslint-disable-next-line import/no-dynamic-require
578
586
  chromeExtraPrefs = require(path.join(process.cwd(), program.chromeExtraPrefs));
579
587
  } catch (err) {
580
- return Promise.reject(new ArgError(`Failed to read/open chrome extra prefs file error: ${err.message}`));
588
+ throw new ArgError(`Failed to read/open chrome extra prefs file error: ${err.message}`);
581
589
  }
582
590
  }
583
591
 
@@ -598,9 +606,10 @@ module.exports = {
598
606
 
599
607
  if (program.paramsFile) {
600
608
  try {
609
+ // eslint-disable-next-line import/no-dynamic-require
601
610
  userParamsData = Object.assign({}, userParamsData, require(path.join(process.cwd(), program.paramsFile)));
602
611
  } catch (err) {
603
- return Promise.reject(new ArgError(`Failed to read/open params file error: ${err.message}`));
612
+ throw new ArgError(`Failed to read/open params file error: ${err.message}`);
604
613
  }
605
614
  }
606
615
 
@@ -608,7 +617,7 @@ module.exports = {
608
617
  try {
609
618
  userParamsData = Object.assign({}, userParamsData, JSON.parse(program.params));
610
619
  } catch (err) {
611
- return Promise.reject(new ArgError(`Failed to parse params string error: ${err.message}`));
620
+ throw new ArgError(`Failed to parse params string error: ${err.message}`);
612
621
  }
613
622
  }
614
623
 
@@ -627,6 +636,7 @@ module.exports = {
627
636
 
628
637
  if (program.sauceOptions) {
629
638
  try {
639
+ // eslint-disable-next-line import/no-dynamic-require
630
640
  const sOptions = require(path.join(process.cwd(), program.sauceOptions));
631
641
  const isMobile = sOptions.platformName && ['ios', 'android'].includes(sOptions.platformName.toLowerCase());
632
642
  if (sOptions.browserName) {
@@ -649,12 +659,12 @@ module.exports = {
649
659
 
650
660
  const isBadVersion = parseFloat(sOptions.version) < 50 && !['dev', 'beta'].includes(sOptions.version);
651
661
  if (!isMobile && program.browser === 'chrome' && isBadVersion) {
652
- return Promise.reject(new ArgError('The minimum chrome supported version is 50.0'));
662
+ throw new ArgError('The minimum chrome supported version is 50.0');
653
663
  }
654
664
 
655
665
  program.saucelabs = Object.assign({}, program.saucelabs, sOptions);
656
666
  } catch (err) {
657
- return Promise.reject(new ArgError(`Failed to parse saucelabs options file error: ${err.message}`));
667
+ throw new ArgError(`Failed to parse saucelabs options file error: ${err.message}`);
658
668
  }
659
669
  }
660
670
 
@@ -672,6 +682,7 @@ module.exports = {
672
682
 
673
683
  if (program.browserstackOptions) {
674
684
  try {
685
+ // eslint-disable-next-line import/no-dynamic-require
675
686
  const bsOptions = require(path.join(process.cwd(), program.browserstackOptions));
676
687
  const isMobile = bsOptions.platform && ['mac', 'android'].includes(bsOptions.platform.toLowerCase());
677
688
  if (bsOptions.browserName) {
@@ -683,12 +694,12 @@ module.exports = {
683
694
  }
684
695
 
685
696
  if (!isMobile && parseFloat(bsOptions.browser_version) < 50 && program.browser === 'chrome') {
686
- return Promise.reject(new ArgError('The minimum chrome supported version is 50.0'));
697
+ throw new ArgError('The minimum chrome supported version is 50.0');
687
698
  }
688
699
 
689
700
  program.browserstack = Object.assign({}, program.browserstack, bsOptions);
690
701
  } catch (err) {
691
- return Promise.reject(new ArgError(`Failed to parse browserstack options file error: ${err.message}`));
702
+ throw new ArgError(`Failed to parse browserstack options file error: ${err.message}`);
692
703
  }
693
704
  }
694
705
 
@@ -700,11 +711,12 @@ module.exports = {
700
711
 
701
712
  if (program.perfectoOptions) {
702
713
  try {
714
+ // eslint-disable-next-line import/no-dynamic-require
703
715
  const perfectoOptions = require(path.join(process.cwd(), program.perfectoOptions));
704
716
  const DEFAULTS = { location: 'US East', securityToken: program.perfectoToken };
705
717
  program.perfecto = Object.assign({}, DEFAULTS, perfectoOptions);
706
718
  } catch (err) {
707
- return Promise.reject(new ArgError(`Failed to parse perfecto options file error: ${err.message}`));
719
+ throw new ArgError(`Failed to parse perfecto options file error: ${err.message}`);
708
720
  }
709
721
  }
710
722
 
@@ -716,11 +728,12 @@ module.exports = {
716
728
 
717
729
  if (program.testobjectOptions) {
718
730
  try {
731
+ // eslint-disable-next-line import/no-dynamic-require
719
732
  const testobjectOptions = require(path.join(process.cwd(), program.testobjectOptions));
720
733
  const DEFAULTS = { testobjectApiKey: program.testobjectKey };
721
734
  program.testobjectSauce = Object.assign({}, DEFAULTS, testobjectOptions);
722
735
  } catch (err) {
723
- return Promise.reject(new ArgError(`Failed to parse test object options file error: ${err.message}`));
736
+ throw new ArgError(`Failed to parse test object options file error: ${err.message}`);
724
737
  }
725
738
  }
726
739
 
@@ -751,8 +764,8 @@ module.exports = {
751
764
  }
752
765
 
753
766
  program.retries = !program.retries || typeof program.retries === 'boolean' ? 1 : Number(program.retries) + 1;
754
- program.browserTimeout = !program.browserTimeout || typeof program.browserTimeout === 'boolean' ? 60 * 1000 : Number(program.browserTimeout);
755
- program.newBrowserWaitTimeout = !program.newBrowserWaitTimeout || typeof program.newBrowserWaitTimeout === 'boolean' ? 10 * 60 * 1000 : Number(program.newBrowserWaitTimeout * 60 * 1000);
767
+ program.browserTimeout = !program.browserTimeout || typeof program.browserTimeout === 'boolean' ? 60 * 1000 : program.browserTimeout;
768
+ program.newBrowserWaitTimeout = !program.newBrowserWaitTimeout || typeof program.newBrowserWaitTimeout === 'boolean' ? 10 * 60 * 1000 : program.newBrowserWaitTimeout * 60 * 1000;
756
769
 
757
770
  if (!program.getBrowserTimeout) {
758
771
  program.getBrowserTimeout = program.browserTimeout;
@@ -764,7 +777,7 @@ module.exports = {
764
777
  program.driverRequestTimeout = program.browserTimeout < program.driverRequestTimeout ? program.driverRequestTimeout : program.browserTimeout;
765
778
 
766
779
  const timeoutWasGiven = Boolean(program.timeout);
767
- program.timeout = !program.timeout || typeof program.timeout === 'boolean' ? 10 * 60 * 1000 : Number(program.timeout);
780
+ program.timeout = !program.timeout || typeof program.timeout === 'boolean' ? 10 * 60 * 1000 : program.timeout;
768
781
  program.beforeParallel = !program.beforeParallel || typeof program.beforeParallel === 'boolean' ? 1 : Number(program.beforeParallel);
769
782
  program.parallel = !program.parallel || typeof program.parallel === 'boolean' ? 1 : Number(program.parallel);
770
783
  program.afterParallel = !program.afterParallel || typeof program.afterParallel === 'boolean' ? 1 : Number(program.afterParallel);
@@ -901,7 +914,7 @@ module.exports = {
901
914
  throw new ArgError('please define exactly one of --grid or --grid-id or --host');
902
915
  }
903
916
 
904
- if (program.host && program.host.includes('/')) {
917
+ if (program.host?.includes('/')) {
905
918
  if (!/^(f|ht)tps?:\/\//i.test(program.host)) {
906
919
  program.host = `http://${program.host}`;
907
920
  }
@@ -1009,7 +1022,7 @@ module.exports = {
1009
1022
  const fileContent = fs.readFileSync(program.tmsFieldFile);
1010
1023
  program.tmsCustomFields = JSON.parse(fileContent);
1011
1024
  } catch (err) {
1012
- return Promise.reject(new ArgError(`failed to parse field file error: ${err.message}`));
1025
+ throw new ArgError(`failed to parse field file error: ${err.message}`);
1013
1026
  }
1014
1027
  }
1015
1028
 
@@ -1046,7 +1059,7 @@ module.exports = {
1046
1059
  const lightweightModeOptions = typeof program.lightweightMode === 'string' ? JSON.parse(program.lightweightMode) : {};
1047
1060
  program.lightweightMode = Object.assign({}, DEFAULTS, lightweightModeOptions);
1048
1061
  } catch (err) {
1049
- return Promise.reject(new ArgError(`failed to parse lightweightMode settings error: ${err.message}`));
1062
+ throw new ArgError(`failed to parse lightweightMode settings error: ${err.message}`);
1050
1063
  }
1051
1064
  } else if (program.turboMode && program.mode === CLI_MODE.EXTENSION) {
1052
1065
  program.lightweightMode = {
@@ -1179,6 +1192,8 @@ module.exports = {
1179
1192
  driverRequestTimeout: program.driverRequestTimeout,
1180
1193
  driverRequestRetries: program.driverRequestRetries,
1181
1194
 
1195
+ testStartTimeout: program.testStartTimeout,
1196
+
1182
1197
  testConfigNames: program.testConfig,
1183
1198
  testConfigIds: program.testConfigId,
1184
1199
 
package/runner.js CHANGED
@@ -118,6 +118,14 @@ function setBranch(options, branchInfoFromServer) {
118
118
  }
119
119
  }
120
120
 
121
+ async function setSfdcCredential(options) {
122
+ const { projectData: { projectId } } = options;
123
+ const branch = branchService.getCurrentBranch();
124
+ if (_.get(options, 'company.activePlan.premiumFeatures.ttaForSalesforce')) {
125
+ options.sfdcCredential = await servicesApi.loadSfdcCredential({ projectId, branch });
126
+ }
127
+ }
128
+
121
129
  function setCompany(options, company) {
122
130
  const { onprem, id, storageBaseUrl, storageType, name, activePlan = {} } = company;
123
131
  if (onprem) {
@@ -172,6 +180,7 @@ function setAuthData(options, authData) {
172
180
  function setProject(options, project) {
173
181
  const { id, name, type, defaults } = project;
174
182
  featureFlags.setProjectId(id);
183
+ featureFlags.setProjectType(type);
175
184
  options.projectData = {
176
185
  projectId: id,
177
186
  type,
@@ -194,6 +203,10 @@ async function setMockNetworkRules(options) {
194
203
  }
195
204
  }
196
205
 
206
+ /**
207
+ * @param {import('./runOptions').RunnerOptions} options
208
+ * @param {string=} customExtensionLocalLocation
209
+ */
197
210
  async function runRunner(options, customExtensionLocalLocation) {
198
211
  perf.log('in runner.js runRunner');
199
212
 
@@ -265,6 +278,7 @@ async function init(options) {
265
278
  setBranch(options, branchName);
266
279
  setAllGrids(options, allGrids);
267
280
  setAuthData(options, authData);
281
+ await setSfdcCredential(options);
268
282
 
269
283
  if (!(options.lightweightMode && options.lightweightMode.disableLabs)) {
270
284
  await labFeaturesService.loadLabFeatures(projectById.id, companyByProjectId.activePlan);
@@ -61,13 +61,13 @@ class ParallelWorkerManager {
61
61
  const combinedTestResults = {};
62
62
  const testCount = testList.length;
63
63
 
64
- const companyId = options.company && options.company.companyId;
65
- const companyName = options.company && options.company.name;
64
+ const companyId = options.company?.companyId;
65
+ const companyName = options.company?.name;
66
66
  const source = options.source || 'cli';
67
67
  const user = options.user;
68
- const companyPlan = options.company && options.company.planType;
69
- const isStartUp = options.company && options.company.isStartUp;
70
- const projectName = options.projectData && options.projectData.name;
68
+ const companyPlan = options.company?.planType;
69
+ const isStartUp = options.company?.isStartUp;
70
+ const projectName = options.projectData?.name;
71
71
  const lightweightMode = options.lightweightMode;
72
72
  const sessionType = utils.getSessionType(options);
73
73
 
@@ -95,7 +95,7 @@ class ParallelWorkerManager {
95
95
  const onTestCompleted = async (wid, testId, testResult, sessionId, isRerun) => {
96
96
  runningTests--;
97
97
  const update = {};
98
- if (lightweightMode && lightweightMode.onlyTestIdsNoSuite) {
98
+ if (lightweightMode?.onlyTestIdsNoSuite) {
99
99
  update.show = true;
100
100
  }
101
101
  if (testResult.seleniumStats) {
@@ -115,9 +115,9 @@ class ParallelWorkerManager {
115
115
  update.gridHost = options.host;
116
116
  }
117
117
  if (options.grid || options.gridId) {
118
- update.gridName = options.grid || (options.gridData && options.gridData.name);
119
- update.gridType = options.gridData && options.gridData.type;
120
- update.gridProvider = options.gridData && options.gridData.provider;
118
+ update.gridName = options.grid || options.gridData?.name;
119
+ update.gridType = options.gridData?.type;
120
+ update.gridProvider = options.gridData?.provider;
121
121
  } else if (options.useLocalChromeDriver) {
122
122
  update.gridName = 'local-chrome-driver-from-options';
123
123
  update.gridType = 'local-chrome';
@@ -214,7 +214,6 @@ class ParallelWorkerManager {
214
214
  }
215
215
  }
216
216
 
217
-
218
217
  function schedule(fn, index) {
219
218
  if (index === 0) {
220
219
  fn();