@testim/testim-cli 3.261.0 → 3.263.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 (39) hide show
  1. package/cli.js +11 -5
  2. package/commons/featureFlags.js +1 -0
  3. package/commons/testimServicesApi.js +10 -7
  4. package/executionQueue.js +9 -1
  5. package/npm-shrinkwrap.json +52 -52
  6. package/package.json +1 -1
  7. package/player/stepActions/RefreshStepAction.js +7 -4
  8. package/player/stepActions/baseJsStepAction.js +45 -46
  9. package/player/stepActions/dropFileStepAction.js +11 -12
  10. package/player/stepActions/evaluateExpressionStepAction.js +32 -33
  11. package/player/stepActions/extensionOnlyStepAction.js +3 -4
  12. package/player/stepActions/extractTextStepAction.js +8 -10
  13. package/player/stepActions/hoverStepAction.js +3 -3
  14. package/player/stepActions/locateStepAction.js +39 -34
  15. package/player/stepActions/mouseStepAction.js +36 -34
  16. package/player/stepActions/navigationStepAction.js +7 -8
  17. package/player/stepActions/scrollStepAction.js +22 -22
  18. package/player/stepActions/stepAction.js +21 -21
  19. package/player/stepActions/stepActionRegistrar.js +63 -58
  20. package/player/stepActions/submitStepAction.js +2 -3
  21. package/player/stepActions/textStepAction.js +14 -14
  22. package/player/stepActions/textValidationStepAction.js +50 -38
  23. package/player/stepActions/wheelStepAction.js +5 -11
  24. package/polyfills/Array.prototype.at.js +13 -0
  25. package/polyfills/index.js +1 -0
  26. package/processHandler.js +2 -0
  27. package/reports/junitReporter.js +18 -1
  28. package/runOptions.d.ts +4 -0
  29. package/runOptions.js +8 -1
  30. package/runner.js +7 -0
  31. package/runners/TestPlanRunner.js +20 -19
  32. package/runners/runnerUtils.js +1 -2
  33. package/testRunHandler.js +18 -9
  34. package/testRunStatus.js +209 -157
  35. package/utils/index.js +9 -2
  36. package/workers/BaseWorker.js +11 -0
  37. package/workers/WorkerExtension.js +117 -91
  38. package/workers/WorkerSelenium.js +8 -3
  39. package/player/stepActions/scripts/polyfills.js +0 -393
package/cli.js CHANGED
@@ -3,6 +3,7 @@
3
3
 
4
4
  'use strict';
5
5
 
6
+ require('./polyfills');
6
7
  require('./bluebirdConfig.js');
7
8
  const options = require('./runOptions');
8
9
  const EventEmitter = require('events');
@@ -35,16 +36,21 @@ async function checkNodeVersion() {
35
36
  throw new ArgError(`Required node version ${version} not satisfied with current version ${process.version}`);
36
37
  }
37
38
 
38
- const minimalNodeVersion = 16;
39
+ const currentMinimalNodeVersion = 14;
40
+ const nextMinimalNodeVersion = 16;
39
41
  const majorVersion = Number(process.versions.node.split('.')[0]);
40
42
  const dateHasPassed = new Date('2023-04-30T00:00:00.000Z') <= new Date();
41
43
 
42
- if (majorVersion < minimalNodeVersion && dateHasPassed) {
43
- throw new ArgError(`Testim.io CLI supports Node.js ${minimalNodeVersion} and above, please upgrade to a newer Node.js version`);
44
+ if (majorVersion < currentMinimalNodeVersion) {
45
+ throw new ArgError(`Testim.io CLI supports Node.js ${currentMinimalNodeVersion} and above, please upgrade to a newer Node.js version`);
44
46
  }
45
47
 
46
- if (majorVersion < minimalNodeVersion) {
47
- console.log('\x1b[33m%s\x1b[0m', `Testim.io CLI will stop supporting Node.js < ${minimalNodeVersion} on April 30 2023, please upgrade to a newer Node.js version`);
48
+ if (majorVersion < nextMinimalNodeVersion && dateHasPassed) {
49
+ throw new ArgError(`Testim.io CLI supports Node.js ${nextMinimalNodeVersion} and above, please upgrade to a newer Node.js version`);
50
+ }
51
+
52
+ if (majorVersion < nextMinimalNodeVersion) {
53
+ console.log('\x1b[33m%s\x1b[0m', `Testim.io CLI will stop supporting Node.js < ${nextMinimalNodeVersion} on April 30 2023, please upgrade to a newer Node.js version`);
48
54
  }
49
55
  }
50
56
 
@@ -63,6 +63,7 @@ class FeatureFlagsService {
63
63
  enableWorkerThreadsCliCodeExecution: new Rox.Flag(true),
64
64
  LTNetworkCapabilities: new Rox.Flag(),
65
65
  downloadToBase64: new Rox.Flag(),
66
+ dec2022eolBrowsers: new Rox.Flag(),
66
67
  };
67
68
  Rox.register('default', this.flags);
68
69
  }
