@checksum-ai/runtime 1.1.51 → 1.1.53-beta
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/checksum-root/checksum.config.ts +20 -31
- package/checksumlib.js +220 -110
- package/cli.js +75 -71
- package/index.js +152 -151
- package/package.json +1 -1
- package/vtg-build/asset-manifest.json +3 -3
- package/vtg-build/index.html +1 -1
- package/vtg-build/static/js/main.03697227.js +3 -0
- package/vtg-build/static/js/main.03697227.js.LICENSE.txt +146 -0
- package/vtg-build/static/js/main.03697227.js.map +1 -0
- package/vtg-build/static/js/main.1d284e9a.js +3 -0
- package/vtg-build/static/js/main.1d284e9a.js.LICENSE.txt +146 -0
- package/vtg-build/static/js/main.1d284e9a.js.map +1 -0
|
@@ -14,38 +14,27 @@ export default getChecksumConfig({
|
|
|
14
14
|
apiKey: "<API key>",
|
|
15
15
|
|
|
16
16
|
/**
|
|
17
|
-
*
|
|
17
|
+
* Define your test run environments and test users within each environment.
|
|
18
|
+
* The environments must be aligned with those set here:
|
|
19
|
+
* https://app.checksum.ai/#/settings/
|
|
18
20
|
*/
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
*/
|
|
37
|
-
// users: [
|
|
38
|
-
// {
|
|
39
|
-
// role: "host",
|
|
40
|
-
// username: "<host username>",
|
|
41
|
-
// password: "<host password>",
|
|
42
|
-
// },
|
|
43
|
-
// {
|
|
44
|
-
// role: "guest",
|
|
45
|
-
// username: "<guest username>",
|
|
46
|
-
// password: "<guest password>",
|
|
47
|
-
// },
|
|
48
|
-
// ],
|
|
21
|
+
environments: [
|
|
22
|
+
{
|
|
23
|
+
name: "<The name of the environment>",
|
|
24
|
+
baseURL:
|
|
25
|
+
"<The base URL of the tested app. e.g. https://example.com. URLs in the tests will be relative to the base URL>",
|
|
26
|
+
loginURL: "<The URL of the login page>",
|
|
27
|
+
default: true,
|
|
28
|
+
users: [
|
|
29
|
+
{
|
|
30
|
+
role: "<The role of the user, may be undefined in case of single user>",
|
|
31
|
+
username: "<username>",
|
|
32
|
+
password: "<password>",
|
|
33
|
+
default: true,
|
|
34
|
+
},
|
|
35
|
+
],
|
|
36
|
+
},
|
|
37
|
+
],
|
|
49
38
|
|
|
50
39
|
options: {
|
|
51
40
|
/**
|
package/checksumlib.js
CHANGED
|
@@ -7598,9 +7598,9 @@
|
|
|
7598
7598
|
case Node.TEXT_NODE:
|
|
7599
7599
|
return node2.nodeValue;
|
|
7600
7600
|
case Node.CDATA_SECTION_NODE:
|
|
7601
|
-
return includeCDATA ? `<![CDATA[${node2.nodeValue}]]>` : "";
|
|
7601
|
+
return includeCDATA && node2.nodeValue.trim().length > 0 ? `<![CDATA[${node2.nodeValue}]]>` : "";
|
|
7602
7602
|
case Node.COMMENT_NODE:
|
|
7603
|
-
return includeComments ? `<!--${node2.nodeValue}-->` : "";
|
|
7603
|
+
return includeComments && node2.nodeValue.trim().length > 0 ? `<!--${node2.nodeValue}-->` : "";
|
|
7604
7604
|
default:
|
|
7605
7605
|
return "";
|
|
7606
7606
|
}
|
|
@@ -29412,14 +29412,74 @@
|
|
|
29412
29412
|
|
|
29413
29413
|
// ../browser-lib/src/session-record-replay/session-replayer.ts
|
|
29414
29414
|
var import_await_sleep3 = __toESM(require_await_sleep());
|
|
29415
|
+
|
|
29416
|
+
// ../browser-lib/src/session-record-replay/replayer-listeners-manager.ts
|
|
29417
|
+
var ReplayerListenersManager = class {
|
|
29418
|
+
constructor() {
|
|
29419
|
+
this._replayingState = "Paused" /* Paused */;
|
|
29420
|
+
// Internal state for isShowing
|
|
29421
|
+
this.listeners = [];
|
|
29422
|
+
}
|
|
29423
|
+
static {
|
|
29424
|
+
__name(this, "ReplayerListenersManager");
|
|
29425
|
+
}
|
|
29426
|
+
// Listeners array
|
|
29427
|
+
// Setter for isShowing with listener notification
|
|
29428
|
+
set replayingState(value) {
|
|
29429
|
+
this._replayingState = value;
|
|
29430
|
+
this.notifyListeners();
|
|
29431
|
+
}
|
|
29432
|
+
// Add a listener to observe changes to isShowing
|
|
29433
|
+
addListener(listener) {
|
|
29434
|
+
this.listeners.push(listener);
|
|
29435
|
+
}
|
|
29436
|
+
// Remove a listener
|
|
29437
|
+
removeListener(listener) {
|
|
29438
|
+
this.listeners = this.listeners.filter((l2) => l2 !== listener);
|
|
29439
|
+
}
|
|
29440
|
+
// Wrapper function to handle loading state
|
|
29441
|
+
async wrapWithLoadingState(fn, loadingCompletedState = "Paused" /* Paused */) {
|
|
29442
|
+
this.replayingState = "Processing" /* Processing */;
|
|
29443
|
+
return new Promise((resolve2, reject) => {
|
|
29444
|
+
requestAnimationFrame(() => {
|
|
29445
|
+
setTimeout(() => {
|
|
29446
|
+
fn().then((result2) => {
|
|
29447
|
+
resolve2(result2);
|
|
29448
|
+
}).catch((error) => {
|
|
29449
|
+
reject(error);
|
|
29450
|
+
}).finally(() => {
|
|
29451
|
+
this.replayingState = loadingCompletedState;
|
|
29452
|
+
});
|
|
29453
|
+
}, 0);
|
|
29454
|
+
});
|
|
29455
|
+
});
|
|
29456
|
+
}
|
|
29457
|
+
// Notify all listeners of the state change
|
|
29458
|
+
notifyListeners() {
|
|
29459
|
+
this.listeners.forEach((listener) => listener(this._replayingState));
|
|
29460
|
+
}
|
|
29461
|
+
};
|
|
29462
|
+
|
|
29463
|
+
// ../browser-lib/src/session-record-replay/session-replayer.ts
|
|
29415
29464
|
var DEBUG_MODE = false;
|
|
29416
29465
|
var SessionReplayer = class {
|
|
29417
29466
|
constructor(config = {}) {
|
|
29418
|
-
|
|
29419
|
-
this.eventsBuffer = [];
|
|
29467
|
+
this.initialEventsBuffer = [];
|
|
29420
29468
|
this.config = {
|
|
29421
29469
|
enableInteract: false
|
|
29422
29470
|
};
|
|
29471
|
+
this.overlayElement = null;
|
|
29472
|
+
this.timer = null;
|
|
29473
|
+
this.animationFrameStepHandler = {
|
|
29474
|
+
wait: /* @__PURE__ */ __name((callback) => requestAnimationFrame(callback), "wait"),
|
|
29475
|
+
cancel: /* @__PURE__ */ __name((id) => cancelAnimationFrame(id), "cancel")
|
|
29476
|
+
};
|
|
29477
|
+
this.timoutStepHandler = {
|
|
29478
|
+
wait: /* @__PURE__ */ __name((callback) => {
|
|
29479
|
+
return setTimeout(callback, 100);
|
|
29480
|
+
}, "wait"),
|
|
29481
|
+
cancel: /* @__PURE__ */ __name((id) => clearTimeout(id), "cancel")
|
|
29482
|
+
};
|
|
29423
29483
|
this.stop = /* @__PURE__ */ __name(() => {
|
|
29424
29484
|
try {
|
|
29425
29485
|
if (this.replayer) {
|
|
@@ -29442,6 +29502,7 @@
|
|
|
29442
29502
|
castedEvents: []
|
|
29443
29503
|
};
|
|
29444
29504
|
this.config = { ...this.config, ...config };
|
|
29505
|
+
this.replayerListenersManager = new ReplayerListenersManager();
|
|
29445
29506
|
}
|
|
29446
29507
|
static {
|
|
29447
29508
|
__name(this, "SessionReplayer");
|
|
@@ -29487,18 +29548,53 @@
|
|
|
29487
29548
|
}
|
|
29488
29549
|
});
|
|
29489
29550
|
}
|
|
29551
|
+
getCurrentTimestamp() {
|
|
29552
|
+
try {
|
|
29553
|
+
return this.replayer.getCurrentTime() + this.firstEvent.timestamp;
|
|
29554
|
+
} catch (e2) {
|
|
29555
|
+
return 0;
|
|
29556
|
+
}
|
|
29557
|
+
}
|
|
29558
|
+
monitorTime(targetTime, onTargetHook, stepHandler = this.animationFrameStepHandler) {
|
|
29559
|
+
const stopTimer = /* @__PURE__ */ __name(() => {
|
|
29560
|
+
if (this.timer) {
|
|
29561
|
+
stepHandler.cancel(this.timer);
|
|
29562
|
+
this.timer = null;
|
|
29563
|
+
}
|
|
29564
|
+
}, "stopTimer");
|
|
29565
|
+
stopTimer();
|
|
29566
|
+
const update = /* @__PURE__ */ __name(() => {
|
|
29567
|
+
const currentTime = this.replayer.getCurrentTime();
|
|
29568
|
+
if (targetTime && currentTime >= targetTime) {
|
|
29569
|
+
console.log(
|
|
29570
|
+
`[SessionReplayer] achieved target time: ${targetTime} with current time ${currentTime}`,
|
|
29571
|
+
Date.now()
|
|
29572
|
+
);
|
|
29573
|
+
onTargetHook();
|
|
29574
|
+
stopTimer();
|
|
29575
|
+
return;
|
|
29576
|
+
} else {
|
|
29577
|
+
console.log(
|
|
29578
|
+
`[SessionReplayer] monitoring time, current: ${currentTime}; target: ${targetTime}...`
|
|
29579
|
+
);
|
|
29580
|
+
}
|
|
29581
|
+
const meta = this.replayer.getMetaData();
|
|
29582
|
+
if (currentTime < meta.totalTime) {
|
|
29583
|
+
this.timer = stepHandler.wait(update);
|
|
29584
|
+
}
|
|
29585
|
+
}, "update");
|
|
29586
|
+
this.timer = stepHandler.wait(update);
|
|
29587
|
+
}
|
|
29490
29588
|
seek(ts, pause = true) {
|
|
29491
29589
|
return new Promise((resolve2) => {
|
|
29492
29590
|
const delta = ts - this.firstEvent.timestamp;
|
|
29493
|
-
this.
|
|
29494
|
-
|
|
29495
|
-
|
|
29496
|
-
|
|
29497
|
-
resolve2();
|
|
29498
|
-
}, 0);
|
|
29499
|
-
} else {
|
|
29591
|
+
this.monitorTime(delta, () => {
|
|
29592
|
+
if (pause) {
|
|
29593
|
+
this.replayer.pause();
|
|
29594
|
+
}
|
|
29500
29595
|
resolve2();
|
|
29501
|
-
}
|
|
29596
|
+
});
|
|
29597
|
+
this.replayer.play(delta);
|
|
29502
29598
|
});
|
|
29503
29599
|
}
|
|
29504
29600
|
start(options, castedEvents = []) {
|
|
@@ -29509,9 +29605,9 @@
|
|
|
29509
29605
|
if (this.config.onlyLive) {
|
|
29510
29606
|
this.makeReplayer([], { baselineTime: events[0].timestamp });
|
|
29511
29607
|
} else {
|
|
29512
|
-
this.
|
|
29513
|
-
if (this.
|
|
29514
|
-
this.makeReplayer(this.
|
|
29608
|
+
this.initialEventsBuffer.push(...events);
|
|
29609
|
+
if (this.initialEventsBuffer.length >= 2) {
|
|
29610
|
+
this.makeReplayer(this.initialEventsBuffer);
|
|
29515
29611
|
} else {
|
|
29516
29612
|
return;
|
|
29517
29613
|
}
|
|
@@ -29538,16 +29634,22 @@
|
|
|
29538
29634
|
return promise;
|
|
29539
29635
|
}
|
|
29540
29636
|
async goLive() {
|
|
29541
|
-
await this.
|
|
29542
|
-
|
|
29637
|
+
await this.replayerListenersManager.wrapWithLoadingState(async () => {
|
|
29638
|
+
await this.seek(this.lastEvent.timestamp, false);
|
|
29639
|
+
await (0, import_await_sleep3.default)(1e3);
|
|
29640
|
+
});
|
|
29543
29641
|
}
|
|
29544
29642
|
async goBack(timestamp, {
|
|
29545
29643
|
sleepAfter = 1e3,
|
|
29546
29644
|
beforeTimestamp = false,
|
|
29547
29645
|
includeAllMatchingTimestamps = false
|
|
29548
29646
|
} = {}) {
|
|
29549
|
-
await this.
|
|
29550
|
-
|
|
29647
|
+
await this.replayerListenersManager.wrapWithLoadingState(async () => {
|
|
29648
|
+
await this.seek(timestamp, true);
|
|
29649
|
+
if (sleepAfter) {
|
|
29650
|
+
await (0, import_await_sleep3.default)(sleepAfter);
|
|
29651
|
+
}
|
|
29652
|
+
});
|
|
29551
29653
|
}
|
|
29552
29654
|
storeEvent(event) {
|
|
29553
29655
|
if (!this.debugData.active) {
|
|
@@ -29565,7 +29667,7 @@
|
|
|
29565
29667
|
this.debugData.active = true;
|
|
29566
29668
|
window.__chkreplayer = {
|
|
29567
29669
|
events: /* @__PURE__ */ __name(() => this.debugData.events, "events"),
|
|
29568
|
-
back: /* @__PURE__ */ __name((ts) => this.goBack(ts
|
|
29670
|
+
back: /* @__PURE__ */ __name((ts) => this.goBack(ts), "back"),
|
|
29569
29671
|
currentTime: /* @__PURE__ */ __name(() => this.replayer.getCurrentTime(), "currentTime"),
|
|
29570
29672
|
castedEvents: /* @__PURE__ */ __name(() => this.debugData.castedEvents, "castedEvents")
|
|
29571
29673
|
};
|
|
@@ -30691,12 +30793,6 @@
|
|
|
30691
30793
|
this.observer = new MutationObserver((mutations) => {
|
|
30692
30794
|
mutations.forEach((mutation) => {
|
|
30693
30795
|
mutation.addedNodes.forEach((addedNode) => {
|
|
30694
|
-
if (addedNode.querySelector) {
|
|
30695
|
-
const ifr = addedNode.querySelector("iframe");
|
|
30696
|
-
if (ifr) {
|
|
30697
|
-
console.log("FFF", ifr);
|
|
30698
|
-
}
|
|
30699
|
-
}
|
|
30700
30796
|
if (addedNode.nodeType !== Node.ELEMENT_NODE) {
|
|
30701
30797
|
return;
|
|
30702
30798
|
}
|
|
@@ -32409,7 +32505,7 @@
|
|
|
32409
32505
|
|
|
32410
32506
|
// ../js-lib/src/helpers/helpers.ts
|
|
32411
32507
|
var awaitSleep = /* @__PURE__ */ __name((ms) => new Promise((resolve2) => setTimeout(resolve2, ms)), "awaitSleep");
|
|
32412
|
-
var guardReturn = /* @__PURE__ */ __name(async (promise, timeout = 1e3, errMessage
|
|
32508
|
+
var guardReturn = /* @__PURE__ */ __name(async (promise, timeout = 1e3, errMessage) => {
|
|
32413
32509
|
if (timeout === null) {
|
|
32414
32510
|
return promise;
|
|
32415
32511
|
}
|
|
@@ -32420,7 +32516,10 @@
|
|
|
32420
32516
|
}, "guard");
|
|
32421
32517
|
const res = await Promise.race([promise, guard()]);
|
|
32422
32518
|
if (typeof res === "string" && res === timeoutStringIdentifier) {
|
|
32423
|
-
|
|
32519
|
+
if (typeof errMessage === "function") {
|
|
32520
|
+
throw new Error(errMessage());
|
|
32521
|
+
}
|
|
32522
|
+
throw new Error(errMessage ?? "guardReturnTimedOut");
|
|
32424
32523
|
}
|
|
32425
32524
|
return res;
|
|
32426
32525
|
}, "guardReturn");
|
|
@@ -32516,6 +32615,7 @@
|
|
|
32516
32615
|
this.expandCSSKeyFeatures(element, cssKeyElements);
|
|
32517
32616
|
}
|
|
32518
32617
|
while (element && element !== this.rootNode) {
|
|
32618
|
+
await awaitSleep(0);
|
|
32519
32619
|
const elementCandidates = this.getAllLocators(
|
|
32520
32620
|
element,
|
|
32521
32621
|
cssKeyElements,
|
|
@@ -32525,11 +32625,12 @@
|
|
|
32525
32625
|
}
|
|
32526
32626
|
);
|
|
32527
32627
|
const validLocators = [];
|
|
32528
|
-
const testCandidate = /* @__PURE__ */ __name((chain) => {
|
|
32628
|
+
const testCandidate = /* @__PURE__ */ __name(async (chain) => {
|
|
32529
32629
|
if (chain.hasDuplicateFilters()) {
|
|
32530
32630
|
return;
|
|
32531
32631
|
}
|
|
32532
32632
|
try {
|
|
32633
|
+
await awaitSleep(0);
|
|
32533
32634
|
const { elements } = this.getLocatorBase(element).locator(
|
|
32534
32635
|
chain.getSelector()
|
|
32535
32636
|
);
|
|
@@ -32543,15 +32644,15 @@
|
|
|
32543
32644
|
}
|
|
32544
32645
|
}, "testCandidate");
|
|
32545
32646
|
if (!locatorsChains.length) {
|
|
32546
|
-
elementCandidates
|
|
32547
|
-
|
|
32548
|
-
|
|
32647
|
+
for (const ec of elementCandidates) {
|
|
32648
|
+
await testCandidate(new LocatorChain([ec]));
|
|
32649
|
+
}
|
|
32549
32650
|
} else {
|
|
32550
|
-
|
|
32551
|
-
locatorsChains
|
|
32552
|
-
|
|
32553
|
-
|
|
32554
|
-
}
|
|
32651
|
+
for (const ec of elementCandidates) {
|
|
32652
|
+
for (const sc of locatorsChains) {
|
|
32653
|
+
await testCandidate(sc.cloneAndAddCandidate(ec));
|
|
32654
|
+
}
|
|
32655
|
+
}
|
|
32555
32656
|
}
|
|
32556
32657
|
if (validLocators.length === 0 && locatorsChains.length === 0) {
|
|
32557
32658
|
const selector = element.tagName.toLowerCase();
|
|
@@ -32944,7 +33045,7 @@
|
|
|
32944
33045
|
* @returns array of new candidates that return only one element
|
|
32945
33046
|
*/
|
|
32946
33047
|
async reduceMultiCandidates(candidate) {
|
|
32947
|
-
await awaitSleep(
|
|
33048
|
+
await awaitSleep(0);
|
|
32948
33049
|
const { elements } = candidate;
|
|
32949
33050
|
const parts = candidate.getSelector().split(" >> ");
|
|
32950
33051
|
const newCandidates = [];
|
|
@@ -33351,6 +33452,68 @@
|
|
|
33351
33452
|
}
|
|
33352
33453
|
__name(isInstanceOfHTMLElement, "isInstanceOfHTMLElement");
|
|
33353
33454
|
|
|
33455
|
+
// ../browser-lib/src/helpers/dom/xpath.ts
|
|
33456
|
+
function getRelativeXPath(element = document, child) {
|
|
33457
|
+
try {
|
|
33458
|
+
let getNodeIdentifier2 = function(node3) {
|
|
33459
|
+
let identifier = node3.nodeName.toLowerCase();
|
|
33460
|
+
let foundAttributeIdentifier = false;
|
|
33461
|
+
["name", "label", "aria-label", "data-testid", "role"].forEach((attr) => {
|
|
33462
|
+
if (node3.hasAttribute(attr)) {
|
|
33463
|
+
identifier += `[@${attr}="${node3.getAttribute(attr)}"]`;
|
|
33464
|
+
foundAttributeIdentifier = true;
|
|
33465
|
+
}
|
|
33466
|
+
});
|
|
33467
|
+
if (!foundAttributeIdentifier) {
|
|
33468
|
+
let index2 = 1;
|
|
33469
|
+
let sibling = node3.previousSibling;
|
|
33470
|
+
while (sibling) {
|
|
33471
|
+
if (sibling.nodeType === Node.ELEMENT_NODE && sibling.nodeName === node3.nodeName) {
|
|
33472
|
+
index2++;
|
|
33473
|
+
}
|
|
33474
|
+
sibling = sibling.previousSibling;
|
|
33475
|
+
}
|
|
33476
|
+
if (index2 > 1) {
|
|
33477
|
+
identifier += `[${index2}]`;
|
|
33478
|
+
}
|
|
33479
|
+
}
|
|
33480
|
+
return identifier;
|
|
33481
|
+
};
|
|
33482
|
+
var getNodeIdentifier = getNodeIdentifier2;
|
|
33483
|
+
__name(getNodeIdentifier2, "getNodeIdentifier");
|
|
33484
|
+
if (!element || !child || !element.contains(child)) {
|
|
33485
|
+
throw new Error("Child is not a descendant of the given element.");
|
|
33486
|
+
}
|
|
33487
|
+
let path = [];
|
|
33488
|
+
let node2 = child;
|
|
33489
|
+
while (node2 !== element) {
|
|
33490
|
+
if (node2.nodeType === Node.ELEMENT_NODE) {
|
|
33491
|
+
path.unshift(getNodeIdentifier2(node2));
|
|
33492
|
+
}
|
|
33493
|
+
node2 = node2.parentElement;
|
|
33494
|
+
}
|
|
33495
|
+
return path.join("/");
|
|
33496
|
+
} catch (error) {
|
|
33497
|
+
console.error("Failed to get relative xpath", error);
|
|
33498
|
+
return;
|
|
33499
|
+
}
|
|
33500
|
+
}
|
|
33501
|
+
__name(getRelativeXPath, "getRelativeXPath");
|
|
33502
|
+
function findElementsByXPath(parentElement2, xpath) {
|
|
33503
|
+
let evaluator = new XPathEvaluator();
|
|
33504
|
+
let result2 = evaluator.evaluate(
|
|
33505
|
+
xpath,
|
|
33506
|
+
parentElement2,
|
|
33507
|
+
null,
|
|
33508
|
+
XPathResult.FIRST_ORDERED_NODE_TYPE,
|
|
33509
|
+
null
|
|
33510
|
+
);
|
|
33511
|
+
return [result2.singleNodeValue].filter(
|
|
33512
|
+
(node2) => node2 instanceof HTMLElement
|
|
33513
|
+
);
|
|
33514
|
+
}
|
|
33515
|
+
__name(findElementsByXPath, "findElementsByXPath");
|
|
33516
|
+
|
|
33354
33517
|
// src/lib/test-generator/selectors/compound-selector.ts
|
|
33355
33518
|
var CLASS_IGNORE_LIST = [
|
|
33356
33519
|
":hover",
|
|
@@ -33441,7 +33604,7 @@
|
|
|
33441
33604
|
const compoundSelector = {
|
|
33442
33605
|
// generate selectors from the common root to the target element
|
|
33443
33606
|
targetSelection: {
|
|
33444
|
-
xpath:
|
|
33607
|
+
xpath: getRelativeXPath(commonRoot, targetElement.element),
|
|
33445
33608
|
cssSelectors: this.generateAllContextualSelectors(
|
|
33446
33609
|
commonRoot,
|
|
33447
33610
|
targetElement.element
|
|
@@ -33535,7 +33698,7 @@
|
|
|
33535
33698
|
if (targetSelection.xpath) {
|
|
33536
33699
|
try {
|
|
33537
33700
|
addElementstoHistogram(
|
|
33538
|
-
|
|
33701
|
+
findElementsByXPath(commonParent, targetSelection.xpath)
|
|
33539
33702
|
);
|
|
33540
33703
|
} catch (error) {
|
|
33541
33704
|
}
|
|
@@ -33699,68 +33862,6 @@
|
|
|
33699
33862
|
});
|
|
33700
33863
|
return [...new Set(selectors)];
|
|
33701
33864
|
}
|
|
33702
|
-
/**
|
|
33703
|
-
* Builds relative xpath from an element to its child
|
|
33704
|
-
*/
|
|
33705
|
-
getRelativeXPath(element, child) {
|
|
33706
|
-
try {
|
|
33707
|
-
let getNodeIdentifier = function(node3) {
|
|
33708
|
-
let identifier = node3.nodeName.toLowerCase();
|
|
33709
|
-
let foundAttributeIdentifier = false;
|
|
33710
|
-
["name", "label", "aria-label", "data-testid", "role"].forEach(
|
|
33711
|
-
(attr) => {
|
|
33712
|
-
if (node3.hasAttribute(attr)) {
|
|
33713
|
-
identifier += `[@${attr}="${node3.getAttribute(attr)}"]`;
|
|
33714
|
-
foundAttributeIdentifier = true;
|
|
33715
|
-
}
|
|
33716
|
-
}
|
|
33717
|
-
);
|
|
33718
|
-
if (!foundAttributeIdentifier) {
|
|
33719
|
-
let index2 = 1;
|
|
33720
|
-
let sibling = node3.previousSibling;
|
|
33721
|
-
while (sibling) {
|
|
33722
|
-
if (sibling.nodeType === Node.ELEMENT_NODE && sibling.nodeName === node3.nodeName) {
|
|
33723
|
-
index2++;
|
|
33724
|
-
}
|
|
33725
|
-
sibling = sibling.previousSibling;
|
|
33726
|
-
}
|
|
33727
|
-
if (index2 > 1) {
|
|
33728
|
-
identifier += `[${index2}]`;
|
|
33729
|
-
}
|
|
33730
|
-
}
|
|
33731
|
-
return identifier;
|
|
33732
|
-
};
|
|
33733
|
-
__name(getNodeIdentifier, "getNodeIdentifier");
|
|
33734
|
-
if (!element || !child || !element.contains(child)) {
|
|
33735
|
-
throw new Error("Child is not a descendant of the given element.");
|
|
33736
|
-
}
|
|
33737
|
-
let path = [];
|
|
33738
|
-
let node2 = child;
|
|
33739
|
-
while (node2 !== element) {
|
|
33740
|
-
if (node2.nodeType === Node.ELEMENT_NODE) {
|
|
33741
|
-
path.unshift(getNodeIdentifier(node2));
|
|
33742
|
-
}
|
|
33743
|
-
node2 = node2.parentElement;
|
|
33744
|
-
}
|
|
33745
|
-
return path.join("/");
|
|
33746
|
-
} catch (error) {
|
|
33747
|
-
console.error("Failed to get relative xpath", error);
|
|
33748
|
-
return;
|
|
33749
|
-
}
|
|
33750
|
-
}
|
|
33751
|
-
findElementsByXPath(parentElement2, xpath) {
|
|
33752
|
-
let evaluator = new XPathEvaluator();
|
|
33753
|
-
let result2 = evaluator.evaluate(
|
|
33754
|
-
xpath,
|
|
33755
|
-
parentElement2,
|
|
33756
|
-
null,
|
|
33757
|
-
XPathResult.FIRST_ORDERED_NODE_TYPE,
|
|
33758
|
-
null
|
|
33759
|
-
);
|
|
33760
|
-
return [result2.singleNodeValue].filter(
|
|
33761
|
-
(node2) => node2 instanceof HTMLElement
|
|
33762
|
-
);
|
|
33763
|
-
}
|
|
33764
33865
|
/**
|
|
33765
33866
|
* Create a contextual selector from the common root to the target element
|
|
33766
33867
|
* We can play with the options to build various types of selectors which we could
|
|
@@ -33958,8 +34059,6 @@
|
|
|
33958
34059
|
);
|
|
33959
34060
|
attributeMaxSize = Math.max(attributeMaxSize - 10, 0);
|
|
33960
34061
|
} while (rootClone.outerHTML.length > this.MAX_SNIPPET_SIZE && attributeMaxSize > 0);
|
|
33961
|
-
rootClone.querySelectorAll("*").forEach((el) => {
|
|
33962
|
-
});
|
|
33963
34062
|
let htmlSnippet = serializeElement(rootClone, {
|
|
33964
34063
|
limitAttributeLength: true
|
|
33965
34064
|
});
|
|
@@ -34010,6 +34109,7 @@
|
|
|
34010
34109
|
this.sessionMirror = sessionMirror;
|
|
34011
34110
|
}
|
|
34012
34111
|
// Get files for a specific input by rrwebId
|
|
34112
|
+
// !! used in msg broker
|
|
34013
34113
|
async getFilesByRrwebId(rrwebId) {
|
|
34014
34114
|
const files = this.filesMap[rrwebId] ?? [];
|
|
34015
34115
|
try {
|
|
@@ -34076,7 +34176,10 @@
|
|
|
34076
34176
|
onBodyReady();
|
|
34077
34177
|
}
|
|
34078
34178
|
});
|
|
34079
|
-
bodyObserver.observe(document2.documentElement, {
|
|
34179
|
+
bodyObserver.observe(document2.documentElement, {
|
|
34180
|
+
childList: true,
|
|
34181
|
+
subtree: true
|
|
34182
|
+
});
|
|
34080
34183
|
}
|
|
34081
34184
|
// Cleanup the observer and remove event listeners
|
|
34082
34185
|
cleanup() {
|
|
@@ -34600,7 +34703,6 @@ ${data.locator}`
|
|
|
34600
34703
|
event.isCheckout = isCheckout;
|
|
34601
34704
|
window.checksumSendBroadcastMessage?.("rrweb", [event]);
|
|
34602
34705
|
this.lastRrwebEventTimestamp = event.timestamp;
|
|
34603
|
-
console.log(event.timestamp);
|
|
34604
34706
|
}, config.recordOptions);
|
|
34605
34707
|
}
|
|
34606
34708
|
if (initFilesObserver) {
|
|
@@ -35426,6 +35528,7 @@ ${data.locator}`
|
|
|
35426
35528
|
constructor() {
|
|
35427
35529
|
super({ enableInteract: true });
|
|
35428
35530
|
this.shouldHandleEvents = true;
|
|
35531
|
+
this.name = "timeMachine";
|
|
35429
35532
|
}
|
|
35430
35533
|
static {
|
|
35431
35534
|
__name(this, "TimeMachine");
|
|
@@ -35457,7 +35560,7 @@ ${data.locator}`
|
|
|
35457
35560
|
if (!timestamp) {
|
|
35458
35561
|
return this.goLive();
|
|
35459
35562
|
}
|
|
35460
|
-
return this.sessionReplayer.goBack(timestamp
|
|
35563
|
+
return this.sessionReplayer.goBack(timestamp);
|
|
35461
35564
|
}
|
|
35462
35565
|
getElementByRRwebId(rrwebId) {
|
|
35463
35566
|
return this.sessionReplayer.getNodeById(rrwebId);
|
|
@@ -35465,6 +35568,9 @@ ${data.locator}`
|
|
|
35465
35568
|
goLive() {
|
|
35466
35569
|
return this.sessionReplayer.goLive();
|
|
35467
35570
|
}
|
|
35571
|
+
getCurrentTimestamp() {
|
|
35572
|
+
return this.sessionReplayer.getCurrentTimestamp();
|
|
35573
|
+
}
|
|
35468
35574
|
};
|
|
35469
35575
|
|
|
35470
35576
|
// ../browser-lib/src/visual-test-generator/time-machine-event-handlers.ts
|
|
@@ -35750,7 +35856,8 @@ ${data.locator}`
|
|
|
35750
35856
|
selector: dropzoneSelector.playwrightSelector,
|
|
35751
35857
|
locator: dropzoneSelector.playwrightLocator,
|
|
35752
35858
|
parentFramesSelectors: dropzoneSelector.playwrightParentFramesSelectors,
|
|
35753
|
-
esraMetadata: dropzoneSelector.esraMetadata
|
|
35859
|
+
esraMetadata: dropzoneSelector.esraMetadata,
|
|
35860
|
+
rrwebId: dropzoneNodeId
|
|
35754
35861
|
}
|
|
35755
35862
|
}
|
|
35756
35863
|
)
|
|
@@ -35771,8 +35878,8 @@ ${data.locator}`
|
|
|
35771
35878
|
window.parent.document.body.appendChild(liveTMDiv);
|
|
35772
35879
|
this.sessionReplayer = new SessionReplayer({
|
|
35773
35880
|
enableInteract: false,
|
|
35774
|
-
root: liveTMDiv
|
|
35775
|
-
|
|
35881
|
+
root: liveTMDiv,
|
|
35882
|
+
onlyLive: true
|
|
35776
35883
|
});
|
|
35777
35884
|
this.sessionReplayer.start({ firstEventTimestamp: Date.now() });
|
|
35778
35885
|
}
|
|
@@ -36018,6 +36125,9 @@ ${data.locator}`
|
|
|
36018
36125
|
pageId: void 0,
|
|
36019
36126
|
timestamp: event.timestamp,
|
|
36020
36127
|
id: data?.id || Date.now().toString(),
|
|
36128
|
+
// @ts-ignore
|
|
36129
|
+
rrwebId: event.data?.id,
|
|
36130
|
+
// add rrwebId for services caching
|
|
36021
36131
|
...data
|
|
36022
36132
|
};
|
|
36023
36133
|
}
|