@appsurify-testmap/rrweb-cypress-plugin 3.2.0-alpha.1 → 3.4.0-alpha.1

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/dist/index.js CHANGED
@@ -1,4 +1,4 @@
1
- "use strict";var g=Object.defineProperty;var A=Object.getOwnPropertyDescriptor;var M=Object.getOwnPropertyNames;var N=Object.prototype.hasOwnProperty;var O=(e,t)=>{for(var n in t)g(e,n,{get:t[n],enumerable:!0})},P=(e,t,n,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let s of M(t))!N.call(e,s)&&s!==n&&g(e,s,{get:()=>t[s],enumerable:!(r=A(t,s))||r.enumerable});return e};var L=e=>P(g({},"__esModule",{value:!0}),e);var X={};O(X,{initializeTestmap:()=>T});module.exports=L(X);var b=new Map;function v(e,t){b.set(e,t)}function u(e){return b.get(e)}function d(e){return e.filter(t=>typeof t=="object"&&t!==null&&"log"in t&&t.log===!1?!1:typeof t=="string"||typeof t=="number"||typeof t=="boolean"||t===null)}function l(e){return e.titlePath().join(" > ")}function D(e){if(e)return{id:e.id,file:e.file,invocationDetails:w(e.invocationDetails),pending:e.pending,root:e.root,title:e.title,type:e.type}}function w(e){return{absoluteFile:e?.absoluteFile??"",column:e?.column??0,fileUrl:e?.fileUrl??"",function:e?.function??"",line:e?.line??0,originalFile:e?.originalFile??"",relativeFile:e?.relativeFile??""}}function x(e){return{runner:e.runner,spec:F(e.spec),browser:z(e.browser),test:U(e.test),recorderEvents:Array.isArray(e.recorderEvents)?e.recorderEvents:[]}}function F(e){return{name:e.name??"",absolute:e.absolute??"",relative:e.relative??"",specFilter:e.specFilter??"",specType:e.specType??"integration",baseName:e.baseName??"",fileExtension:e.fileExtension??"",fileName:e.fileName??"",id:e.id??""}}function z(e){return{name:e.name??"",version:e.version??"",displayName:e.displayName??"",family:e.family??"",majorVersion:e.majorVersion??"",channel:e.channel??"",path:e.path??""}}function U(e){return{suite:D(e.parent),file:e.file??"",duration:e.duration??0,id:e.id??"",invocationDetails:w(e.invocationDetails),pending:e.pending??!1,state:e.state??"unknown",sync:e.sync??!1,timedOut:e.timedOut??!1,title:e.title??"",titlePath:typeof e.titlePath=="function"?e.titlePath():[],fullTitle:typeof e.fullTitle=="function"?e.fullTitle():"",type:e.type??"test"}}var $=require("@appsurify-testmap/rrweb"),k=require("@appsurify-testmap/rrweb-plugin-sequential-id-record");var S=`(function (g, f) {if ("object" == typeof exports && "object" == typeof module) {module.exports = f();} else if ("function" == typeof define && define.amd) {define("rrweb", [], f);} else if ("object" == typeof exports) {exports["rrweb"] = f();} else {g["rrweb"] = f();}}(typeof self !== 'undefined' ? self : typeof globalThis !== 'undefined' ? globalThis : this, () => {var exports = {};var module = { exports };
1
+ "use strict";var g=Object.defineProperty;var A=Object.getOwnPropertyDescriptor;var M=Object.getOwnPropertyNames;var N=Object.prototype.hasOwnProperty;var O=(e,t)=>{for(var s in t)g(e,s,{get:t[s],enumerable:!0})},P=(e,t,s,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let n of M(t))!N.call(e,n)&&n!==s&&g(e,n,{get:()=>t[n],enumerable:!(r=A(t,n))||r.enumerable});return e};var L=e=>P(g({},"__esModule",{value:!0}),e);var X={};O(X,{initializeTestmap:()=>T});module.exports=L(X);var b=new Map;function v(e,t){b.set(e,t)}function u(e){return b.get(e)}function d(e){return e.filter(t=>typeof t=="object"&&t!==null&&"log"in t&&t.log===!1?!1:typeof t=="string"||typeof t=="number"||typeof t=="boolean"||t===null)}function l(e){return e.titlePath().join(" > ")}function D(e){if(e)return{id:e.id,file:e.file,invocationDetails:w(e.invocationDetails),pending:e.pending,root:e.root,title:e.title,type:e.type}}function w(e){return{absoluteFile:e?.absoluteFile??"",column:e?.column??0,fileUrl:e?.fileUrl??"",function:e?.function??"",line:e?.line??0,originalFile:e?.originalFile??"",relativeFile:e?.relativeFile??""}}function S(e){return{runner:e.runner,spec:F(e.spec),browser:U(e.browser),test:z(e.test),recorderEvents:Array.isArray(e.recorderEvents)?e.recorderEvents:[]}}function F(e){return{name:e.name??"",absolute:e.absolute??"",relative:e.relative??"",specFilter:e.specFilter??"",specType:e.specType??"integration",baseName:e.baseName??"",fileExtension:e.fileExtension??"",fileName:e.fileName??"",id:e.id??""}}function U(e){return{name:e.name??"",version:e.version??"",displayName:e.displayName??"",family:e.family??"",majorVersion:e.majorVersion??"",channel:e.channel??"",path:e.path??""}}function z(e){return{suite:D(e.parent),file:e.file??"",duration:e.duration??0,id:e.id??"",invocationDetails:w(e.invocationDetails),pending:e.pending??!1,state:e.state??"unknown",sync:e.sync??!1,timedOut:e.timedOut??!1,title:e.title??"",titlePath:typeof e.titlePath=="function"?e.titlePath():[],fullTitle:typeof e.fullTitle=="function"?e.fullTitle():"",type:e.type??"test"}}var k=require("@appsurify-testmap/rrweb"),$=require("@appsurify-testmap/rrweb-plugin-sequential-id-record");var x=`(function (g, f) {if ("object" == typeof exports && "object" == typeof module) {module.exports = f();} else if ("function" == typeof define && define.amd) {define("rrweb", [], f);} else if ("object" == typeof exports) {exports["rrweb"] = f();} else {g["rrweb"] = f();}}(typeof self !== 'undefined' ? self : typeof globalThis !== 'undefined' ? globalThis : this, () => {var exports = {};var module = { exports };
2
2
  "use strict";
3
3
  var __defProp = Object.defineProperty;
4
4
  var __defProps = Object.defineProperties;
@@ -14273,6 +14273,7 @@ function initNavigationObserver({
14273
14273
  doc,
14274
14274
  sampling
14275
14275
  }) {
14276
+ var _a2;
14276
14277
  if (sampling.navigation === false) {
14277
14278
  return () => {
14278
14279
  };
@@ -14323,6 +14324,30 @@ function initNavigationObserver({
14323
14324
  handlers.push(restoreReplaceState);
14324
14325
  handlers.push(on("popstate", () => emitNavigation("popstate"), win));
14325
14326
  handlers.push(on("hashchange", () => emitNavigation("hashchange"), win));
14327
+ const useNavigationAPI = typeof sampling.navigation === "object" ? (_a2 = sampling.navigation.useNavigationAPI) != null ? _a2 : true : true;
14328
+ if (useNavigationAPI && "navigation" in win) {
14329
+ try {
14330
+ const nav = win.navigation;
14331
+ const handler = (event) => {
14332
+ var _a22;
14333
+ const navEvent = event;
14334
+ if (navEvent.navigationType === "push" || navEvent.navigationType === "replace") {
14335
+ const destUrl = (_a22 = navEvent.destination) == null ? void 0 : _a22.url;
14336
+ if (destUrl && destUrl !== lastHref) {
14337
+ navigationCb({
14338
+ href: destUrl,
14339
+ oldHref: lastHref,
14340
+ navigationType: "navigate"
14341
+ });
14342
+ lastHref = destUrl;
14343
+ }
14344
+ }
14345
+ };
14346
+ nav.addEventListener("navigate", handler);
14347
+ handlers.push(() => nav.removeEventListener("navigate", handler));
14348
+ } catch (e) {
14349
+ }
14350
+ }
14326
14351
  return callbackWrapper(() => {
14327
14352
  handlers.forEach((h) => h());
14328
14353
  });
@@ -16451,6 +16476,168 @@ class VisibilityManager {
16451
16476
  }
16452
16477
  }
16453
16478
  }
16479
+ const DEFAULT_SETTLE_TIMEOUT = 150;
16480
+ const DEFAULT_MAX_WAIT = 5e3;
16481
+ const DEFAULT_DEBOUNCE = 100;
16482
+ class NavigationManager {
16483
+ constructor(options) {
16484
+ var _a2, _b, _c;
16485
+ __publicField(this, "frozen", false);
16486
+ __publicField(this, "locked", false);
16487
+ __publicField(this, "disabled", false);
16488
+ __publicField(this, "settleTimeout");
16489
+ __publicField(this, "maxWait");
16490
+ __publicField(this, "debounceMs");
16491
+ __publicField(this, "settlingObserver", null);
16492
+ __publicField(this, "debounceTimer", null);
16493
+ __publicField(this, "settleCheckTimer", null);
16494
+ __publicField(this, "maxWaitTimer", null);
16495
+ __publicField(this, "lastMutationTime", 0);
16496
+ __publicField(this, "pendingNavigation", null);
16497
+ __publicField(this, "doc");
16498
+ __publicField(this, "onSnapshot");
16499
+ const { doc, config, onSnapshot } = options;
16500
+ this.doc = doc;
16501
+ this.onSnapshot = callbackWrapper(onSnapshot);
16502
+ this.settleTimeout = (_a2 = config.settleTimeout) != null ? _a2 : DEFAULT_SETTLE_TIMEOUT;
16503
+ this.maxWait = (_b = config.maxWait) != null ? _b : DEFAULT_MAX_WAIT;
16504
+ this.debounceMs = (_c = config.debounce) != null ? _c : DEFAULT_DEBOUNCE;
16505
+ }
16506
+ handleNavigation(data) {
16507
+ if (this.disabled)
16508
+ return;
16509
+ if (this.locked)
16510
+ return;
16511
+ this.cancelTimers();
16512
+ this.disconnectSettlingObserver();
16513
+ this.pendingNavigation = data;
16514
+ if (this.frozen) {
16515
+ return;
16516
+ }
16517
+ this.startDebounce();
16518
+ }
16519
+ cancelPending() {
16520
+ this.cancelTimers();
16521
+ this.disconnectSettlingObserver();
16522
+ this.pendingNavigation = null;
16523
+ }
16524
+ freeze() {
16525
+ this.frozen = true;
16526
+ this.cancelTimers();
16527
+ this.disconnectSettlingObserver();
16528
+ }
16529
+ unfreeze() {
16530
+ this.frozen = false;
16531
+ if (this.pendingNavigation && !this.locked && !this.disabled) {
16532
+ this.startDebounce();
16533
+ }
16534
+ }
16535
+ lock() {
16536
+ this.locked = true;
16537
+ this.cancelTimers();
16538
+ this.disconnectSettlingObserver();
16539
+ }
16540
+ unlock() {
16541
+ this.locked = false;
16542
+ this.pendingNavigation = null;
16543
+ }
16544
+ unsetFrozen() {
16545
+ this.frozen = false;
16546
+ }
16547
+ reset() {
16548
+ this.cancelTimers();
16549
+ this.disconnectSettlingObserver();
16550
+ this.pendingNavigation = null;
16551
+ this.frozen = false;
16552
+ this.locked = false;
16553
+ }
16554
+ destroy() {
16555
+ const hadPending = this.pendingNavigation !== null;
16556
+ this.reset();
16557
+ this.disabled = true;
16558
+ if (hadPending) {
16559
+ this.onSnapshot(true);
16560
+ }
16561
+ }
16562
+ startDebounce() {
16563
+ this.debounceTimer = setTimeout(() => {
16564
+ this.debounceTimer = null;
16565
+ this.startDOMSettling();
16566
+ }, this.debounceMs);
16567
+ }
16568
+ startDOMSettling() {
16569
+ if (this.frozen || this.locked || this.disabled)
16570
+ return;
16571
+ this.lastMutationTime = performance.now();
16572
+ const ObserverCtor = mutationObserverCtor();
16573
+ this.settlingObserver = new ObserverCtor(() => {
16574
+ this.lastMutationTime = performance.now();
16575
+ if (this.settleCheckTimer !== null) {
16576
+ clearTimeout(this.settleCheckTimer);
16577
+ }
16578
+ this.settleCheckTimer = setTimeout(
16579
+ () => this.checkSettled(),
16580
+ this.settleTimeout
16581
+ );
16582
+ });
16583
+ this.settlingObserver.observe(this.doc, {
16584
+ childList: true,
16585
+ subtree: true,
16586
+ attributes: true,
16587
+ characterData: true
16588
+ });
16589
+ this.settleCheckTimer = setTimeout(
16590
+ () => this.checkSettled(),
16591
+ this.settleTimeout
16592
+ );
16593
+ this.maxWaitTimer = setTimeout(() => {
16594
+ this.maxWaitTimer = null;
16595
+ this.completeSettling();
16596
+ }, this.maxWait);
16597
+ }
16598
+ checkSettled() {
16599
+ this.settleCheckTimer = null;
16600
+ const elapsed = performance.now() - this.lastMutationTime;
16601
+ if (elapsed >= this.settleTimeout) {
16602
+ this.completeSettling();
16603
+ } else {
16604
+ this.settleCheckTimer = setTimeout(
16605
+ () => this.checkSettled(),
16606
+ this.settleTimeout - elapsed
16607
+ );
16608
+ }
16609
+ }
16610
+ completeSettling() {
16611
+ if (this.frozen || this.locked || this.disabled)
16612
+ return;
16613
+ if (!this.pendingNavigation)
16614
+ return;
16615
+ this.cancelTimers();
16616
+ this.disconnectSettlingObserver();
16617
+ this.pendingNavigation = null;
16618
+ this.onSnapshot(true);
16619
+ }
16620
+ cancelTimers() {
16621
+ if (this.debounceTimer !== null) {
16622
+ clearTimeout(this.debounceTimer);
16623
+ this.debounceTimer = null;
16624
+ }
16625
+ if (this.settleCheckTimer !== null) {
16626
+ clearTimeout(this.settleCheckTimer);
16627
+ this.settleCheckTimer = null;
16628
+ }
16629
+ if (this.maxWaitTimer !== null) {
16630
+ clearTimeout(this.maxWaitTimer);
16631
+ this.maxWaitTimer = null;
16632
+ }
16633
+ }
16634
+ disconnectSettlingObserver() {
16635
+ if (this.settlingObserver) {
16636
+ this.settlingObserver.disconnect();
16637
+ this.settlingObserver = null;
16638
+ }
16639
+ }
16640
+ }
16454
16641
  class StylesheetManager {
16455
16642
  constructor(options) {
16456
16643
  __publicField(this, "trackedLinkElements", /* @__PURE__ */ new WeakSet());
@@ -16538,43 +16725,13 @@ class ProcessedNodeManager {
16538
16725
  destroy() {
16539
16726
  }
16540
16727
  }
16541
- const version$1 = "3.1.1-alpha.3";
16728
+ const version$1 = "3.4.0-alpha.1";
16542
16729
  let wrappedEmit;
16543
16730
  let takeFullSnapshot$1;
16544
16731
  let canvasManager;
16545
16732
  let recording = false;
16546
16733
  const customEventQueue = [];
16547
16734
  let flushCustomEventQueue$1;
16548
- function waitForDOMStabilization(win) {
16549
- const maxWaitMs = 5e3;
16550
- return new Promise((resolve2) => {
16551
- const captureAfterPaint = () => {
16552
- requestAnimationFrame(() => {
16553
- requestAnimationFrame(() => {
16554
- resolve2();
16555
- });
16556
- });
16557
- };
16558
- const safeResolve = /* @__PURE__ */ (() => {
16559
- let called = false;
16560
- return () => {
16561
- if (!called) {
16562
- called = true;
16563
- captureAfterPaint();
16564
- }
16565
- };
16566
- })();
16567
- if (["interactive", "complete"].includes(win.document.readyState)) {
16568
- safeResolve();
16569
- } else {
16570
- win.addEventListener("DOMContentLoaded", safeResolve, { once: true });
16571
- win.addEventListener("load", safeResolve, { once: true });
16572
- setTimeout(() => {
16573
- safeResolve();
16574
- }, maxWaitMs);
16575
- }
16576
- });
16577
- }
16578
16735
  try {
16579
16736
  if (Array.from([1], (x2) => x2 * 2)[0] !== 2) {
16580
16737
  const cleanFrame = document.createElement("iframe");
@@ -16707,6 +16864,7 @@ function record(options = {}) {
16707
16864
  checkoutDebounceTimer = null;
16708
16865
  checkoutPending = false;
16709
16866
  checkoutFreezeTimestamp = null;
16867
+ navigationManager == null ? void 0 : navigationManager.cancelPending();
16710
16868
  takeFullSnapshot$1(true);
16711
16869
  mutationBuffers.forEach((buf) => {
16712
16870
  buf.resetBuffers();
@@ -16715,6 +16873,9 @@ function record(options = {}) {
16715
16873
  if (visibilityManager) {
16716
16874
  visibilityManager.unsetFrozen();
16717
16875
  }
16876
+ if (navigationManager) {
16877
+ navigationManager.unsetFrozen();
16878
+ }
16718
16879
  };
16719
16880
  wrappedEmit = (r2, isCheckout) => {
16720
16881
  var _a2;
@@ -16724,6 +16885,7 @@ function record(options = {}) {
16724
16885
  if (((_a2 = mutationBuffers[0]) == null ? void 0 : _a2.isFrozen()) && !checkoutPending && e2.type !== EventType.FullSnapshot && !(e2.type === EventType.IncrementalSnapshot && e2.data.source === IncrementalSource.Mutation)) {
16725
16886
  mutationBuffers.forEach((buf) => buf.unfreeze());
16726
16887
  visibilityManager == null ? void 0 : visibilityManager.unfreeze();
16888
+ navigationManager == null ? void 0 : navigationManager.unfreeze();
16727
16889
  }
16728
16890
  if (inEmittingFrame) {
16729
16891
  emit == null ? void 0 : emit(eventProcessor(e2), isCheckout);
@@ -16928,6 +17090,7 @@ function record(options = {}) {
16928
17090
  shadowDomManager.init();
16929
17091
  mutationBuffers.forEach((buf) => buf.lock());
16930
17092
  visibilityManager == null ? void 0 : visibilityManager.lock();
17093
+ navigationManager == null ? void 0 : navigationManager.lock();
16931
17094
  const node2 = snapshot(document, {
16932
17095
  mirror,
16933
17096
  blockClass,
@@ -16979,6 +17142,7 @@ function record(options = {}) {
16979
17142
  );
16980
17143
  mutationBuffers.forEach((buf) => buf.unlock());
16981
17144
  visibilityManager == null ? void 0 : visibilityManager.unlock();
17145
+ navigationManager == null ? void 0 : navigationManager.unlock();
16982
17146
  if (document.adoptedStyleSheets && document.adoptedStyleSheets.length > 0)
16983
17147
  stylesheetManager.adoptStyleSheets(
16984
17148
  document.adoptedStyleSheets,
@@ -16991,6 +17155,31 @@ function record(options = {}) {
16991
17155
  }
16992
17156
  customEventQueue.length = 0;
16993
17157
  };
17158
+ let navigationManager;
17159
+ const navigationSampling = sampling.navigation;
17160
+ if (navigationSampling !== false) {
17161
+ const navConfig = typeof navigationSampling === "object" ? navigationSampling : {};
17162
+ navigationManager = new NavigationManager({
17163
+ doc: document,
17164
+ config: navConfig,
17165
+ onSnapshot: (isCheckout) => {
17166
+ if (checkoutPending) {
17167
+ if (checkoutDebounceTimer) {
17168
+ clearTimeout(checkoutDebounceTimer);
17169
+ checkoutDebounceTimer = null;
17170
+ }
17171
+ checkoutPending = false;
17172
+ checkoutFreezeTimestamp = null;
17173
+ mutationBuffers.forEach((buf) => {
17174
+ buf.resetBuffers();
17175
+ buf.unsetFrozen();
17176
+ });
17177
+ visibilityManager == null ? void 0 : visibilityManager.unsetFrozen();
17178
+ }
17179
+ takeFullSnapshot$1(isCheckout);
17180
+ }
17181
+ });
17182
+ }
16994
17183
  try {
16995
17184
  const handlers = [];
16996
17185
  const observe = (doc) => {
@@ -17019,14 +17208,11 @@ function record(options = {}) {
17019
17208
  }, d)
17020
17209
  }),
17021
17210
  navigationCb: (navData) => {
17022
- console.debug(
17023
- \`[\${nowTimestamp()}] [rrweb:record/navigation] \\u{1F9ED} Navigation detected:\`,
17024
- navData.navigationType,
17025
- navData.oldHref,
17026
- "\\u2192",
17027
- navData.href
17028
- );
17029
- takeFullSnapshot$1(true);
17211
+ if (navigationManager) {
17212
+ navigationManager.handleNavigation(navData);
17213
+ } else {
17214
+ takeFullSnapshot$1(true);
17215
+ }
17030
17216
  },
17031
17217
  inputCb: (v2) => wrappedEmit({
17032
17218
  type: EventType.IncrementalSnapshot,
@@ -17138,23 +17324,6 @@ function record(options = {}) {
17138
17324
  flushCustomEventQueue$1();
17139
17325
  }
17140
17326
  };
17141
- const runInit = async () => {
17142
- if (flushCustomEvent === "before") {
17143
- flushCustomEventQueue$1();
17144
- }
17145
- if (recordAfter === "DOMContentStabilized") {
17146
- console.debug(\`[\${nowTimestamp()}] [rrweb:record] \\u{1F7E2} Waiting for DOM stabilization...\`);
17147
- await waitForDOMStabilization(window);
17148
- console.debug(\`[\${nowTimestamp()}] [rrweb:record] \\u2705 DOM stabilized, starting recording\`);
17149
- }
17150
- console.debug(\`[\${nowTimestamp()}] [rrweb:record] \\u2705 Init dom and takeFullSnapshot \`);
17151
- takeFullSnapshot$1();
17152
- handlers.push(observe(document));
17153
- recording = true;
17154
- if (flushCustomEvent === "after") {
17155
- flushCustomEventQueue$1();
17156
- }
17157
- };
17158
17327
  if (document.readyState === "interactive" || document.readyState === "complete") {
17159
17328
  init();
17160
17329
  } else {
@@ -17190,6 +17359,7 @@ function record(options = {}) {
17190
17359
  }
17191
17360
  flushCustomEventQueue$1();
17192
17361
  handlers.forEach((h) => h());
17362
+ navigationManager == null ? void 0 : navigationManager.destroy();
17193
17363
  processedNodeManager.destroy();
17194
17364
  recording = false;
17195
17365
  unregisterErrorHandler();
@@ -17258,5 +17428,5 @@ exports.record = record;
17258
17428
  return module.exports;
17259
17429
  }))
17260
17430
  //# sourceMappingURL=rrweb-record.umd.cjs.map
17261
- `;var B={slimDOMOptions:"all",inlineStylesheet:!0,recordDOM:!0,recordCanvas:!0,collectFonts:!0,inlineImages:!0,maskInputOptions:{password:!0},sampling:{mousemove:!1,mouseInteraction:{MouseUp:!1,MouseDown:!1,Click:!0,ContextMenu:!0,DblClick:!0,Focus:!0,Blur:!0,TouchStart:!1,TouchEnd:!1},scroll:100,media:100,input:"last",canvas:"all",visibility:{mode:"none",debounce:50,threshold:.5,sensitivity:.05,rafThrottle:50}},flushCustomEvent:"after",recordAfter:"DOMContentLoaded",userTriggeredOnInput:!0};function C(e,t){let n={...e};for(let r in t){let s=t[r],o=e[r];s&&typeof s=="object"&&!Array.isArray(s)&&o&&typeof o=="object"&&!Array.isArray(o)?n[r]=C(o,s):s!==void 0&&(n[r]=s)}return n}var p=class{recordFn=null;stopFn=null;targetWindow=null;context;eventCounter=0;events=[];recordOptions;pendingEvents=[];recorderScriptVersion="unknown";recorderLibVersion=$.version;constructor(t){this.recordOptions=C(B,t??{}),this.context={pushEvent:n=>this.events.push(n)}}handleEmit(t){if(t.type===0||t.type===1)return;let n={...t};this.context.pushEvent(n)}inject(t){let n=t;if(this.targetWindow=t,n.rrweb){this.recordFn=n.rrweb.record??null;return}let r=t.document.createElement("script");r.type="text/javascript",r.innerHTML=S,t.document.head.appendChild(r);let s=t.rrweb;if(!s||!s.record){console.error(`[${Date.now()}] [recorder] Failed to load rrweb.record`);return}this.recordFn=s.record,this.recorderScriptVersion=this.recordFn.getVersion()}start(){if(!this.targetWindow||!this.recordFn){console.debug(`[${Date.now()}] [recorder] Not ready to start`);return}if(this.stopFn){console.debug(`[${Date.now()}] [recorder] Already recording`);return}this.stopFn=this.recordFn({emit:t=>this.handleEmit(t),plugins:[(0,k.getRecordSequentialIdPlugin)({key:"id",getId:()=>++this.eventCounter})],...this.recordOptions}),this.flush()}stop(){this.flush(),this.stopFn?.(),this.stopFn=null}reset(){this.eventCounter=0,this.events=[],this.stop(),this.context={pushEvent:t=>this.events.push(t)}}flush(){if(!this.recordFn)return;let t=[];for(let n of this.pendingEvents)try{this.recordFn.addCustomEvent(n.tag,n.payload)}catch{console.debug(`[${Date.now()}] [recorder] flush failed for custom event: ${n.tag}`),t.push(n)}this.pendingEvents=t}addCustomEvent(t,n){let r={tag:t,payload:n};if(!this.recordFn||!this.stopFn){console.debug(`[${Date.now()}] [recorder] queued custom event (recorder not ready): ${t}`),this.pendingEvents.push(r);return}try{this.recordFn.addCustomEvent(t,n)}catch(s){console.debug(`[${Date.now()}] [recorder] error adding custom event: ${t}`,s),this.pendingEvents.push(r)}}isRecordingReady(){return!!this.recordFn&&!!this.stopFn}isRecording(){return this.recordFn?.isRecording()||!1}getScriptVersion(){return`@appsurify-testmap/rrweb-record:${this.recorderScriptVersion}`}getLibVersion(){return`@appsurify-testmap/rrweb:${this.recorderLibVersion}`}getEvents(){return this.events}getMirror(){return this.recordFn?.mirror}bind(t){this.context=t}setEventCounter(t){this.eventCounter=t}};var h=p;var y=Cypress.env("testmap")??{},H=typeof y=="object"&&"recordingOpts"in y?y.recordingOpts:h,i=new h(H),_=()=>{Cypress.on("test:before:run",j).on("window:before:load",K).on("window:before:unload",V).on("window:unload",G).on("window:load",Y).on("test:after:run",J).on("command:queue:end",q).on("fail",Z),afterEach(()=>{let e=Cypress.currentTest;if(!e)return;let t=l({titlePath:()=>e.titlePath}),n=u(t);if(!n)return;n.recorderEvents.map(s=>{if(s.type!==5)return s;let o=n.commandLiveRefs.get(s.data.payload.id);return s.data.payload.state=o?.state??"unknown",s.data.payload.args=d(o?.get("args")),s.data.payload.query=o?.get("query"),s.data.payload.timeout=o?.get("timeout"),s.data.payload.name=o?.get("name"),s.data.payload.type=o?.get("type"),o?.get("prev")&&(s.data.payload.prev={state:o?.get("prev").state,name:o?.get("prev").get("name"),args:d(o?.get("prev").get("args")),type:o?.get("prev").get("type"),query:o?.get("prev").get("query"),id:o?.get("prev").get("id")}),o?.get("next")&&(s.data.payload.next={state:o?.get("next").state,name:o?.get("next").get("name"),args:d(o?.get("next").get("args")),type:o?.get("next").get("type"),query:o?.get("next").get("query"),id:o?.get("next").get("id")}),s}),console.debug(`[${Date.now()}] [cypress] afterEach:`,n.recorderEvents);let r=x(n);try{cy.task("saveRRWebReport",{testRunResult:r},{log:!1})}catch(s){console.error(`[${Date.now()}] [cypress] afterEach:saveRRWebReport`,s)}})},j=(e,t)=>{let n=l(t),r={runner:{source:"cypress",type:Cypress.testingType,version:Cypress.version,platform:Cypress.platform,arch:Cypress.arch,recorder:{scriptVersion:i.getLibVersion()||"unknown",libVersion:i.getLibVersion()||"unknown"}},spec:Cypress.spec,test:t,browser:Cypress.browser,autWindow:null,waitForPaint:()=>Promise.resolve(void 0),paintComplete:!1,recorderEvents:[],commandLiveRefs:new Map};v(n,r),i.bind({pushEvent:s=>{if(console.debug(`[${Date.now()}] [cypress] pushEvent`,s),r.recorderEvents.push(s),s.type===5){let f=r.commandLiveRefs.get(s.data.payload.id)?.get("subject"),m=f?.selector,c=i.getMirror()?.getMeta(f?.[0]);s.data.payload.element={...c,selector:m,childNodes:[]}}}})};var V=e=>{},G=e=>{try{i.stop()}catch{}},K=e=>{i.inject(e);let t=Cypress.currentTest;if(!t)return;let n=l({titlePath:()=>t.titlePath}),r=u(n);r&&(r.runner.recorder.scriptVersion=i.getScriptVersion(),r.autWindow=e,r.paintComplete=!1)},Y=e=>{console.debug(`[${Date.now()}] [cypress] onWindowLoad`,e);let t=Cypress.currentTest;if(!t)return;let n=l({titlePath:()=>t.titlePath}),r=u(n);r&&(r.autWindow||(r.autWindow=e,r.paintComplete=!1),r.waitForPaint=s=>new Promise(o=>{let m=()=>{requestAnimationFrame(()=>{requestAnimationFrame(()=>{o(s)})})},a=(()=>{let c=!1;return()=>{c||(c=!0,m())}})();["interactive","complete"].includes(e.document.readyState)?a():(e.addEventListener("DOMContentLoaded",a,{once:!0}),e.addEventListener("load",a,{once:!0}),setTimeout(()=>{console.warn("\u23F3 Timeout: forcing resolution"),a()},5e3))}),r.waitForPaint().then(async()=>{r.paintComplete=!0,i.inject(e),i.start()}))};var q=()=>{},Z=(e,t)=>{throw e},J=async(e,t)=>{console.debug(`[${Date.now()}] [cypress] onTestAfterRun`,e,t),i.stop()};var E=()=>{Cypress.mocha.getRunner().on("hook",Q)},Q=()=>{},I=()=>{beforeEach("",()=>{}),afterEach("",()=>{})};var R=()=>{_(),E(),I()};var T=()=>{R()};0&&(module.exports={initializeTestmap});
17431
+ `;var B={slimDOMOptions:"all",inlineStylesheet:!0,recordDOM:!0,recordCanvas:!0,collectFonts:!0,inlineImages:!0,maskInputOptions:{password:!0},sampling:{mousemove:!1,mouseInteraction:{MouseUp:!1,MouseDown:!1,Click:!0,ContextMenu:!0,DblClick:!0,Focus:!0,Blur:!0,TouchStart:!1,TouchEnd:!1},scroll:100,media:100,input:"last",canvas:"all",visibility:{mode:"none",debounce:50,threshold:.5,sensitivity:.05,rafThrottle:50}},flushCustomEvent:"after",recordAfter:"DOMContentLoaded",userTriggeredOnInput:!0};function C(e,t){let s={...e};for(let r in t){let n=t[r],o=e[r];n&&typeof n=="object"&&!Array.isArray(n)&&o&&typeof o=="object"&&!Array.isArray(o)?s[r]=C(o,n):n!==void 0&&(s[r]=n)}return s}var p=class{recordFn=null;stopFn=null;targetWindow=null;context;eventCounter=0;events=[];recordOptions;pendingEvents=[];recorderScriptVersion="unknown";recorderLibVersion=k.version;constructor(t){this.recordOptions=C(B,t??{}),this.context={pushEvent:s=>this.events.push(s)}}handleEmit(t){if(t.type===0||t.type===1)return;let s={...t};this.context.pushEvent(s)}inject(t){let s=t;if(this.targetWindow=t,s.rrweb){this.recordFn=s.rrweb.record??null;return}let r=t.document.createElement("script");r.type="text/javascript",r.innerHTML=x,t.document.head.appendChild(r);let n=t.rrweb;if(!n||!n.record){console.error(`[${Date.now()}] [recorder] Failed to load rrweb.record`);return}this.recordFn=n.record,this.recorderScriptVersion=this.recordFn.getVersion()}start(){if(!this.targetWindow||!this.recordFn){console.debug(`[${Date.now()}] [recorder] Not ready to start`);return}if(this.stopFn){console.debug(`[${Date.now()}] [recorder] Already recording`);return}this.stopFn=this.recordFn({emit:t=>this.handleEmit(t),plugins:[(0,$.getRecordSequentialIdPlugin)({key:"id",getId:()=>++this.eventCounter})],...this.recordOptions}),this.flush()}stop(){this.flush(),this.stopFn?.(),this.stopFn=null}reset(){this.eventCounter=0,this.events=[],this.stop(),this.context={pushEvent:t=>this.events.push(t)}}flush(){if(!this.recordFn)return;let t=[];for(let s of this.pendingEvents)try{this.recordFn.addCustomEvent(s.tag,s.payload)}catch{console.debug(`[${Date.now()}] [recorder] flush failed for custom event: ${s.tag}`),t.push(s)}this.pendingEvents=t}addCustomEvent(t,s){let r={tag:t,payload:s};if(!this.recordFn||!this.stopFn){console.debug(`[${Date.now()}] [recorder] queued custom event (recorder not ready): ${t}`),this.pendingEvents.push(r);return}try{this.recordFn.addCustomEvent(t,s)}catch(n){console.debug(`[${Date.now()}] [recorder] error adding custom event: ${t}`,n),this.pendingEvents.push(r)}}isRecordingReady(){return!!this.recordFn&&!!this.stopFn}isRecording(){return this.recordFn?.isRecording()||!1}getScriptVersion(){return`@appsurify-testmap/rrweb-record:${this.recorderScriptVersion}`}getLibVersion(){return`@appsurify-testmap/rrweb:${this.recorderLibVersion}`}getEvents(){return this.events}getMirror(){return this.recordFn?.mirror}bind(t){this.context=t}setEventCounter(t){this.eventCounter=t}};var h=p;var y=Cypress.env("testmap")??{},H=typeof y=="object"&&"recordingOpts"in y?y.recordingOpts:h,i=new h(H),_=()=>{Cypress.on("test:before:run",j).on("window:before:load",K).on("window:before:unload",V).on("window:unload",G).on("window:load",Y).on("test:after:run",J).on("command:queue:end",q).on("fail",Z),afterEach(()=>{i.stop();let e=Cypress.currentTest;if(!e)return;let t=l({titlePath:()=>e.titlePath}),s=u(t);if(!s)return;s.recorderEvents.map(n=>{if(n.type!==5)return n;let o=s.commandLiveRefs.get(n.data.payload.id);return n.data.payload.state=o?.state??"unknown",n.data.payload.args=d(o?.get("args")),n.data.payload.query=o?.get("query"),n.data.payload.timeout=o?.get("timeout"),n.data.payload.name=o?.get("name"),n.data.payload.type=o?.get("type"),o?.get("prev")&&(n.data.payload.prev={state:o?.get("prev").state,name:o?.get("prev").get("name"),args:d(o?.get("prev").get("args")),type:o?.get("prev").get("type"),query:o?.get("prev").get("query"),id:o?.get("prev").get("id")}),o?.get("next")&&(n.data.payload.next={state:o?.get("next").state,name:o?.get("next").get("name"),args:d(o?.get("next").get("args")),type:o?.get("next").get("type"),query:o?.get("next").get("query"),id:o?.get("next").get("id")}),n}),console.debug(`[${Date.now()}] [cypress] afterEach:`,s.recorderEvents);let r=S(s);try{cy.task("saveRRWebReport",{testRunResult:r},{log:!1})}catch(n){console.error(`[${Date.now()}] [cypress] afterEach:saveRRWebReport`,n)}})},j=(e,t)=>{let s=l(t),r={runner:{source:"cypress",type:Cypress.testingType,version:Cypress.version,platform:Cypress.platform,arch:Cypress.arch,recorder:{scriptVersion:i.getLibVersion()||"unknown",libVersion:i.getLibVersion()||"unknown"}},spec:Cypress.spec,test:t,browser:Cypress.browser,autWindow:null,waitForPaint:()=>Promise.resolve(void 0),paintComplete:!1,recorderEvents:[],commandLiveRefs:new Map};v(s,r),i.bind({pushEvent:n=>{if(console.debug(`[${Date.now()}] [cypress] pushEvent`,n),r.recorderEvents.push(n),n.type===5){let f=r.commandLiveRefs.get(n.data.payload.id)?.get("subject"),m=f?.selector,c=i.getMirror()?.getMeta(f?.[0]);n.data.payload.element={...c,selector:m,childNodes:[]}}}})};var V=e=>{},G=e=>{try{i.stop()}catch{}},K=e=>{i.inject(e);let t=Cypress.currentTest;if(!t)return;let s=l({titlePath:()=>t.titlePath}),r=u(s);r&&(r.runner.recorder.scriptVersion=i.getScriptVersion(),r.autWindow=e,r.paintComplete=!1)},Y=e=>{console.debug(`[${Date.now()}] [cypress] onWindowLoad`,e);let t=Cypress.currentTest;if(!t)return;let s=l({titlePath:()=>t.titlePath}),r=u(s);r&&(r.autWindow||(r.autWindow=e,r.paintComplete=!1),r.waitForPaint=n=>new Promise(o=>{let m=()=>{requestAnimationFrame(()=>{requestAnimationFrame(()=>{o(n)})})},a=(()=>{let c=!1;return()=>{c||(c=!0,m())}})();["interactive","complete"].includes(e.document.readyState)?a():(e.addEventListener("DOMContentLoaded",a,{once:!0}),e.addEventListener("load",a,{once:!0}),setTimeout(()=>{console.warn("\u23F3 Timeout: forcing resolution"),a()},5e3))}),r.waitForPaint().then(async()=>{r.paintComplete=!0,i.inject(e),i.start()}))};var q=()=>{},Z=(e,t)=>{throw e},J=async(e,t)=>{console.debug(`[${Date.now()}] [cypress] onTestAfterRun`,e,t),i.stop()};var E=()=>{Cypress.mocha.getRunner().on("hook",Q)},Q=()=>{},I=()=>{beforeEach("",()=>{}),afterEach("",()=>{})};var R=()=>{_(),E(),I()};var T=()=>{R()};0&&(module.exports={initializeTestmap});
17262
17432
  //# sourceMappingURL=index.js.map