@checksum-ai/runtime 1.1.41 → 1.1.43
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/checksumlib.js +168 -112
- package/cli.js +89 -92
- package/index.d.ts +4 -3
- package/index.js +298 -149
- package/package.json +1 -1
- package/test-run-monitor.js +40 -12
- package/vtg-build/asset-manifest.json +3 -3
- package/vtg-build/index.html +1 -1
- package/vtg-build/static/js/main.2f8b964e.js +116 -0
- package/vtg-build/static/js/main.2f8b964e.js.LICENSE.txt +136 -0
- package/vtg-build/static/js/main.2f8b964e.js.map +1 -0
- package/vtg-build/static/js/main.881785b7.js +116 -0
- package/vtg-build/static/js/main.881785b7.js.LICENSE.txt +136 -0
- package/vtg-build/static/js/main.881785b7.js.map +1 -0
package/checksumlib.js
CHANGED
|
@@ -9663,9 +9663,13 @@
|
|
|
9663
9663
|
}
|
|
9664
9664
|
async safeGetSelectorAndLocator(node2, { retriesLeft = 3 } = {}) {
|
|
9665
9665
|
try {
|
|
9666
|
-
|
|
9667
|
-
node2
|
|
9668
|
-
|
|
9666
|
+
try {
|
|
9667
|
+
return window.playwright.generateSelectorAndLocator(node2);
|
|
9668
|
+
} catch (err) {
|
|
9669
|
+
return this.getElementWindowPlaywright(node2).generateSelectorAndLocator(
|
|
9670
|
+
node2
|
|
9671
|
+
);
|
|
9672
|
+
}
|
|
9669
9673
|
} catch (error) {
|
|
9670
9674
|
if (retriesLeft > 0) {
|
|
9671
9675
|
await (0, import_await_sleep.default)(500);
|
|
@@ -9682,48 +9686,55 @@
|
|
|
9682
9686
|
stripAttributes = true,
|
|
9683
9687
|
ignoredIframesSelectors = []
|
|
9684
9688
|
} = {}) {
|
|
9685
|
-
|
|
9686
|
-
|
|
9687
|
-
|
|
9688
|
-
const
|
|
9689
|
-
|
|
9690
|
-
|
|
9691
|
-
|
|
9692
|
-
|
|
9693
|
-
|
|
9694
|
-
|
|
9695
|
-
|
|
9696
|
-
|
|
9697
|
-
|
|
9698
|
-
|
|
9699
|
-
|
|
9700
|
-
|
|
9701
|
-
|
|
9689
|
+
try {
|
|
9690
|
+
if (!node2) return null;
|
|
9691
|
+
const iframes = getIframes({ ignoredIframesSelectors });
|
|
9692
|
+
const parentFramesSelectors = searchParentFrames ? await getParentFramesSelectors(node2, iframes, async (node3) => {
|
|
9693
|
+
const selection = await this.getSelectorAndLocator(node3, {
|
|
9694
|
+
searchParentFrames: false
|
|
9695
|
+
});
|
|
9696
|
+
return selection.selector;
|
|
9697
|
+
}) : (
|
|
9698
|
+
// ? await this.getParentFramesSelectors(node, iframes)
|
|
9699
|
+
[]
|
|
9700
|
+
);
|
|
9701
|
+
const nodeHTML = node2;
|
|
9702
|
+
const testSelector2 = this.getTestAttributeSelector(
|
|
9703
|
+
nodeHTML,
|
|
9704
|
+
testIdSelector
|
|
9705
|
+
);
|
|
9706
|
+
if (testSelector2) {
|
|
9707
|
+
return {
|
|
9708
|
+
selector: testSelector2,
|
|
9709
|
+
locator: `locator("${testSelector2}")`,
|
|
9710
|
+
parentFramesSelectors
|
|
9711
|
+
};
|
|
9712
|
+
}
|
|
9713
|
+
let removedAttributes;
|
|
9714
|
+
if (stripAttributes) {
|
|
9715
|
+
removedAttributes = this.stripNodeAttributes(node2);
|
|
9716
|
+
}
|
|
9717
|
+
let { selector, locator } = await this.safeGetSelectorAndLocator(
|
|
9718
|
+
nodeHTML
|
|
9719
|
+
);
|
|
9720
|
+
if (removedAttributes) {
|
|
9721
|
+
this.restoreNodeAttributes(node2, removedAttributes);
|
|
9722
|
+
const result2 = await this.getElementWindowPlaywright(node2).$(selector);
|
|
9723
|
+
if (result2 !== node2) {
|
|
9724
|
+
({ selector, locator } = await this.safeGetSelectorAndLocator(
|
|
9725
|
+
nodeHTML
|
|
9726
|
+
));
|
|
9727
|
+
}
|
|
9728
|
+
}
|
|
9702
9729
|
return {
|
|
9703
|
-
selector
|
|
9704
|
-
locator
|
|
9730
|
+
selector,
|
|
9731
|
+
locator,
|
|
9705
9732
|
parentFramesSelectors
|
|
9706
9733
|
};
|
|
9734
|
+
} catch (error) {
|
|
9735
|
+
console.log("get selector and locator error", node2, error);
|
|
9736
|
+
return { selector: "", locator: "" };
|
|
9707
9737
|
}
|
|
9708
|
-
let removedAttributes;
|
|
9709
|
-
if (stripAttributes) {
|
|
9710
|
-
removedAttributes = this.stripNodeAttributes(node2);
|
|
9711
|
-
}
|
|
9712
|
-
let { selector, locator } = await this.safeGetSelectorAndLocator(nodeHTML);
|
|
9713
|
-
if (removedAttributes) {
|
|
9714
|
-
this.restoreNodeAttributes(node2, removedAttributes);
|
|
9715
|
-
const result2 = await this.getElementWindowPlaywright(node2).$(selector);
|
|
9716
|
-
if (result2 !== node2) {
|
|
9717
|
-
({ selector, locator } = await this.safeGetSelectorAndLocator(
|
|
9718
|
-
nodeHTML
|
|
9719
|
-
));
|
|
9720
|
-
}
|
|
9721
|
-
}
|
|
9722
|
-
return {
|
|
9723
|
-
selector,
|
|
9724
|
-
locator,
|
|
9725
|
-
parentFramesSelectors
|
|
9726
|
-
};
|
|
9727
9738
|
}
|
|
9728
9739
|
async findIframeWindowByParentFrameSelectors(parentFramesSelectors = []) {
|
|
9729
9740
|
let targetWindow = window.top;
|
|
@@ -10620,6 +10631,7 @@
|
|
|
10620
10631
|
this.flashingElementsDetector = new FlashingElementsDetector();
|
|
10621
10632
|
this.forceIncludeElements = [];
|
|
10622
10633
|
this.preMapReducedHTMLSelectors = false;
|
|
10634
|
+
this.useRrwebIdsAsChecksumIds = false;
|
|
10623
10635
|
this.excludedNodes = 0;
|
|
10624
10636
|
// how many nodes to reduce in percentage
|
|
10625
10637
|
this.reducePercentage = 50;
|
|
@@ -10799,6 +10811,10 @@
|
|
|
10799
10811
|
originalEl._rrwebid = sessionMirror.getMeta(originalEl)?.id?.toString() ?? "";
|
|
10800
10812
|
}
|
|
10801
10813
|
el.setAttribute("rrwebid", originalEl._rrwebid);
|
|
10814
|
+
if (this.useRrwebIdsAsChecksumIds) {
|
|
10815
|
+
el.setAttribute("checksumid", originalEl._rrwebid);
|
|
10816
|
+
el._checksumid = originalEl._rrwebid;
|
|
10817
|
+
}
|
|
10802
10818
|
}
|
|
10803
10819
|
}
|
|
10804
10820
|
this.checksumIdToRRwebIdMap[originalEl._checksumid] = parseInt(
|
|
@@ -29431,7 +29447,13 @@
|
|
|
29431
29447
|
return promise;
|
|
29432
29448
|
}, "fastForward");
|
|
29433
29449
|
this.stop = /* @__PURE__ */ __name(() => {
|
|
29434
|
-
|
|
29450
|
+
try {
|
|
29451
|
+
if (this.replayer) {
|
|
29452
|
+
this.replayer.destroy();
|
|
29453
|
+
}
|
|
29454
|
+
} catch (e2) {
|
|
29455
|
+
console.warn("Error destroying replayer", e2);
|
|
29456
|
+
}
|
|
29435
29457
|
}, "stop");
|
|
29436
29458
|
this.getOriginalTimestamp = /* @__PURE__ */ __name((event) => {
|
|
29437
29459
|
return event.originalTimestamp ?? event.timestamp;
|
|
@@ -29539,7 +29561,7 @@
|
|
|
29539
29561
|
this.liveEvents = this.events;
|
|
29540
29562
|
}
|
|
29541
29563
|
const events = getEvents2();
|
|
29542
|
-
if (events.length === this.currentTraveledNumberOfEvents) {
|
|
29564
|
+
if (events.length === this.currentTraveledNumberOfEvents || events.length < 2) {
|
|
29543
29565
|
return;
|
|
29544
29566
|
}
|
|
29545
29567
|
this.stop();
|
|
@@ -29548,6 +29570,10 @@
|
|
|
29548
29570
|
this.isLive = false;
|
|
29549
29571
|
this.currentTraveledNumberOfEvents = events.length;
|
|
29550
29572
|
const { trimmedEvents } = this.trimEventsToLastCheckout(events);
|
|
29573
|
+
if (trimmedEvents.length < 2) {
|
|
29574
|
+
console.log("trimmedEvents.length is less than 2");
|
|
29575
|
+
return;
|
|
29576
|
+
}
|
|
29551
29577
|
this.makeReplayer(trimmedEvents, false, { speed: 360 });
|
|
29552
29578
|
this.replayer.play(trimmedEvents[trimmedEvents.length - 1].timestamp);
|
|
29553
29579
|
if (sleepAfter) {
|
|
@@ -31604,7 +31630,7 @@
|
|
|
31604
31630
|
const iframeOffset = { left: 0, top: 0, right: 0, bottom: 0 };
|
|
31605
31631
|
if (renderDocument !== element.ownerDocument) {
|
|
31606
31632
|
let iframe = element.ownerDocument.defaultView?.frameElement;
|
|
31607
|
-
while (iframe) {
|
|
31633
|
+
while (iframe && iframe.contentDocument !== renderDocument) {
|
|
31608
31634
|
const iframeRect = iframe.getBoundingClientRect();
|
|
31609
31635
|
iframeOffset.left += iframeRect.left;
|
|
31610
31636
|
iframeOffset.top += iframeRect.top;
|
|
@@ -32114,7 +32140,7 @@
|
|
|
32114
32140
|
function sanitizeRoot(input2, element) {
|
|
32115
32141
|
if (isParentNode(input2)) {
|
|
32116
32142
|
if (!input2.contains(element)) {
|
|
32117
|
-
showWarning("element root mismatch", "Provided root does not contain the element. This will most likely result in producing a fallback selector using element's real root node. If you plan to use the selector using provided root (e.g. `root.querySelector`), it will
|
|
32143
|
+
showWarning("element root mismatch", "Provided root does not contain the element. This will most likely result in producing a fallback selector using element's real root node. If you plan to use the selector using provided root (e.g. `root.querySelector`), it will not work as intended.");
|
|
32118
32144
|
}
|
|
32119
32145
|
return input2;
|
|
32120
32146
|
}
|
|
@@ -32125,7 +32151,7 @@
|
|
|
32125
32151
|
}
|
|
32126
32152
|
return rootNode;
|
|
32127
32153
|
}
|
|
32128
|
-
return element
|
|
32154
|
+
return getRootNode2(element);
|
|
32129
32155
|
}
|
|
32130
32156
|
__name(sanitizeRoot, "sanitizeRoot");
|
|
32131
32157
|
function sanitizeMaxNumber(input2) {
|
|
@@ -32255,18 +32281,21 @@
|
|
|
32255
32281
|
return `[${name}='${value}']`;
|
|
32256
32282
|
}
|
|
32257
32283
|
__name(attributeNodeToSelector, "attributeNodeToSelector");
|
|
32258
|
-
function isValidAttributeNode({ nodeName }, element) {
|
|
32284
|
+
function isValidAttributeNode({ nodeName, nodeValue }, element) {
|
|
32259
32285
|
const tagName = element.tagName.toLowerCase();
|
|
32260
32286
|
if (["input", "option"].includes(tagName) && nodeName === "value") {
|
|
32261
32287
|
return false;
|
|
32262
32288
|
}
|
|
32289
|
+
if (nodeName === "src" && (nodeValue === null || nodeValue === void 0 ? void 0 : nodeValue.startsWith("data:"))) {
|
|
32290
|
+
return false;
|
|
32291
|
+
}
|
|
32263
32292
|
return !attributeBlacklistMatch(nodeName);
|
|
32264
32293
|
}
|
|
32265
32294
|
__name(isValidAttributeNode, "isValidAttributeNode");
|
|
32266
32295
|
function sanitizeAttributeData({ nodeName, nodeValue }) {
|
|
32267
32296
|
return {
|
|
32268
32297
|
name: sanitizeSelectorItem(nodeName),
|
|
32269
|
-
value: sanitizeSelectorItem(nodeValue)
|
|
32298
|
+
value: sanitizeSelectorItem(nodeValue !== null && nodeValue !== void 0 ? nodeValue : void 0)
|
|
32270
32299
|
};
|
|
32271
32300
|
}
|
|
32272
32301
|
__name(sanitizeAttributeData, "sanitizeAttributeData");
|
|
@@ -32286,7 +32315,8 @@
|
|
|
32286
32315
|
|
|
32287
32316
|
// ../../node_modules/css-selector-generator/esm/selector-class.js
|
|
32288
32317
|
function getElementClassSelectors(element) {
|
|
32289
|
-
|
|
32318
|
+
var _a2;
|
|
32319
|
+
return ((_a2 = element.getAttribute("class")) !== null && _a2 !== void 0 ? _a2 : "").trim().split(/\s+/).filter((item) => !INVALID_CLASS_RE.test(item)).map((item) => `.${sanitizeSelectorItem(item)}`);
|
|
32290
32320
|
}
|
|
32291
32321
|
__name(getElementClassSelectors, "getElementClassSelectors");
|
|
32292
32322
|
function getClassSelectors(elements) {
|
|
@@ -32297,7 +32327,8 @@
|
|
|
32297
32327
|
|
|
32298
32328
|
// ../../node_modules/css-selector-generator/esm/selector-id.js
|
|
32299
32329
|
function getElementIdSelectors(element) {
|
|
32300
|
-
|
|
32330
|
+
var _a2;
|
|
32331
|
+
const id = (_a2 = element.getAttribute("id")) !== null && _a2 !== void 0 ? _a2 : "";
|
|
32301
32332
|
const selector = `#${sanitizeSelectorItem(id)}`;
|
|
32302
32333
|
const rootNode = element.getRootNode({ composed: false });
|
|
32303
32334
|
return !INVALID_ID_RE.test(id) && testSelector([element], selector, rootNode) ? [selector] : [];
|
|
@@ -32315,7 +32346,9 @@
|
|
|
32315
32346
|
const siblings = Array.from(parent.childNodes).filter(isElement2);
|
|
32316
32347
|
const elementIndex = siblings.indexOf(element);
|
|
32317
32348
|
if (elementIndex > -1) {
|
|
32318
|
-
return [
|
|
32349
|
+
return [
|
|
32350
|
+
`:nth-child(${String(elementIndex + 1)})`
|
|
32351
|
+
];
|
|
32319
32352
|
}
|
|
32320
32353
|
}
|
|
32321
32354
|
return [];
|
|
@@ -32350,7 +32383,7 @@
|
|
|
32350
32383
|
const elementIndex = siblings.indexOf(element);
|
|
32351
32384
|
if (elementIndex > -1) {
|
|
32352
32385
|
return [
|
|
32353
|
-
`${tag}:nth-of-type(${elementIndex + 1})`
|
|
32386
|
+
`${tag}:nth-of-type(${String(elementIndex + 1)})`
|
|
32354
32387
|
];
|
|
32355
32388
|
}
|
|
32356
32389
|
}
|
|
@@ -32426,8 +32459,7 @@
|
|
|
32426
32459
|
var ESCAPED_COLON = ":".charCodeAt(0).toString(16).toUpperCase();
|
|
32427
32460
|
var SPECIAL_CHARACTERS_RE = /[ !"#$%&'()\[\]{|}<>*+,./;=?@^`~\\]/;
|
|
32428
32461
|
function sanitizeSelectorItem(input2 = "") {
|
|
32429
|
-
|
|
32430
|
-
return (_b = (_a2 = CSS === null || CSS === void 0 ? void 0 : CSS.escape) === null || _a2 === void 0 ? void 0 : _a2.call(CSS, input2)) !== null && _b !== void 0 ? _b : legacySanitizeSelectorItem(input2);
|
|
32462
|
+
return CSS ? CSS.escape(input2) : legacySanitizeSelectorItem(input2);
|
|
32431
32463
|
}
|
|
32432
32464
|
__name(sanitizeSelectorItem, "sanitizeSelectorItem");
|
|
32433
32465
|
function legacySanitizeSelectorItem(input2 = "") {
|
|
@@ -32463,8 +32495,7 @@
|
|
|
32463
32495
|
}
|
|
32464
32496
|
__name(getElementSelectorsByType, "getElementSelectorsByType");
|
|
32465
32497
|
function getSelectorsByType(elements, selector_type) {
|
|
32466
|
-
|
|
32467
|
-
const getter = (_a2 = SELECTOR_TYPE_GETTERS[selector_type]) !== null && _a2 !== void 0 ? _a2 : () => [];
|
|
32498
|
+
const getter = SELECTOR_TYPE_GETTERS[selector_type];
|
|
32468
32499
|
return getter(elements);
|
|
32469
32500
|
}
|
|
32470
32501
|
__name(getSelectorsByType, "getSelectorsByType");
|
|
@@ -32509,7 +32540,7 @@
|
|
|
32509
32540
|
__name(getSelectorsList, "getSelectorsList");
|
|
32510
32541
|
function getSelectorsToGet(options) {
|
|
32511
32542
|
const { selectors, includeTag } = options;
|
|
32512
|
-
const selectors_to_get = []
|
|
32543
|
+
const selectors_to_get = [...selectors];
|
|
32513
32544
|
if (includeTag && !selectors_to_get.includes("tag")) {
|
|
32514
32545
|
selectors_to_get.push("tag");
|
|
32515
32546
|
}
|
|
@@ -32536,7 +32567,7 @@
|
|
|
32536
32567
|
const data = {};
|
|
32537
32568
|
selector_types.forEach((selector_type) => {
|
|
32538
32569
|
const selector_variants = selectors_by_type[selector_type];
|
|
32539
|
-
if (selector_variants.length > 0) {
|
|
32570
|
+
if (selector_variants && selector_variants.length > 0) {
|
|
32540
32571
|
data[selector_type] = selector_variants;
|
|
32541
32572
|
}
|
|
32542
32573
|
});
|
|
@@ -32568,10 +32599,10 @@
|
|
|
32568
32599
|
}
|
|
32569
32600
|
__name(generateCandidates, "generateCandidates");
|
|
32570
32601
|
function getSelectorWithinRoot(elements, root2, rootSelector = "", options) {
|
|
32571
|
-
const elementSelectors = getAllSelectors(elements,
|
|
32602
|
+
const elementSelectors = getAllSelectors(elements, root2, options);
|
|
32572
32603
|
const selectorCandidates = generateCandidates(elementSelectors, rootSelector);
|
|
32573
32604
|
for (const candidateSelector of selectorCandidates) {
|
|
32574
|
-
if (testSelector(elements, candidateSelector,
|
|
32605
|
+
if (testSelector(elements, candidateSelector, root2)) {
|
|
32575
32606
|
return candidateSelector;
|
|
32576
32607
|
}
|
|
32577
32608
|
}
|
|
@@ -32634,7 +32665,8 @@
|
|
|
32634
32665
|
}
|
|
32635
32666
|
let selector = "";
|
|
32636
32667
|
pattern.forEach((selectorType) => {
|
|
32637
|
-
|
|
32668
|
+
var _a2;
|
|
32669
|
+
const selectorsOfType = (_a2 = selectors[selectorType]) !== null && _a2 !== void 0 ? _a2 : [];
|
|
32638
32670
|
selectorsOfType.forEach(({ value, include }) => {
|
|
32639
32671
|
if (include) {
|
|
32640
32672
|
selector += value;
|
|
@@ -32665,10 +32697,12 @@
|
|
|
32665
32697
|
|
|
32666
32698
|
// ../../node_modules/css-selector-generator/esm/index.js
|
|
32667
32699
|
function getCssSelector(needle, custom_options = {}) {
|
|
32700
|
+
var _a2;
|
|
32668
32701
|
const elements = sanitizeSelectorNeedle(needle);
|
|
32669
32702
|
const options = sanitizeOptions(elements[0], custom_options);
|
|
32703
|
+
const root2 = (_a2 = options.root) !== null && _a2 !== void 0 ? _a2 : getRootNode2(elements[0]);
|
|
32670
32704
|
let partialSelector = "";
|
|
32671
|
-
let currentRoot =
|
|
32705
|
+
let currentRoot = root2;
|
|
32672
32706
|
function updateIdentifiableParent() {
|
|
32673
32707
|
return getClosestIdentifiableParent(elements, currentRoot, partialSelector, options);
|
|
32674
32708
|
}
|
|
@@ -32676,7 +32710,7 @@
|
|
|
32676
32710
|
let closestIdentifiableParent = updateIdentifiableParent();
|
|
32677
32711
|
while (closestIdentifiableParent) {
|
|
32678
32712
|
const { foundElements, selector } = closestIdentifiableParent;
|
|
32679
|
-
if (testSelector(elements, selector,
|
|
32713
|
+
if (testSelector(elements, selector, root2)) {
|
|
32680
32714
|
return selector;
|
|
32681
32715
|
}
|
|
32682
32716
|
currentRoot = foundElements[0];
|
|
@@ -32966,20 +33000,23 @@
|
|
|
32966
33000
|
* i.e - playwright can point at a parent button if element is a child of it
|
|
32967
33001
|
*/
|
|
32968
33002
|
addOptionalParentSelector(useTextContent, addCSSSelectorGenerator, expandCSSKeyElements) {
|
|
32969
|
-
|
|
32970
|
-
|
|
32971
|
-
playwright.
|
|
32972
|
-
|
|
32973
|
-
|
|
32974
|
-
|
|
32975
|
-
|
|
32976
|
-
|
|
32977
|
-
|
|
32978
|
-
|
|
32979
|
-
|
|
32980
|
-
|
|
33003
|
+
try {
|
|
33004
|
+
const playwright = getElementWindowPlaywright(this.targetElement);
|
|
33005
|
+
const playwrightTargetElement = playwright.locator(
|
|
33006
|
+
playwright.selector(this.targetElement)
|
|
33007
|
+
).element;
|
|
33008
|
+
if (playwrightTargetElement !== this.targetElement && playwrightTargetElement?.contains(this.targetElement)) {
|
|
33009
|
+
return this.generate(playwrightTargetElement, [], {
|
|
33010
|
+
isPartOfListItem: false,
|
|
33011
|
+
isForContextElement: false,
|
|
33012
|
+
useTextContent,
|
|
33013
|
+
addCSSSelectorGenerator,
|
|
33014
|
+
expandCSSKeyElements
|
|
33015
|
+
});
|
|
33016
|
+
}
|
|
33017
|
+
} finally {
|
|
33018
|
+
return [];
|
|
32981
33019
|
}
|
|
32982
|
-
return [];
|
|
32983
33020
|
}
|
|
32984
33021
|
/**
|
|
32985
33022
|
* Add CSS key features to the element chain, based on attributes that are not covered by playwright selectors
|
|
@@ -33162,7 +33199,7 @@
|
|
|
33162
33199
|
*/
|
|
33163
33200
|
getLocatorBase(element) {
|
|
33164
33201
|
const playwright = getElementWindowPlaywright(element);
|
|
33165
|
-
if (this.rootNode === document) {
|
|
33202
|
+
if (this.rootNode === document || this.rootNode.nodeType === 9) {
|
|
33166
33203
|
return playwright;
|
|
33167
33204
|
}
|
|
33168
33205
|
return playwright.locator(playwright.selector(this.rootNode));
|
|
@@ -34252,16 +34289,16 @@
|
|
|
34252
34289
|
this.overrideDialog("confirm" /* Confirm */);
|
|
34253
34290
|
this.overrideDialog("prompt" /* Prompt */);
|
|
34254
34291
|
}
|
|
34255
|
-
overrideDialog(
|
|
34256
|
-
const orig = window[
|
|
34257
|
-
window[
|
|
34258
|
-
const dialogResult = orig(
|
|
34259
|
-
const dialogAction = this.determineDialogAction(dialogResult,
|
|
34292
|
+
overrideDialog(dialogType) {
|
|
34293
|
+
const orig = window[dialogType].bind(window);
|
|
34294
|
+
window[dialogType] = (dialogMessage) => {
|
|
34295
|
+
const dialogResult = orig(dialogMessage);
|
|
34296
|
+
const dialogAction = this.determineDialogAction(dialogResult, dialogType);
|
|
34260
34297
|
this.sessionRecorder.addCustomEvent(
|
|
34261
34298
|
"native-dialog-event" /* NativeDialogEvent */,
|
|
34262
34299
|
{
|
|
34263
|
-
dialogType
|
|
34264
|
-
|
|
34300
|
+
dialogType,
|
|
34301
|
+
dialogMessage,
|
|
34265
34302
|
dialogResult,
|
|
34266
34303
|
dialogAction
|
|
34267
34304
|
}
|
|
@@ -34284,10 +34321,12 @@
|
|
|
34284
34321
|
|
|
34285
34322
|
// ../browser-lib/src/element-inspector/element-inspector.ts
|
|
34286
34323
|
var ElementInspector = class _ElementInspector {
|
|
34287
|
-
constructor(
|
|
34288
|
-
|
|
34289
|
-
|
|
34290
|
-
|
|
34324
|
+
constructor({
|
|
34325
|
+
rootDocument = document,
|
|
34326
|
+
getRenderDocument = /* @__PURE__ */ __name((defaultView2) => void 0, "getRenderDocument"),
|
|
34327
|
+
defaultView,
|
|
34328
|
+
topLevelInspector
|
|
34329
|
+
} = {}) {
|
|
34291
34330
|
this.wasHoveredElementSelected = false;
|
|
34292
34331
|
this.selected = [];
|
|
34293
34332
|
this.singleSelection = true;
|
|
@@ -34328,28 +34367,29 @@
|
|
|
34328
34367
|
capture: true
|
|
34329
34368
|
});
|
|
34330
34369
|
}
|
|
34331
|
-
const { locator, selector, parentFramesSelectors } = await this.playwrightElementSelectorGenerator.getSelectorAndLocator(
|
|
34332
|
-
|
|
34333
|
-
|
|
34370
|
+
const { locator, selector, parentFramesSelectors } = await this.playwrightElementSelectorGenerator.getSelectorAndLocator(targetElement).catch((error) => {
|
|
34371
|
+
return {
|
|
34372
|
+
locator: "",
|
|
34373
|
+
selector: "",
|
|
34374
|
+
parentFramesSelectors: []
|
|
34375
|
+
};
|
|
34376
|
+
});
|
|
34334
34377
|
elementHighlighter.highlightElement(targetElement, {
|
|
34335
34378
|
text: locator.replace("frameLocator('iframe').", ""),
|
|
34336
34379
|
textPosition: "below",
|
|
34337
34380
|
textWidthType: "auto",
|
|
34338
34381
|
pointerEvents: "none",
|
|
34339
34382
|
classNames: ["element-inspector-ignore"],
|
|
34340
|
-
renderDocument: this.defaultView
|
|
34383
|
+
renderDocument: this.getRenderDocument(this.defaultView)
|
|
34341
34384
|
});
|
|
34342
|
-
const elementByLocator = await this.playwrightElementSelectorGenerator.selector(
|
|
34343
|
-
selector,
|
|
34344
|
-
parentFramesSelectors
|
|
34345
|
-
);
|
|
34385
|
+
const elementByLocator = await this.playwrightElementSelectorGenerator.selector(selector, parentFramesSelectors).catch(() => targetElement);
|
|
34346
34386
|
if (elementByLocator !== target) {
|
|
34347
34387
|
elementHighlighter.highlightElement(elementByLocator, {
|
|
34348
34388
|
// highlightStyle: { outlineColor: "blue" },
|
|
34349
34389
|
clear: false,
|
|
34350
34390
|
pointerEvents: "none",
|
|
34351
34391
|
classNames: ["element-inspector-ignore"],
|
|
34352
|
-
renderDocument: this.defaultView
|
|
34392
|
+
renderDocument: this.getRenderDocument(this.defaultView)
|
|
34353
34393
|
});
|
|
34354
34394
|
}
|
|
34355
34395
|
this.hoveredElement = targetElement;
|
|
@@ -34386,11 +34426,12 @@
|
|
|
34386
34426
|
}
|
|
34387
34427
|
this.stopSubDocumentInspector(true);
|
|
34388
34428
|
}
|
|
34389
|
-
this.subDocumentInspector = new _ElementInspector(
|
|
34390
|
-
newRootDocument,
|
|
34429
|
+
this.subDocumentInspector = new _ElementInspector({
|
|
34430
|
+
rootDocument: newRootDocument,
|
|
34391
34431
|
defaultView,
|
|
34392
|
-
this.topLevelInspector ?? this
|
|
34393
|
-
|
|
34432
|
+
topLevelInspector: this.topLevelInspector ?? this,
|
|
34433
|
+
getRenderDocument: this.getRenderDocument
|
|
34434
|
+
});
|
|
34394
34435
|
this.subDocumentInspector.start(this.singleSelection);
|
|
34395
34436
|
return true;
|
|
34396
34437
|
}, "handleSubDocument");
|
|
@@ -34400,14 +34441,18 @@
|
|
|
34400
34441
|
this.subDocumentInspector = null;
|
|
34401
34442
|
}
|
|
34402
34443
|
}, "stopSubDocumentInspector");
|
|
34444
|
+
this.rootDocument = rootDocument;
|
|
34445
|
+
this.topLevelInspector = topLevelInspector;
|
|
34446
|
+
this.getRenderDocument = getRenderDocument;
|
|
34447
|
+
this.defaultView = defaultView ?? this.getDefaultView();
|
|
34403
34448
|
this.playwrightElementSelectorGenerator = new PlaywrightElementSelectorGenerator();
|
|
34404
|
-
if (!defaultView) {
|
|
34405
|
-
this.defaultView = this.rootDocument.nodeType === Node.DOCUMENT_NODE ? this.rootDocument.defaultView : window;
|
|
34406
|
-
}
|
|
34407
34449
|
}
|
|
34408
34450
|
static {
|
|
34409
34451
|
__name(this, "ElementInspector");
|
|
34410
34452
|
}
|
|
34453
|
+
getDefaultView() {
|
|
34454
|
+
return this.rootDocument.nodeType === Node.DOCUMENT_NODE ? this.rootDocument.defaultView : window;
|
|
34455
|
+
}
|
|
34411
34456
|
start(singleSelection = true) {
|
|
34412
34457
|
this.singleSelection = singleSelection;
|
|
34413
34458
|
this.stop();
|
|
@@ -34582,7 +34627,9 @@ ${data.locator}`
|
|
|
34582
34627
|
});
|
|
34583
34628
|
}
|
|
34584
34629
|
startObserver() {
|
|
34585
|
-
this.elementInspector = new ElementInspector(
|
|
34630
|
+
this.elementInspector = new ElementInspector({
|
|
34631
|
+
rootDocument: window.document
|
|
34632
|
+
});
|
|
34586
34633
|
this.elementInspector.start();
|
|
34587
34634
|
this.enableEventsFilter();
|
|
34588
34635
|
}
|
|
@@ -36000,10 +36047,11 @@ ${data.locator}`
|
|
|
36000
36047
|
// -------- [Native Dialog] -------- //
|
|
36001
36048
|
handleNativeDialog(data, event) {
|
|
36002
36049
|
try {
|
|
36003
|
-
const { dialogAction, dialogType, dialogResult } = data;
|
|
36050
|
+
const { dialogAction, dialogType, dialogResult, dialogMessage } = data;
|
|
36004
36051
|
const nativeDialog = {
|
|
36005
36052
|
dialogResult,
|
|
36006
|
-
dialogType
|
|
36053
|
+
dialogType,
|
|
36054
|
+
dialogMessage
|
|
36007
36055
|
};
|
|
36008
36056
|
const action = this.makePageAction(
|
|
36009
36057
|
dialogAction,
|
|
@@ -36021,7 +36069,7 @@ ${data.locator}`
|
|
|
36021
36069
|
// -------- [Assertions] -------- //
|
|
36022
36070
|
handleRecordAssertion(data, event) {
|
|
36023
36071
|
this.addStep({
|
|
36024
|
-
step: this.makeAssertion(data),
|
|
36072
|
+
step: this.makeAssertion(data, event),
|
|
36025
36073
|
type: "assertion" /* Assertion */
|
|
36026
36074
|
});
|
|
36027
36075
|
}
|
|
@@ -36124,11 +36172,12 @@ ${data.locator}`
|
|
|
36124
36172
|
this.lastInteractionEventIndex = this.events.length;
|
|
36125
36173
|
this.onStep?.(step);
|
|
36126
36174
|
}
|
|
36127
|
-
makeAssertion(data) {
|
|
36175
|
+
makeAssertion(data, event) {
|
|
36128
36176
|
return {
|
|
36129
36177
|
matcher: data.matcher,
|
|
36130
36178
|
locator: data.locator,
|
|
36131
36179
|
thought: data.thought,
|
|
36180
|
+
timestamp: event.timestamp,
|
|
36132
36181
|
id: data?.id || Date.now().toString()
|
|
36133
36182
|
};
|
|
36134
36183
|
}
|
|
@@ -36233,9 +36282,16 @@ ${data.locator}`
|
|
|
36233
36282
|
this.sendRecordedSteps = sendRecordedSteps;
|
|
36234
36283
|
}
|
|
36235
36284
|
startInspector(singleSelection = true, rootDocument) {
|
|
36236
|
-
this.
|
|
36237
|
-
|
|
36238
|
-
|
|
36285
|
+
this.stopInspector();
|
|
36286
|
+
const getRenderDocument = /* @__PURE__ */ __name((defaultView) => {
|
|
36287
|
+
return defaultView.top.document.querySelector(
|
|
36288
|
+
"iframe.time-machine-iframe"
|
|
36289
|
+
).contentDocument;
|
|
36290
|
+
}, "getRenderDocument");
|
|
36291
|
+
this.elementInspector = new ElementInspector({
|
|
36292
|
+
rootDocument: rootDocument ?? this.getRRwebReplayerDocument(),
|
|
36293
|
+
getRenderDocument
|
|
36294
|
+
});
|
|
36239
36295
|
this.elementInspector.start(singleSelection);
|
|
36240
36296
|
}
|
|
36241
36297
|
getRRwebReplayerDocument() {
|