browserstack-cypress-cli 1.32.8 → 1.34.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 (82) hide show
  1. package/.claude/settings.local.json +13 -0
  2. package/.nyc_output/1c1b6051-514d-4847-bd2a-d03b2d537cfb.json +1 -0
  3. package/.nyc_output/20afa9bb-5b9f-42e2-adfe-9dbf55591bb8.json +1 -0
  4. package/.nyc_output/22e511c5-8971-4265-b783-553560573bdc.json +1 -0
  5. package/.nyc_output/2d21e700-0ac9-4ac9-8f8c-322a5cbefe8d.json +1 -0
  6. package/.nyc_output/3c54171a-9bf6-478d-a4c0-28ec402806cf.json +1 -0
  7. package/.nyc_output/52675bfd-ff62-4f5b-944c-e3f48af2972c.json +1 -0
  8. package/.nyc_output/5766c03a-3d68-4298-89f7-c298c025e176.json +1 -0
  9. package/.nyc_output/625adc06-9859-4c11-8892-0498922cc2aa.json +1 -0
  10. package/.nyc_output/730f797e-97d0-44a8-b5d0-7fd3f8c06d75.json +1 -0
  11. package/.nyc_output/73501809-7c04-439e-8c09-9a1bff7962c6.json +1 -0
  12. package/.nyc_output/77484870-1b25-4c2d-a361-2ac51c0951bc.json +1 -0
  13. package/.nyc_output/8098fa2d-312d-4762-ad96-3e9827eaef09.json +1 -0
  14. package/.nyc_output/87357e21-685f-4861-9a6f-4c6b62f85ac0.json +1 -0
  15. package/.nyc_output/8fcd9f27-af41-43f7-bdf8-7bea2efd7abb.json +1 -0
  16. package/.nyc_output/9f8ad8fd-775b-4a99-ba77-c6142e7df5e9.json +1 -0
  17. package/.nyc_output/a1de1cdd-5eed-409d-a528-1c7cf16d56b5.json +1 -0
  18. package/.nyc_output/a25237ac-032d-4a27-af09-fb32326b539a.json +1 -0
  19. package/.nyc_output/a5d38a55-372c-4676-b4bc-c6def0669c0d.json +1 -0
  20. package/.nyc_output/a67d3cbf-0548-4fcb-8aad-2af60b532670.json +1 -0
  21. package/.nyc_output/aa2117b0-10c0-4f5b-9d8d-1f96375f0240.json +1 -0
  22. package/.nyc_output/ac17471f-3f16-45ab-b53e-ba8956afd5d4.json +1 -0
  23. package/.nyc_output/bbbe672a-8524-4850-b6b3-b725aa2b6c16.json +1 -0
  24. package/.nyc_output/c7289c09-7047-47cb-9737-f11fe7fc9628.json +1 -0
  25. package/.nyc_output/ceeeac29-3ca3-40af-b779-12c0408cf05d.json +1 -0
  26. package/.nyc_output/d08d37a4-6abc-41a7-98bd-de074a1fca7f.json +1 -0
  27. package/.nyc_output/d1dbecb0-8458-41bc-86c8-9d2470b60415.json +1 -0
  28. package/.nyc_output/d7245fa2-3732-4790-831b-44dbcba15a16.json +1 -0
  29. package/.nyc_output/e184572f-281b-4bd6-81e3-58842eac98ee.json +1 -0
  30. package/.nyc_output/efd98bd9-1699-472b-ab98-0808e5d39899.json +1 -0
  31. package/.nyc_output/processinfo/1c1b6051-514d-4847-bd2a-d03b2d537cfb.json +1 -0
  32. package/.nyc_output/processinfo/20afa9bb-5b9f-42e2-adfe-9dbf55591bb8.json +1 -0
  33. package/.nyc_output/processinfo/22e511c5-8971-4265-b783-553560573bdc.json +1 -0
  34. package/.nyc_output/processinfo/2d21e700-0ac9-4ac9-8f8c-322a5cbefe8d.json +1 -0
  35. package/.nyc_output/processinfo/3c54171a-9bf6-478d-a4c0-28ec402806cf.json +1 -0
  36. package/.nyc_output/processinfo/52675bfd-ff62-4f5b-944c-e3f48af2972c.json +1 -0
  37. package/.nyc_output/processinfo/5766c03a-3d68-4298-89f7-c298c025e176.json +1 -0
  38. package/.nyc_output/processinfo/625adc06-9859-4c11-8892-0498922cc2aa.json +1 -0
  39. package/.nyc_output/processinfo/730f797e-97d0-44a8-b5d0-7fd3f8c06d75.json +1 -0
  40. package/.nyc_output/processinfo/73501809-7c04-439e-8c09-9a1bff7962c6.json +1 -0
  41. package/.nyc_output/processinfo/77484870-1b25-4c2d-a361-2ac51c0951bc.json +1 -0
  42. package/.nyc_output/processinfo/8098fa2d-312d-4762-ad96-3e9827eaef09.json +1 -0
  43. package/.nyc_output/processinfo/87357e21-685f-4861-9a6f-4c6b62f85ac0.json +1 -0
  44. package/.nyc_output/processinfo/8fcd9f27-af41-43f7-bdf8-7bea2efd7abb.json +1 -0
  45. package/.nyc_output/processinfo/9f8ad8fd-775b-4a99-ba77-c6142e7df5e9.json +1 -0
  46. package/.nyc_output/processinfo/a1de1cdd-5eed-409d-a528-1c7cf16d56b5.json +1 -0
  47. package/.nyc_output/processinfo/a25237ac-032d-4a27-af09-fb32326b539a.json +1 -0
  48. package/.nyc_output/processinfo/a5d38a55-372c-4676-b4bc-c6def0669c0d.json +1 -0
  49. package/.nyc_output/processinfo/a67d3cbf-0548-4fcb-8aad-2af60b532670.json +1 -0
  50. package/.nyc_output/processinfo/aa2117b0-10c0-4f5b-9d8d-1f96375f0240.json +1 -0
  51. package/.nyc_output/processinfo/ac17471f-3f16-45ab-b53e-ba8956afd5d4.json +1 -0
  52. package/.nyc_output/processinfo/bbbe672a-8524-4850-b6b3-b725aa2b6c16.json +1 -0
  53. package/.nyc_output/processinfo/c7289c09-7047-47cb-9737-f11fe7fc9628.json +1 -0
  54. package/.nyc_output/processinfo/ceeeac29-3ca3-40af-b779-12c0408cf05d.json +1 -0
  55. package/.nyc_output/processinfo/d08d37a4-6abc-41a7-98bd-de074a1fca7f.json +1 -0
  56. package/.nyc_output/processinfo/d1dbecb0-8458-41bc-86c8-9d2470b60415.json +1 -0
  57. package/.nyc_output/processinfo/d7245fa2-3732-4790-831b-44dbcba15a16.json +1 -0
  58. package/.nyc_output/processinfo/e184572f-281b-4bd6-81e3-58842eac98ee.json +1 -0
  59. package/.nyc_output/processinfo/efd98bd9-1699-472b-ab98-0808e5d39899.json +1 -0
  60. package/.nyc_output/processinfo/index.json +1 -0
  61. package/bin/accessibility-automation/cypress/index.js +1 -1
  62. package/bin/accessibility-automation/helper.js +60 -32
  63. package/bin/commands/runs.js +10 -3
  64. package/bin/helpers/build.js +2 -0
  65. package/bin/helpers/capabilityHelper.js +7 -1
  66. package/bin/helpers/constants.js +22 -0
  67. package/bin/helpers/helper.js +2 -1
  68. package/bin/helpers/packageInstaller.js +3 -2
  69. package/bin/helpers/readCypressConfigUtil.js +133 -11
  70. package/bin/helpers/utils.js +241 -3
  71. package/bin/templates/configTemplate.js +2 -0
  72. package/bin/testObservability/crashReporter/index.js +2 -2
  73. package/bin/testObservability/cypress/index.js +194 -96
  74. package/bin/testObservability/helper/cleanupQueueSync.js +1 -2
  75. package/bin/testObservability/helper/constants.js +4 -0
  76. package/bin/testObservability/helper/helper.js +21 -22
  77. package/bin/testObservability/helper/requestQueueHandler.js +1 -1
  78. package/bin/testObservability/plugin/index.js +6 -0
  79. package/bin/testObservability/plugin/ipcServer.js +1 -1
  80. package/bin/testObservability/reporter/index.js +26 -18
  81. package/log/usage.log +393 -4
  82. package/package.json +6 -5
