@dev-blinq/cucumber_client 1.0.1517-dev → 1.0.1519-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.
@@ -4,7 +4,7 @@ import { existsSync, readdirSync, readFileSync, rmSync } from "fs";
4
4
  import path from "path";
5
5
  import url from "url";
6
6
  import { getImplementedSteps, parseRouteFiles } from "./implemented_steps.js";
7
- import { NamesService } from "./services.js";
7
+ import { NamesService, RemoteBrowserService } from "./services.js";
8
8
  import { BVTStepRunner } from "./step_runner.js";
9
9
  import { readFile, writeFile } from "fs/promises";
10
10
  import { updateStepDefinitions, loadStepDefinitions, getCommandsForImplementedStep } from "./step_utils.js";
@@ -16,7 +16,7 @@ import { unEscapeNonPrintables } from "../cucumber/utils.js";
16
16
  import { findAvailablePort } from "../utils/index.js";
17
17
  import socketLogger from "../utils/socket_logger.js";
18
18
  import { tmpdir } from "os";
19
- import { faker } from "@faker-js/faker";
19
+ import { faker } from "@faker-js/faker/locale/en_US";
20
20
  const __dirname = path.dirname(url.fileURLToPath(import.meta.url));
21
21
 
22
22
  const delay = (ms) => new Promise((resolve) => setTimeout(resolve, ms));
@@ -209,6 +209,7 @@ export class BVTRecorder {
209
209
  cmdExecutionSuccess: "BVTRecorder.cmdExecutionSuccess",
210
210
  cmdExecutionError: "BVTRecorder.cmdExecutionError",
211
211
  interceptResults: "BVTRecorder.interceptResults",
212
+ onDebugURLChange: "BVTRecorder.onDebugURLChange",
212
213
  };
213
214
  bindings = {
214
215
  __bvt_recordCommand: async ({ frame, page, context }, event) => {
@@ -402,6 +403,15 @@ export class BVTRecorder {
402
403
  // add listeners for new pages
403
404
  this._addPagelisteners(this.context);
404
405
 
406
+ if (process.env.REMOTE_RECORDER === "true") {
407
+ this.remoteBrowser = new RemoteBrowserService({
408
+ CDP_CONNECT_URL: `http://localhost:${this.#remoteDebuggerPort}`,
409
+ currentPage: this.page,
410
+ });
411
+ this.remoteBrowser.on("debugURLChange", (url) => {
412
+ this.sendEvent(this.events.onDebugURLChange, url);
413
+ });
414
+ }
405
415
  await this.page.goto(url, {
406
416
  waitUntil: "domcontentloaded",
407
417
  });
@@ -624,7 +634,9 @@ export class BVTRecorder {
624
634
  try {
625
635
  if (page.isClosed()) return;
626
636
  this.pageSet.add(page);
627
-
637
+ if (this.remoteBrowser) {
638
+ this.remoteBrowser.selectedPage = page;
639
+ }
628
640
  await page.waitForLoadState("domcontentloaded");
629
641
 
630
642
  // add listener for frame navigation on new tab
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dev-blinq/cucumber_client",
3
- "version": "1.0.1517-dev",
3
+ "version": "1.0.1519-dev",
4
4
  "description": " ",
5
5
  "main": "bin/index.js",
6
6
  "types": "bin/index.d.ts",