@testim/testim-cli 3.192.0 → 3.196.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.
@@ -119,6 +119,7 @@ type ApiCallOptions = {
119
119
  headers?: Headers;
120
120
  body?: string;
121
121
  sendViaWebApp?: boolean;
122
+ omitCookies?: boolean;
122
123
  }
123
124
 
124
125
  export enum GeneratedValueTypes {
@@ -193,7 +193,6 @@ function _buildChromiumOptions(opts, browserOptions, testRunConfig, customExtens
193
193
  }
194
194
 
195
195
  if (isDFGrid(gridInfo) && browserName === 'MicrosoftEdge') {
196
- delete chromiumOptions.prefs['profile.content_settings.exceptions.clipboard']; // for some reason this breaks
197
196
  opts.desiredCapabilities['ms:edgeChromium'] = true;
198
197
  }
199
198
 
@@ -100,7 +100,7 @@ function saveTestPlanResult(projectId, testPlanId, result) {
100
100
  return utils.runWithRetries(() => postAuth({ url: '/testPlan/result', body: { projectId, testPlanId, result } }));
101
101
  }
102
102
 
103
- function updateTestStatus(status, executionId, testId, resultId, startTime, endTime, success, failureReason, config, projectId, remoteRunId, testRetryKey) {
103
+ function updateTestStatus(status, executionId, testId, resultId, startTime, endTime, success, failureReason, config, projectId, remoteRunId, testRetryKey, apiRetries = DEFAULT_REQUEST_RETRY) {
104
104
  return utils.runWithRetries(() => putAuth('/result/run/test', {
105
105
  runId: executionId,
106
106
  testId,
@@ -115,7 +115,7 @@ function updateTestStatus(status, executionId, testId, resultId, startTime, endT
115
115
  runnerVersion,
116
116
  remoteRunId,
117
117
  testRetryKey,
118
- }), DEFAULT_REQUEST_RETRY);
118
+ }), apiRetries);
119
119
  }
120
120
 
121
121
  function updateExecutionTests(executionId, runnerStatuses, status, reason, success, startTime, endTime, projectId) {
@@ -1311,9 +1311,9 @@
1311
1311
  }
1312
1312
  },
1313
1313
  "axios-retry": {
1314
- "version": "3.2.3",
1315
- "resolved": "https://registry.npmjs.org/axios-retry/-/axios-retry-3.2.3.tgz",
1316
- "integrity": "sha512-JfxUUN6PDyinrDVP/NbCKxmwvwJfMfQ0DLs95o/OEd+mw5+hrBXNGfx1Wq2gskd7ODWc4kcd9CjStCpDv3Us4g==",
1314
+ "version": "3.2.4",
1315
+ "resolved": "https://registry.npmjs.org/axios-retry/-/axios-retry-3.2.4.tgz",
1316
+ "integrity": "sha512-Co3UXiv4npi6lM963mfnuH90/YFLKWWDmoBYfxkHT5xtkSSWNqK9zdG3fw5/CP/dsoKB5aMMJCsgab+tp1OxLQ==",
1317
1317
  "requires": {
1318
1318
  "@babel/runtime": "^7.15.4",
1319
1319
  "is-retry-allowed": "^2.2.0"
@@ -1561,15 +1561,15 @@
1561
1561
  "dev": true
1562
1562
  },
1563
1563
  "browserslist": {
1564
- "version": "4.17.4",
1565
- "resolved": "https://registry.npmjs.org/browserslist/-/browserslist-4.17.4.tgz",
1566
- "integrity": "sha512-Zg7RpbZpIJRW3am9Lyckue7PLytvVxxhJj1CaJVlCWENsGEAOlnlt8X0ZxGRPp7Bt9o8tIRM5SEXy4BCPMJjLQ==",
1564
+ "version": "4.17.5",
1565
+ "resolved": "https://registry.npmjs.org/browserslist/-/browserslist-4.17.5.tgz",
1566
+ "integrity": "sha512-I3ekeB92mmpctWBoLXe0d5wPS2cBuRvvW0JyyJHMrk9/HmP2ZjrTboNAZ8iuGqaEIlKguljbQY32OkOJIRrgoA==",
1567
1567
  "dev": true,
1568
1568
  "requires": {
1569
- "caniuse-lite": "^1.0.30001265",
1570
- "electron-to-chromium": "^1.3.867",
1569
+ "caniuse-lite": "^1.0.30001271",
1570
+ "electron-to-chromium": "^1.3.878",
1571
1571
  "escalade": "^3.1.1",
1572
- "node-releases": "^2.0.0",
1572
+ "node-releases": "^2.0.1",
1573
1573
  "picocolors": "^1.0.0"
1574
1574
  }
1575
1575
  },
@@ -1722,9 +1722,9 @@
1722
1722
  "dev": true
1723
1723
  },
