@checksum-ai/runtime 1.1.51 → 1.1.52

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.
@@ -14,38 +14,27 @@ export default getChecksumConfig({
14
14
  apiKey: "<API key>",
15
15
 
16
16
  /**
17
- * This is the base URL of the tested app. E.g. https://example.com. URLs in the tests will be relative to the base URL.
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
- baseURL: "<base URL>",
20
-
21
- /**
22
- * Insert the account's username that will be used
23
- * to login into your testing environment
24
- */
25
- username: "<username>",
26
-
27
- /**
28
- * Insert the account's password that will be used
29
- * to login into your testing environment
30
- */
31
- password: "<password>",
32
-
33
- /**
34
- * The credentials of the users that will be used to login into your testing environment
35
- * Uncomment if you require support for multiple users
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
  }
@@ -33351,6 +33351,68 @@
33351
33351
  }
33352
33352
  __name(isInstanceOfHTMLElement, "isInstanceOfHTMLElement");
33353
33353
 
33354
+ // ../browser-lib/src/helpers/dom/xpath.ts
33355
+ function getRelativeXPath(element = document, child) {
33356
+ try {
33357
+ let getNodeIdentifier2 = function(node3) {
33358
+ let identifier = node3.nodeName.toLowerCase();
33359
+ let foundAttributeIdentifier = false;
33360
+ ["name", "label", "aria-label", "data-testid", "role"].forEach((attr) => {
33361
+ if (node3.hasAttribute(attr)) {
33362
+ identifier += `[@${attr}="${node3.getAttribute(attr)}"]`;
33363
+ foundAttributeIdentifier = true;
33364
+ }
33365
+ });
33366
+ if (!foundAttributeIdentifier) {
33367
+ let index2 = 1;
33368
+ let sibling = node3.previousSibling;
33369
+ while (sibling) {
33370
+ if (sibling.nodeType === Node.ELEMENT_NODE && sibling.nodeName === node3.nodeName) {
33371
+ index2++;
33372
+ }
33373
+ sibling = sibling.previousSibling;
33374
+ }
33375
+ if (index2 > 1) {
33376
+ identifier += `[${index2}]`;
33377
+ }
33378
+ }
33379
+ return identifier;
33380
+ };
33381
+ var getNodeIdentifier = getNodeIdentifier2;
33382
+ __name(getNodeIdentifier2, "getNodeIdentifier");
33383
+ if (!element || !child || !element.contains(child)) {
33384
+ throw new Error("Child is not a descendant of the given element.");
33385
+ }
33386
+ let path = [];
33387
+ let node2 = child;
33388
+ while (node2 !== element) {
33389
+ if (node2.nodeType === Node.ELEMENT_NODE) {
33390
+ path.unshift(getNodeIdentifier2(node2));
33391
+ }
33392
+ node2 = node2.parentElement;
33393
+ }
33394
+ return path.join("/");
33395
+ } catch (error) {
33396
+ console.error("Failed to get relative xpath", error);
33397
+ return;
33398
+ }
33399
+ }
33400
+ __name(getRelativeXPath, "getRelativeXPath");
33401
+ function findElementsByXPath(parentElement2, xpath) {
33402
+ let evaluator = new XPathEvaluator();
33403
+ let result2 = evaluator.evaluate(
33404
+ xpath,
33405
+ parentElement2,
33406
+ null,
33407
+ XPathResult.FIRST_ORDERED_NODE_TYPE,
33408
+ null
33409
+ );
33410
+ return [result2.singleNodeValue].filter(
33411
+ (node2) => node2 instanceof HTMLElement
33412
+ );
33413
+ }
33414
+ __name(findElementsByXPath, "findElementsByXPath");
33415
+
33354
33416
  // src/lib/test-generator/selectors/compound-selector.ts
33355
33417
  var CLASS_IGNORE_LIST = [
33356
33418
  ":hover",
@@ -33441,7 +33503,7 @@
33441
33503
  const compoundSelector = {
33442
33504
  // generate selectors from the common root to the target element
33443
33505
  targetSelection: {
33444
- xpath: this.getRelativeXPath(commonRoot, targetElement.element),
33506
+ xpath: getRelativeXPath(commonRoot, targetElement.element),
33445
33507
  cssSelectors: this.generateAllContextualSelectors(
33446
33508
  commonRoot,
33447
33509
  targetElement.element
@@ -33535,7 +33597,7 @@
33535
33597
  if (targetSelection.xpath) {
33536
33598
  try {
33537
33599
  addElementstoHistogram(
33538
- this.findElementsByXPath(commonParent, targetSelection.xpath)
33600
+ findElementsByXPath(commonParent, targetSelection.xpath)
33539
33601
  );
33540
33602
  } catch (error) {
33541
33603
  }
@@ -33699,68 +33761,6 @@
33699
33761
  });
33700
33762
  return [...new Set(selectors)];
33701
33763
  }
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
33764
  /**
33765
33765
  * Create a contextual selector from the common root to the target element
33766
33766
  * We can play with the options to build various types of selectors which we could
@@ -33958,8 +33958,6 @@
33958
33958
  );
33959
33959
  attributeMaxSize = Math.max(attributeMaxSize - 10, 0);
33960
33960
  } while (rootClone.outerHTML.length > this.MAX_SNIPPET_SIZE && attributeMaxSize > 0);
33961
- rootClone.querySelectorAll("*").forEach((el) => {
33962
- });
33963
33961
  let htmlSnippet = serializeElement(rootClone, {
33964
33962
  limitAttributeLength: true
33965
33963
  });
@@ -35750,7 +35748,8 @@ ${data.locator}`
35750
35748
  selector: dropzoneSelector.playwrightSelector,
35751
35749
  locator: dropzoneSelector.playwrightLocator,
35752
35750
  parentFramesSelectors: dropzoneSelector.playwrightParentFramesSelectors,
35753
- esraMetadata: dropzoneSelector.esraMetadata
35751
+ esraMetadata: dropzoneSelector.esraMetadata,
35752
+ rrwebId: dropzoneNodeId
35754
35753
  }
35755
35754
  }
35756
35755
  )
@@ -35771,8 +35770,8 @@ ${data.locator}`
35771
35770
  window.parent.document.body.appendChild(liveTMDiv);
35772
35771
  this.sessionReplayer = new SessionReplayer({
35773
35772
  enableInteract: false,
35774
- root: liveTMDiv
35775
- // onlyLive: true,
35773
+ root: liveTMDiv,
35774
+ onlyLive: true
35776
35775
  });
35777
35776
  this.sessionReplayer.start({ firstEventTimestamp: Date.now() });
35778
35777
  }
@@ -36018,6 +36017,9 @@ ${data.locator}`
36018
36017
  pageId: void 0,
36019
36018
  timestamp: event.timestamp,
36020
36019
  id: data?.id || Date.now().toString(),
36020
+ // @ts-ignore
36021
+ rrwebId: event.data?.id,
36022
+ // add rrwebId for services caching
36021
36023
  ...data
36022
36024
  };
36023
36025
  }