@testim/testim-cli 3.267.0 → 3.269.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.
@@ -1,5 +1,6 @@
1
+ // @ts-check
2
+
1
3
  /* eslint-disable no-console */
2
- const Promise = require('bluebird');
3
4
  const semver = require('semver');
4
5
  const config = require('./commons/config');
5
6
  const fs = require('fs');
@@ -7,10 +8,9 @@ const logger = require('./commons/logger').getLogger('npm-driver');
7
8
  const localRunnerCache = require('./commons/runnerFileCache');
8
9
  const npmWrapper = require('./commons/npmWrapper');
9
10
  const chalk = require('chalk');
11
+ const utils = require('./utils');
10
12
 
11
- function getNpmVersion(packName) {
12
- return Promise.resolve(npmWrapper.getLatestPackageVersion(packName));
13
- }
13
+ const getNpmVersion = localRunnerCache.memoize(() => npmWrapper.getLatestPackageVersion('@testim/testim-cli'), 'getNpmVersion');
14
14
 
15
15
  function getPackageVersion() {
16
16
  try {
@@ -29,22 +29,21 @@ function getPackageVersion() {
29
29
  }
30
30
  }
31
31
 
32
- function checkNpmVersion() {
32
+ async function checkNpmVersion() {
33
33
  if (config.IS_ON_PREM) {
34
- return Promise.resolve();
34
+ return;
35
+ }
36
+ try {
37
+ const latestVersion = await utils.promiseTimeout(getNpmVersion(), 5000, 'The API call to NPM timed out');
38
+ const packVersion = getPackageVersion();
39
+ if (packVersion && semver.lt(packVersion, latestVersion)) {
40
+ console.log(chalk.yellow(
41
+ `Warning: You are using version ${packVersion}, a newer version is available. To update please run npm install (npm install -g @testim/testim-cli)`)
42
+ );
43
+ }
44
+ } catch (err) {
45
+ logger.warn('Failed to get NPM version', { err });
35
46
  }
36
- return localRunnerCache.memoize(() => getNpmVersion('@testim/testim-cli')
37
- .timeout(5000, 'The API call to NPM timed out')
38
- .then(latestVersion => {
39
- const packVersion = getPackageVersion();
40
- if (packVersion && semver.lt(packVersion, latestVersion)) {
41
- console.log(chalk.yellow(
42
- `Warning: You are using version ${packVersion}, a newer version is available. To update please run npm install (npm install -g @testim/testim-cli)`)
43
- );
44
- }
45
- })
46
- .catch(err => logger.warn('Failed to get NPM version', { err }))
47
- .then(() => true), 'checkNpmVersion');
48
47
  }
49
48
 
50
49
  module.exports = {
@@ -87,4 +87,5 @@ module.exports = {
87
87
  promiseTimeout,
88
88
  promiseMap,
89
89
  promiseFromCallback,
90
+ TimeoutError,
90
91
  };
@@ -86,8 +86,8 @@ class BaseWorker {
86
86
  * @param {import('../testRunHandler')} testRunHandler
87
87
  */
88
88
  async getGridSlot(browser, testRunHandler) {
89
- const slot = await gridService.getGridSlot(browser, testRunHandler.getExecutionId(), this.options, this.id);
90
- this.onGridSlot(testRunHandler.getTestResultId(), slot);
89
+ const slot = await gridService.getGridSlot(browser, testRunHandler.executionId, this.options, this.id);
90
+ this.onGridSlot(testRunHandler.testResultId, slot);
91
91
  return slot;
92
92
  }
93
93
 
@@ -116,10 +116,10 @@ class BaseWorker {
116
116
  * @param {ReturnType<typeof this['initPlayer']>} player
117
117
  */
118
118
  async runTestOnce(testRunHandler, player) {
119
- testRunHandler.setSessionId(player.getSessionId());
119
+ testRunHandler.sessionId = player.getSessionId();
120
120
  logger.info('Test run started', {
121
- testId: testRunHandler.getTestId(),
122
- resultId: testRunHandler.getTestResultId(),
121
+ testId: testRunHandler.testId,
122
+ resultId: testRunHandler.testResultId,
123
123
  seleniumSession: player.getSessionId(),
124
124
  });
125
125
 
@@ -128,15 +128,15 @@ class BaseWorker {
128
128
 
129
129
  /** @param {import('../testRunHandler')} testRunHandler */
130
130
  handleQuarantine(testRunHandler) {
131
- if (!utils.isQuarantineAndNotRemoteRun({ testStatus: testRunHandler.getTestStatus() }, this.options)) {
131
+ if (!utils.isQuarantineAndNotRemoteRun({ testStatus: testRunHandler.testStatus }, this.options)) {
132
132
  return undefined;
133
133
  }
134
134
  const testResult = {
135
- name: testRunHandler.getTestName(),
136
- testId: testRunHandler.getTestId(),
137
- resultId: testRunHandler.getTestResultId(),
135
+ name: testRunHandler.testName,
136
+ testId: testRunHandler.testId,
137
+ resultId: testRunHandler.testResultId,
138
138
  runnerStatus: runnerTestStatus.SKIPPED,
139
- testStatus: testRunHandler.getTestStatus(),
139
+ testStatus: testRunHandler.testStatus,
140
140
  };
141
141
  this.onTestIgnored(this.id, testResult);
142
142
  return testResult;
@@ -242,7 +242,7 @@ class BaseWorker {
242
242
  }
243
243
 
244
244
  perf.log('before runTest onTestStarted');
245
- const test = await this.onTestStarted(this.id, testRunHandler.getTestId(), testRunHandler.getTestResultId(), shouldRerun, testRunHandler.getRetryKey());
245
+ const test = await this.onTestStarted(this.id, testRunHandler.testId, testRunHandler.testResultId, shouldRerun, testRunHandler.retryKey);
246
246
  testRunHandler._baseUrl = test.config.baseUrl;
247
247
 
248
248
  const testPlayer = await this.getTestPlayer(testRunHandler, customExtensionLocalLocation);
@@ -273,7 +273,7 @@ class BaseWorker {
273
273
  if (utils.isQuarantineAndNotRemoteRun(testResult, this.options)) {
274
274
  return runNextTest();
275
275
  }
276
- const sessionId = testRunHandler.getSessionId();
276
+ const sessionId = testRunHandler.sessionId;
277
277
 
278
278
  const isTimeoutError = (timeoutMsg) => err.message.includes(timeoutMsg);
279
279
  const isIgnoreErrors = err && (err instanceof GetBrowserError);
@@ -287,7 +287,7 @@ class BaseWorker {
287
287
  );
288
288
 
289
289
  try {
290
- const testRetryKey = testRunHandler.getRetryKey();
290
+ const testRetryKey = testRunHandler.retryKey;
291
291
  testResult.testRetryKey = testRetryKey;
292
292
  await this.onTestCompleted(this.id, this.testId, testResult, sessionId, shouldRerun);
293
293
  if (this.executionQueue.hasMoreTests() && !this.options.lightweightMode?.general) {
@@ -307,7 +307,7 @@ class BaseWorker {
307
307
  testRetryKey,
308
308
  totalRetries: testRunHandler._totalRetryCount,
309
309
  });
310
- this.testResultId = testRunHandler.getTestResultId();
310
+ this.testResultId = testRunHandler.testResultId;
311
311
  return await runTestAndCalcResult(testRunHandler, shouldRerun);
312
312
  }
313
313
  return await runNextTest();
@@ -404,9 +404,9 @@ class BaseWorker {
404
404
  success: false,
405
405
  reason,
406
406
  errorType,
407
- testRetryKey: testRunHandler.getRetryKey(),
407
+ testRetryKey: testRunHandler.retryKey,
408
408
  setupStepResult: { status: testRunStatus.COMPLETED, success: false, reason, errorType },
409
- }, testRunHandler.getRemoteRunId());
409
+ }, testRunHandler.remoteRunId);
410
410
  await onRunComplete(buildFailureResult(this.testId, this.testName, this.testResultId, reason), testRunHandler, err);
411
411
  };
412
412
 
@@ -478,12 +478,12 @@ class BaseWorker {
478
478
  if (!testRunHandler) { // no more tests to run
479
479
  return this.onQueueCompleted();
480
480
  }
481
- this.testId = testRunHandler.getTestId();
482
- this.testName = testRunHandler.getTestName();
483
- this.testResultId = testRunHandler.getTestResultId();
484
- this.overrideTestConfigId = testRunHandler.getOverrideTestConfigId();
485
- this.testRunConfig = testRunHandler.getRunConfig();
486
- this.branch = testRunHandler.getBranch();
481
+ this.testId = testRunHandler.testId;
482
+ this.testName = testRunHandler.testName;
483
+ this.testResultId = testRunHandler.testResultId;
484
+ this.overrideTestConfigId = testRunHandler.overrideTestConfigId;
485
+ this.testRunConfig = testRunHandler.runConfig;
486
+ this.branch = testRunHandler.branch;
487
487
 
488
488
  return runTestAndCalcResult(testRunHandler);
489
489
  }
@@ -30,7 +30,7 @@ describe('BaseWorker', () => {
30
30
  worker.options = { gridData: {}, browser: 'chrome', company: { companyId: 'companyId' }, getBrowserTimeout: 1000, getSessionTimeout: 100, getBrowserRetries: 10 };
31
31
  worker.testRunConfig = {};
32
32
 
33
- testRunHandlerMock = { getExecutionId: () => 'executionId', getTestResultId: () => 'testResultId' };
33
+ testRunHandlerMock = { executionId: 'executionId', testResultId: 'testResultId' };
34
34
  testPlayerMock = { onDone: sinon.spy() };
35
35
 
36
36
  sinon.stub(worker, 'initPlayer').returns(testPlayerMock);
@@ -170,11 +170,6 @@ describe('BaseWorker', () => {
170
170
  it('should call the runTestOnc with the base url of the test object we acquired from onTestStarted', async () => {
171
171
  const testRunHandler = {
172
172
  _baseUrl: 'https://testim.io',
173
- getTestStatus: () => sinon.stub().returns(42),
174
- getTestId: () => sinon.stub().returns(42),
175
- getTestResultId: () => sinon.stub().returns(42),
176
- getRetryKey: () => sinon.stub().returns(42),
177
- getExecutionId: () => sinon.stub().returns(42),
178
173
  testRunHandler: () => sinon.stub().returns(42),
179
174
  clearTestResult: () => sinon.stub().returns(42),
180
175
  };
@@ -8,28 +8,56 @@ const AppiumTestPlayer = require('../player/appiumTestPlayer');
8
8
  const sessionPlayerInit = require('../commons/getSessionPlayerRequire');
9
9
  const AppiumApi = require('../commons/getSessionPlayerRequire').AppiumApi;
10
10
  const desiredCapabilitiesBuilder = require('../commons/testimDesiredCapabilitiesBuilder');
11
+ const testimServicesApi = require('../commons/testimServicesApi');
12
+ const config = require('../commons/config');
11
13
 
12
14
  class WorkerAppium extends BaseWorker {
15
+ /**
16
+ * @override
17
+ * @param {import('../testRunHandler')} testRunHandler
18
+ */
13
19
  initPlayer(testRunHandler) {
14
- return new AppiumTestPlayer(this.id,
15
- testRunHandler.getRunParams(),
20
+ return new AppiumTestPlayer(
21
+ this.id,
22
+ testRunHandler.runParams,
16
23
  this.options.shouldMonitorPerformance,
17
- testRunHandler.getAutomationMode(),
24
+ testRunHandler.automationMode,
18
25
  undefined,
19
- testRunHandler.getRetryCount(),
20
- testRunHandler.getPreviousTestResultId());
26
+ testRunHandler.retryCount,
27
+ testRunHandler.previousTestResultId,
28
+ );
21
29
  }
22
30
 
23
31
  async getBrowserOnce(testRunHandler, customExtensionLocalLocation, appiumTestPlayer, gridInfo) {
24
- reporter.onGetSession(this.id, this.testName, testRunHandler.getRunMode());
32
+ reporter.onGetSession(this.id, this.testName, testRunHandler.runMode);
25
33
  const { driver } = appiumTestPlayer;
26
- const nativeApp = testRunHandler.getNativeAppData();
27
34
  const projectType = this.options.projectData.type;
28
- const capabilities = desiredCapabilitiesBuilder.buildAppiumOptions({ projectType, gridInfo, testRunConfig: this.testRunConfig, nativeApp, options: this.options });
35
+ const nativeApp = await testRunHandler.getNativeAppData();
36
+ const androidActivityWait = projectType === 'android' ? testRunHandler.androidActivityWait : null;
37
+ let appPath = testRunHandler.nativeAppLink;
38
+ if (this.options.appId) {
39
+ const { project: projectId, appId } = this.options;
40
+ const mobileApp = await testimServicesApi.getAppDetails({ appId, projectId });
41
+ if (!mobileApp) {
42
+ logger.error('mobile app not found', { appId, projectId });
43
+ throw new Error('mobile app not found');
44
+ }
45
+ appPath = `${config.SERVICES_HOST}/storage${mobileApp.filePath}?access_token=${this.options.authData.token}`;
46
+ }
29
47
  try {
30
- //we assume the application is installed on the device. (all headspin allocated devices)
48
+ const capabilities = desiredCapabilitiesBuilder.buildAppiumOptions({
49
+ projectType,
50
+ gridInfo,
51
+ testRunConfig: this.testRunConfig,
52
+ nativeApp,
53
+ options: this.options,
54
+ appPath,
55
+ androidActivityWait,
56
+ });
57
+
31
58
  const activeSession = await driver.remote(capabilities);
32
59
  driver.activeSession = activeSession;
60
+ await this.updateDeviceInfo(testRunHandler, activeSession);
33
61
  logger.info(`init new appium session testName: ${this.testName}`, { sessionId: activeSession.sessionId, testResultId: this.testResultId, nativeApp });
34
62
  } catch (err) {
35
63
  //TODO: catch app status validation
@@ -39,10 +67,34 @@ class WorkerAppium extends BaseWorker {
39
67
  }
40
68
 
41
69
  getServerAddressFromGrid(testRunHandler) {
42
- const { _options: { gridData: { host, port, accessToken } } } = testRunHandler;
70
+ const { host, port, accessToken } = testRunHandler._options.gridData;
43
71
  return `https://${host}:${port}/v0/${accessToken}/wd/hub`;
44
72
  }
45
73
 
74
+ async updateDeviceInfo(testRunHandler, activeSession) {
75
+ const {
76
+ _executionId, _testId, _testResultId,
77
+ _options: { project: projectId },
78
+ } = testRunHandler;
79
+ const device = {
80
+ name: activeSession.capabilities.deviceName,
81
+ model: activeSession.capabilities.deviceModel,
82
+ osVersion: activeSession.capabilities.platformVersion,
83
+ udid: activeSession.capabilities.udid,
84
+ osType: activeSession.capabilities.platformName,
85
+ scaleFactor: activeSession.capabilities.pixelRatio,
86
+ virtual: false,
87
+ };
88
+ await testimServicesApi.updateTestStatus(
89
+ projectId,
90
+ _executionId,
91
+ _testId,
92
+ _testResultId,
93
+ 'RUNNING',
94
+ { device },
95
+ );
96
+ }
97
+
46
98
  getDirectAddressConnection(activeSessionCapabilities) {
47
99
  const { directConnectProtocol: protocol, directConnectHost: host, directConnectPort: port, directConnectPath: path } = activeSessionCapabilities;
48
100
  if (protocol && host && port && path) {
@@ -51,27 +103,29 @@ class WorkerAppium extends BaseWorker {
51
103
  return undefined;
52
104
  }
53
105
 
106
+ /**
107
+ * @param {import('../testRunHandler')} testRunHandler
108
+ * @param {import('../player/appiumTestPlayer')} appiumTestPlayer
109
+ */
54
110
  async runTestOnce(testRunHandler, appiumTestPlayer) {
55
111
  const { driver, sessionPlayer } = appiumTestPlayer;
56
112
  const version = sessionPlayerInit.manifestVersion || 'runner';
57
113
 
58
114
  reporter.onWaitToTestComplete(this.id, this.isCodeMode);
59
115
 
60
- sessionPlayer.playbackManager.executionId = testRunHandler.getExecutionId();
61
- sessionPlayer.playbackManager.executionName = testRunHandler.getExecutionName();
116
+ sessionPlayer.playbackManager.executionId = testRunHandler.executionId;
117
+ sessionPlayer.playbackManager.executionName = testRunHandler.executionName;
62
118
 
63
119
  const serverAddress = this.getDirectAddressConnection(driver.activeSession.capabilities) || this.getServerAddressFromGrid(testRunHandler);
64
- const DOMParser = new (jsdom.JSDOM)('').window.DOMParser;
120
+ const DOMParser = new jsdom.JSDOM('').window.DOMParser;
65
121
  sessionPlayer.playbackManager.appiumApi = new AppiumApi(serverAddress, driver.activeSession.sessionId, DOMParser);
66
-
67
-
68
122
  if (sessionPlayerInit.localAssetService) {
69
123
  sessionPlayerInit.localAssetService.initialize({ serverUrl: this.options.localRCASaver });
70
124
  }
71
125
  async function runAppiumTest() {
72
126
  try {
73
127
  const INCOGNITO = false;
74
- const testResult = await (new Promise((resolve, reject) =>
128
+ const testResult = await new Promise((resolve, reject) =>
75
129
  // eslint-disable-next-line no-promise-executor-return
76
130
  sessionPlayer.playByTestId(
77
131
  this.testId,
@@ -85,11 +139,12 @@ class WorkerAppium extends BaseWorker {
85
139
  this.overrideTestConfigId,
86
140
  this.branch,
87
141
  INCOGNITO,
88
- testRunHandler.getRemoteRunId(),
89
- undefined,
142
+ testRunHandler.remoteRunId,
90
143
  undefined,
91
144
  undefined,
92
- )));
145
+ undefined
146
+ )
147
+ );
93
148
  if (sessionPlayerInit.localAssetService) {
94
149
  await sessionPlayerInit.localAssetService.drain();
95
150
  }
@@ -21,6 +21,12 @@ class WorkerExtension extends BaseWorker {
21
21
  return new ExtensionTestPlayer(this.id);
22
22
  }
23
23
 
24
+ /**
25
+ * @param {import('../testRunHandler')} testRunHandler
26
+ * @param {string=} customExtensionLocalLocation
27
+ * @param {import('../player/extensionTestPlayer')} player
28
+ * @param {Awaited<ReturnType<import('../services/gridService')['getGridSlot']>>} gridInfo
29
+ */
24
30
  async _getBrowserOnce(testRunHandler, customExtensionLocalLocation, player, gridInfo) {
25
31
  const { driver } = player;
26
32
  try {
@@ -40,8 +46,8 @@ class WorkerExtension extends BaseWorker {
40
46
  logger.error('failed to get browser', {
41
47
  err,
42
48
  gridInfo,
43
- testId: testRunHandler.getTestId(),
44
- resultId: testRunHandler.getTestResultId(),
49
+ testId: testRunHandler.testId,
50
+ resultId: testRunHandler.testResultId,
45
51
  });
46
52
  throw err;
47
53
  }
@@ -49,7 +55,7 @@ class WorkerExtension extends BaseWorker {
49
55
 
50
56
  /** @override */
51
57
  async getBrowserOnce(testRunHandler, customExtensionLocalLocation, player, gridInfo) {
52
- reporter.onGetSession(this.id, this.testName, testRunHandler.getRunMode());
58
+ reporter.onGetSession(this.id, this.testName, testRunHandler.runMode);
53
59
  return this._getBrowserOnce(testRunHandler, customExtensionLocalLocation, player, gridInfo);
54
60
  }
55
61
 
@@ -175,8 +181,8 @@ class WorkerExtension extends BaseWorker {
175
181
  } catch (err) {
176
182
  logger.error('failed to run test', {
177
183
  err,
178
- testId: testRunHandler.getTestId(),
179
- resultId: testRunHandler.getTestResultId(),
184
+ testId: testRunHandler.testId,
185
+ resultId: testRunHandler.testResultId,
180
186
  });
181
187
  throw err;
182
188
  }
@@ -23,7 +23,7 @@ class WorkerExtensionSingleBrowser extends WorkerExtension {
23
23
  }
24
24
 
25
25
  async getBrowserOnce(testRunHandler, customExtensionLocalLocation, player, gridInfo) {
26
- reporter.onGetSession(this.id, `worker ${this.id}`, testRunHandler.getRunMode());
26
+ reporter.onGetSession(this.id, `worker ${this.id}`, testRunHandler.runMode);
27
27
  return this._getBrowserOnce(testRunHandler, customExtensionLocalLocation, player, gridInfo);
28
28
  }
29
29
 
@@ -43,6 +43,11 @@ class WorkerExtensionSingleBrowser extends WorkerExtension {
43
43
  return this.testPlayer;
44
44
  }
45
45
 
46
+ /**
47
+ * @param {import('../testRunHandler')} testRunHandler
48
+ * @param {string=} customExtensionLocalLocation
49
+ * @param {boolean=} shouldRerun
50
+ */
46
51
  async runTest(testRunHandler, customExtensionLocalLocation, shouldRerun) {
47
52
  const quarantineResult = this.handleQuarantine(testRunHandler);
48
53
  if (quarantineResult) {
@@ -50,7 +55,7 @@ class WorkerExtensionSingleBrowser extends WorkerExtension {
50
55
  }
51
56
 
52
57
  perf.log('before runTest onTestStarted single browser');
53
- const test = await this.onTestStarted(this.id, testRunHandler.getTestId(), testRunHandler.getTestResultId(), shouldRerun, testRunHandler.getRetryKey());
58
+ const test = await this.onTestStarted(this.id, testRunHandler.testId, testRunHandler.testResultId, shouldRerun, testRunHandler.retryKey);
54
59
  testRunHandler._baseUrl = test.config.baseUrl;
55
60
  const testPlayer = await this.getTestPlayer(testRunHandler, customExtensionLocalLocation);
56
61
 
@@ -1,9 +1,6 @@
1
1
  'use strict';
2
2
 
3
3
  const Promise = require('bluebird');
4
-
5
- const { timeoutMessages } = require('../commons/constants');
6
- const { PageNotAvailableError } = require('../errors');
7
4
  const BaseWorker = require('./BaseWorker');
8
5
  const logger = require('../commons/logger').getLogger('worker-selenium');
9
6
  const reporter = require('../reports/reporter');
@@ -11,6 +8,9 @@ const SeleniumTestPlayer = require('../player/seleniumTestPlayer');
11
8
  const WindowUtils = require('../player/utils/windowUtils');
12
9
  const sessionPlayerInit = require('../commons/getSessionPlayerRequire');
13
10
  const perf = require('../commons/performance-logger');
11
+ const utils = require('../utils');
12
+ const { timeoutMessages } = require('../commons/constants');
13
+ const { PageNotAvailableError } = require('../errors');
14
14
  const { preloadTests } = require('../commons/preloadTests');
15
15
 
16
16
  // this navigation timeout is handled from outside the worker, so don't pass a small timeout to navigate
@@ -24,12 +24,12 @@ class WorkerSelenium extends BaseWorker {
24
24
  initPlayer(testRunHandler) {
25
25
  return new SeleniumTestPlayer(
26
26
  this.id,
27
- testRunHandler.getRunParams(),
27
+ testRunHandler.runParams,
28
28
  this.options.shouldMonitorPerformance,
29
- testRunHandler.getAutomationMode(),
29
+ testRunHandler.automationMode,
30
30
  undefined,
31
- testRunHandler.getRetryCount(),
32
- testRunHandler.getPreviousTestResultId(),
31
+ testRunHandler.retryCount,
32
+ testRunHandler.previousTestResultId,
33
33
  );
34
34
  }
35
35
 
@@ -42,14 +42,14 @@ class WorkerSelenium extends BaseWorker {
42
42
  */
43
43
  async getBrowserOnce(testRunHandler, customExtensionLocalLocation, seleniumTestPlayer, gridInfo) {
44
44
  perf.log('in WorkerSelenium getBrowserOnce');
45
- reporter.onGetSession(this.id, this.testName, testRunHandler.getRunMode());
45
+ reporter.onGetSession(this.id, this.testName, testRunHandler.runMode);
46
46
  const { driver } = seleniumTestPlayer;
47
47
 
48
48
  this.windowUtils = new WindowUtils(this.id, driver);
49
49
  seleniumTestPlayer.clearSessionTabs();
50
50
 
51
51
  const { browserValue } = this.testRunConfig;
52
- const baseUrl = testRunHandler.getBaseUrl();
52
+ const baseUrl = testRunHandler.baseUrl;
53
53
 
54
54
  try {
55
55
  const fastInit = this.options.useLocalChromeDriver;
@@ -101,12 +101,12 @@ class WorkerSelenium extends BaseWorker {
101
101
 
102
102
  setupCliPerformanceMonitoring(sessionPlayer);
103
103
 
104
- sessionPlayer.playbackManager.executionId = testRunHandler.getExecutionId();
105
- sessionPlayer.playbackManager.executionName = testRunHandler.getExecutionName();
104
+ sessionPlayer.playbackManager.executionId = testRunHandler.executionId;
105
+ sessionPlayer.playbackManager.executionName = testRunHandler.executionName;
106
106
 
107
107
  sessionPlayer.setLightweightMode(this.options.lightweightMode);
108
- if (testRunHandler.getSfdcCredential()) {
109
- sessionPlayer.setSfdcCredential(testRunHandler.getSfdcCredential());
108
+ if (testRunHandler.sfdcCredential) {
109
+ sessionPlayer.setSfdcCredential(testRunHandler.sfdcCredential);
110
110
  }
111
111
  if (sessionPlayerInit.localAssetService) {
112
112
  sessionPlayerInit.localAssetService.initialize({ serverUrl: this.options.localRCASaver });
@@ -119,7 +119,7 @@ class WorkerSelenium extends BaseWorker {
119
119
  }
120
120
 
121
121
  async function runSeleniumTest() {
122
- if (testRunHandler.getAutomationMode() === 'codeful') {
122
+ if (testRunHandler.automationMode === 'codeful') {
123
123
  // Testim Development Kit test;
124
124
  if (!sessionPlayer.callOrderScheduler) { // old session player
125
125
  await testRunHandler.waitForExecutionStartedFinished();
@@ -142,14 +142,14 @@ class WorkerSelenium extends BaseWorker {
142
142
  false,
143
143
  this.overrideTestConfigId,
144
144
  this.branch,
145
- testRunHandler.getCode(),
146
- testRunHandler.getTestName()
145
+ testRunHandler.code,
146
+ testRunHandler.testName
147
147
  ).catch(reject))
148
148
  .log('right after playTestByCode')
149
149
  .timeout(this.testRunTimeout, timeoutMessages.TEST_COMPLETE_TIMEOUT_MSG)
150
- .catch(Promise.TimeoutError, err => {
151
- if (sessionPlayer.stopPlayingOnTestTimeout) {
152
- sessionPlayer.stopPlayingOnTestTimeout();
150
+ .catch(err => {
151
+ if (err instanceof utils.TimeoutError) {
152
+ sessionPlayer.stopPlayingOnTestTimeout?.();
153
153
  }
154
154
  throw err;
155
155
  })
@@ -173,15 +173,15 @@ class WorkerSelenium extends BaseWorker {
173
173
  this.overrideTestConfigId,
174
174
  this.branch,
175
175
  INCOGNITO,
176
- testRunHandler.getRemoteRunId(),
176
+ testRunHandler.remoteRunId,
177
177
  undefined,
178
178
  undefined,
179
179
  preloadedTest
180
180
  ).catch(reject))
181
181
  .timeout(this.testRunTimeout, timeoutMessages.TEST_COMPLETE_TIMEOUT_MSG)
182
- .catch(Promise.TimeoutError, err => {
183
- if (sessionPlayer.stopPlayingOnTestTimeout) {
184
- sessionPlayer.stopPlayingOnTestTimeout();
182
+ .catch(err => {
183
+ if (err instanceof utils.TimeoutError) {
184
+ sessionPlayer.stopPlayingOnTestTimeout?.();
185
185
  }
186
186
  throw err;
187
187
  })