@dev-blinq/cucumber_client 1.0.1571-dev → 1.0.1573-dev
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.
|
@@ -157,6 +157,17 @@ const transformAction = (action, el, isVerify, isPopupCloseClick, isInHoverMode,
|
|
|
157
157
|
}
|
|
158
158
|
}
|
|
159
159
|
};
|
|
160
|
+
const diffPaths = (currentPath, newPath) => {
|
|
161
|
+
const currentDomain = new URL(currentPath).hostname;
|
|
162
|
+
const newDomain = new URL(newPath).hostname;
|
|
163
|
+
if (currentDomain !== newDomain) {
|
|
164
|
+
return true;
|
|
165
|
+
} else {
|
|
166
|
+
const currentRoute = new URL(currentPath).pathname;
|
|
167
|
+
const newRoute = new URL(newPath).pathname;
|
|
168
|
+
return currentRoute !== newRoute;
|
|
169
|
+
}
|
|
170
|
+
};
|
|
160
171
|
/**
|
|
161
172
|
* @typedef {Object} BVTRecorderInput
|
|
162
173
|
* @property {string} envName
|
|
@@ -422,7 +433,7 @@ export class BVTRecorder {
|
|
|
422
433
|
|
|
423
434
|
// eval init script on current tab
|
|
424
435
|
// await this._initPage(this.page);
|
|
425
|
-
this.#currentURL =
|
|
436
|
+
this.#currentURL = url;
|
|
426
437
|
|
|
427
438
|
await this.page.dispatchEvent("html", "scroll");
|
|
428
439
|
await delay(1000);
|
|
@@ -464,14 +475,15 @@ export class BVTRecorder {
|
|
|
464
475
|
element: { inputID: "frame" },
|
|
465
476
|
});
|
|
466
477
|
|
|
467
|
-
const
|
|
478
|
+
const newUrl = frame.url();
|
|
479
|
+
const newPath = new URL(newUrl).pathname;
|
|
468
480
|
const newTitle = await frame.title();
|
|
469
|
-
|
|
481
|
+
const changed = diffPaths(this.#currentURL, newUrl);
|
|
482
|
+
|
|
483
|
+
if (changed) {
|
|
470
484
|
this.sendEvent(this.events.onFrameNavigate, { url: newPath, title: newTitle });
|
|
471
|
-
this.#currentURL =
|
|
485
|
+
this.#currentURL = newUrl;
|
|
472
486
|
}
|
|
473
|
-
// await this._setRecordingMode(frame);
|
|
474
|
-
// await this._initPage(page);
|
|
475
487
|
} catch (error) {
|
|
476
488
|
this.logger.error("Error in frame navigate event");
|
|
477
489
|
this.logger.error(error);
|
|
@@ -633,7 +645,6 @@ export class BVTRecorder {
|
|
|
633
645
|
|
|
634
646
|
_addPagelisteners(context) {
|
|
635
647
|
context.on("page", async (page) => {
|
|
636
|
-
console.log("New page opened");
|
|
637
648
|
try {
|
|
638
649
|
if (page.isClosed()) return;
|
|
639
650
|
this.pageSet.add(page);
|
|
@@ -722,7 +733,7 @@ export class BVTRecorder {
|
|
|
722
733
|
const { id, contextId, doc } = snapshotDetails;
|
|
723
734
|
// const selector = `[data-blinq-id="${id}"]`;
|
|
724
735
|
const newPage = await this.backgroundContext.newPage();
|
|
725
|
-
await newPage.setContent(doc);
|
|
736
|
+
await newPage.setContent(doc, { waitUntil: "domcontentloaded" });
|
|
726
737
|
const locatorsObj = await newPage.evaluate(
|
|
727
738
|
([id, contextId, mode]) => {
|
|
728
739
|
const recorder = window.__bvt_Recorder;
|