@testim/testim-cli 3.195.0 → 3.199.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 (70) hide show
  1. package/README.md +1 -1
  2. package/cli/onExit.js +12 -1
  3. package/cli.js +5 -1
  4. package/commons/constants.js +0 -25
  5. package/commons/featureFlags.js +2 -0
  6. package/commons/npmWrapper.js +46 -14
  7. package/commons/npmWrapper.test.js +182 -6
  8. package/commons/socket/testResultService.js +4 -14
  9. package/commons/testimAnalytics.js +0 -1
  10. package/commons/testimDesiredCapabilitiesBuilder.js +0 -94
  11. package/commons/testimServicesApi.js +9 -79
  12. package/executionQueue.js +7 -4
  13. package/npm-shrinkwrap.json +962 -526
  14. package/package.json +3 -1
  15. package/player/stepActions/baseJsStepAction.js +5 -1
  16. package/player/stepActions/pixelValidationStepAction.js +28 -0
  17. package/player/stepActions/salesforceApexActionStepAction.js +9 -0
  18. package/player/stepActions/salesforceAutoLoginStepAction.js +5 -3
  19. package/player/stepActions/stepActionRegistrar.js +6 -48
  20. package/player/utils/eyeSdkService.js +230 -0
  21. package/reports/consoleReporter.js +29 -44
  22. package/reports/reporter.js +0 -21
  23. package/runOptions.js +13 -89
  24. package/runner.js +3 -44
  25. package/runners/{strategies/LocalStrategy.js → ParallelWorkerManager.js} +59 -68
  26. package/runners/TestPlanRunner.js +292 -67
  27. package/runners/runnerUtils.js +73 -0
  28. package/services/analyticsService.js +94 -0
  29. package/services/gridService.js +24 -16
  30. package/services/gridService.test.js +21 -21
  31. package/services/lambdatestService.js +1 -1
  32. package/testRunHandler.js +23 -2
  33. package/testRunStatus.js +17 -13
  34. package/utils.js +5 -5
  35. package/workers/BaseWorker.js +39 -39
  36. package/workers/BaseWorker.test.js +1 -1
  37. package/workers/WorkerExtensionSingleBrowser.js +6 -3
  38. package/commons/apkUploader/apkUploader.js +0 -46
  39. package/commons/apkUploader/apkUploaderFactory.js +0 -68
  40. package/commons/apkUploader/deviceFarmApkUploader.js +0 -41
  41. package/commons/apkUploader/saucelabsApkUploader.js +0 -36
  42. package/commons/apkUploader/testObjectApkUploader.js +0 -34
  43. package/player/mobile/mobileTestPlayer.js +0 -80
  44. package/player/mobile/mobileWebDriver.js +0 -155
  45. package/player/mobile/services/frameLocatorMock.js +0 -18
  46. package/player/mobile/services/mobilePortSelector.js +0 -22
  47. package/player/mobile/services/mobileTabService.js +0 -241
  48. package/player/mobile/utils/mobileScreenshotUtils.js +0 -46
  49. package/player/mobile/utils/mobileWindowUtils.js +0 -84
  50. package/player/stepActions/mobile/android/androidLocateStepAction.js +0 -122
  51. package/player/stepActions/mobile/android/androidLongClickStepAction.js +0 -12
  52. package/player/stepActions/mobile/android/androidScrollStepAction.js +0 -134
  53. package/player/stepActions/mobile/android/androidSpecialKeyStepAction.js +0 -22
  54. package/player/stepActions/mobile/android/androidSwipeStepAction.js +0 -32
  55. package/player/stepActions/mobile/androidGlobalActionStepAction.js +0 -12
  56. package/player/stepActions/mobile/androidTapStepAction.js +0 -19
  57. package/player/stepActions/mobile/androidTextChangeStepAction.js +0 -23
  58. package/player/stepActions/mobile/ios/iosLocateStepAction.js +0 -124
  59. package/player/stepActions/mobile/ios/iosScrollStepAction.js +0 -76
  60. package/runners/AnonymousTestPlanRunner.js +0 -106
  61. package/runners/BaseRunner.js +0 -42
  62. package/runners/BaseTestPlanRunner.js +0 -194
  63. package/runners/DeviceFarmRemoteRunner.js +0 -50
  64. package/runners/SchedulerRemoteRunner.js +0 -47
  65. package/runners/strategies/BaseStrategy.js +0 -86
  66. package/runners/strategies/DeviceFarmStrategy.js +0 -195
  67. package/runners/strategies/LocalDeviceFarmStrategy.js +0 -12
  68. package/runners/strategies/LocalTestStrategy.js +0 -14
  69. package/runners/strategies/Strategy.js +0 -17
  70. package/workers/WorkerAppium.js +0 -70
