@appsurify-testmap/rrweb-cypress-plugin 3.1.1-alpha.2 → 3.2.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 +158 -10
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +158 -10
- package/dist/index.mjs.map +1 -1
- package/package.json +5 -5
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
|
|
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 };
|
|
2
2
|
"use strict";
|
|
3
3
|
var __defProp = Object.defineProperty;
|
|
4
4
|
var __defProps = Object.defineProperties;
|
|
@@ -981,7 +981,14 @@ const bt$1 = {
|
|
|
981
981
|
source: "dom-dsl"
|
|
982
982
|
};
|
|
983
983
|
function P$1(r2) {
|
|
984
|
-
|
|
984
|
+
if (/^[a-z]+-\\d+$/i.test(r2) || /^[a-z]+(-[a-z]+)+-\\d+$/i.test(r2) || /^[a-z]+(_[a-z]+)*_\\d+$/i.test(r2) || /^\\d+$/.test(r2) || /^:[a-z0-9]+:$/i.test(r2) || /^[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{12}$/i.test(r2))
|
|
985
|
+
return true;
|
|
986
|
+
if (/^[a-z]{1,3}[A-Za-z0-9]{8,}$/.test(r2)) {
|
|
987
|
+
const t2 = /\\d/.test(r2), e2 = /[A-Z]/.test(r2), s2 = r2.length >= 20;
|
|
988
|
+
if (t2 && e2 || s2)
|
|
989
|
+
return true;
|
|
990
|
+
}
|
|
991
|
+
return !!(/^radix-/.test(r2) || /^mui-\\d+$/.test(r2));
|
|
985
992
|
}
|
|
986
993
|
const Q$1 = /* @__PURE__ */ new Set([
|
|
987
994
|
"aria-labelledby",
|
|
@@ -1182,6 +1189,11 @@ const xt$1 = [
|
|
|
1182
1189
|
/^(rtl|ltr):/,
|
|
1183
1190
|
// === FIX 4: Group and peer variants ===
|
|
1184
1191
|
/^(group|peer)(-hover|-focus|-active)?:/,
|
|
1192
|
+
// === Arbitrary pseudo-class/modifier variants (catch-all) ===
|
|
1193
|
+
// Matches any lowercase/hyphenated prefix followed by colon
|
|
1194
|
+
// e.g., file:bg-transparent, placeholder:text-gray, invalid:border-red, accept:text-primary
|
|
1195
|
+
// Must come AFTER semantic pattern checks to avoid false positives
|
|
1196
|
+
/^[a-z][a-z-]*:/,
|
|
1185
1197
|
// === FIX 4: Tailwind utilities with fraction values ===
|
|
1186
1198
|
/\\/([\\d.]+|full|auto|screen)$/,
|
|
1187
1199
|
// /50, /100, /full, /auto, /screen
|
|
@@ -11752,7 +11764,14 @@ const bt = {
|
|
|
11752
11764
|
source: "dom-dsl"
|
|
11753
11765
|
};
|
|
11754
11766
|
function P(r2) {
|
|
11755
|
-
|
|
11767
|
+
if (/^[a-z]+-\\d+$/i.test(r2) || /^[a-z]+(-[a-z]+)+-\\d+$/i.test(r2) || /^[a-z]+(_[a-z]+)*_\\d+$/i.test(r2) || /^\\d+$/.test(r2) || /^:[a-z0-9]+:$/i.test(r2) || /^[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{12}$/i.test(r2))
|
|
11768
|
+
return true;
|
|
11769
|
+
if (/^[a-z]{1,3}[A-Za-z0-9]{8,}$/.test(r2)) {
|
|
11770
|
+
const t2 = /\\d/.test(r2), e2 = /[A-Z]/.test(r2), s2 = r2.length >= 20;
|
|
11771
|
+
if (t2 && e2 || s2)
|
|
11772
|
+
return true;
|
|
11773
|
+
}
|
|
11774
|
+
return !!(/^radix-/.test(r2) || /^mui-\\d+$/.test(r2));
|
|
11756
11775
|
}
|
|
11757
11776
|
const Q = /* @__PURE__ */ new Set([
|
|
11758
11777
|
"aria-labelledby",
|
|
@@ -11953,6 +11972,11 @@ const xt = [
|
|
|
11953
11972
|
/^(rtl|ltr):/,
|
|
11954
11973
|
// === FIX 4: Group and peer variants ===
|
|
11955
11974
|
/^(group|peer)(-hover|-focus|-active)?:/,
|
|
11975
|
+
// === Arbitrary pseudo-class/modifier variants (catch-all) ===
|
|
11976
|
+
// Matches any lowercase/hyphenated prefix followed by colon
|
|
11977
|
+
// e.g., file:bg-transparent, placeholder:text-gray, invalid:border-red, accept:text-primary
|
|
11978
|
+
// Must come AFTER semantic pattern checks to avoid false positives
|
|
11979
|
+
/^[a-z][a-z-]*:/,
|
|
11956
11980
|
// === FIX 4: Tailwind utilities with fraction values ===
|
|
11957
11981
|
/\\/([\\d.]+|full|auto|screen)$/,
|
|
11958
11982
|
// /50, /100, /full, /auto, /screen
|
|
@@ -13906,6 +13930,30 @@ class MutationBuffer {
|
|
|
13906
13930
|
this.shadowDomManager.reset();
|
|
13907
13931
|
this.canvasManager.reset();
|
|
13908
13932
|
}
|
|
13933
|
+
/**
|
|
13934
|
+
* Clear all accumulated mutation data without emitting.
|
|
13935
|
+
* Used after freeze+debounce checkout \u2014 FullSnapshot already captured the state.
|
|
13936
|
+
*/
|
|
13937
|
+
resetBuffers() {
|
|
13938
|
+
this.addedSet = /* @__PURE__ */ new Set();
|
|
13939
|
+
this.movedSet = /* @__PURE__ */ new Set();
|
|
13940
|
+
this.droppedSet = /* @__PURE__ */ new Set();
|
|
13941
|
+
this.removesSubTreeCache = /* @__PURE__ */ new Set();
|
|
13942
|
+
this.mapRemoves = [];
|
|
13943
|
+
this.movedMap = {};
|
|
13944
|
+
this.attributes = [];
|
|
13945
|
+
this.texts = [];
|
|
13946
|
+
this.attributeMap = /* @__PURE__ */ new WeakMap();
|
|
13947
|
+
this.removes = [];
|
|
13948
|
+
}
|
|
13949
|
+
/**
|
|
13950
|
+
* Clear frozen flag without triggering emit.
|
|
13951
|
+
* Used after freeze+debounce checkout \u2014 buffers already cleared by resetBuffers().
|
|
13952
|
+
*/
|
|
13953
|
+
unsetFrozen() {
|
|
13954
|
+
this.frozen = false;
|
|
13955
|
+
this.canvasManager.unfreeze();
|
|
13956
|
+
}
|
|
13909
13957
|
}
|
|
13910
13958
|
function deepDelete(addsSet, n2) {
|
|
13911
13959
|
addsSet.delete(n2);
|
|
@@ -16326,11 +16374,15 @@ class VisibilityManager {
|
|
|
16326
16374
|
}
|
|
16327
16375
|
flushBuffer() {
|
|
16328
16376
|
var _a2;
|
|
16377
|
+
if (this.frozen || this.locked)
|
|
16378
|
+
return;
|
|
16329
16379
|
if (this.buffer.size === 0)
|
|
16330
16380
|
return;
|
|
16331
|
-
|
|
16332
|
-
|
|
16381
|
+
const mutations = Array.from(this.buffer.values());
|
|
16382
|
+
const count = mutations.length;
|
|
16333
16383
|
this.buffer.clear();
|
|
16384
|
+
this.mutationCb({ mutations });
|
|
16385
|
+
(_a2 = this.notifyActivity) == null ? void 0 : _a2.call(this, count);
|
|
16334
16386
|
}
|
|
16335
16387
|
observe(el) {
|
|
16336
16388
|
if (this.disabled)
|
|
@@ -16346,6 +16398,10 @@ class VisibilityManager {
|
|
|
16346
16398
|
}
|
|
16347
16399
|
freeze() {
|
|
16348
16400
|
this.frozen = true;
|
|
16401
|
+
if (this.debounceTimer) {
|
|
16402
|
+
clearTimeout(this.debounceTimer);
|
|
16403
|
+
this.debounceTimer = null;
|
|
16404
|
+
}
|
|
16349
16405
|
}
|
|
16350
16406
|
unfreeze() {
|
|
16351
16407
|
this.frozen = false;
|
|
@@ -16353,9 +16409,33 @@ class VisibilityManager {
|
|
|
16353
16409
|
}
|
|
16354
16410
|
lock() {
|
|
16355
16411
|
this.locked = true;
|
|
16412
|
+
if (this.debounceTimer) {
|
|
16413
|
+
clearTimeout(this.debounceTimer);
|
|
16414
|
+
this.debounceTimer = null;
|
|
16415
|
+
}
|
|
16356
16416
|
}
|
|
16357
16417
|
unlock() {
|
|
16358
16418
|
this.locked = false;
|
|
16419
|
+
this.buffer.clear();
|
|
16420
|
+
if (this.debounceTimer) {
|
|
16421
|
+
clearTimeout(this.debounceTimer);
|
|
16422
|
+
this.debounceTimer = null;
|
|
16423
|
+
}
|
|
16424
|
+
if (!this.disabled && this.elements.size > 0) {
|
|
16425
|
+
this.previousState = computeVisibility(this.elements, /* @__PURE__ */ new Map(), {
|
|
16426
|
+
root: this.root,
|
|
16427
|
+
threshold: this.threshold,
|
|
16428
|
+
sensitivity: this.sensitivity,
|
|
16429
|
+
rootMargin: this.rootMargin
|
|
16430
|
+
});
|
|
16431
|
+
}
|
|
16432
|
+
}
|
|
16433
|
+
/**
|
|
16434
|
+
* Clear frozen flag without triggering flush.
|
|
16435
|
+
* Used after freeze+debounce checkout \u2014 buffer already cleared by unlock().
|
|
16436
|
+
*/
|
|
16437
|
+
unsetFrozen() {
|
|
16438
|
+
this.frozen = false;
|
|
16359
16439
|
}
|
|
16360
16440
|
reset() {
|
|
16361
16441
|
this.elements.clear();
|
|
@@ -16458,7 +16538,7 @@ class ProcessedNodeManager {
|
|
|
16458
16538
|
destroy() {
|
|
16459
16539
|
}
|
|
16460
16540
|
}
|
|
16461
|
-
const version$1 = "3.1.1-alpha.
|
|
16541
|
+
const version$1 = "3.1.1-alpha.3";
|
|
16462
16542
|
let wrappedEmit;
|
|
16463
16543
|
let takeFullSnapshot$1;
|
|
16464
16544
|
let canvasManager;
|
|
@@ -16512,6 +16592,7 @@ function record(options = {}) {
|
|
|
16512
16592
|
checkoutEveryNms,
|
|
16513
16593
|
checkoutEveryNth,
|
|
16514
16594
|
checkoutEveryNvm,
|
|
16595
|
+
checkoutDebounce,
|
|
16515
16596
|
blockClass = "rr-block",
|
|
16516
16597
|
blockSelector = null,
|
|
16517
16598
|
ignoreClass = "rr-ignore",
|
|
@@ -16606,6 +16687,10 @@ function record(options = {}) {
|
|
|
16606
16687
|
let lastFullSnapshotEvent;
|
|
16607
16688
|
let incrementalSnapshotCount = 0;
|
|
16608
16689
|
let visibilityMutationCount = 0;
|
|
16690
|
+
let checkoutId = 0;
|
|
16691
|
+
let checkoutPending = false;
|
|
16692
|
+
let checkoutDebounceTimer = null;
|
|
16693
|
+
let checkoutFreezeTimestamp = null;
|
|
16609
16694
|
const eventProcessor = (e2) => {
|
|
16610
16695
|
for (const plugin3 of plugins || []) {
|
|
16611
16696
|
if (plugin3.eventProcessor) {
|
|
@@ -16618,11 +16703,25 @@ function record(options = {}) {
|
|
|
16618
16703
|
}
|
|
16619
16704
|
return e2;
|
|
16620
16705
|
};
|
|
16706
|
+
const executeCheckout = () => {
|
|
16707
|
+
checkoutDebounceTimer = null;
|
|
16708
|
+
checkoutPending = false;
|
|
16709
|
+
checkoutFreezeTimestamp = null;
|
|
16710
|
+
takeFullSnapshot$1(true);
|
|
16711
|
+
mutationBuffers.forEach((buf) => {
|
|
16712
|
+
buf.resetBuffers();
|
|
16713
|
+
buf.unsetFrozen();
|
|
16714
|
+
});
|
|
16715
|
+
if (visibilityManager) {
|
|
16716
|
+
visibilityManager.unsetFrozen();
|
|
16717
|
+
}
|
|
16718
|
+
};
|
|
16621
16719
|
wrappedEmit = (r2, isCheckout) => {
|
|
16622
16720
|
var _a2;
|
|
16623
16721
|
const e2 = r2;
|
|
16624
16722
|
e2.timestamp = nowTimestamp();
|
|
16625
|
-
|
|
16723
|
+
e2.checkoutId = checkoutId;
|
|
16724
|
+
if (((_a2 = mutationBuffers[0]) == null ? void 0 : _a2.isFrozen()) && !checkoutPending && e2.type !== EventType.FullSnapshot && !(e2.type === EventType.IncrementalSnapshot && e2.data.source === IncrementalSource.Mutation)) {
|
|
16626
16725
|
mutationBuffers.forEach((buf) => buf.unfreeze());
|
|
16627
16726
|
visibilityManager == null ? void 0 : visibilityManager.unfreeze();
|
|
16628
16727
|
}
|
|
@@ -16649,7 +16748,29 @@ function record(options = {}) {
|
|
|
16649
16748
|
const exceedCount = checkoutEveryNth && incrementalSnapshotCount >= checkoutEveryNth;
|
|
16650
16749
|
const exceedTime = checkoutEveryNms && e2.timestamp - lastFullSnapshotEvent.timestamp > checkoutEveryNms;
|
|
16651
16750
|
if (exceedCount || exceedTime) {
|
|
16652
|
-
|
|
16751
|
+
if (checkoutDebounce) {
|
|
16752
|
+
if (!checkoutPending) {
|
|
16753
|
+
checkoutPending = true;
|
|
16754
|
+
checkoutFreezeTimestamp = nowTimestamp();
|
|
16755
|
+
mutationBuffers.forEach((buf) => buf.freeze());
|
|
16756
|
+
visibilityManager == null ? void 0 : visibilityManager.freeze();
|
|
16757
|
+
}
|
|
16758
|
+
if (checkoutDebounceTimer) {
|
|
16759
|
+
clearTimeout(checkoutDebounceTimer);
|
|
16760
|
+
}
|
|
16761
|
+
const frozenDuration = nowTimestamp() - checkoutFreezeTimestamp;
|
|
16762
|
+
const maxFreeze = checkoutDebounce * 3;
|
|
16763
|
+
if (frozenDuration >= maxFreeze) {
|
|
16764
|
+
executeCheckout();
|
|
16765
|
+
} else {
|
|
16766
|
+
checkoutDebounceTimer = setTimeout(
|
|
16767
|
+
() => executeCheckout(),
|
|
16768
|
+
checkoutDebounce
|
|
16769
|
+
);
|
|
16770
|
+
}
|
|
16771
|
+
} else {
|
|
16772
|
+
takeFullSnapshot$1(true);
|
|
16773
|
+
}
|
|
16653
16774
|
}
|
|
16654
16775
|
}
|
|
16655
16776
|
}
|
|
@@ -16759,8 +16880,30 @@ function record(options = {}) {
|
|
|
16759
16880
|
notifyActivity: checkoutEveryNvm != null ? (count) => {
|
|
16760
16881
|
visibilityMutationCount += count;
|
|
16761
16882
|
if (visibilityMutationCount >= checkoutEveryNvm) {
|
|
16762
|
-
takeFullSnapshot$1(true);
|
|
16763
16883
|
visibilityMutationCount = 0;
|
|
16884
|
+
if (checkoutDebounce) {
|
|
16885
|
+
if (!checkoutPending) {
|
|
16886
|
+
checkoutPending = true;
|
|
16887
|
+
checkoutFreezeTimestamp = nowTimestamp();
|
|
16888
|
+
mutationBuffers.forEach((buf) => buf.freeze());
|
|
16889
|
+
visibilityManager == null ? void 0 : visibilityManager.freeze();
|
|
16890
|
+
}
|
|
16891
|
+
if (checkoutDebounceTimer) {
|
|
16892
|
+
clearTimeout(checkoutDebounceTimer);
|
|
16893
|
+
}
|
|
16894
|
+
const frozenDuration = nowTimestamp() - checkoutFreezeTimestamp;
|
|
16895
|
+
const maxFreeze = checkoutDebounce * 3;
|
|
16896
|
+
if (frozenDuration >= maxFreeze) {
|
|
16897
|
+
executeCheckout();
|
|
16898
|
+
} else {
|
|
16899
|
+
checkoutDebounceTimer = setTimeout(
|
|
16900
|
+
() => executeCheckout(),
|
|
16901
|
+
checkoutDebounce
|
|
16902
|
+
);
|
|
16903
|
+
}
|
|
16904
|
+
} else {
|
|
16905
|
+
takeFullSnapshot$1(true);
|
|
16906
|
+
}
|
|
16764
16907
|
}
|
|
16765
16908
|
} : void 0
|
|
16766
16909
|
});
|
|
@@ -16769,6 +16912,7 @@ function record(options = {}) {
|
|
|
16769
16912
|
if (!recordDOM) {
|
|
16770
16913
|
return;
|
|
16771
16914
|
}
|
|
16915
|
+
checkoutId++;
|
|
16772
16916
|
wrappedEmit(
|
|
16773
16917
|
{
|
|
16774
16918
|
type: EventType.Meta,
|
|
@@ -17040,6 +17184,10 @@ function record(options = {}) {
|
|
|
17040
17184
|
);
|
|
17041
17185
|
}
|
|
17042
17186
|
return () => {
|
|
17187
|
+
if (checkoutDebounceTimer) {
|
|
17188
|
+
clearTimeout(checkoutDebounceTimer);
|
|
17189
|
+
checkoutDebounceTimer = null;
|
|
17190
|
+
}
|
|
17043
17191
|
flushCustomEventQueue$1();
|
|
17044
17192
|
handlers.forEach((h) => h());
|
|
17045
17193
|
processedNodeManager.destroy();
|
|
@@ -17110,5 +17258,5 @@ exports.record = record;
|
|
|
17110
17258
|
return module.exports;
|
|
17111
17259
|
}))
|
|
17112
17260
|
//# sourceMappingURL=rrweb-record.umd.cjs.map
|
|
17113
|
-
`;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=
|
|
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});
|
|
17114
17262
|
//# sourceMappingURL=index.js.map
|