1724
1724
  "caniuse-lite": {
1725
- "version": "1.0.30001270",
1726
- "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001270.tgz",
1727
- "integrity": "sha512-TcIC7AyNWXhcOmv2KftOl1ShFAaHQYcB/EPL/hEyMrcS7ZX0/DvV1aoy6BzV0+16wTpoAyTMGDNAJfSqS/rz7A==",
1725
+ "version": "1.0.30001271",
1726
+ "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001271.tgz",
1727
+ "integrity": "sha512-BBruZFWmt3HFdVPS8kceTBIguKxu4f99n5JNp06OlPD/luoAMIaIK5ieV5YjnBLH3Nysai9sxj9rpJj4ZisXOA==",
1728
1728
  "dev": true
1729
1729
  },
1730
1730
  "caseless": {
@@ -1912,9 +1912,9 @@
1912
1912
  },
1913
1913
  "dependencies": {
1914
1914
  "@types/node": {
1915
- "version": "16.11.1",
1916
- "resolved": "https://registry.npmjs.org/@types/node/-/node-16.11.1.tgz",
1917
- "integrity": "sha512-PYGcJHL9mwl1Ek3PLiYgyEKtwTMmkMw4vbiyz/ps3pfdRYLVv+SN7qHVAImrjdAXxgluDEw6Ph4lyv+m9UpRmA=="
1915
+ "version": "16.11.6",
1916
+ "resolved": "https://registry.npmjs.org/@types/node/-/node-16.11.6.tgz",
1917
+ "integrity": "sha512-ua7PgUoeQFjmWPcoo9khiPum3Pd60k4/2ZGXt18sm2Slk0W0xZTqt5Y0Ny1NyBiN1EVQ/+FaF9NcY4Qe6rwk5w=="
1918
1918
  },
1919
1919
  "mkdirp": {
1920
1920
  "version": "0.5.5",
@@ -2853,9 +2853,9 @@
2853
2853
  "integrity": "sha512-GJCAeDBKfREgkBtgrYSf9hQy9kTb3helv0zGdzqhM7iAkW8FA/ZF97VQDbwFiwIT8MQLLOe5VlPZOEvZAqtUAQ=="
2854
2854
  },
2855
2855
  "electron-to-chromium": {
2856
- "version": "1.3.876",
2857
- "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.3.876.tgz",
2858
- "integrity": "sha512-a6LR4738psrubCtGx5HxM/gNlrIsh4eFTNnokgOqvQo81GWd07lLcOjITkAXn2y4lIp18vgS+DGnehj+/oEAxQ==",
2856
+ "version": "1.3.880",
2857
+ "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.3.880.tgz",
2858
+ "integrity": "sha512-iwIP/6WoeSimzUKJIQtjtpVDsK8Ir8qQCMXsUBwg+rxJR2Uh3wTNSbxoYRfs+3UWx/9MAnPIxVZCyWkm8MT0uw==",
2859
2859
  "dev": true
2860
2860
  },
2861
2861
  "emoji-regex": {
@@ -5310,9 +5310,9 @@
5310
5310
  }
5311
5311
  },
