@appsurify-testmap/rrweb-playwright-plugin 3.1.1-alpha.3 → 3.3.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 +360 -64
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +359 -63
- package/dist/index.mjs.map +1 -1
- package/package.json +4 -4
package/dist/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";var O=Object.create;var f=Object.defineProperty;var P=Object.getOwnPropertyDescriptor;var
|
|
1
|
+
"use strict";var O=Object.create;var f=Object.defineProperty;var P=Object.getOwnPropertyDescriptor;var D=Object.getOwnPropertyNames;var L=Object.getPrototypeOf,F=Object.prototype.hasOwnProperty;var U=(t,e)=>{for(var n in e)f(t,n,{get:e[n],enumerable:!0})},$=(t,e,n,r)=>{if(e&&typeof e=="object"||typeof e=="function")for(let s of D(e))!F.call(t,s)&&s!==n&&f(t,s,{get:()=>e[s],enumerable:!(r=P(e,s))||r.enumerable});return t};var b=(t,e,n)=>(n=t!=null?O(L(t)):{},$(e||!t||!t.__esModule?f(n,"default",{value:t,enumerable:!0}):n,t)),z=t=>$(f({},"__esModule",{value:!0}),t);var Y={};U(Y,{expect:()=>y.expect,test:()=>k});module.exports=z(Y);var y=require("@playwright/test");var w=b(require("os")),p=b(require("path")),d=b(require("fs")),B="test-results/playwright/ui";function W(t,e){let n=p.default.dirname(t),r=p.default.join(n,`.${p.default.basename(t)}.tmp-${process.pid}-${Date.now()}`);d.default.mkdirSync(n,{recursive:!0}),d.default.writeFileSync(r,e,"utf-8"),d.default.renameSync(r,t)}function j(t){try{if(!d.default.existsSync(t))return[];let e=d.default.readFileSync(t,"utf-8").trim();if(!e)return[];let n=JSON.parse(e);return Array.isArray(n)?n:[]}catch{return[]}}function C(t,e){let n=e!==void 0?e:B,r=v(t.spec.name),s=v(t.test.suite?.title),o=v(t.test.title),i=t.browser.name,c=`${s?s+"-":""}${o}.json`,u=p.default.join(n,r,i,c),h={events:t.recorderEvents,metadata:{runner:t.runner,spec:t.spec,suite:t.test.suite,test:t.test,browser:t.browser}};d.default.mkdirSync(n,{recursive:!0}),d.default.mkdirSync(p.default.dirname(u),{recursive:!0}),d.default.writeFileSync(u,JSON.stringify(h,null,2),"utf-8"),console.log(`[ui-coverage] Saved report to ${u}`);try{let a=p.default.join(n,"ui-coverage-aggregated.json"),l=j(a);l.push(h),W(a,JSON.stringify(l,null,2)),console.log(`[ui-coverage] Updated aggregate: ${a}`)}catch(a){console.warn("[ui-coverage] Failed to update aggregate report:",a)}}function v(t){return(t??"").trim().replace(/[\s:/\\<>|"'?*]+/g,"-").replace(/-+/g,"-").replace(/^-|-$/g,"")}function _(t,e){let n=t.browserType(),r=t.version(),s=n.name(),o=e.file,i=o.replace(process.cwd(),"").replace(/^[/\\]/,""),c=i.split(/[\\/]/).pop()??"",[u,h]=c.split(/\.(?=[^\\.]+$)/),a=e.titlePath.slice(1,-1),l=a.join(" > ")||"Root Suite";return{runner:{source:"playwright",type:"unknown",version:e.config.version,platform:w.default.platform(),arch:w.default.arch(),recorder:{scriptVersion:"unknown",libVersion:"unknown"}},spec:{name:c,relative:i,absolute:o,baseName:c,fileName:u,fileExtension:h,id:i},test:{suite:{id:a.join("::")||"root",invocationDetails:{absoluteFile:o,column:e.column??0,line:e.line??0,fileUrl:void 0,function:void 0,originalFile:void 0,relativeFile:i},pending:!1,root:a.length===0,title:l,type:"unknown"},id:e.testId,title:e.title,titlePath:e.titlePath.slice(1),fullTitle:e.titlePath.slice(1).join(" "),file:e.file,invocationDetails:{absoluteFile:o,column:e.column,line:e.line,fileUrl:"",relativeFile:i},state:e.status,duration:e.duration,pending:!1,sync:!1,timedOut:void 0,type:""},browser:{name:s,family:s,version:r,majorVersion:parseInt(r.split(".")[0],10),displayName:e.project.use?.channel?.toUpperCase?.()??s.charAt(0).toUpperCase()+s.slice(1),channel:e.project.use?.channel??"",path:n.executablePath()},recorderEvents:[]}}function S(t,e){let n={...t};for(let r in e){let s=e[r],o=t[r];s&&typeof s=="object"&&!Array.isArray(s)&&o&&typeof o=="object"&&!Array.isArray(o)?n[r]=S(o,s):s!==void 0&&(n[r]=s)}return n}async function E(t,e=500){let n=Date.now(),r=t.getEvents().length;return new Promise(s=>{let o=setInterval(()=>{let i=t.getEvents().length;(i===r||Date.now()-n>e)&&(clearInterval(o),s()),r=i},50)})}async function I(t){await t.evaluate(()=>new Promise(e=>requestAnimationFrame(()=>e())))}var H={i8:Int8Array,ui8:Uint8Array,ui8c:Uint8ClampedArray,i16:Int16Array,ui16:Uint16Array,i32:Int32Array,ui32:Uint32Array,f32:Float32Array,f64:Float64Array,bi64:BigInt64Array,bui64:BigUint64Array},Z=new Map(Object.entries(H).map(([t,e])=>[e,t]));var R=`(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;
|
|
@@ -13930,6 +13930,30 @@ class MutationBuffer {
|
|
|
13930
13930
|
this.shadowDomManager.reset();
|
|
13931
13931
|
this.canvasManager.reset();
|
|
13932
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
|
+
}
|
|
13933
13957
|
}
|
|
13934
13958
|
function deepDelete(addsSet, n2) {
|
|
13935
13959
|
addsSet.delete(n2);
|
|
@@ -14249,6 +14273,7 @@ function initNavigationObserver({
|
|
|
14249
14273
|
doc,
|
|
14250
14274
|
sampling
|
|
14251
14275
|
}) {
|
|
14276
|
+
var _a2;
|
|
14252
14277
|
if (sampling.navigation === false) {
|
|
14253
14278
|
return () => {
|
|
14254
14279
|
};
|
|
@@ -14299,6 +14324,30 @@ function initNavigationObserver({
|
|
|
14299
14324
|
handlers.push(restoreReplaceState);
|
|
14300
14325
|
handlers.push(on("popstate", () => emitNavigation("popstate"), win));
|
|
14301
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
|
+
}
|
|
14302
14351
|
return callbackWrapper(() => {
|
|
14303
14352
|
handlers.forEach((h) => h());
|
|
14304
14353
|
});
|
|
@@ -16350,11 +16399,15 @@ class VisibilityManager {
|
|
|
16350
16399
|
}
|
|
16351
16400
|
flushBuffer() {
|
|
16352
16401
|
var _a2;
|
|
16402
|
+
if (this.frozen || this.locked)
|
|
16403
|
+
return;
|
|
16353
16404
|
if (this.buffer.size === 0)
|
|
16354
16405
|
return;
|
|
16355
|
-
|
|
16356
|
-
|
|
16406
|
+
const mutations = Array.from(this.buffer.values());
|
|
16407
|
+
const count = mutations.length;
|
|
16357
16408
|
this.buffer.clear();
|
|
16409
|
+
this.mutationCb({ mutations });
|
|
16410
|
+
(_a2 = this.notifyActivity) == null ? void 0 : _a2.call(this, count);
|
|
16358
16411
|
}
|
|
16359
16412
|
observe(el) {
|
|
16360
16413
|
if (this.disabled)
|
|
@@ -16370,6 +16423,10 @@ class VisibilityManager {
|
|
|
16370
16423
|
}
|
|
16371
16424
|
freeze() {
|
|
16372
16425
|
this.frozen = true;
|
|
16426
|
+
if (this.debounceTimer) {
|
|
16427
|
+
clearTimeout(this.debounceTimer);
|
|
16428
|
+
this.debounceTimer = null;
|
|
16429
|
+
}
|
|
16373
16430
|
}
|
|
16374
16431
|
unfreeze() {
|
|
16375
16432
|
this.frozen = false;
|
|
@@ -16377,9 +16434,33 @@ class VisibilityManager {
|
|
|
16377
16434
|
}
|
|
16378
16435
|
lock() {
|
|
16379
16436
|
this.locked = true;
|
|
16437
|
+
if (this.debounceTimer) {
|
|
16438
|
+
clearTimeout(this.debounceTimer);
|
|
16439
|
+
this.debounceTimer = null;
|
|
16440
|
+
}
|
|
16380
16441
|
}
|
|
16381
16442
|
unlock() {
|
|
16382
16443
|
this.locked = false;
|
|
16444
|
+
this.buffer.clear();
|
|
16445
|
+
if (this.debounceTimer) {
|
|
16446
|
+
clearTimeout(this.debounceTimer);
|
|
16447
|
+
this.debounceTimer = null;
|
|
16448
|
+
}
|
|
16449
|
+
if (!this.disabled && this.elements.size > 0) {
|
|
16450
|
+
this.previousState = computeVisibility(this.elements, /* @__PURE__ */ new Map(), {
|
|
16451
|
+
root: this.root,
|
|
16452
|
+
threshold: this.threshold,
|
|
16453
|
+
sensitivity: this.sensitivity,
|
|
16454
|
+
rootMargin: this.rootMargin
|
|
16455
|
+
});
|
|
16456
|
+
}
|
|
16457
|
+
}
|
|
16458
|
+
/**
|
|
16459
|
+
* Clear frozen flag without triggering flush.
|
|
16460
|
+
* Used after freeze+debounce checkout \u2014 buffer already cleared by unlock().
|
|
16461
|
+
*/
|
|
16462
|
+
unsetFrozen() {
|
|
16463
|
+
this.frozen = false;
|
|
16383
16464
|
}
|
|
16384
16465
|
reset() {
|
|
16385
16466
|
this.elements.clear();
|
|
@@ -16395,6 +16476,170 @@ class VisibilityManager {
|
|
|
16395
16476
|
}
|
|
16396
16477
|
}
|
|
16397
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
|
+
this.reset();
|
|
16556
|
+
this.disabled = true;
|
|
16557
|
+
}
|
|
16558
|
+
startDebounce() {
|
|
16559
|
+
this.debounceTimer = setTimeout(() => {
|
|
16560
|
+
this.debounceTimer = null;
|
|
16561
|
+
this.startDOMSettling();
|
|
16562
|
+
}, this.debounceMs);
|
|
16563
|
+
}
|
|
16564
|
+
startDOMSettling() {
|
|
16565
|
+
if (this.frozen || this.locked || this.disabled)
|
|
16566
|
+
return;
|
|
16567
|
+
this.lastMutationTime = performance.now();
|
|
16568
|
+
const ObserverCtor = mutationObserverCtor();
|
|
16569
|
+
this.settlingObserver = new ObserverCtor(() => {
|
|
16570
|
+
this.lastMutationTime = performance.now();
|
|
16571
|
+
if (this.settleCheckTimer !== null) {
|
|
16572
|
+
clearTimeout(this.settleCheckTimer);
|
|
16573
|
+
}
|
|
16574
|
+
this.settleCheckTimer = setTimeout(
|
|
16575
|
+
() => this.checkSettled(),
|
|
16576
|
+
this.settleTimeout
|
|
16577
|
+
);
|
|
16578
|
+
});
|
|
16579
|
+
this.settlingObserver.observe(this.doc, {
|
|
16580
|
+
childList: true,
|
|
16581
|
+
subtree: true,
|
|
16582
|
+
attributes: true,
|
|
16583
|
+
characterData: true
|
|
16584
|
+
});
|
|
16585
|
+
this.settleCheckTimer = setTimeout(
|
|
16586
|
+
() => this.checkSettled(),
|
|
16587
|
+
this.settleTimeout
|
|
16588
|
+
);
|
|
16589
|
+
this.maxWaitTimer = setTimeout(() => {
|
|
16590
|
+
this.maxWaitTimer = null;
|
|
16591
|
+
this.completeSettling();
|
|
16592
|
+
}, this.maxWait);
|
|
16593
|
+
}
|
|
16594
|
+
checkSettled() {
|
|
16595
|
+
this.settleCheckTimer = null;
|
|
16596
|
+
const elapsed = performance.now() - this.lastMutationTime;
|
|
16597
|
+
if (elapsed >= this.settleTimeout) {
|
|
16598
|
+
this.completeSettling();
|
|
16599
|
+
} else {
|
|
16600
|
+
this.settleCheckTimer = setTimeout(
|
|
16601
|
+
() => this.checkSettled(),
|
|
16602
|
+
this.settleTimeout - elapsed
|
|
16603
|
+
);
|
|
16604
|
+
}
|
|
16605
|
+
}
|
|
16606
|
+
completeSettling() {
|
|
16607
|
+
if (this.frozen || this.locked || this.disabled)
|
|
16608
|
+
return;
|
|
16609
|
+
if (!this.pendingNavigation)
|
|
16610
|
+
return;
|
|
16611
|
+
this.cancelTimers();
|
|
16612
|
+
this.disconnectSettlingObserver();
|
|
16613
|
+
this.pendingNavigation = null;
|
|
16614
|
+
requestAnimationFrame(() => {
|
|
16615
|
+
requestAnimationFrame(() => {
|
|
16616
|
+
if (!this.frozen && !this.locked && !this.disabled) {
|
|
16617
|
+
this.onSnapshot(true);
|
|
16618
|
+
}
|
|
16619
|
+
});
|
|
16620
|
+
});
|
|
16621
|
+
}
|
|
16622
|
+
cancelTimers() {
|
|
16623
|
+
if (this.debounceTimer !== null) {
|
|
16624
|
+
clearTimeout(this.debounceTimer);
|
|
16625
|
+
this.debounceTimer = null;
|
|
16626
|
+
}
|
|
16627
|
+
if (this.settleCheckTimer !== null) {
|
|
16628
|
+
clearTimeout(this.settleCheckTimer);
|
|
16629
|
+
this.settleCheckTimer = null;
|
|
16630
|
+
}
|
|
16631
|
+
if (this.maxWaitTimer !== null) {
|
|
16632
|
+
clearTimeout(this.maxWaitTimer);
|
|
16633
|
+
this.maxWaitTimer = null;
|
|
16634
|
+
}
|
|
16635
|
+
}
|
|
16636
|
+
disconnectSettlingObserver() {
|
|
16637
|
+
if (this.settlingObserver) {
|
|
16638
|
+
this.settlingObserver.disconnect();
|
|
16639
|
+
this.settlingObserver = null;
|
|
16640
|
+
}
|
|
16641
|
+
}
|
|
16642
|
+
}
|
|
16398
16643
|
class StylesheetManager {
|
|
16399
16644
|
constructor(options) {
|
|
16400
16645
|
__publicField(this, "trackedLinkElements", /* @__PURE__ */ new WeakSet());
|
|
@@ -16482,43 +16727,13 @@ class ProcessedNodeManager {
|
|
|
16482
16727
|
destroy() {
|
|
16483
16728
|
}
|
|
16484
16729
|
}
|
|
16485
|
-
const version$1 = "3.
|
|
16730
|
+
const version$1 = "3.3.0-alpha.1";
|
|
16486
16731
|
let wrappedEmit;
|
|
16487
16732
|
let takeFullSnapshot$1;
|
|
16488
16733
|
let canvasManager;
|
|
16489
16734
|
let recording = false;
|
|
16490
16735
|
const customEventQueue = [];
|
|
16491
16736
|
let flushCustomEventQueue$1;
|
|
16492
|
-
function waitForDOMStabilization(win) {
|
|
16493
|
-
const maxWaitMs = 5e3;
|
|
16494
|
-
return new Promise((resolve2) => {
|
|
16495
|
-
const captureAfterPaint = () => {
|
|
16496
|
-
requestAnimationFrame(() => {
|
|
16497
|
-
requestAnimationFrame(() => {
|
|
16498
|
-
resolve2();
|
|
16499
|
-
});
|
|
16500
|
-
});
|
|
16501
|
-
};
|
|
16502
|
-
const safeResolve = /* @__PURE__ */ (() => {
|
|
16503
|
-
let called = false;
|
|
16504
|
-
return () => {
|
|
16505
|
-
if (!called) {
|
|
16506
|
-
called = true;
|
|
16507
|
-
captureAfterPaint();
|
|
16508
|
-
}
|
|
16509
|
-
};
|
|
16510
|
-
})();
|
|
16511
|
-
if (["interactive", "complete"].includes(win.document.readyState)) {
|
|
16512
|
-
safeResolve();
|
|
16513
|
-
} else {
|
|
16514
|
-
win.addEventListener("DOMContentLoaded", safeResolve, { once: true });
|
|
16515
|
-
win.addEventListener("load", safeResolve, { once: true });
|
|
16516
|
-
setTimeout(() => {
|
|
16517
|
-
safeResolve();
|
|
16518
|
-
}, maxWaitMs);
|
|
16519
|
-
}
|
|
16520
|
-
});
|
|
16521
|
-
}
|
|
16522
16737
|
try {
|
|
16523
16738
|
if (Array.from([1], (x2) => x2 * 2)[0] !== 2) {
|
|
16524
16739
|
const cleanFrame = document.createElement("iframe");
|
|
@@ -16536,6 +16751,7 @@ function record(options = {}) {
|
|
|
16536
16751
|
checkoutEveryNms,
|
|
16537
16752
|
checkoutEveryNth,
|
|
16538
16753
|
checkoutEveryNvm,
|
|
16754
|
+
checkoutDebounce,
|
|
16539
16755
|
blockClass = "rr-block",
|
|
16540
16756
|
blockSelector = null,
|
|
16541
16757
|
ignoreClass = "rr-ignore",
|
|
@@ -16630,6 +16846,10 @@ function record(options = {}) {
|
|
|
16630
16846
|
let lastFullSnapshotEvent;
|
|
16631
16847
|
let incrementalSnapshotCount = 0;
|
|
16632
16848
|
let visibilityMutationCount = 0;
|
|
16849
|
+
let checkoutId = 0;
|
|
16850
|
+
let checkoutPending = false;
|
|
16851
|
+
let checkoutDebounceTimer = null;
|
|
16852
|
+
let checkoutFreezeTimestamp = null;
|
|
16633
16853
|
const eventProcessor = (e2) => {
|
|
16634
16854
|
for (const plugin3 of plugins || []) {
|
|
16635
16855
|
if (plugin3.eventProcessor) {
|
|
@@ -16642,13 +16862,32 @@ function record(options = {}) {
|
|
|
16642
16862
|
}
|
|
16643
16863
|
return e2;
|
|
16644
16864
|
};
|
|
16865
|
+
const executeCheckout = () => {
|
|
16866
|
+
checkoutDebounceTimer = null;
|
|
16867
|
+
checkoutPending = false;
|
|
16868
|
+
checkoutFreezeTimestamp = null;
|
|
16869
|
+
navigationManager == null ? void 0 : navigationManager.cancelPending();
|
|
16870
|
+
takeFullSnapshot$1(true);
|
|
16871
|
+
mutationBuffers.forEach((buf) => {
|
|
16872
|
+
buf.resetBuffers();
|
|
16873
|
+
buf.unsetFrozen();
|
|
16874
|
+
});
|
|
16875
|
+
if (visibilityManager) {
|
|
16876
|
+
visibilityManager.unsetFrozen();
|
|
16877
|
+
}
|
|
16878
|
+
if (navigationManager) {
|
|
16879
|
+
navigationManager.unsetFrozen();
|
|
16880
|
+
}
|
|
16881
|
+
};
|
|
16645
16882
|
wrappedEmit = (r2, isCheckout) => {
|
|
16646
16883
|
var _a2;
|
|
16647
16884
|
const e2 = r2;
|
|
16648
16885
|
e2.timestamp = nowTimestamp();
|
|
16649
|
-
|
|
16886
|
+
e2.checkoutId = checkoutId;
|
|
16887
|
+
if (((_a2 = mutationBuffers[0]) == null ? void 0 : _a2.isFrozen()) && !checkoutPending && e2.type !== EventType.FullSnapshot && !(e2.type === EventType.IncrementalSnapshot && e2.data.source === IncrementalSource.Mutation)) {
|
|
16650
16888
|
mutationBuffers.forEach((buf) => buf.unfreeze());
|
|
16651
16889
|
visibilityManager == null ? void 0 : visibilityManager.unfreeze();
|
|
16890
|
+
navigationManager == null ? void 0 : navigationManager.unfreeze();
|
|
16652
16891
|
}
|
|
16653
16892
|
if (inEmittingFrame) {
|
|
16654
16893
|
emit == null ? void 0 : emit(eventProcessor(e2), isCheckout);
|
|
@@ -16673,7 +16912,29 @@ function record(options = {}) {
|
|
|
16673
16912
|
const exceedCount = checkoutEveryNth && incrementalSnapshotCount >= checkoutEveryNth;
|
|
16674
16913
|
const exceedTime = checkoutEveryNms && e2.timestamp - lastFullSnapshotEvent.timestamp > checkoutEveryNms;
|
|
16675
16914
|
if (exceedCount || exceedTime) {
|
|
16676
|
-
|
|
16915
|
+
if (checkoutDebounce) {
|
|
16916
|
+
if (!checkoutPending) {
|
|
16917
|
+
checkoutPending = true;
|
|
16918
|
+
checkoutFreezeTimestamp = nowTimestamp();
|
|
16919
|
+
mutationBuffers.forEach((buf) => buf.freeze());
|
|
16920
|
+
visibilityManager == null ? void 0 : visibilityManager.freeze();
|
|
16921
|
+
}
|
|
16922
|
+
if (checkoutDebounceTimer) {
|
|
16923
|
+
clearTimeout(checkoutDebounceTimer);
|
|
16924
|
+
}
|
|
16925
|
+
const frozenDuration = nowTimestamp() - checkoutFreezeTimestamp;
|
|
16926
|
+
const maxFreeze = checkoutDebounce * 3;
|
|
16927
|
+
if (frozenDuration >= maxFreeze) {
|
|
16928
|
+
executeCheckout();
|
|
16929
|
+
} else {
|
|
16930
|
+
checkoutDebounceTimer = setTimeout(
|
|
16931
|
+
() => executeCheckout(),
|
|
16932
|
+
checkoutDebounce
|
|
16933
|
+
);
|
|
16934
|
+
}
|
|
16935
|
+
} else {
|
|
16936
|
+
takeFullSnapshot$1(true);
|
|
16937
|
+
}
|
|
16677
16938
|
}
|
|
16678
16939
|
}
|
|
16679
16940
|
}
|
|
@@ -16783,8 +17044,30 @@ function record(options = {}) {
|
|
|
16783
17044
|
notifyActivity: checkoutEveryNvm != null ? (count) => {
|
|
16784
17045
|
visibilityMutationCount += count;
|
|
16785
17046
|
if (visibilityMutationCount >= checkoutEveryNvm) {
|
|
16786
|
-
takeFullSnapshot$1(true);
|
|
16787
17047
|
visibilityMutationCount = 0;
|
|
17048
|
+
if (checkoutDebounce) {
|
|
17049
|
+
if (!checkoutPending) {
|
|
17050
|
+
checkoutPending = true;
|
|
17051
|
+
checkoutFreezeTimestamp = nowTimestamp();
|
|
17052
|
+
mutationBuffers.forEach((buf) => buf.freeze());
|
|
17053
|
+
visibilityManager == null ? void 0 : visibilityManager.freeze();
|
|
17054
|
+
}
|
|
17055
|
+
if (checkoutDebounceTimer) {
|
|
17056
|
+
clearTimeout(checkoutDebounceTimer);
|
|
17057
|
+
}
|
|
17058
|
+
const frozenDuration = nowTimestamp() - checkoutFreezeTimestamp;
|
|
17059
|
+
const maxFreeze = checkoutDebounce * 3;
|
|
17060
|
+
if (frozenDuration >= maxFreeze) {
|
|
17061
|
+
executeCheckout();
|
|
17062
|
+
} else {
|
|
17063
|
+
checkoutDebounceTimer = setTimeout(
|
|
17064
|
+
() => executeCheckout(),
|
|
17065
|
+
checkoutDebounce
|
|
17066
|
+
);
|
|
17067
|
+
}
|
|
17068
|
+
} else {
|
|
17069
|
+
takeFullSnapshot$1(true);
|
|
17070
|
+
}
|
|
16788
17071
|
}
|
|
16789
17072
|
} : void 0
|
|
16790
17073
|
});
|
|
@@ -16793,6 +17076,7 @@ function record(options = {}) {
|
|
|
16793
17076
|
if (!recordDOM) {
|
|
16794
17077
|
return;
|
|
16795
17078
|
}
|
|
17079
|
+
checkoutId++;
|
|
16796
17080
|
wrappedEmit(
|
|
16797
17081
|
{
|
|
16798
17082
|
type: EventType.Meta,
|
|
@@ -16808,6 +17092,7 @@ function record(options = {}) {
|
|
|
16808
17092
|
shadowDomManager.init();
|
|
16809
17093
|
mutationBuffers.forEach((buf) => buf.lock());
|
|
16810
17094
|
visibilityManager == null ? void 0 : visibilityManager.lock();
|
|
17095
|
+
navigationManager == null ? void 0 : navigationManager.lock();
|
|
16811
17096
|
const node2 = snapshot(document, {
|
|
16812
17097
|
mirror,
|
|
16813
17098
|
blockClass,
|
|
@@ -16859,6 +17144,7 @@ function record(options = {}) {
|
|
|
16859
17144
|
);
|
|
16860
17145
|
mutationBuffers.forEach((buf) => buf.unlock());
|
|
16861
17146
|
visibilityManager == null ? void 0 : visibilityManager.unlock();
|
|
17147
|
+
navigationManager == null ? void 0 : navigationManager.unlock();
|
|
16862
17148
|
if (document.adoptedStyleSheets && document.adoptedStyleSheets.length > 0)
|
|
16863
17149
|
stylesheetManager.adoptStyleSheets(
|
|
16864
17150
|
document.adoptedStyleSheets,
|
|
@@ -16871,6 +17157,31 @@ function record(options = {}) {
|
|
|
16871
17157
|
}
|
|
16872
17158
|
customEventQueue.length = 0;
|
|
16873
17159
|
};
|
|
17160
|
+
let navigationManager;
|
|
17161
|
+
const navigationSampling = sampling.navigation;
|
|
17162
|
+
if (navigationSampling !== false) {
|
|
17163
|
+
const navConfig = typeof navigationSampling === "object" ? navigationSampling : {};
|
|
17164
|
+
navigationManager = new NavigationManager({
|
|
17165
|
+
doc: document,
|
|
17166
|
+
config: navConfig,
|
|
17167
|
+
onSnapshot: (isCheckout) => {
|
|
17168
|
+
if (checkoutPending) {
|
|
17169
|
+
if (checkoutDebounceTimer) {
|
|
17170
|
+
clearTimeout(checkoutDebounceTimer);
|
|
17171
|
+
checkoutDebounceTimer = null;
|
|
17172
|
+
}
|
|
17173
|
+
checkoutPending = false;
|
|
17174
|
+
checkoutFreezeTimestamp = null;
|
|
17175
|
+
mutationBuffers.forEach((buf) => {
|
|
17176
|
+
buf.resetBuffers();
|
|
17177
|
+
buf.unsetFrozen();
|
|
17178
|
+
});
|
|
17179
|
+
visibilityManager == null ? void 0 : visibilityManager.unsetFrozen();
|
|
17180
|
+
}
|
|
17181
|
+
takeFullSnapshot$1(isCheckout);
|
|
17182
|
+
}
|
|
17183
|
+
});
|
|
17184
|
+
}
|
|
16874
17185
|
try {
|
|
16875
17186
|
const handlers = [];
|
|
16876
17187
|
const observe = (doc) => {
|
|
@@ -16899,14 +17210,11 @@ function record(options = {}) {
|
|
|
16899
17210
|
}, d)
|
|
16900
17211
|
}),
|
|
16901
17212
|
navigationCb: (navData) => {
|
|
16902
|
-
|
|
16903
|
-
|
|
16904
|
-
|
|
16905
|
-
|
|
16906
|
-
|
|
16907
|
-
navData.href
|
|
16908
|
-
);
|
|
16909
|
-
takeFullSnapshot$1(true);
|
|
17213
|
+
if (navigationManager) {
|
|
17214
|
+
navigationManager.handleNavigation(navData);
|
|
17215
|
+
} else {
|
|
17216
|
+
takeFullSnapshot$1(true);
|
|
17217
|
+
}
|
|
16910
17218
|
},
|
|
16911
17219
|
inputCb: (v2) => wrappedEmit({
|
|
16912
17220
|
type: EventType.IncrementalSnapshot,
|
|
@@ -17018,23 +17326,6 @@ function record(options = {}) {
|
|
|
17018
17326
|
flushCustomEventQueue$1();
|
|
17019
17327
|
}
|
|
17020
17328
|
};
|
|
17021
|
-
const runInit = async () => {
|
|
17022
|
-
if (flushCustomEvent === "before") {
|
|
17023
|
-
flushCustomEventQueue$1();
|
|
17024
|
-
}
|
|
17025
|
-
if (recordAfter === "DOMContentStabilized") {
|
|
17026
|
-
console.debug(\`[\${nowTimestamp()}] [rrweb:record] \\u{1F7E2} Waiting for DOM stabilization...\`);
|
|
17027
|
-
await waitForDOMStabilization(window);
|
|
17028
|
-
console.debug(\`[\${nowTimestamp()}] [rrweb:record] \\u2705 DOM stabilized, starting recording\`);
|
|
17029
|
-
}
|
|
17030
|
-
console.debug(\`[\${nowTimestamp()}] [rrweb:record] \\u2705 Init dom and takeFullSnapshot \`);
|
|
17031
|
-
takeFullSnapshot$1();
|
|
17032
|
-
handlers.push(observe(document));
|
|
17033
|
-
recording = true;
|
|
17034
|
-
if (flushCustomEvent === "after") {
|
|
17035
|
-
flushCustomEventQueue$1();
|
|
17036
|
-
}
|
|
17037
|
-
};
|
|
17038
17329
|
if (document.readyState === "interactive" || document.readyState === "complete") {
|
|
17039
17330
|
init();
|
|
17040
17331
|
} else {
|
|
@@ -17064,8 +17355,13 @@ function record(options = {}) {
|
|
|
17064
17355
|
);
|
|
17065
17356
|
}
|
|
17066
17357
|
return () => {
|
|
17358
|
+
if (checkoutDebounceTimer) {
|
|
17359
|
+
clearTimeout(checkoutDebounceTimer);
|
|
17360
|
+
checkoutDebounceTimer = null;
|
|
17361
|
+
}
|
|
17067
17362
|
flushCustomEventQueue$1();
|
|
17068
17363
|
handlers.forEach((h) => h());
|
|
17364
|
+
navigationManager == null ? void 0 : navigationManager.destroy();
|
|
17069
17365
|
processedNodeManager.destroy();
|
|
17070
17366
|
recording = false;
|
|
17071
17367
|
unregisterErrorHandler();
|
|
@@ -17134,7 +17430,7 @@ exports.record = record;
|
|
|
17134
17430
|
return module.exports;
|
|
17135
17431
|
}))
|
|
17136
17432
|
//# sourceMappingURL=rrweb-record.umd.cjs.map
|
|
17137
|
-
`;var
|
|
17433
|
+
`;var T=`(function (g, f) {if ("object" == typeof exports && "object" == typeof module) {module.exports = f();} else if ("function" == typeof define && define.amd) {define("rrwebPluginSequentialIdRecord", [], f);} else if ("object" == typeof exports) {exports["rrwebPluginSequentialIdRecord"] = f();} else {g["rrwebPluginSequentialIdRecord"] = f();}}(typeof self !== 'undefined' ? self : typeof globalThis !== 'undefined' ? globalThis : this, () => {var exports = {};var module = { exports };
|
|
17138
17434
|
"use strict";
|
|
17139
17435
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
17140
17436
|
const defaultOptions = {
|
|
@@ -17178,5 +17474,5 @@ exports.globalSequentialId = globalSequentialId;
|
|
|
17178
17474
|
return module.exports;
|
|
17179
17475
|
}))
|
|
17180
17476
|
//# sourceMappingURL=rrweb-plugin-sequential-id-record.umd.cjs.map
|
|
17181
|
-
`;var K={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:0,threshold:.5,sensitivity:.05,rafThrottle:10}},flushCustomEvent:"after",recordAfter:"DOMContentLoaded",userTriggeredOnInput:!0},m=class{recordFn=null;page=null;context;eventCounter=0;events=[];recordOptions;pendingEvents=[];recorderScriptVersion="unknown";recorderLibVersion="unknown";isRecording=!1;constructor(e){this.recordOptions=S(K,e??{}),this.context={pushEvent:n=>this.events.push(n)}}handleEmit(e){if(e.type===0||e.type===1)return;let n={...e};this.context.pushEvent(n)}async inject(e){this.page=e,await this.page?.addInitScript({content:R}),await this.page?.addInitScript({content:
|
|
17477
|
+
`;var K={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:0,threshold:.5,sensitivity:.05,rafThrottle:10}},flushCustomEvent:"after",recordAfter:"DOMContentLoaded",userTriggeredOnInput:!0},m=class{recordFn=null;page=null;context;eventCounter=0;events=[];recordOptions;pendingEvents=[];recorderScriptVersion="unknown";recorderLibVersion="unknown";isRecording=!1;constructor(e){this.recordOptions=S(K,e??{}),this.context={pushEvent:n=>this.events.push(n)}}handleEmit(e){if(e.type===0||e.type===1)return;let n={...e};this.context.pushEvent(n)}async inject(e){this.page=e,await this.page?.addInitScript({content:R}),await this.page?.addInitScript({content:T}),await this.page?.exposeFunction("handleEmit",n=>{this.handleEmit(n)})}async start(){this.recordFn=await this.page?.evaluateHandle(()=>window.rrweb?.record),await this.recordFn?.evaluate((e,n)=>{let r=JSON.parse(n),s=[];window.rrwebPluginSequentialIdRecord&&s.push(window.rrwebPluginSequentialIdRecord.getRecordSequentialIdPlugin({key:"id"})),window.stopFn=e({emit:o=>{window.handleEmit?.(o)},plugins:s,...r})},JSON.stringify(this.recordOptions)),this.isRecording=await this.recordFn?.evaluate(e=>e.isRecording()),this.recorderScriptVersion=await this.recordFn?.evaluate(e=>e.getVersion()),await this.flush()}async stop(){this.isRecording=!1,this.recordFn&&this.page&&!this.page.isClosed()&&(await this.flush(),await this.page.evaluate(()=>{window.stopFn=null}))}async reset(){this.eventCounter=0,this.events=[],await this.stop(),this.context={pushEvent:e=>this.events.push(e)}}async flush(){if(!this.recordFn)return;let e=[];for(let n of this.pendingEvents)try{await this.recordFn.evaluate((r,s)=>{r.addCustomEvent(s.tag,s.payload)},n)}catch{console.debug(`[${Date.now()}] [recorder] flush failed for custom event: ${n.tag}`),e.push(n)}this.pendingEvents=e}async addCustomEvent(e,n){let r={tag:e,payload:n};if(!this.recordFn||!this.isRecording){console.debug(`[${Date.now()}] [recorder] queued custom event (recorder not ready): ${e}`),this.pendingEvents.push(r);return}try{await this.recordFn.evaluate((s,o)=>{s.addCustomEvent(o.tag,o.payload)},r)}catch{this.pendingEvents.push(r)}}isRecordingReady(){return!!this.recordFn&&this.isRecording}getScriptVersion(){return`@appsurify-testmap/rrweb-record:${this.recorderScriptVersion}`}getLibVersion(){return`@appsurify-testmap/rrweb:${this.recorderLibVersion!=="unknown"?this.recorderLibVersion:this.recorderScriptVersion}`}getEvents(){return this.events}getMirror(){return this.recordFn?.mirror}bind(e){this.context=e}setEventCounter(e){this.eventCounter=e}};var g=m;var A=new Map;function M(t,e){A.set(t,e)}function x(t){return A.get(t)}var k=y.test.extend({browser:async({browser:t},e)=>{await e(t)},context:async({browser:t},e,n)=>{let r=await t.newContext(),s=_(t,n);M(n.testId,s),await e(r),await r.close()},page:async({page:t},e,n)=>{let s=n.project.use.testmap??{},o=typeof s=="object"&&"recordingOpts"in s?s.recordingOpts:g,i=new g(o),c=x(n.testId);c&&(c.recorderInstance=i),i.bind({pushEvent:async a=>{c?.recorderEvents.push(a),await Promise.resolve()}}),await i.inject(t),t.on("console",async a=>{a.type()!=="debug"&&console.debug(`[${Date.now()}] [page] console`,a.text())}),t.on("load",async()=>{}),t.on("domcontentloaded",async()=>{await i.start(),c?.runner&&(c.runner.recorder={scriptVersion:i.getScriptVersion(),libVersion:i.getLibVersion()})}),t.on("framenavigated",async()=>{}),t.on("close",async()=>{await i.flush()});let u=n._onStepEnd.bind(void 0);n._onStepEnd=async a=>{let l=n._stepMap.get(a.stepId);if(l.apiName&&l?.location.file===n.file&&await i.addCustomEvent(l.apiName,{stepId:l.stepId,category:l.category,location:l.location,title:l.title,apiName:l.apiName,endWallTime:l.endWallTime}),!t.isClosed())try{await I(t)}catch{}await u(a)};let h=n._onDidFinishTestFunction.bind(void 0);n._onDidFinishTestFunction=async()=>{i&&i.isRecordingReady()&&(await E(i,500),await i.stop()),await h()},await e(t)}});k.beforeEach(async({},t)=>{console.log(`[${Date.now()}] [\u{1F7E2} TEST START] ${t.title}`)});k.afterEach(async({},t)=>{console.log(`[${Date.now()}] [\u{1F534} TEST END] ${t.title}`);let e=x(t.testId);if(!e)return;e.test.duration=t.duration;let n={runner:e?.runner,spec:e?.spec,browser:e?.browser,test:e?.test,suite:e?.test.suite,recorderEvents:Array.isArray(e?.recorderEvents)?e?.recorderEvents:[]},s=t.project.use.testmap??{};C(n,s.outputReportDir)});0&&(module.exports={expect,test});
|
|
17182
17478
|
//# sourceMappingURL=index.js.map
|