@@ -12,7 +12,7 @@ const Mocha = requireModule('mocha');
12
12
  const Runnable = require('mocha/lib/runnable'); // need to handle as this isn't present in older mocha versions
13
13
  const { v4: uuidv4 } = require('uuid');
14
14
 
15
- const { IPC_EVENTS } = require('../helper/constants');
15
+ const { IPC_EVENTS, TEST_REPORTING_ANALYTICS } = require('../helper/constants');
16
16
  const { startIPCServer } = require('../plugin/ipcServer');
17
17
 
18
18
  const HOOK_TYPES_MAP = {
@@ -52,7 +52,6 @@ const {
52
52
  mapTestHooks,
53
53
  debug,
54
54
  isBrowserstackInfra,
55
- requestQueueHandler,
56
55
  getHookSkippedTests,
57
56
  getOSDetailsFromSystem,
58
57
  findGitConfig,
@@ -88,6 +87,7 @@ class MyReporter {
88
87
  })
89
88
 
90
89
  .on(EVENT_HOOK_BEGIN, async (hook) => {
90
+ if (this.isInternalHook(hook)) return;
91
91
  debugOnConsole(`[MOCHA EVENT] EVENT_HOOK_BEGIN`);
92
92
  if(this.testObservability == true) {
93
93
  if(!hook.hookAnalyticsId) {
@@ -105,6 +105,7 @@ class MyReporter {
105
105
  })
106
106
 
107
107
  .on(EVENT_HOOK_END, async (hook) => {
108
+ if (this.isInternalHook(hook)) return;
108
109
  debugOnConsole(`[MOCHA EVENT] EVENT_HOOK_END`);
109
110
  if(this.testObservability == true) {
110
111
  if(!this.runStatusMarkedHash[hook.hookAnalyticsId]) {
@@ -206,6 +207,13 @@ class MyReporter {
206
207
  });
207
208
  }
208
209
 
210
+ isInternalHook(hook) {
211
+ if (hook && hook.body && hook.body.includes('/* browserstack internal helper hook */')) {
212
+ return true;
213
+ }
214
+ return false;
215
+ }
216
+
209
217
  registerListeners() {
210
218
  startIPCServer(
211
219
  (server) => {
@@ -247,7 +255,7 @@ class MyReporter {
247
255
  }
248
256
  }
249
257
 
250
- uploadTestSteps = async (shouldClearCurrentSteps = true, cypressSteps = null) => {
258
+ uploadTestSteps = async (shouldClearCurrentSteps = true, cypressSteps = null) => {
251
259
  const currentTestSteps = cypressSteps ? cypressSteps : JSON.parse(JSON.stringify(this.currentTestSteps));
252
260
  /* TODO - Send as test logs */
253
261
  const allStepsAsLogs = [];
@@ -511,14 +519,14 @@ class MyReporter {
511
519
  });
512
520
  }
513
521
  } catch(error) {
514
- debug(`Exception in uploading log data to Observability with error : ${error}`, true, error);
522
+ debug(`Exception in uploading log data to ${TEST_REPORTING_ANALYTICS} with error : ${error}`, true, error);
515
523
  }
516
524
  }
517
525
 
518
526
  cypressConfigListener = async (config) => {
519
527
  }
520
528
 
521
- cypressCucumberStepListener = async ({log}) => {
529
+ cypressCucumberStepListener = async ({log, started_at, finished_at}) => {
522
530
  if(log.name == 'step' && log.consoleProps && log.consoleProps.step && log.consoleProps.step.keyword) {
523
531
  this.currentTestCucumberSteps = [
524
532
  ...this.currentTestCucumberSteps,
@@ -526,8 +534,8 @@ class MyReporter {
526
534
  id: log.chainerId,
527
535
  keyword: log.consoleProps.step.keyword,
528
536
  text: log.consoleProps.step.text,
529
- started_at: new Date().toISOString(),
530
- finished_at: new Date().toISOString(),
537
+ started_at: started_at || new Date().toISOString(),
538
+ finished_at: finished_at || new Date().toISOString(),
531
539
  duration: 0,
532
540
  result: 'passed'
533
541
  }
@@ -537,8 +545,8 @@ class MyReporter {
537
545
  if(gherkinStep.id == log.chainerId) {
538
546
  this.currentTestCucumberSteps[idx] = {
539
547
  ...gherkinStep,
540
- finished_at: new Date().toISOString(),
541
- duration: Date.now() - (new Date(gherkinStep.started_at)).getTime(),
548
+ finished_at: finished_at || new Date().toISOString(),
549
+ duration: (finished_at ? new Date(finished_at).getTime() : Date.now()) - (new Date(gherkinStep.started_at)).getTime(),
542
550
  result: log.state,
543
551
  failure: log.err?.stack || log.err?.message,
544
552
  failure_reason: log.err?.stack || log.err?.message,
@@ -549,9 +557,9 @@ class MyReporter {
549
557
  }
550
558
  }
551
559
 
552
- cypressLogListener = async ({level, message, file}) => {
560
+ cypressLogListener = async ({timestamp, level, message}) => {
553
561
  this.appendTestItemLog({
554
- timestamp: new Date().toISOString(),
562
+ timestamp: timestamp || new Date().toISOString(),
555
563
  level: level.toUpperCase(),
556
564
  message,
557
565
  kind: 'TEST_LOG',
@@ -612,12 +620,12 @@ class MyReporter {
612
620
  const currentStepObj = {
613
621
  id: command.attributes.id,
614
622
  text: 'cy.' + command.attributes.name + '(' + this.getFormattedArgs(command.attributes.args) + ')',
615
- started_at: new Date().toISOString(),
623
+ started_at: command.started_at || new Date().toISOString(),
616
624
  finished_at: null,
617
625
  duration: null,
618
626
  result: 'pending',
619
- test_run_uuid: this.current_test?.testAnalyticsId && !this.runStatusMarkedHash[this.current_test.testAnalyticsId] ? this.current_test.testAnalyticsId : null,
620
- hook_run_uuid : this.current_hook?.hookAnalyticsId && !this.runStatusMarkedHash[this.current_hook.hookAnalyticsId] ? this.current_hook.hookAnalyticsId : null
627
+ test_run_uuid: command.location === 'test' ? this.current_test?.testAnalyticsId : null,
628
+ hook_run_uuid : command.location === 'hook' ? this.current_hook?.hookAnalyticsId : null
621
629
  };
622
630
  if(currentStepObj.hook_run_uuid && currentStepObj.test_run_uuid) delete currentStepObj.test_run_uuid;
623
631
  this.currentTestSteps = [
@@ -630,8 +638,8 @@ class MyReporter {
630
638
  if(val.id == command.attributes.id) {
631
639
  this.currentTestSteps[idx] = {
632
640
  ...val,
633
- finished_at: new Date().toISOString(),
634
- duration: Date.now() - (new Date(val.started_at)).getTime(),
641
+ finished_at: command.finished_at || new Date().toISOString(),
642
+ duration: (command.finished_at ? new Date(command.finished_at).getTime() : Date.now()) - (new Date(val.started_at)).getTime(),
635
643
  result: command.state
636
644
  };
637
645
  stepUpdated = true;
@@ -647,8 +655,8 @@ class MyReporter {
647
655
  finished_at: new Date().toISOString(),
648
656
  duration: 0,
649
657
  result: command.state,
650
- test_run_uuid: this.current_test?.testAnalyticsId && !this.runStatusMarkedHash[this.current_test.testAnalyticsId] ? this.current_test.testAnalyticsId : null,
651
- hook_run_uuid : this.current_hook?.hookAnalyticsId && !this.runStatusMarkedHash[this.current_hook.hookAnalyticsId] ? this.current_hook.hookAnalyticsId : null
658
+ test_run_uuid: command.location === 'test' ? this.current_test?.testAnalyticsId : null,
659
+ hook_run_uuid : command.location === 'hook' ? this.current_hook?.hookAnalyticsId : null
652
660
  };
653
661
  if(currentStepObj.hook_run_uuid && currentStepObj.test_run_uuid) delete currentStepObj.test_run_uuid;
654
662
  this.currentTestSteps = [