@@ -183,6 +183,14 @@ function reportExecutionFinished(status, executionId, projectId, success, tmsOpt
183
183
  }), { retries: DEFAULT_REQUEST_RETRY });
184
184
  }
185
185
 
186
+ /**
187
+ * @param {string} projectId
188
+ * @param {string[]} names
189
+ * @param {string[]} planIds
190
+ * @param {string} branch
191
+ * @param {import('../runOptions').RunnerOptions['intersections']} intersections
192
+ * @returns {ReturnType<import('services/src/test-plan/service')['testPlan']['getTestPlanTestList']>}
193
+ */
186
194
  async function getTestPlanTestList(projectId, names, planIds, branch, intersections) {
187
195
  return pRetry(() => postAuth({
188
196
  url: '/testPlan/list',
@@ -206,12 +214,7 @@ async function getTestPlanTestList(projectId, names, planIds, branch, intersecti
206
214
  * testConfigIds?: string[];
207
215
  * intersections: import('../runOptions').RunnerOptions['intersections'];
208
216
  * }} param0
209
- * @returns {globalThis.Promise<{
210
- * tests: any[][];
211
- * branch?: string;
212
- * runName?: string;
213
- * runExists?: boolean;
214
- * }>}
217
+ * @returns {import('services/src/suite/service').RunListResult}
215
218
  */
216
219
  function getSuiteTestList({
217
220
  projectId, labels, testIds, testNames, testConfigNames, suiteNames, suiteIds, branch, rerunFailedByRunId, testConfigIds, intersections,
@@ -247,7 +250,7 @@ function isTestResultCompleted(resultId, projectId, testRetryKey) {
247
250
  }
248
251
 
249
252
  function getTestResults(testId, resultId, projectId, branch) {
250
- return pRetry(() => getWithAuth(`/test/v2/${testId}/result/${resultId}`, { projectId, branch }), { retries: DEFAULT_REQUEST_RETRY });
253
+ return pRetry(() => getWithAuth(`/test/v2/${testId}/result/${resultId}`, { projectId, branch }), { retries: DEFAULT_REQUEST_RETRY, factor: 1 });
251
254
  }
252
255
 
253
256
  function keepAliveGrid(projectId, slots) {
package/executionQueue.js CHANGED
@@ -1,8 +1,16 @@
1
1
  'use strict';
2
2
 
3
- const TestRun = require('./testRunHandler.js');
3
+ const TestRun = require('./testRunHandler');
4
4
 
5
5
  class ExecutionQueue {
6
+ /**
7
+ * @param {string} executionId
8
+ * @param {string} executionName
9
+ * @param {any[]} testList
10
+ * @param {import('./runOptions').RunnerOptions} options
11
+ * @param {string} branchToUse
12
+ * @param {import('./testRunStatus')} testRunStatus
13
+ */
6
14
  constructor(executionId, executionName, testList, options, branchToUse, testStatus) {
7
15
  this._waitingTests = testList.map(testInfo => new TestRun(executionId, executionName, testInfo, options, branchToUse, testStatus));
8
16
  }
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "@testim/testim-cli",
3
- "version": "3.261.0",
3
+ "version": "3.263.0",
4
4
  "lockfileVersion": 2,
5
5
  "requires": true,
6
6
  "packages": {
7
7
  "": {
8
8
  "name": "@testim/testim-cli",
9
- "version": "3.261.0",
9
+ "version": "3.263.0",
10
10
  "license": "Proprietary",
11
11
  "dependencies": {
12
12
  "@applitools/eyes-sdk-core": "13.6.23",
@@ -559,11 +559,11 @@
559
559
  }
560
560
  },
561
561
  "node_modules/@babel/runtime": {
562
- "version": "7.20.1",
563
- "resolved": "https://registry.npmjs.org/@babel/runtime/-/runtime-7.20.1.tgz",
564
- "integrity": "sha512-mrzLkl6U9YLF8qpqI7TB82PESyEGjm/0Ly91jG575eVxMMlb8fYfOXFZIJ8XfLrJZQbm7dlKry2bJmXBUEkdFg==",
562
+ "version": "7.20.6",
563
+ "resolved": "https://registry.npmjs.org/@babel/runtime/-/runtime-7.20.6.tgz",
564
+ "integrity": "sha512-Q+8MqP7TiHMWzSfwiJwXCjyf4GYA4Dgw3emg/7xmwsdLJOZUp+nMqcOwOzzYheuM1rhDu8FSj2l0aoMygEuXuA==",
565
565
  "dependencies": {
566
- "regenerator-runtime": "^0.13.10"
566
+ "regenerator-runtime": "^0.13.11"
567
567
  },
568
568
  "engines": {
569
569
  "node": ">=6.9.0"
@@ -1064,9 +1064,9 @@
1064
1064
  }
1065
1065
  },
1066
1066
  "node_modules/@sinonjs/commons": {
1067
- "version": "1.8.5",
1068
- "resolved": "https://registry.npmjs.org/@sinonjs/commons/-/commons-1.8.5.tgz",
1069
- "integrity": "sha512-rTpCA0wG1wUxglBSFdMMY0oTrKYvgf4fNgv/sXbfCVAdf+FnPBdKJR/7XbpTCwbCrvCbdPYnlWaUUYz4V2fPDA==",
1067
+ "version": "1.8.6",
1068
+ "resolved": "https://registry.npmjs.org/@sinonjs/commons/-/commons-1.8.6.tgz",
1069
+ "integrity": "sha512-Ky+XkAkqPZSm3NLBeUng77EBQl3cmeJhITaGHdYH8kjVB+aun3S4XBRti2zt17mtt0mIUDiNxYeoJm6drVvBJQ==",
1070
1070
  "dev": true,
1071
1071
  "dependencies": {
1072
1072
  "type-detect": "4.0.8"
@@ -1511,9 +1511,9 @@
1511
1511
  }
1512
1512
  },
1513
1513
  "node_modules/@wdio/config/node_modules/minimatch": {
1514
- "version": "5.1.0",
1515
- "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-5.1.0.tgz",
1516
- "integrity": "sha512-9TPBGGak4nHfGZsPBohm9AWg6NoT7QTCehS3BIJABslyZbzxfV78QM2Y6+i741OPZIafFAaiiEMh5OyIrJPgtg==",
1514
+ "version": "5.1.1",
1515
+ "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-5.1.1.tgz",
1516
+ "integrity": "sha512-362NP+zlprccbEt/SkxKfRMHnNY85V74mVnpUpNyr3F35covl09Kec7/sEFLt3RA4oXmewtoaanoIf67SE5Y5g==",
1517
1517
  "dependencies": {
1518
1518
  "brace-expansion": "^2.0.1"
1519
1519
  },
@@ -5567,9 +5567,9 @@
5567
5567
  }
5568
5568
  },
5569
5569
  "node_modules/filelist/node_modules/minimatch": {
5570
- "version": "5.1.0",
5571
- "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-5.1.0.tgz",
5572
- "integrity": "sha512-9TPBGGak4nHfGZsPBohm9AWg6NoT7QTCehS3BIJABslyZbzxfV78QM2Y6+i741OPZIafFAaiiEMh5OyIrJPgtg==",
5570
+ "version": "5.1.1",
5571
+ "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-5.1.1.tgz",
5572
+ "integrity": "sha512-362NP+zlprccbEt/SkxKfRMHnNY85V74mVnpUpNyr3F35covl09Kec7/sEFLt3RA4oXmewtoaanoIf67SE5Y5g==",
5573
5573
  "dependencies": {
5574
5574
  "brace-expansion": "^2.0.1"
5575
5575
  },
@@ -7797,9 +7797,9 @@
7797
7797
  }
7798
7798
  },
7799
7799
  "node_modules/js-beautify/node_modules/minimatch": {
7800
- "version": "5.1.0",
7801
- "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-5.1.0.tgz",
7802
- "integrity": "sha512-9TPBGGak4nHfGZsPBohm9AWg6NoT7QTCehS3BIJABslyZbzxfV78QM2Y6+i741OPZIafFAaiiEMh5OyIrJPgtg==",
7800
+ "version": "5.1.1",
7801
+ "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-5.1.1.tgz",
7802
+ "integrity": "sha512-362NP+zlprccbEt/SkxKfRMHnNY85V74mVnpUpNyr3F35covl09Kec7/sEFLt3RA4oXmewtoaanoIf67SE5Y5g==",
7803
7803
  "dev": true,
7804
7804
  "dependencies": {
7805
7805
  "brace-expansion": "^2.0.1"
@@ -12959,9 +12959,9 @@
12959
12959
  }
12960
12960
  },
12961
12961
  "node_modules/readdir-glob/node_modules/minimatch": {
12962
- "version": "5.1.0",
12963
- "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-5.1.0.tgz",
12964
- "integrity": "sha512-9TPBGGak4nHfGZsPBohm9AWg6NoT7QTCehS3BIJABslyZbzxfV78QM2Y6+i741OPZIafFAaiiEMh5OyIrJPgtg==",
12962
+ "version": "5.1.1",
12963
+ "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-5.1.1.tgz",
12964
+ "integrity": "sha512-362NP+zlprccbEt/SkxKfRMHnNY85V74mVnpUpNyr3F35covl09Kec7/sEFLt3RA4oXmewtoaanoIf67SE5Y5g==",
12965
12965
  "dependencies": {
12966
12966
  "brace-expansion": "^2.0.1"
12967
12967
  },
@@ -15572,9 +15572,9 @@
15572
15572
  }
15573
15573
  },
15574
15574
  "node_modules/vm2": {
15575
- "version": "3.9.11",
15576
- "resolved": "https://registry.npmjs.org/vm2/-/vm2-3.9.11.tgz",
15577
- "integrity": "sha512-PFG8iJRSjvvBdisowQ7iVF580DXb1uCIiGaXgm7tynMR1uTBlv7UJlB1zdv5KJ+Tmq1f0Upnj3fayoEOPpCBKg==",
15575
+ "version": "3.9.12",
15576
+ "resolved": "https://registry.npmjs.org/vm2/-/vm2-3.9.12.tgz",
15577
+ "integrity": "sha512-OMmRsKh1gmdosFzuqmj6O43hqIStqXA24YbwjtUTO0TkOBP8yLNHLplbr4odnAzEcMnm9lt2r3R8kTivn8urMg==",
15578
15578
  "dependencies": {
15579
15579
  "acorn": "^8.7.0",
15580
15580
  "acorn-walk": "^8.2.0"
@@ -15702,9 +15702,9 @@
15702
15702
  }
15703
15703
  },
15704
15704
  "node_modules/webdriverio/node_modules/minimatch": {
15705
- "version": "5.1.0",
15706
- "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-5.1.0.tgz",
15707
- "integrity": "sha512-9TPBGGak4nHfGZsPBohm9AWg6NoT7QTCehS3BIJABslyZbzxfV78QM2Y6+i741OPZIafFAaiiEMh5OyIrJPgtg==",
15705
+ "version": "5.1.1",
15706
+ "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-5.1.1.tgz",
15707
+ "integrity": "sha512-362NP+zlprccbEt/SkxKfRMHnNY85V74mVnpUpNyr3F35covl09Kec7/sEFLt3RA4oXmewtoaanoIf67SE5Y5g==",
15708
15708
  "dependencies": {
15709
15709
  "brace-expansion": "^2.0.1"
15710
15710
  },
@@ -16582,11 +16582,11 @@
16582
16582
  }
16583
16583
  },
16584
16584
  "@babel/runtime": {
16585
- "version": "7.20.1",
16586
- "resolved": "https://registry.npmjs.org/@babel/runtime/-/runtime-7.20.1.tgz",
16587
- "integrity": "sha512-mrzLkl6U9YLF8qpqI7TB82PESyEGjm/0Ly91jG575eVxMMlb8fYfOXFZIJ8XfLrJZQbm7dlKry2bJmXBUEkdFg==",
16585
+ "version": "7.20.6",
16586
+ "resolved": "https://registry.npmjs.org/@babel/runtime/-/runtime-7.20.6.tgz",
16587
+ "integrity": "sha512-Q+8MqP7TiHMWzSfwiJwXCjyf4GYA4Dgw3emg/7xmwsdLJOZUp+nMqcOwOzzYheuM1rhDu8FSj2l0aoMygEuXuA==",
16588
16588
  "requires": {
16589
- "regenerator-runtime": "^0.13.10"
16589
+ "regenerator-runtime": "^0.13.11"
16590
16590
  }
16591
16591
  },
16592
16592
  "@colors/colors": {
@@ -16965,9 +16965,9 @@
16965
16965
  "integrity": "sha512-t09vSN3MdfsyCHoFcTRCH/iUtG7OJ0CsjzB8cjAmKc/va/kIgeDI/TxsigdncE/4be734m0cvIYwNaV4i2XqAw=="
16966
16966
  },
16967
16967
  "@sinonjs/commons": {
16968
- "version": "1.8.5",
16969
- "resolved": "https://registry.npmjs.org/@sinonjs/commons/-/commons-1.8.5.tgz",
16970
- "integrity": "sha512-rTpCA0wG1wUxglBSFdMMY0oTrKYvgf4fNgv/sXbfCVAdf+FnPBdKJR/7XbpTCwbCrvCbdPYnlWaUUYz4V2fPDA==",
16968
+ "version": "1.8.6",
16969
+ "resolved": "https://registry.npmjs.org/@sinonjs/commons/-/commons-1.8.6.tgz",
16970
+ "integrity": "sha512-Ky+XkAkqPZSm3NLBeUng77EBQl3cmeJhITaGHdYH8kjVB+aun3S4XBRti2zt17mtt0mIUDiNxYeoJm6drVvBJQ==",
16971
16971
  "dev": true,
16972
16972
  "requires": {
16973
16973
  "type-detect": "4.0.8"
@@ -17362,9 +17362,9 @@
17362
17362
  }
17363
17363
  },
17364
17364
  "minimatch": {
17365
- "version": "5.1.0",
17366
- "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-5.1.0.tgz",
17367
- "integrity": "sha512-9TPBGGak4nHfGZsPBohm9AWg6NoT7QTCehS3BIJABslyZbzxfV78QM2Y6+i741OPZIafFAaiiEMh5OyIrJPgtg==",
17365
+ "version": "5.1.1",
17366
+ "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-5.1.1.tgz",
17367
+ "integrity": "sha512-362NP+zlprccbEt/SkxKfRMHnNY85V74mVnpUpNyr3F35covl09Kec7/sEFLt3RA4oXmewtoaanoIf67SE5Y5g==",
17368
17368
  "requires": {
17369
17369
  "brace-expansion": "^2.0.1"
17370
17370
  }
@@ -20606,9 +20606,9 @@
20606
20606
  }
20607
20607
  },
20608
20608
  "minimatch": {
20609
- "version": "5.1.0",
20610
- "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-5.1.0.tgz",
20611
- "integrity": "sha512-9TPBGGak4nHfGZsPBohm9AWg6NoT7QTCehS3BIJABslyZbzxfV78QM2Y6+i741OPZIafFAaiiEMh5OyIrJPgtg==",
20609
+ "version": "5.1.1",
20610
+ "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-5.1.1.tgz",
20611
+ "integrity": "sha512-362NP+zlprccbEt/SkxKfRMHnNY85V74mVnpUpNyr3F35covl09Kec7/sEFLt3RA4oXmewtoaanoIf67SE5Y5g==",
20612
20612
  "requires": {
20613
20613
  "brace-expansion": "^2.0.1"
20614
20614
  }
@@ -22334,9 +22334,9 @@
22334
22334
  }
22335
22335
  },
22336
22336
  "minimatch": {
22337
- "version": "5.1.0",
22338
- "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-5.1.0.tgz",
22339
- "integrity": "sha512-9TPBGGak4nHfGZsPBohm9AWg6NoT7QTCehS3BIJABslyZbzxfV78QM2Y6+i741OPZIafFAaiiEMh5OyIrJPgtg==",
22337
+ "version": "5.1.1",
22338
+ "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-5.1.1.tgz",
22339
+ "integrity": "sha512-362NP+zlprccbEt/SkxKfRMHnNY85V74mVnpUpNyr3F35covl09Kec7/sEFLt3RA4oXmewtoaanoIf67SE5Y5g==",
22340
22340
  "dev": true,
22341
22341
  "requires": {
22342
22342
  "brace-expansion": "^2.0.1"
@@ -26173,9 +26173,9 @@
26173
26173
  }
26174
26174
  },
26175
26175
  "minimatch": {
26176
- "version": "5.1.0",
26177
- "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-5.1.0.tgz",
26178
- "integrity": "sha512-9TPBGGak4nHfGZsPBohm9AWg6NoT7QTCehS3BIJABslyZbzxfV78QM2Y6+i741OPZIafFAaiiEMh5OyIrJPgtg==",
26176
+ "version": "5.1.1",
26177
+ "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-5.1.1.tgz",
26178
+ "integrity": "sha512-362NP+zlprccbEt/SkxKfRMHnNY85V74mVnpUpNyr3F35covl09Kec7/sEFLt3RA4oXmewtoaanoIf67SE5Y5g==",
26179
26179
  "requires": {
26180
26180
  "brace-expansion": "^2.0.1"
26181
26181
  }
@@ -28316,9 +28316,9 @@
28316
28316
  }
28317
28317
  },
28318
28318
  "vm2": {
28319
- "version": "3.9.11",
28320
- "resolved": "https://registry.npmjs.org/vm2/-/vm2-3.9.11.tgz",
28321
- "integrity": "sha512-PFG8iJRSjvvBdisowQ7iVF580DXb1uCIiGaXgm7tynMR1uTBlv7UJlB1zdv5KJ+Tmq1f0Upnj3fayoEOPpCBKg==",
28319
+ "version": "3.9.12",
28320
+ "resolved": "https://registry.npmjs.org/vm2/-/vm2-3.9.12.tgz",
28321
+ "integrity": "sha512-OMmRsKh1gmdosFzuqmj6O43hqIStqXA24YbwjtUTO0TkOBP8yLNHLplbr4odnAzEcMnm9lt2r3R8kTivn8urMg==",
28322
28322
  "requires": {
28323
28323
  "acorn": "^8.7.0",
28324
28324
  "acorn-walk": "^8.2.0"
@@ -28431,9 +28431,9 @@
28431
28431
  }
28432
28432
  },
28433
28433
  "minimatch": {
28434
- "version": "5.1.0",
28435
- "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-5.1.0.tgz",
28436
- "integrity": "sha512-9TPBGGak4nHfGZsPBohm9AWg6NoT7QTCehS3BIJABslyZbzxfV78QM2Y6+i741OPZIafFAaiiEMh5OyIrJPgtg==",
28434
+ "version": "5.1.1",
28435
+ "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-5.1.1.tgz",
28436
+ "integrity": "sha512-362NP+zlprccbEt/SkxKfRMHnNY85V74mVnpUpNyr3F35covl09Kec7/sEFLt3RA4oXmewtoaanoIf67SE5Y5g==",
28437
28437
  "requires": {
28438
28438
  "brace-expansion": "^2.0.1"
28439
28439
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@testim/testim-cli",
3
- "version": "3.261.0",
3
+ "version": "3.263.0",
4
4
  "description": "Command line interface for running Testing on your CI",
5
5
  "author": "Oren Rubin",
6
6
  "contributors": [{
@@ -4,10 +4,13 @@ const StepAction = require('./stepAction');
4
4
  require('bluebird');
5
5
 
6
6
  class RefreshStepAction extends StepAction {
7
- execute() {
8
- return this.driver.reloadTab()
9
- .then(() => ({ success: true }))
10
- .catch(error => ({ success: false, reason: error.message }));
7
+ async execute() {
8
+ try {
9
+ await this.driver.reloadTab();
10
+ return { success: true };
11
+ } catch (error) {
12
+ return { success: false, reason: error.message };
13
+ }
11
14
  }
12
15
  }
13
16
 
@@ -15,6 +15,7 @@ const constants = commonConstants.stepResult;
15
15
  const logger = require('../../commons/logger').getLogger('base-js-step-action');
16
16
 
17
17
  const _ = require('lodash');
18
+ const utils = require('../../utils');
18
19
 
19
20
  function constructWithArguments(constructor, args) {
20
21
  function F() {
@@ -98,46 +99,43 @@ class BaseJsStepAction extends StepAction {
98
99
  const that = this;
99
100
  const retryInterval = that.context.config.retryTimeout;
100
101
  let timeToPlayStep = that.context.data.timeToPlayStep - retryInterval;
101
- return new Promise(resolve => {
102
- function checkScriptStatus() {
103
- return that.executeGetStatus(transactionId)
104
- .catch(err => {
105
- logger.warn('failed to get js status', { err });
106
- return { value: { status: 'exception' } };
107
- })
108
- .then(selRes => {
109
- let res;
110
- try {
111
- res = JSON.parse(selRes ? selRes.value : '{}');
112
- } catch (e) {
113
- logger.warn('non object value', { selRes });
114
- res = { status: 'exception' };
115
- }
116
- const abortReason = that.stepActionUtils.abortedSteps.find(abortedStep => abortedStep.id === that.step.id);
117
- if (abortReason) {
118
- return resolve(abortReason);
119
- }
120
- if (!res) {
121
- return resolve({ success: true });
122
- }
123
- if (res.status && res.status === 'done') {
124
- return resolve(res);
125
- }
126
- if (res.status && res.status === 'failed') {
127
- return resolve({ success: false, shouldRetry: true, result: res.result });
128
- }
129
- if (timeToPlayStep - retryInterval > 0) {
130
- timeToPlayStep -= retryInterval;
131
- setTimeout(checkScriptStatus, retryInterval);
132
- } else {
133
- return resolve(Object.assign({}, res, { success: false, shouldRetry: true }));
134
- }
135
- return undefined;
136
- });
102
+ async function checkScriptStatus() {
103
+ let selRes;
104
+ try {
105
+ selRes = await that.executeGetStatus(transactionId);
106
+ } catch (err) {
107
+ logger.warn('failed to get js status', { err });
108
+ selRes = { value: { status: 'exception' } };
109
+ }
110
+ let res;
111
+ try {
112
+ res = JSON.parse(selRes ? selRes.value : '{}');
113
+ } catch (e) {
114
+ logger.warn('non object value', { selRes });
115
+ res = { status: 'exception' };
116
+ }
117
+ const abortReason = that.stepActionUtils.abortedSteps.find(abortedStep => abortedStep.id === that.step.id);
118
+ if (abortReason) {
119
+ return abortReason;
120
+ }
121
+ if (!res) {
122
+ return { success: true };
123
+ }
124
+ if (res.status && res.status === 'done') {
125
+ return res;
137
126
  }
127
+ if (res.status && res.status === 'failed') {
128
+ return { success: false, shouldRetry: true, result: res.result };
129
+ }
130
+ if (timeToPlayStep - retryInterval <= 0) {
131
+ return Object.assign(res, { success: false, shouldRetry: true });
132
+ }
133
+ timeToPlayStep -= retryInterval;
134
+ await utils.delay(retryInterval);
135
+ return checkScriptStatus();
136
+ }
138
137
 
139
- checkScriptStatus();
140
- });
138
+ return checkScriptStatus();
141
139
  }
142
140
 
143
141
  executeInAut(eventMessage) {
@@ -241,7 +239,7 @@ class BaseJsStepAction extends StepAction {
241
239
  return resp?.success ? this.codeExecDone(resp) : this.codeExecFailed(resp);
242
240
  }
243
241
 
244
- performAction() {
242
+ async performAction() {
245
243
  const step = this.step;
246
244
  const context = this.context;
247
245
 
@@ -262,14 +260,15 @@ class BaseJsStepAction extends StepAction {
262
260
  testResultId: context.testResultId,
263
261
  };
264
262
 
263
+ const browserAndOS = await this.driver.getBrowserAndOS();
264
+ Object.assign(eventMessage, { browser: browserAndOS.browser, browserMajor: browserAndOS.browserMajor });
265
+
266
+ if (!this.context.isPendingPromise) {
267
+ await this.executeInAut(eventMessage);
268
+ }
265
269
 
266
- return this.driver.getBrowserAndOS()
267
- .then(browserAndOS => {
268
- Object.assign(eventMessage, { browser: browserAndOS.browser, browserMajor: browserAndOS.browserMajor });
269
- return this.context.isPendingPromise ? undefined : this.executeInAut(eventMessage);
270
- })
271
- .then(() => this.checkStatus(eventMessage.transactionId))
272
- .then(resp => this.checkCodeResponse(resp));
270
+ const resp = await this.checkStatus(eventMessage.transactionId);
271
+ return await this.checkCodeResponse(resp);
273
272
  }
274
273
 
275
274
  handleExecutionError(err) {
@@ -8,26 +8,25 @@ const { codeSnippets, utils } = require('../../commons/getSessionPlayerRequire')
8
8
  const featureFlagService = require('../../commons/featureFlags');
9
9
 
10
10
  class DropFileStepAction extends StepAction {
11
- performAction() {
11
+ async performAction() {
12
12
  const target = this.context.data[this.step.targetId || 'targetId'];
13
13
  const overrideAzureStorageUrl = featureFlagService.flags.overrideAzureStorageUrl.isEnabled();
14
- //TODO remove if after release session player
15
- return (utils.addTokenToFileUrl ? utils.addTokenToFileUrl(
14
+ const fileUrls = await utils.addTokenToFileUrl(
16
15
  this.context.project.id,
17
16
  this.step.fileUrls,
18
17
  this.stepActionUtils.testimServicesApi,
19
18
  overrideAzureStorageUrl,
20
19
  logger,
21
- ) : Promise.resolve(this.step.fileUrls)).then((fileUrls) => {
22
- const dropFileCode = `
23
- var getLocatedElement = ${codeSnippets.getLocatedElementCode};
24
- var createDropEvent = ${(codeSnippets.createDropEvent ? codeSnippets.createDropEvent : createDropEventLegacy).toString()};
25
- var downloadFileAndFireDropEvent = ${downloadFileAndFireDropEvent.toString()};
26
- return downloadFileAndFireDropEvent.apply(null, arguments)
27
- `;
20
+ );
28
21
 
29
- return this.driver.executeJSWithArray(dropFileCode, [target.locatedElement, fileUrls]).then(() => {});
30
- });
22
+ const dropFileCode = `
23
+ var getLocatedElement = ${codeSnippets.getLocatedElementCode};
24
+ var createDropEvent = ${(codeSnippets.createDropEvent ? codeSnippets.createDropEvent : createDropEventLegacy).toString()};
25
+ var downloadFileAndFireDropEvent = ${downloadFileAndFireDropEvent.toString()};
26
+ return downloadFileAndFireDropEvent.apply(null, arguments)
27
+ `;
28
+
29
+ return await this.driver.executeJSWithArray(dropFileCode, [target.locatedElement, fileUrls]);
31
30
  }
32
31
  }
33
32
 
@@ -1,6 +1,5 @@
1
1
  'use strict';
2
2
 
3
- const Promise = require('bluebird');
4
3
  const sessionPlayer = require('../../commons/getSessionPlayerRequire');
5
4
  const StepAction = require('./stepAction');
6
5
 
@@ -10,44 +9,44 @@ const logger = require('../../commons/logger').getLogger('evaluate-expression-st
10
9
  const _ = require('lodash');
11
10
 
12
11
  class EvaluateExpressionStepAction extends StepAction {
13
- execute() {
12
+ async execute() {
14
13
  const step = this.step;
15
14
  const context = this.context;
16
15
  const exportsGlobal = this.exportsGlobal;
17
16
  const exportsTest = this.exportsTest;
18
17
 
19
- return new Promise((resolve, reject) => {
20
- try {
21
- logger.info('runner running incoming params evaluation');
22
- let incomingParams = context.incomingParams || {};
23
- if (_.isEmpty(incomingParams)) {
24
- incomingParams = stepParamBuilder.getStepInputs(step, context, exportsGlobal, exportsTest);
25
- }
26
-
27
- const params = ['context', ...incomingParams.as.functionParameters];
28
- const args = [context, ...incomingParams.as.functionArguments];
29
- const expressionToEvaluate = step.subType === 'text' ? `'${step.expression.replace(/'/g, "\\\'")}'` : step.expression;
30
- const code = (`return ${expressionToEvaluate}`).replace(/\n/g, '\\n');
31
- const textEvaluateFunction = Function.apply(Function, params.concat([code]));
32
- const evaluatedText = textEvaluateFunction.apply(null, args);
33
-
34
- context.data[step.targetName] = evaluatedText;
35
- context.data[step.targetId] = evaluatedText;
36
- if (context.internalParams) {
37
- context.internalParams.add(step.targetId);
38
- }
39
-
40
- const result = {
41
- success: true,
42
- evaluatedText,
43
- data: context.data,
44
- };
45
-
46
- resolve(result);
47
- } catch (e) {
48
- reject({ errorType: constants.EVALUATE_EXPRESSION_EXCEPTION, resultInfo: { exception: e.toString() }, success: false });
18
+ try {
19
+ logger.info('runner running incoming params evaluation');
20
+ let incomingParams = context.incomingParams || {};
21
+ if (_.isEmpty(incomingParams)) {
22
+ incomingParams = stepParamBuilder.getStepInputs(step, context, exportsGlobal, exportsTest);
49
23
  }
50
- });
24
+
25
+ const params = ['context', ...incomingParams.as.functionParameters];
26
+ const args = [context, ...incomingParams.as.functionArguments];
27
+ const expressionToEvaluate = step.subType === 'text' ? `'${step.expression.replace(/'/g, "\\\'")}'` : step.expression;
28
+ const code = `return ${expressionToEvaluate}`.replace(/\n/g, '\\n');
29
+ const textEvaluateFunction = Function.apply(Function, params.concat([code]));
30
+ const evaluatedText = textEvaluateFunction.apply(null, args);
31
+
32
+ context.data[step.targetName] = evaluatedText;
33
+ context.data[step.targetId] = evaluatedText;
34
+ if (context.internalParams) {
35
+ context.internalParams.add(step.targetId);
36
+ }
37
+
38
+ const result = {
39
+ success: true,
40
+ evaluatedText,
41
+ data: context.data,
42
+ };
43
+
44
+ return result;
45
+ } catch (e) {
46
+ // TODO: Fix throwing non-error
47
+ // eslint-disable-next-line no-throw-literal
48
+ throw { errorType: constants.EVALUATE_EXPRESSION_EXCEPTION, resultInfo: { exception: e.toString() }, success: false };
49
+ }
51
50
  }
52
51
  }
53
52
 
@@ -1,12 +1,11 @@
1
1
  const StepAction = require('./stepAction');
2
- const Promise = require('bluebird');
3
2
 
4
3
  class ExtensionOnlyStepAction extends StepAction {
5
- performAction() {
6
- return Promise.resolve({
4
+ async performAction() {
5
+ return {
7
6
  success: 'skipped',
8
7
  reason: 'This step can run only on Chrome',
9
- });
8
+ };
10
9
  }
11
10
  }
12
11
 
@@ -3,18 +3,16 @@
3
3
  const StepAction = require('./stepAction');
4
4
 
5
5
  class ExtractTextStepAction extends StepAction {
6
- performAction() {
6
+ async performAction() {
7
7
  const paramName = this.step.extractTextParamName;
8
8
 
9
- return this.stepActionUtils.extractTargetText(this.getTarget())
10
- .then(extractedText => {
11
- this.context.data.exports = this.context.data.exports || {};
12
- this.context.data.exports[paramName] = extractedText;
13
- return {
14
- success: true,
15
- data: this.context.data,
16
- };
17
- });
9
+ const extractedText = await this.stepActionUtils.extractTargetText(this.getTarget());
10
+ this.context.data.exports = this.context.data.exports || {};
11
+ this.context.data.exports[paramName] = extractedText;
12
+ return {
13
+ success: true,
14
+ data: this.context.data,
15
+ };
18
16
  }
19
17
  }
20
18