5312
5312
  "estraverse": {
5313
- "version": "5.2.0",
5314
- "resolved": "https://registry.npmjs.org/estraverse/-/estraverse-5.2.0.tgz",
5315
- "integrity": "sha512-BxbNGGNm0RyRYvUdHpIwv9IWzeM9XClbOxwoATuFdOE7ZE6wHL+HQ5T8hoPM+zHvmKzzsEqhgy0GrQ5X13afiQ=="
5313
+ "version": "5.3.0",
5314
+ "resolved": "https://registry.npmjs.org/estraverse/-/estraverse-5.3.0.tgz",
5315
+ "integrity": "sha512-MMdARuVEQziNTeJD8DgMqmhwR11BRQ/cBP+pLtYdSTnf3MIO8fFeiINEbX36ZdNlfU/7A9f3gUw49B3oQsvwBA=="
5316
5316
  },
5317
5317
  "html-encoding-sniffer": {
5318
5318
  "version": "2.0.1",
@@ -5521,9 +5521,9 @@
5521
5521
  }
5522
5522
  },
5523
5523
  "lazystream": {
5524
- "version": "1.0.0",
5525
- "resolved": "https://registry.npmjs.org/lazystream/-/lazystream-1.0.0.tgz",
5526
- "integrity": "sha1-9plf4PggOS9hOWvolGJAe7dxaOQ=",
5524
+ "version": "1.0.1",
5525
+ "resolved": "https://registry.npmjs.org/lazystream/-/lazystream-1.0.1.tgz",
5526
+ "integrity": "sha512-b94GiNHQNy6JNTrt5w6zNyffMrNkXZb3KTkCZJb2V1xaEGCk093vkZ2jk3tpaeP33/OiXC+WvK9AxUebnf5nbw==",
5527
5527
  "requires": {
5528
5528
  "readable-stream": "^2.0.5"
5529
5529
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@testim/testim-cli",
3
- "version": "3.192.0",
3
+ "version": "3.196.0",
4
4
  "description": "Command line interface for running Testing on your CI",
5
5
  "author": "Oren Rubin",
6
6
  "contributors": [{
@@ -4,9 +4,10 @@ const launcher = require('chrome-launcher');
4
4
  const desiredCapabilitiesBuilder = require('../commons/testimDesiredCapabilitiesBuilder');
5
5
  const utils = require('../utils');
6
6
  const httpRequest = require('../commons/httpRequest');
7
+ const { registerExitHook } = require('../processHandler');
7
8
  const CDPTestRunner = require('../cdpTestRunner');
8
9
 
9
- class LancherDriver {
10
+ class LauncherDriver {
10
11
  constructor(sessionId) {
11
12
  this.sessionId = sessionId;
12
13
  this.cdpTestRunner = new CDPTestRunner();
@@ -24,6 +25,8 @@ class LancherDriver {
24
25
  this._isAlive = true;
25
26
  const browserEndpoint = await httpRequest.get(`http://localhost:${this.chrome.port}/json/version`);
26
27
  await this.cdpTestRunner.initSession(browserEndpoint.webSocketDebuggerUrl);
28
+
29
+ registerExitHook(() => this.chrome.kill());
27
30
  }
28
31
 
29
32
  isAlive() {
@@ -49,7 +52,7 @@ class LancherDriver {
49
52
  class ChromeLauncherTestPlayer {
50
53
  constructor(id) {
51
54
  this.sessionId = utils.guid();
52
- this.driver = new LancherDriver(this.sessionId);
55
+ this.driver = new LauncherDriver(this.sessionId);
53
56
  this.id = id;
54
57
  }
55
58
 
@@ -36,6 +36,7 @@ class ApiStepAction extends StepAction {
36
36
  headers: context.apiHeaders,
37
37
  body: context.apiBody,
38
38
  timeout: context.data.maxTotalStepTime,
39
+ omitCookies: step.omitCookies,
39
40
  };
40
41
 
41
42
  return (step.sendViaWebApp ? this.runApiInAut(step, context) : this.runApiInBg(eventData))
@@ -0,0 +1,37 @@
1
+ const NavigationStepAction = require('./navigationStepAction');
2
+ const Promise = require('bluebird');
3
+
4
+ class SalesforceAutoLoginStepAction extends NavigationStepAction {
5
+ async performAction() {
6
+ let salesforceUrl = this.context.data.testimNavigationStepDestination || this.context.data.url;
7
+ try {
8
+ salesforceUrl = await this.updateBaseUrl(salesforceUrl);
9
+ await this.driver.url(salesforceUrl);
10
+ await Promise.delay(300); // wait a little for the page to load (fixes screenshots and clicking on elements in username verification screen)
11
+ let newUrl = await this.driver.getUrl();
12
+ // Verify username screen
13
+ const isUsernameVerificationNeeded = newUrl.includes(this.step.USERNAME_VERIFICATION_PATH_ID);
14
+ if (isUsernameVerificationNeeded) {
15
+ await this.driver.executeCodeAsync(`
16
+ function ${this.step.handleUsernameVerificationAUTFunc.toString()}
17
+ handleUsernameVerificationAUTFunc();
18
+ var done = arguments[1];
19
+ done();
20
+ `);
21
+ await Promise.delay(500);
22
+ newUrl = await this.driver.getUrl(); // If we managed to continue correctly we want to get the new redirected url
23
+ }
24
+ return {
25
+ success: true,
26
+ newUrl,
27
+ };
28
+ } catch (err) {
29
+ return {
30
+ success: false,
31
+ reason: err.message,
32
+ };
33
+ }
34
+ }
35
+ }
36
+
37
+ module.exports = SalesforceAutoLoginStepAction;
@@ -1,6 +1,6 @@
1
1
  module.exports = function dispatchFocus(targetElement, oldActiveElement) {
2
2
  function createFocusEvent(eventName) {
3
- var event = document.createEvent("FocusEvent");
3
+ var event = document.createEvent("HTMLEvents");
4
4
  // TODO we want to use new Event, but mootools (used by zuora which is used by jfrog)
5
5
  // overrides window.Event and throws an error
6
6
  event.initEvent(eventName, true, false);
@@ -16,10 +16,12 @@ module.exports = function dispatchFocus(targetElement, oldActiveElement) {
16
16
  }
17
17
 
18
18
  function setFocus(element, oldActiveElement) {
19
- element.dispatchEvent(createFocusEvent('focusin'));
20
19
  if (oldActiveElement) {
21
- oldActiveElement.dispatchEvent(createFocusEvent('focusout'));
20
+ oldActiveElement.dispatchEvent(createFocusEvent('focusout'));
21
+ oldActiveElement.dispatchEvent(createFocusEvent('blur'));
22
22
  }
23
+ element.dispatchEvent(createFocusEvent('focusin'));
24
+ element.dispatchEvent(createFocusEvent('focus'));
23
25
  if (typeof element.focus === 'function') {
24
26
  element.focus();
25
27
  }
@@ -21,6 +21,7 @@ const RefreshStepAction = require('./RefreshStepAction');
21
21
  const ApiStepAction = require('./apiStepAction');
22
22
  const ExtractTextStepAction = require('./extractTextStepAction');
23
23
  const TdkHybridStepAction = require('./tdkHybridStepAction');
24
+ const SalesforceAutoLoginStepAction = require('./salesforceAutoLoginStepAction');
24
25
 
25
26
  const CliJsStepAction = require('./cliJsStepAction');
26
27
  const CliConditionStepAction = require('./cliConditionStepAction');
@@ -92,6 +93,8 @@ module.exports = function (driver, stepActionFactory, runMode) {
92
93
  'email-code-step': JsCodeStepAction,
93
94
  'cli-email-code-step': CliJsStepAction,
94
95
  'tdk-hybrid': TdkHybridStepAction,
96
+
97
+ 'salesforce-autologin': SalesforceAutoLoginStepAction,
95
98
  };
96
99
 
97
100
  const ANDROID_STEP_ACTION_MAPPING = {
package/runOptions.js CHANGED
@@ -1021,6 +1021,7 @@ module.exports = {
1021
1021
  const DEFAULTS = {
1022
1022
  general: true,
1023
1023
  disableLabs: true,
1024
+ disableFeatureFlags: true,
1024
1025
  disableAssets: true,
1025
1026
  disablePixelValidation: true,
1026
1027
  disableResults: true,
@@ -1035,6 +1036,7 @@ module.exports = {
1035
1036
  onlyTestIdsNoSuite: true,
1036
1037
  uploadAssetsAndResultsOnFailure: true,
1037
1038
  preloadTests: true,
1039
+ disableProjectDefaults: true,
1038
1040
  type: 'lightweight',
1039
1041
  };
1040
1042
 
@@ -1047,10 +1049,11 @@ module.exports = {
1047
1049
  program.lightweightMode = {
1048
1050
  general: true,
1049
1051
  disableLabs: false,
1052
+ disableFeatureFlags: false,
1050
1053
  disableAssets: true,
1051
1054
  disablePixelValidation: false,
1052
1055
  disableResults: true,
1053
- disableStepDelay: false,
1056
+ disableStepDelay: true,
1054
1057
  disableRemoteStep: false,
1055
1058
  assumePreloadedSharedSteps: false,
1056
1059
  disableVisibilityCheck: false,
@@ -1061,6 +1064,7 @@ module.exports = {
1061
1064
  onlyTestIdsNoSuite: false,
1062
1065
  uploadAssetsAndResultsOnFailure: true,
1063
1066
  preloadTests: false,
1067
+ disableProjectDefaults: false,
1064
1068
  type: 'highSpeed',
1065
1069
  };
1066
1070
  }
package/runner.js CHANGED
@@ -1,7 +1,7 @@
1
1
  'use strict';
2
2
 
3
3
  /* eslint-disable no-console */
4
- const { CLI_MODE, gridTypes } = require('./commons/constants');
4
+ const { CLI_MODE } = require('./commons/constants');
5
5
  const Promise = require('bluebird');
6
6
  const _ = require('lodash');
7
7
  const { EDITOR_URL } = require('./commons/config');
@@ -309,10 +309,14 @@ async function init(options) {
309
309
  await labFeaturesService.loadLabFeatures(projectById.id, companyByProjectId.activePlan);
310
310
  }
311
311
 
312
- if (options.lightweightMode && options.lightweightMode.type === 'highSpeed' && !labFeaturesService.isFeatureAvailableForProject('highSpeedMode')) {
312
+ if (options.lightweightMode && options.lightweightMode.type === 'highSpeed' && (!labFeaturesService.isFeatureAvailableForProject('highSpeedMode') || options.company.planType === 'free')) {
313
313
  delete options.lightweightMode;
314
314
  }
315
315
 
316
+ if (options.lightweightMode && options.lightweightMode.type === 'highSpeed') {
317
+ console.log('High-speed mode will ignore step delays. Test artifacts like screenshots and logs will only be saved for failed runs. For more information see our docs: https://help.testim.io/docs/high-speed-mode');
318
+ }
319
+
316
320
  gridService.keepAlive.start(project);
317
321
  analyticsIdentify(project);
318
322
  await setMockNetworkRules(options);
@@ -51,26 +51,31 @@ class BaseStrategy {
51
51
 
52
52
  analyticsTestEnd({
53
53
  executionId, projectId, testId, resultId, result, companyId, companyName, projectName, companyPlanType, sessionType, source, user, lightweightMode,
54
+ logger,
54
55
  }) {
55
- const properties = setLightweightAnalytics({
56
- executionId,
57
- projectId,
58
- testId,
59
- resultId,
60
- companyId,
61
- companyName,
62
- projectName,
63
- companyPlanType,
64
- sessionType,
65
- mockNetworkEnabled: result.wasMockNetworkActivated,
66
- source: calcSource(source, user),
67
- }, lightweightMode);
56
+ try {
57
+ const properties = setLightweightAnalytics({
58
+ executionId,
59
+ projectId,
60
+ testId,
61
+ resultId,
62
+ companyId,
63
+ companyName,
64
+ projectName,
65
+ companyPlanType,
66
+ sessionType,
67
+ mockNetworkEnabled: result.wasMockNetworkActivated,
68
+ source: calcSource(source, user),
69
+ }, lightweightMode);
68
70
 
69
- if (result.success) {
70
- analytics.trackWithCIUser('test-run-ci-success', properties);
71
- return;
71
+ if (result.success) {
72
+ analytics.trackWithCIUser('test-run-ci-success', properties);
73
+ return;
74
+ }
75
+ analytics.trackWithCIUser('test-run-ci-fail', Object.assign({}, properties, { failureReason: result.failureReason }));
76
+ } catch (err) {
77
+ logger.error('failed to update test end analytics', { err });
72
78
  }
73
- analytics.trackWithCIUser('test-run-ci-fail', Object.assign({}, properties, { failureReason: result.failureReason }));
74
79
  }
75
80
 
76
81
  runTests(testList, testStatus, executionId, options, branchToUse, authData, workerCount, stopOnError) {
@@ -95,7 +95,9 @@ class LocalStrategy extends BaseStrategy {
95
95
  });
96
96
  return testStatus.testStartAndReport(wid, executionId, resultId, isRerun, testRetryKey);
97
97
  };
98
- const onTestCompleted = (wid, testId, testResult, sessionId, isRerun) => testStatus.testEndAndReport(wid, testResult, executionId, sessionId, isRerun).then(() => {
98
+ const onTestCompleted = (wid, testId, testResult, sessionId, isRerun) => testStatus.testEndAndReport(wid, testResult, executionId, sessionId, isRerun).catch(err => {
99
+ logger.error('testEndAndReport threw an error', { err });
100
+ }).then(() => {
99
101
  const isLocalRun = Boolean(options.useLocalChromeDriver || options.useChromeLauncher);
100
102
  if (lightweightMode && lightweightMode.disableResults && isLocalRun) {
101
103
  return undefined;
@@ -161,6 +163,7 @@ class LocalStrategy extends BaseStrategy {
161
163
  source,
162
164
  user,
163
165
  lightweightMode,
166
+ logger,
164
167
  });
165
168
  if (stopOnError && !testResult.success) {
166
169
  reject(new StopRunOnError());
@@ -16,7 +16,7 @@ const { getExtensionsUrl } = require('../runOptionsUtils');
16
16
 
17
17
  const logger = require('../commons/logger').getLogger('lambdatestService');
18
18
 
19
- const LT_TUNNEL_BINARY_ORIGIN = 'https://downloads.lambdatest.com/tunnel/alpha';
19
+ const LT_TUNNEL_BINARY_ORIGIN = 'https://downloads.lambdatest.com/tunnel/v3';
20
20
  const LT_TUNNEL_BINARY_PATHNAME = {
21
21
  win32ia32: 'windows/32bit/LT_Windows.zip',
22
22
  win32x64: 'windows/64bit/LT_Windows.zip',
package/testRunHandler.js CHANGED
@@ -518,7 +518,7 @@ TestRun.prototype.onRetry = async function () {
518
518
  this._originalTestResultId = this._originalTestResultId || this._previousTestResultId;
519
519
  this._testResultId = utils.guid();
520
520
 
521
- if (this._options.lightweightMode && this._options.lightweightMode.disableResults) {
521
+ if (this._options.lightweightMode && this._options.lightweightMode.onlyTestIdsNoSuite) {
522
522
  return;
523
523
  }
524
524
 
package/testRunStatus.js CHANGED
@@ -47,7 +47,7 @@ const RunStatus = function (testInfoList, options, testPlanId, branchToUse) {
47
47
  this.executionStartedPromise = Promise.resolve();
48
48
 
49
49
  const browserNames = utils.getUniqBrowsers(options, testInfoList);
50
- const runnerMode = options.lightweightMode ? options.lightweightMode.type : options.mode;
50
+ const runnerMode = options.lightweightMode ? options.lightweightMode.type : options.mode;
51
51
  this.execConfig = {
52
52
  parallel: TESTIM_CONCURRENT_WORKER_COUNT || options.parallel || 1,
53
53
  browser: browserNames,
@@ -153,7 +153,7 @@ RunStatus.prototype.testStart = function (wid, executionId, resultId, isRerun) {
153
153
 
154
154
  RunStatus.prototype.updateTestStatusRunning = function (test, executionId, testRetryKey) {
155
155
  const { project: projectId, remoteRunId, projectData } = this.options;
156
- if (this.options.lightweightMode && this.options.lightweightMode.disableResults) {
156
+ if (this.options.lightweightMode && this.options.lightweightMode.onlyTestIdsNoSuite) {
157
157
  return this.executionStartedPromise;
158
158
  }
159
159
 
@@ -185,9 +185,6 @@ RunStatus.prototype.testStartReport = function (test, executionId, testRetryKey)
185
185
  .then(params => {
186
186
  this.options.runParams[test.resultId] = test.config.testData = Object.assign({}, test.config.testData, this.exportsGlobal, this.fileUserParamsData, this.beforeSuiteParams, params);
187
187
  test.startTime = Date.now();
188
- if (this.options.lightweightMode && this.options.lightweightMode.disableResults) {
189
- return undefined;
190
- }
191
188
  return this.updateTestStatusRunning(test, executionId, testRetryKey);
192
189
  }).catch(err => {
193
190
  logger.error('Failed to start test', { err });
@@ -280,19 +277,25 @@ RunStatus.prototype.testEnd = function (wid, result, executionId, sessionId, isR
280
277
  return test;
281
278
  };
282
279
 
283
- RunStatus.prototype.testEndReport = function (test, executionId, result) {
280
+ RunStatus.prototype.testEndReport = async function (test, executionId, result) {
284
281
  const globalParameters = result.exportsGlobal;
285
- return runHook(this.options.afterTest, Object.assign({}, test, { globalParameters }))
286
- .then(() => {
287
- if (this.options.lightweightMode && this.options.lightweightMode.disableResults) {
288
- return undefined;
289
- }
290
- return servicesApi.updateTestStatus('FINISHED', executionId, test.testId, test.resultId, test.startTime, result.endTime, test.success, test.failureReason, null, this.options.project, this.options.remoteRunId);
291
- })
292
- .catch(err => {
293
- logger.error('Failed to update test finished', { err });
294
- throw err;
295
- });
282
+ try {
283
+ try {
284
+ await runHook(this.options.afterTest, Object.assign({}, test, { globalParameters }));
285
+ } catch (err) {
286
+ logger.error('HOOK threw an error', { test: test.testId, err });
287
+ // eslint-disable-next-line no-console
288
+ console.error('HOOK threw an error', err); // show the customer that his hook failed.
289
+ }
290
+ if (this.options.lightweightMode && this.options.lightweightMode.onlyTestIdsNoSuite) {
291
+ return undefined;
292
+ }
293
+
294
+ return await servicesApi.updateTestStatus('FINISHED', executionId, test.testId, test.resultId, test.startTime, result.endTime, test.success, test.failureReason, null, this.options.project, this.options.remoteRunId, undefined, 5);
295
+ } catch (err) {
296
+ logger.error('Failed to update test finished', { err });
297
+ throw err;
298
+ }
296
299
  };
297
300
 
298
301
  RunStatus.prototype.testEndAndReport = function (wid, result, executionId, sessionId, isRerun) {
@@ -447,7 +450,7 @@ RunStatus.prototype.executionEnd = function (executionId) {
447
450
  .then((coverageSummary) => {
448
451
  resultExtraData.coverageSummary = coverageSummary;
449
452
 
450
- if (this.options.lightweightMode && this.options.lightweightMode.disableResults && this.options.lightweightMode.onlyTestIdsNoSuite) {
453
+ if (this.options.lightweightMode && this.options.lightweightMode.onlyTestIdsNoSuite) {
451
454
  return undefined;
452
455
  }
453
456
  return servicesApi.reportExecutionFinished(