@flowriki/agent 0.1.0-beta.19 → 0.1.0-beta.20

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.19";
9
+ var AGENT_VERSION = "0.1.0-beta.20";
10
10
  async function prepareBrowsers() {
11
11
  if (browsersReady()) {
12
12
  return { ok: true, already: true, message: "chromium is already installed" };
@@ -1457,6 +1457,39 @@ function describeAssertion(a, subject) {
1457
1457
  const label = check.label.replace("attribute", `attribute${attr}`);
1458
1458
  return who ? `\u201C${who}\u201D ${label}${expects}` : `${label}${expects}`;
1459
1459
  }
1460
+ var STEP_PRESENTATION = {
1461
+ fill: { label: "Fill", tone: "accent" },
1462
+ select: { label: "Select", tone: "accent" },
1463
+ // Click, press and the double/right variants share a tone: all of them
1464
+ // commit the page and can produce an outcome.
1465
+ click: { label: "Click", tone: "pass" },
1466
+ press: { label: "Press", tone: "pass" },
1467
+ dblclick: { label: "Double-click", tone: "pass" },
1468
+ rightclick: { label: "Right-click", tone: "pass" },
1469
+ check: { label: "Check", tone: "warn" },
1470
+ hover: { label: "Hover", tone: "warn" },
1471
+ drag: { label: "Drag", tone: "accent" },
1472
+ upload: { label: "Upload", tone: "accent" },
1473
+ scroll: { label: "Scroll", tone: "skip" },
1474
+ setRange: { label: "Set", tone: "accent" },
1475
+ // A check, not an action. "assert" is the schema's word; "Check" is the
1476
+ // word the product uses everywhere a person reads it.
1477
+ assert: { label: "Check", tone: "accent" },
1478
+ back: { label: "Back", tone: "skip" },
1479
+ forward: { label: "Forward", tone: "skip" },
1480
+ navigate: { label: "Go to", tone: "skip" },
1481
+ closePage: { label: "Close tab", tone: "skip" },
1482
+ // Steps that act on the SESSION rather than on the page. Drawn apart from
1483
+ // the actions on purpose: these are the rows that explain why a later step
1484
+ // saw what it saw, and falling through to "Click" drew a sign-in as a mouse
1485
+ // click on a button nobody could find in the recording.
1486
+ signIn: { label: "Sign in", tone: "accent" },
1487
+ signOut: { label: "Sign out", tone: "accent" },
1488
+ useActor: { label: "Continue as", tone: "accent" },
1489
+ resetActor: { label: "Start over as", tone: "skip" },
1490
+ capture: { label: "Capture", tone: "warn" },
1491
+ unsupported: { label: "Unsupported", tone: "warn" }
1492
+ };
1460
1493
 
1461
1494
  // ../engine-playwright/dist/index.js
1462
1495
  import fs4 from "fs";
@@ -2441,6 +2474,12 @@ function installDebugPanel() {
2441
2474
  /** The dropdown's headings, in order. Thirty-one options in one layer
2442
2475
  * is a list nobody reads, and whether they are grouped is invisible to
2443
2476
  * a test that only looks at the values. */
2477
+ /** Each step card's type pill, as label and tone — the two things that
2478
+ * have to agree with the flow editor. */
2479
+ stepPills: () => Array.from(root.querySelectorAll(".t")).map((el) => ({
2480
+ label: el.textContent ?? "",
2481
+ tone: Array.from(el.classList).find((c) => c !== "t") ?? ""
2482
+ })),
2444
2483
  checkGroups: () => Array.from(root.querySelectorAll("#acheck optgroup")).map((g) => g.label),
2445
2484
  /** Options sitting directly under the select rather than inside a
2446
2485
  * group — the flat list this was, and the thing that must be empty. */
@@ -2594,10 +2633,13 @@ function installDebugPanel() {
2594
2633
  "font-variant-numeric:tabular-nums;color:var(--subtle)}",
2595
2634
  ".t{display:inline-flex;align-items:center;border-radius:999px;padding:2px 7px;",
2596
2635
  "font-size:10px;font-weight:500}",
2597
- ".t.fill,.t.select{background:var(--accent-soft);color:var(--accent-ink)}",
2598
- ".t.click,.t.press{background:var(--pass-soft);color:var(--pass)}",
2599
- ".t.check{background:var(--warn-soft);color:var(--warn)}",
2600
- ".t.back,.t.forward{background:var(--skip-soft);color:var(--skip)}",
2636
+ // FOUR TONES, the same four the Flows page spells as Tailwind classes.
2637
+ // Keyed by meaning rather than by step type, so a type added to the
2638
+ // catalogue is drawn correctly here without touching this stylesheet.
2639
+ ".t.accent{background:var(--accent-soft);color:var(--accent-ink)}",
2640
+ ".t.pass{background:var(--pass-soft);color:var(--pass)}",
2641
+ ".t.warn{background:var(--warn-soft);color:var(--warn)}",
2642
+ ".t.skip{background:var(--skip-soft);color:var(--skip)}",
2601
2643
  ".nm{font:500 12px ui-monospace,SFMono-Regular,Menlo,monospace;",
2602
2644
  "color:var(--ink);overflow:hidden;text-overflow:ellipsis;white-space:nowrap}",
2603
2645
  ".sc{font-size:10px;color:var(--subtle);overflow:hidden;",
@@ -2629,18 +2671,10 @@ function installDebugPanel() {
2629
2671
  }
2630
2672
  return to;
2631
2673
  };
2632
- const label = (t) => ({
2633
- fill: "Fill",
2634
- select: "Select",
2635
- click: "Click",
2636
- check: "Check",
2637
- press: "Press",
2638
- // "assert" is the schema's word for the step type. "Check" is the word
2639
- // the product uses everywhere a person reads it.
2640
- assert: "Check",
2641
- back: "Back",
2642
- forward: "Forward"
2643
- })[t] || t;
2674
+ const STEPS = w.__flSteps ?? {};
2675
+ const presentation = (t) => STEPS[t] ?? STEPS["click"] ?? { label: t, tone: "pass" };
2676
+ const label = (t) => presentation(t).label;
2677
+ const tone = (t) => presentation(t).tone;
2644
2678
  const esc = (s2) => String(s2).replace(
2645
2679
  /[&<>"]/g,
2646
2680
  (c) => ({ "&": "&amp;", "<": "&lt;", ">": "&gt;", '"': "&quot;" })[c]
@@ -2680,7 +2714,7 @@ function installDebugPanel() {
2680
2714
  state.recorded.includes(st.id) ? "new" : ""
2681
2715
  ].filter(Boolean).join(" ");
2682
2716
  const val = st.secret ? "\u2022\u2022\u2022\u2022\u2022\u2022\u2022\u2022" : st.value || "";
2683
- return '<div class="' + cls + '" data-id="' + esc(st.id) + '" data-i="' + i + '">' + (state.mode === "record" ? "" : '<button class="bp ' + (state.breakpoints.includes(st.id) ? "on" : "") + '" data-bp="' + esc(st.id) + '" title="Breakpoint"></button>') + '<button class="x" data-del="' + esc(st.id) + '" title="Delete step">&#215;</button><div class="h"><span class="o">' + String(i + 1).padStart(2, "0") + '</span><span class="t ' + esc(st.type) + '">' + esc(label(st.type)) + '</span></div><div class="nm"' + (st.detail ? ' title="' + esc(st.detail) + '"' : "") + ">" + // A check names the assertion, because two checks on one element are
2717
+ return '<div class="' + cls + '" data-id="' + esc(st.id) + '" data-i="' + i + '">' + (state.mode === "record" ? "" : '<button class="bp ' + (state.breakpoints.includes(st.id) ? "on" : "") + '" data-bp="' + esc(st.id) + '" title="Breakpoint"></button>') + '<button class="x" data-del="' + esc(st.id) + '" title="Delete step">&#215;</button><div class="h"><span class="o">' + String(i + 1).padStart(2, "0") + '</span><span class="t ' + esc(tone(st.type)) + '">' + esc(label(st.type)) + '</span></div><div class="nm"' + (st.detail ? ' title="' + esc(st.detail) + '"' : "") + ">" + // A check names the assertion, because two checks on one element are
2684
2718
  // two different steps and the element's name renders them the same.
2685
2719
  (st.detail ? esc(st.detail) : st.name ? "&quot;" + esc(st.name) + "&quot;" : "&#8212;") + "</div>" + (st.scope ? '<div class="sc">in ' + esc(st.scope) + "</div>" : "") + (val ? '<div class="vl">' + esc(val) + "</div>" : "") + "</div>";
2686
2720
  }).join("");
@@ -4888,7 +4922,7 @@ async function startRecordingSession(opts) {
4888
4922
  } else if (msg.command === "record") void session.setPaused(!msg.on);
4889
4923
  });
4890
4924
  const INIT_SCRIPT = `${accNameScript()}
4891
- ;window.__flChecks=${JSON.stringify(CHECKS)};
4925
+ ;window.__flChecks=${JSON.stringify(CHECKS)};window.__flSteps=${JSON.stringify(STEP_PRESENTATION)};
4892
4926
  ;(${installRecorder.toString()})();
4893
4927
  ;(${installDebugPanel.toString()})();`;
4894
4928
  const page = await context.newPage();
@@ -5322,7 +5356,7 @@ async function startDebugSession(opts) {
5322
5356
  });
5323
5357
  await context2.addInitScript({
5324
5358
  content: `${accNameScript2()}
5325
- ;window.__flChecks=${JSON.stringify(CHECKS)};
5359
+ ;window.__flChecks=${JSON.stringify(CHECKS)};window.__flSteps=${JSON.stringify(STEP_PRESENTATION)};
5326
5360
  ;(${installRecorder.toString()})();
5327
5361
  ;(${installDebugPanel.toString()})();`
5328
5362
  });
package/dist/cli.js CHANGED
@@ -8,7 +8,7 @@ import {
8
8
  resolveCheckouts,
9
9
  start,
10
10
  status
11
- } from "./chunk-K6L6NDH6.js";
11
+ } from "./chunk-ZVX26LV7.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-K6L6NDH6.js";
12
+ } from "./chunk-ZVX26LV7.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.19",
3
+ "version": "0.1.0-beta.20",
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",