@flowriki/agent 0.1.0-beta.21 → 0.1.0-beta.22
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.
- package/dist/{chunk-U3QYIAXF.js → chunk-O3S4QSN4.js} +22 -18
- package/dist/cli.js +1 -1
- package/dist/engine.js +1 -1
- package/package.json +1 -1
|
@@ -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.
|
|
9
|
+
var AGENT_VERSION = "0.1.0-beta.22";
|
|
10
10
|
async function prepareBrowsers() {
|
|
11
11
|
if (browsersReady()) {
|
|
12
12
|
return { ok: true, already: true, message: "chromium is already installed" };
|
|
@@ -458,7 +458,7 @@ import path7 from "path";
|
|
|
458
458
|
// ../engine-playwright/dist/index.js
|
|
459
459
|
import path3 from "path";
|
|
460
460
|
|
|
461
|
-
// ../test-model/dist/chunk-
|
|
461
|
+
// ../test-model/dist/chunk-X4X4KGMA.js
|
|
462
462
|
import { z as z3 } from "zod";
|
|
463
463
|
var LocatorOverrideSchema = z3.object({
|
|
464
464
|
strategy: z3.enum(["css", "xpath", "id", "testId", "text", "label", "placeholder", "altText", "title"]),
|
|
@@ -542,11 +542,13 @@ var RecordedTargetSchema = z3.object({
|
|
|
542
542
|
* find its element has none — although the field is sitting in plain sight
|
|
543
543
|
* and two other things about it are unchanged.
|
|
544
544
|
*
|
|
545
|
-
* Tried in order, and ONLY where the one before
|
|
546
|
-
*
|
|
547
|
-
*
|
|
548
|
-
*
|
|
549
|
-
*
|
|
545
|
+
* Tried in order, and ONLY where the one before did not identify a single
|
|
546
|
+
* element. EXACTLY ONE MATCH WINS: a locator matching several is
|
|
547
|
+
* disqualified rather than obeyed, so choosing between two elements never
|
|
548
|
+
* happens — and where nothing identifies one, the run stops and names the
|
|
549
|
+
* ambiguity. A step that resolves by anything other than its first choice
|
|
550
|
+
* says so in the result: a repair nobody can see is a repair nobody can
|
|
551
|
+
* trust. */
|
|
550
552
|
candidates: z3.array(LocatorOverrideSchema).max(4).optional(),
|
|
551
553
|
nth: z3.number().int().nonnegative().optional()
|
|
552
554
|
});
|
|
@@ -4814,25 +4816,27 @@ async function ensureTarget(page, step, timeout) {
|
|
|
4814
4816
|
const primary = candidates[0];
|
|
4815
4817
|
const firstWait = Math.max(500, Math.floor(timeout * 0.45));
|
|
4816
4818
|
const recovery = Math.max(1e3, Math.floor(timeout * 0.35));
|
|
4819
|
+
let several = null;
|
|
4817
4820
|
try {
|
|
4818
4821
|
await primary.waitFor({ state: "attached", timeout: firstWait });
|
|
4819
4822
|
return { loc: primary };
|
|
4820
4823
|
} catch (error) {
|
|
4821
|
-
if (/strict mode violation/.test(String(error)))
|
|
4822
|
-
throw Object.assign(error, { kind: "ambiguous" });
|
|
4823
|
-
}
|
|
4824
|
+
if (/strict mode violation/.test(String(error))) several = error;
|
|
4824
4825
|
}
|
|
4826
|
+
let crowded = null;
|
|
4825
4827
|
for (let at = 1; at < candidates.length; at += 1) {
|
|
4826
4828
|
const found = await candidates[at].count().catch(() => 0);
|
|
4827
4829
|
if (found === 1) return { loc: candidates[at], foundBy: described[at] ?? "another locator" };
|
|
4828
|
-
if (found > 1) {
|
|
4829
|
-
|
|
4830
|
-
|
|
4831
|
-
|
|
4832
|
-
|
|
4833
|
-
|
|
4834
|
-
|
|
4835
|
-
|
|
4830
|
+
if (found > 1 && !crowded) crowded = { where: described[at] ?? "another locator", count: found };
|
|
4831
|
+
}
|
|
4832
|
+
if (several) throw Object.assign(several, { kind: "ambiguous" });
|
|
4833
|
+
if (crowded) {
|
|
4834
|
+
throw Object.assign(
|
|
4835
|
+
new Error(
|
|
4836
|
+
`"${step.name}" could not be found the way this step records it, and ${crowded.count} elements match ${crowded.where} \u2014 nothing this step knows tells them apart, so narrow it in the editor`
|
|
4837
|
+
),
|
|
4838
|
+
{ kind: "ambiguous" }
|
|
4839
|
+
);
|
|
4836
4840
|
}
|
|
4837
4841
|
if (await scrollUntilFound(page, primary, recovery)) return { loc: primary };
|
|
4838
4842
|
throw Object.assign(
|
package/dist/cli.js
CHANGED
package/dist/engine.js
CHANGED
package/package.json
CHANGED