@@ -55,11 +55,6 @@ function putAuth(url, body) {
55
55
  .then(headers => httpRequest.put(`${config.SERVICES_HOST}${url || ''}`, body, headers));
56
56
  }
57
57
 
58
- function getTextWithAuth(url, query) {
59
- return getTokenHeader()
60
- .then(headers => httpRequest.getText(`${config.SERVICES_HOST}${url || ''}`, query, headers));
61
- }
62
-
63
58
  function getWithAuth(url, query, options, timeout) {
64
59
  return getTokenHeader()
65
60
  .then(headers => httpRequest.get(`${config.SERVICES_HOST}${url || ''}`, query, headers, timeout, options));
@@ -69,10 +64,6 @@ function getS3Artifact(url, timeout) {
69
64
  return utils.runWithRetries(() => getWithAuth(`/storage${url}`, null, { isBinary: true }, timeout));
70
65
  }
71
66
 
72
- function getS3ArtifactText(url) {
73
- return utils.runWithRetries(() => getTextWithAuth(`/storage${url}`));
74
- }
75
-
76
67
  function getTestPlan(projectId, testPlanNames) {
77
68
  //TODO: need to be checked after 3 months to prevent users from using old version
78
69
  const parseProperty = (dataValue) => (dataValue == null ? [] : (typeof (dataValue) === 'string' && JSON.parse(dataValue)) || dataValue);
@@ -100,21 +91,15 @@ function saveTestPlanResult(projectId, testPlanId, result) {
100
91
  return utils.runWithRetries(() => postAuth({ url: '/testPlan/result', body: { projectId, testPlanId, result } }));
101
92
  }
102
93
 
103
- function updateTestStatus(status, executionId, testId, resultId, startTime, endTime, success, failureReason, config, projectId, remoteRunId, testRetryKey, apiRetries = DEFAULT_REQUEST_RETRY) {
94
+ function updateTestStatus(projectId, executionId, testId, resultId, status, data, apiRetries = DEFAULT_REQUEST_RETRY) {
104
95
  return utils.runWithRetries(() => putAuth('/result/run/test', {
105
96
  runId: executionId,
106
97
  testId,
107
- startTime,
108
- endTime,
109
- success,
110
- failureReason,
111
98
  resultId,
112
99
  status,
113
- config,
114
100
  projectId,
115
101
  runnerVersion,
116
- remoteRunId,
117
- testRetryKey,
102
+ ...data,
118
103
  }), apiRetries);
119
104
  }
120
105
 
@@ -182,14 +167,6 @@ function reportExecutionFinished(status, executionId, projectId, success, tmsOpt
182
167
  }), DEFAULT_REQUEST_RETRY);
183
168
  }
184
169
 
