@dev-blinq/cucumber_client 1.0.1572-dev → 1.0.1574-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 = new URL(url).pathname;
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 newPath = new URL(frame.url()).pathname;
478
+ const newUrl = frame.url();
479
+ const newPath = new URL(newUrl).pathname;
468
480
  const newTitle = await frame.title();
469
- if (newPath !== this.#currentURL) {
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 = newPath;
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);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dev-blinq/cucumber_client",
3
- "version": "1.0.1572-dev",
3
+ "version": "1.0.1574-dev",
4
4
  "description": " ",
5
5
  "main": "bin/index.js",
6
6
  "types": "bin/index.d.ts",
@@ -37,7 +37,7 @@
37
37
  "@babel/traverse": "^7.27.1",
38
38
  "@babel/types": "^7.27.1",
39
39
  "@cucumber/tag-expressions": "^6.1.1",
40
- "@dev-blinq/cucumber-js": "1.0.198-dev",
40
+ "@dev-blinq/cucumber-js": "1.0.199-dev",
41
41
  "@faker-js/faker": "^8.4.1",
42
42
  "automation_model": "1.0.888-dev",
43
43
  "axios": "^1.7.4",