@capillarytech/cap-ui-dev-tools 1.8.0 → 2.0.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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@capillarytech/cap-ui-dev-tools",
3
- "version": "1.8.0",
3
+ "version": "2.0.0",
4
4
  "description": "Development tools for Capillary UI projects including webpack hot-reload plugin and CapVision session recording",
5
5
  "main": "src/index.js",
6
6
  "exports": {
@@ -318,7 +318,6 @@ function createWDIOCapVisionHooks(recorderConfig = {}, enhancerConfig = {}) {
318
318
  // Start recording if enabled
319
319
  if (capVisionRecorder.isCapVisionEnabled()) {
320
320
  try {
321
- console.log('🟡 Starting CapVision recording for test:', test.title);
322
321
  await capVisionRecorder.startRecording();
323
322
  } catch (error) {
324
323
  console.error('🔴 Failed to start CapVision recording:', error.message);
@@ -338,19 +337,8 @@ function createWDIOCapVisionHooks(recorderConfig = {}, enhancerConfig = {}) {
338
337
  if (capVisionRecorder.isCapVisionEnabled()) {
339
338
  try {
340
339
  const testName = test.title || 'unknown_test';
341
- console.log('🟡 Test result:', result.passed);
342
340
  const testPassed = result.passed !== false; // Default to true if not specified
343
341
  const metadata = await capVisionRecorder.stopRecordingAndSave(testName, testPassed);
344
-
345
- if (metadata && metadata.totalEvents > 0) {
346
- if (metadata.filename) {
347
- console.log(`🟢 CapVision recording saved: ${metadata.totalEvents} events -> ${metadata.filename}`);
348
- } else {
349
- console.log(`🟡 CapVision recording discarded (test passed): ${metadata.totalEvents} events`);
350
- }
351
- } else {
352
- console.log('🟨 No CapVision events were captured during test execution');
353
- }
354
342
  } catch (error) {
355
343
  console.error('🔴 Failed to save CapVision recording:', error.message);
356
344
  }
@@ -147,11 +147,9 @@ class CapVisionRecorder {
147
147
  const match = testFilePath.match(/\/(smoke|sanity|regression)\//);
148
148
  if (match) {
149
149
  this.currentTestType = match[1];
150
- console.log(`🟡 Detected test type from path: ${this.currentTestType}`);
151
150
  return this.currentTestType;
152
151
  }
153
152
 
154
- console.log('🟡 Could not detect test type from path:', testFilePath);
155
153
  return null;
156
154
  }
157
155
 
@@ -176,18 +174,10 @@ class CapVisionRecorder {
176
174
  const cluster = currentCluster || process.env.cluster;
177
175
 
178
176
  if (!cluster) {
179
- console.log('🟡 No cluster specified in environment, CapVision recording disabled');
180
177
  return false;
181
178
  }
182
179
 
183
180
  const isEnabled = this.config.enabledClusters.includes(cluster);
184
-
185
- if (isEnabled) {
186
- console.log(`🟢 CapVision recording enabled for cluster: ${cluster}`);
187
- } else {
188
- console.log(`🟡 CapVision recording disabled for cluster: ${cluster}`);
189
- }
190
-
191
181
  return isEnabled;
192
182
  }
193
183
 
@@ -204,18 +194,11 @@ class CapVisionRecorder {
204
194
  const module = currentModule || process.env.module;
205
195
 
206
196
  if (!module) {
207
- console.log('🟡 No module specified in environment, CapVision recording disabled');
208
197
  return false;
209
198
  }
210
199
 
211
200
  const isEnabled = this.config.enabledModules.includes(module);
212
201
 
213
- if (isEnabled) {
214
- console.log(`🟢 CapVision recording enabled for module: ${module}`);
215
- } else {
216
- console.log(`🟡 CapVision recording disabled for module: ${module}`);
217
- }
218
-
219
202
  return isEnabled;
220
203
  }
221
204
 
@@ -231,18 +214,11 @@ class CapVisionRecorder {
231
214
  const currentTestType = this.getCurrentTestType();
232
215
 
233
216
  if (!currentTestType) {
234
- console.log('🟡 No test type detected, CapVision recording disabled');
235
217
  return false;
236
218
  }
237
219
 
238
220
  const isEnabled = this.config.enabledTestTypes.includes(currentTestType);
239
221
 
240
- if (isEnabled) {
241
- console.log(`🟢 CapVision recording enabled for test type: ${currentTestType}`);
242
- } else {
243
- console.log(`🟡 CapVision recording disabled for test type: ${currentTestType}`);
244
- }
245
-
246
222
  return isEnabled;
247
223
  }
248
224
 
@@ -265,9 +241,7 @@ class CapVisionRecorder {
265
241
 
266
242
  const isEnabled = clusterEnabled && moduleEnabled && testTypeEnabled;
267
243
 
268
- if (isEnabled) {
269
- console.log('🟢 CapVision recording enabled (all criteria met)');
270
- } else {
244
+ if (!isEnabled) {
271
245
  const disabledReasons = [];
272
246
  if (!clusterEnabled) disabledReasons.push('cluster');
273
247
  if (!moduleEnabled) disabledReasons.push('module');
@@ -289,7 +263,6 @@ class CapVisionRecorder {
289
263
  files.forEach((file) => {
290
264
  fs.unlinkSync(path.join(recordingsDir, file));
291
265
  });
292
- console.log('🟢 Cleared recordings folder');
293
266
  }
294
267
  } catch (error) {
295
268
  console.error('🔴 Failed to clear recordings folder:', error.message);
@@ -304,8 +277,6 @@ class CapVisionRecorder {
304
277
  */
305
278
  saveEventsToFile(events, testName = 'test') {
306
279
  try {
307
- console.log('🟡 Saving CapVision events to file...');
308
-
309
280
  const recordingsDir = this.config.recordingsOutputDir;
310
281
 
311
282
  if (!fs.existsSync(recordingsDir)) {
@@ -347,7 +318,6 @@ class CapVisionRecorder {
347
318
  };
348
319
 
349
320
  fs.writeFileSync(filepath, JSON.stringify(eventsData, null, 2));
350
- console.log(`🟢 Saved ${events.length} events to: ${filename}`);
351
321
 
352
322
  return filename;
353
323
 
@@ -374,7 +344,6 @@ class CapVisionRecorder {
374
344
  const tempFilePath = path.join(tempDir, tempFileName);
375
345
 
376
346
  fs.writeFileSync(tempFilePath, JSON.stringify([]), 'utf8');
377
- console.log(`🟡 Created temp file: ${tempFilePath}`);
378
347
 
379
348
  return tempFilePath;
380
349
  }
@@ -420,7 +389,6 @@ class CapVisionRecorder {
420
389
  try {
421
390
  if (this.tempFilePath && fs.existsSync(this.tempFilePath)) {
422
391
  fs.unlinkSync(this.tempFilePath);
423
- console.log('🟢 Temp file deleted');
424
392
  this.tempFilePath = null;
425
393
  }
426
394
  } catch (error) {
@@ -440,12 +408,9 @@ class CapVisionRecorder {
440
408
  }
441
409
 
442
410
  if (!this.isCapVisionEnabled()) {
443
- console.log("🟡 Skipping CapVision recording (disabled by configuration)");
444
411
  return;
445
412
  }
446
413
 
447
- console.log("🟡 Starting CapVision recording...");
448
-
449
414
  // Create temp file if using file-based storage
450
415
  if (this.config.useTempFile) {
451
416
  this.tempFilePath = this.createTempFile();
@@ -476,13 +441,10 @@ class CapVisionRecorder {
476
441
  window.capVisionLastCheckTime = Date.now();
477
442
  window.capVisionEvents = [];
478
443
 
479
- console.log('🟢 Initialized empty events array for recording');
480
-
481
444
  // Inject CapVision script
482
445
  const injectScript = () => {
483
446
  return new Promise((resolve) => {
484
447
  if (window.rrweb) {
485
- console.log('🟢 CapVision script already loaded');
486
448
  resolve();
487
449
  return;
488
450
  }
@@ -491,7 +453,6 @@ class CapVisionRecorder {
491
453
  const script = document.createElement('script');
492
454
  script.textContent = capVisionScript;
493
455
  document.head.appendChild(script);
494
- console.log('🟢 CapVision script injected from bundled file');
495
456
  resolve();
496
457
  } catch (error) {
497
458
  console.error('❌ Failed to inject CapVision script:', error.message);
@@ -534,7 +495,6 @@ class CapVisionRecorder {
534
495
  const parsed = JSON.parse(saved);
535
496
  if (Array.isArray(parsed) && parsed.length > 0) {
536
497
  window.capVisionEvents = parsed;
537
- console.log(`🟢 Restored ${parsed.length} events from sessionStorage`);
538
498
  }
539
499
  }
540
500
  } catch (error) {
@@ -602,7 +562,6 @@ class CapVisionRecorder {
602
562
  const consolePlugin = getConsolePlugin();
603
563
  if (consolePlugin) {
604
564
  plugins.push(consolePlugin);
605
- console.log('🟢 Console recording enabled');
606
565
  }
607
566
 
608
567
  window.rrwebRecorder = window.rrweb.record({
@@ -627,7 +586,6 @@ class CapVisionRecorder {
627
586
 
628
587
  window.capVisionInitialized = true;
629
588
  window.capVisionLastCheckTime = Date.now();
630
- console.log('🟢 CapVision recording started');
631
589
  });
632
590
  };
633
591
 
@@ -636,14 +594,12 @@ class CapVisionRecorder {
636
594
  window.addEventListener('beforeunload', () => {
637
595
  if (!config.useTempFile) {
638
596
  saveEventsToStorage();
639
- console.log('🟡 Events saved to sessionStorage before unload');
640
597
  }
641
598
  });
642
599
 
643
600
  const checkInterval = setInterval(() => {
644
601
  // Check master feature flag first
645
602
  if (config.ENABLE_FEATURE === false) {
646
- console.log('🟡 CapVision feature disabled (ENABLE_FEATURE=false), stopping reinitialization checks');
647
603
  clearInterval(checkInterval);
648
604
  return;
649
605
  }
@@ -656,7 +612,6 @@ class CapVisionRecorder {
656
612
  window.capVisionLastCheckTime = now;
657
613
 
658
614
  if (!window.capVisionInitialized || !window.rrwebRecorder) {
659
- console.log('🟡 CapVision not active, attempting reinitialization...');
660
615
 
661
616
  if (!document.querySelector('script[src*="capvision"]')) {
662
617
  injectScript()
@@ -704,7 +659,6 @@ class CapVisionRecorder {
704
659
  }
705
660
  }, this.config.saveIntervalMs);
706
661
 
707
- console.log(`🟢 Periodic file save enabled (every ${this.config.saveIntervalMs}ms)`);
708
662
  }
709
663
  }
710
664
 
@@ -722,7 +676,6 @@ class CapVisionRecorder {
722
676
  }
723
677
 
724
678
  if (!this.isCapVisionEnabled()) {
725
- console.log("🟡 Skipping CapVision stop (disabled by configuration)");
726
679
  return {
727
680
  timestamp: new Date().toISOString(),
728
681
  totalEvents: 0,
@@ -730,26 +683,21 @@ class CapVisionRecorder {
730
683
  };
731
684
  }
732
685
 
733
- console.log("🟡 Stopping CapVision recording and saving...");
734
-
735
686
  // Clear periodic save interval
736
687
  if (this.saveIntervalHandle) {
737
688
  clearInterval(this.saveIntervalHandle);
738
689
  this.saveIntervalHandle = null;
739
- console.log('🟢 Periodic file save stopped');
740
690
  }
741
691
 
742
692
  // Final save
743
693
  if (this.config.useTempFile) {
744
694
  try {
745
- console.log('🟡 Performing final save before stopping...');
746
695
  const finalEvents = await this.browserExecutor.execute(() => {
747
696
  return window.capVisionEvents || [];
748
697
  });
749
698
 
750
699
  if (finalEvents && finalEvents.length > 0) {
751
700
  this.saveToTempFile(finalEvents);
752
- console.log(`🟢 Final save: ${finalEvents.length} events written to temp file`);
753
701
  }
754
702
  } catch (error) {
755
703
  console.warn('⚠️ Final save failed:', error.message);
@@ -764,7 +712,6 @@ class CapVisionRecorder {
764
712
  // Stop recorder
765
713
  if (window.rrwebRecorder) {
766
714
  window.rrwebRecorder();
767
- console.log('🟢 Recorder stopped');
768
715
  }
769
716
 
770
717
  // Clean up intervals
@@ -801,15 +748,11 @@ class CapVisionRecorder {
801
748
  if (!testPassed) {
802
749
  // Only save permanently if test failed
803
750
  savedFilename = this.saveEventsToFile(events, testName);
804
- console.log(`🟢 Saved ${events.length} events to: ${savedFilename} (test failed)`);
805
- } else {
806
- console.log(`🟡 Test passed - skipping permanent save (${events.length} events discarded)`);
807
751
  }
808
752
  }
809
753
 
810
754
  // Always delete temp file regardless of test result
811
755
  this.deleteTempFile();
812
- console.log('🟢 Temporary file cleaned up');
813
756
  } catch (error) {
814
757
  console.error('🔴 Failed to process events from temp file:', error.message);
815
758
  // Still try to delete temp file even if there was an error
@@ -820,8 +763,6 @@ class CapVisionRecorder {
820
763
  }
821
764
  }
822
765
  }
823
-
824
- console.log(`🟢 Recording stopped. Captured ${metadata.totalEvents} events`);
825
766
 
826
767
  return {
827
768
  timestamp: metadata.timestamp,
@@ -842,12 +783,9 @@ class CapVisionRecorder {
842
783
  }
843
784
 
844
785
  if (!this.isCapVisionEnabled()) {
845
- console.log("🟡 Skipping CapVision re-initialization (disabled by configuration)");
846
786
  return;
847
787
  }
848
788
 
849
- console.log("🟡 Re-initializing CapVision after page change...");
850
-
851
789
  await this.browserExecutor.pause(this.config.pageStabilizationDelayMs);
852
790
 
853
791
  // Read scripts
@@ -874,7 +812,6 @@ class CapVisionRecorder {
874
812
  try {
875
813
  const tempEvents = this.readFromTempFile();
876
814
  eventCount = tempEvents ? tempEvents.length : 0;
877
- console.log(`🟢 Will restore ${eventCount} events from temp file`);
878
815
  } catch (error) {
879
816
  console.warn('⚠️ Could not read temp file:', error.message);
880
817
  }
@@ -885,7 +822,6 @@ class CapVisionRecorder {
885
822
  const injectScript = () => {
886
823
  return new Promise((resolve) => {
887
824
  if (window.rrweb) {
888
- console.log('🟢 CapVision script already loaded');
889
825
  resolve();
890
826
  return;
891
827
  }
@@ -894,7 +830,6 @@ class CapVisionRecorder {
894
830
  const script = document.createElement('script');
895
831
  script.textContent = capVisionScript;
896
832
  document.head.appendChild(script);
897
- console.log('🟢 CapVision script re-injected');
898
833
  resolve();
899
834
  } catch (error) {
900
835
  console.error('❌ Failed to re-inject CapVision script:', error.message);
@@ -939,7 +874,6 @@ class CapVisionRecorder {
939
874
  const parsed = JSON.parse(saved);
940
875
  if (Array.isArray(parsed) && parsed.length > 0) {
941
876
  window.capVisionEvents = parsed;
942
- console.log(`🟢 Restored ${parsed.length} events from sessionStorage`);
943
877
  }
944
878
  }
945
879
  } catch (error) {
@@ -951,9 +885,6 @@ class CapVisionRecorder {
951
885
  const initializeEventsForFileMode = () => {
952
886
  if (config.useTempFile) {
953
887
  window.capVisionEvents = [];
954
- if (count > 0) {
955
- console.log(`🟢 Temp file has ${count} events`);
956
- }
957
888
  }
958
889
  };
959
890
 
@@ -1019,10 +950,6 @@ class CapVisionRecorder {
1019
950
  console.warn('⚠️ Failed to save events to sessionStorage:', error.message);
1020
951
  }
1021
952
  }
1022
-
1023
- // if (window.capVisionEvents.length % 10 === 0) {
1024
- // console.log(`🟡 Captured ${window.capVisionEvents.length} events`);
1025
- // }
1026
953
  },
1027
954
  checkoutEveryNms: config.checkoutIntervalMs,
1028
955
  recordCanvas: config.recordCanvas,
@@ -1038,13 +965,11 @@ class CapVisionRecorder {
1038
965
 
1039
966
  window.capVisionInitialized = true;
1040
967
  window.capVisionLastCheckTime = Date.now();
1041
- console.log('🟢 CapVision re-started');
1042
968
  });
1043
969
  };
1044
970
 
1045
971
  const reinitialize = async () => {
1046
972
  try {
1047
- console.log('🟡 Re-initializing...');
1048
973
  await injectScript();
1049
974
  await injectConsolePlugin(pluginCode);
1050
975
  restoreEventsFromStorage();
@@ -1058,7 +983,6 @@ class CapVisionRecorder {
1058
983
  reinitialize();
1059
984
  }, this.config, eventCount, capVisionScriptCode, consolePluginCode);
1060
985
 
1061
- console.log("🟢 Re-initialization complete");
1062
986
  }
1063
987
  }
1064
988
 
@@ -407,7 +407,6 @@ ${recordingPlayersHTML}
407
407
  const playerContainer = document.getElementById(\`capvision-player-inline-\${index}\`);
408
408
  if (playerContainer) {
409
409
  try {
410
- console.log('🟡 Initializing inline player for recording:', recording.filename);
411
410
 
412
411
  // Clear loading message
413
412
  playerContainer.innerHTML = '';
@@ -462,7 +461,6 @@ ${recordingPlayersHTML}
462
461
 
463
462
  players[index] = player;
464
463
 
465
- console.log('🟢 Successfully initialized inline player for recording:', recording.filename);
466
464
 
467
465
  } catch (error) {
468
466
  console.error('🔴 Failed to initialize inline player for recording:', recording.filename, error);
@@ -493,7 +491,6 @@ ${recordingPlayersHTML}
493
491
  });
494
492
  });
495
493
 
496
- console.log('🟢 CapVision Player integration loaded with', recordings.length, 'recording(s)');
497
494
 
498
495
  })();
499
496
  </script>
@@ -514,16 +511,12 @@ ${recordingPlayersHTML}
514
511
  return;
515
512
  }
516
513
 
517
- console.log('🟡 Enhancing HTML report with CapVision player:', reportPath);
518
-
519
514
  if (!fs.existsSync(reportPath)) {
520
- console.log('🟡 HTML report not found, skipping enhancement');
521
515
  return;
522
516
  }
523
517
 
524
518
  const recordings = this.getAvailableRecordings();
525
519
  if (recordings.length === 0) {
526
- console.log('🟡 No CapVision recordings found, skipping enhancement');
527
520
  return;
528
521
  }
529
522
 
@@ -537,7 +530,6 @@ ${recordingPlayersHTML}
537
530
  const bodyEndIndex = htmlContent.lastIndexOf('</body>');
538
531
 
539
532
  if (bodyEndIndex === -1) {
540
- console.log('🟡 Could not find </body> tag, appending to end');
541
533
  htmlContent += capVisionPlayerHTML;
542
534
  } else {
543
535
  htmlContent = htmlContent.slice(0, bodyEndIndex) + capVisionPlayerHTML + htmlContent.slice(bodyEndIndex);
@@ -545,9 +537,6 @@ ${recordingPlayersHTML}
545
537
 
546
538
  fs.writeFileSync(reportPath, htmlContent);
547
539
 
548
- console.log('🟢 Successfully enhanced HTML report with CapVision player');
549
- console.log(`🟢 Found ${recordings.length} recording(s) to integrate`);
550
-
551
540
  } catch (error) {
552
541
  console.error('🔴 Failed to enhance HTML report:', error.message);
553
542
  }
@@ -566,13 +555,7 @@ ${recordingPlayersHTML}
566
555
  return;
567
556
  }
568
557
 
569
- // if (!this.isEnhancementEnabled()) {
570
- // console.log('🟡 Skipping report enhancement (disabled for current cluster/module)');
571
- // return;
572
- // }
573
-
574
558
  if (!fs.existsSync(this.config.reportsDir)) {
575
- console.log('🟡 Reports directory not found');
576
559
  return;
577
560
  }
578
561
 
@@ -584,8 +567,6 @@ ${recordingPlayersHTML}
584
567
  await this.enhanceReport(reportPath);
585
568
  }
586
569
 
587
- console.log('🟢 Enhanced all HTML reports with CapVision player');
588
-
589
570
  } catch (error) {
590
571
  console.error('🔴 Failed to enhance reports:', error.message);
591
572
  }