@flowriki/agent 0.1.0-beta.14 → 0.1.0-beta.15

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.
@@ -6,7 +6,7 @@ import os from "os";
6
6
  import path from "path";
7
7
  import { createRequire } from "module";
8
8
  import { spawnSync } from "child_process";
9
- var AGENT_VERSION = "0.1.0-beta.14";
9
+ var AGENT_VERSION = "0.1.0-beta.15";
10
10
  async function prepareBrowsers() {
11
11
  if (browsersReady()) {
12
12
  return { ok: true, already: true, message: "chromium is already installed" };
@@ -4780,15 +4780,22 @@ async function startRecordingSession(opts) {
4780
4780
  const page = await context.newPage();
4781
4781
  if (opts.authentication) {
4782
4782
  try {
4783
- await page.goto(url, { waitUntil: "domcontentloaded" });
4783
+ const runnable = opts.authentication.step.auth ? opts.authentication.resolveAuth(opts.authentication.step.auth) : void 0;
4784
+ if (!runnable || runnable.navigation.kind === "continue") {
4785
+ await page.goto(url, { waitUntil: "domcontentloaded" });
4786
+ }
4784
4787
  await executeStep(page, opts.authentication.step, { ...opts.authentication, baseUrl: url });
4785
4788
  const resume = { id: "auth-return", type: "navigate", name: "Open recording start page", role: "", scope: "", value: new URL(url).pathname + new URL(url).search + new URL(url).hash, navigationBase: "application", secret: false, legacySelector: "", proposals: [] };
4786
4789
  steps.push(opts.authentication.step, resume);
4787
4790
  onStep?.(opts.authentication.step);
4788
4791
  onStep?.(resume);
4789
4792
  } catch (error) {
4790
- await browser.close();
4791
- throw error;
4793
+ const landed = await page.url().replace(/^https?:\/\/[^/]+/, "");
4794
+ const title = await page.title().catch(() => "");
4795
+ stopped = true;
4796
+ await browser.close().catch(() => {
4797
+ });
4798
+ throw new Error(`${firstLine2(error)} \u2014 the browser was on ${landed || "/"}${title ? ` ("${title}")` : ""}`);
4792
4799
  }
4793
4800
  }
4794
4801
  await context.addInitScript({ content: INIT_SCRIPT });
package/dist/cli.js CHANGED
@@ -8,7 +8,7 @@ import {
8
8
  resolveCheckouts,
9
9
  start,
10
10
  status
11
- } from "./chunk-OMYFENN7.js";
11
+ } from "./chunk-KY7KDJTV.js";
12
12
 
13
13
  // src/cli.ts
14
14
  import { parseArgs } from "util";
package/dist/engine.js CHANGED
@@ -9,7 +9,7 @@ import {
9
9
  resolveCheckouts,
10
10
  start,
11
11
  status
12
- } from "./chunk-OMYFENN7.js";
12
+ } from "./chunk-KY7KDJTV.js";
13
13
  export {
14
14
  AGENT_VERSION,
15
15
  browsersReady,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@flowriki/agent",
3
- "version": "0.1.0-beta.14",
3
+ "version": "0.1.0-beta.15",
4
4
  "description": "Run Flowriki UI tests on your own computer. Connects this machine to your Flowriki account.",
5
5
  "license": "SEE LICENSE IN LICENSE",
6
6
  "type": "module",