185
- function getBranchData(projectId, branchName) {
186
- return utils.runWithRetries(() => getWithAuth(`/branch/branchData/${encodeURIComponent(branchName)}`, { projectId }));
187
- }
188
-
189
- function getUserDetails(userId) {
190
- return utils.runWithRetries(() => getWithAuth(`/user/user/${userId}`));
191
- }
192
-
193
170
  function getTestPlanTestList(projectId, names, planIds, branch) {
194
171
  return utils.runWithRetries(() => postAuth({
195
172
  url: '/testPlan/list',
@@ -243,11 +220,11 @@ function keepAliveGrid(projectId, slots) {
243
220
  });
244
221
  }
245
222
 
246
- function releaseGridSlot(projectId, slotId, gridId, browser) {
223
+ function releaseGridSlot(companyId, projectId, slotId, gridId, browser) {
247
224
  return postAuth({
248
225
  url: `/grid/release?reqId=${utils.guid()}`,
249
226
  body: {
250
- projectId, slotId, gridId, browser,
227
+ companyId, projectId, slotId, gridId, browser,
251
228
  },
252
229
  });
253
230
  }
@@ -259,23 +236,16 @@ function getHybridGridProvider(body) {
259
236
  });
260
237
  }
261
238
 
262
- function getGridByProject(projectId, gridName, browser, executionId) {
239
+ function getGridByName(companyId, projectId, gridName, browser, executionId) {
263
240
  return utils.runWithRetries(() => getWithAuth('/grid/name', {
264
- projectId, name: gridName, browser, executionId, reqId: utils.guid(),
241
+ companyId, projectId, name: gridName, browser, executionId, reqId: utils.guid(),
265
242
  }));
266
243
  }
267
244
 
268
- function getGridById(projectId, gridId, browser, executionId) {
269
- return utils.runWithRetries(() => getWithAuth(`/grid/${gridId}`, { projectId, browser, executionId, reqId: utils.guid() }));
270
- }
271
-
272
- function getCompanyByProjectId(projectId) {
273
- return utils.runWithRetries(() => getWithAuth(`/company/company/${projectId}`));
245
+ function getGridById(companyId, projectId, gridId, browser, executionId) {
246
+ return utils.runWithRetries(() => getWithAuth(`/grid/${gridId}`, { companyId, projectId, browser, executionId, reqId: utils.guid() }));
274
247
  }
275
248
 
276
- function getProject(projectId) {
277
- return utils.runWithRetries(() => getWithAuth(`/v2/project/project?projectId=${projectId}`));
278
- }
279
249
 
280
250
  async function initializeUserWithAuth({ projectId, token, branchName, lightweightMode, localGrid }) {
281
251
  try {
@@ -325,38 +295,6 @@ const fetchLambdatestConfig = async () => utils.runWithRetries(() => getWithAuth
325
295
 
326
296
  const getLabFeaturesByProjectId = async (projectId) => utils.runWithRetries(() => getWithAuth(`/labFeature/v2/project/${projectId}`));
327
297
 
328
- function getAppUploadUrl(projectId, projectArn, appName) {
329
- return utils.runWithRetries(() => postAuth({
330
- url: '/deviceFarm/app',
331
- body: {
332
- projectId,
333
- projectArn,
334
- appName,
335
- },
336
- }));
337
- }
338
-
339
- function createDeviceFarmRun(companyId, projectId, projectArn, appArn, configuration, branch, executionId, env, remoteRunObject) {
340
- return postAuth({
341
- url: '/deviceFarm/run',
342
- body: {
343
- companyId,
344
- projectId,
345
- projectArn,
346
- appArn,
347
- configuration,
348
- branch,
349
- executionId,
350
- env,
351
- remoteRunObject,
352
- },
353
- timeout: 30000,
354
- });
355
- }
356
-
357
- function getDeviceFarmRun(projectId, runArn) {
358
- return getWithAuth(`/deviceFarm/run?projectId=${projectId}&runArn=${runArn}`);
359
- }
360
298
 
361
299
  function getRealData(projectId, channel, query) {
362
300
  return utils.runWithRetries(() => getWithAuth(`/real-data/${channel}?${query}&projectId=${projectId}`));
@@ -492,30 +430,22 @@ function addTestRetry({
492
430
 
493
431
  module.exports = {
494
432
  getS3Artifact,
495
- getS3ArtifactText,
496
433
  getTestPlan,
497
434
  saveTestPlanResult,
498
435
  updateTestStatus,
499
436
  updateExecutionTests,
500
437
  reportExecutionStarted,
501
438
  reportExecutionFinished,
502
- getBranchData,
503
- getUserDetails,
504
439
  getTestPlanTestList,
505
440
  getSuiteTestList,
506
- getCompanyByProjectId,
507
- getProject,
508
441
  getUsageForCurrentBillingPeriod,
509
442
  getTestResults,
510
- getGridByProject,
443
+ getGridByName,
511
444
  releaseGridSlot,
512
445
  keepAliveGrid,
513
446
  getGridById,
514
447
  getAllGrids,
515
448
  fetchLambdatestConfig,
516
- getAppUploadUrl,
517
- createDeviceFarmRun,
518
- getDeviceFarmRun,
519
449
  getRealData,
520
450
  updateTestResult,
521
451
  clearTestResult,
package/executionQueue.js CHANGED
@@ -1,12 +1,10 @@
1
- "use strict";
1
+ 'use strict';
2
2
 
3
3
  const TestRun = require('./testRunHandler.js');
4
4
 
5
5
  class ExecutionQueue {
6
6
  constructor(executionId, testList, options, branchToUse, testStatus) {
7
- this._waitingTests = testList.map(testInfo => {
8
- return new TestRun(executionId, testInfo, options, branchToUse, testStatus);
9
- });
7
+ this._waitingTests = testList.map(testInfo => new TestRun(executionId, testInfo, options, branchToUse, testStatus));
10
8
  }
11
9
 
12
10
  getNext() {
@@ -14,6 +12,11 @@ class ExecutionQueue {
14
12
  if (nextTestRunHandler) {
15
13
  return nextTestRunHandler;
16
14
  }
15
+ return undefined;
16
+ }
17
+
18
+ hasMoreTests() {
19
+ return Boolean(this._waitingTests.length);
17
20
  }
18
21
  }
19
22