@flowriki/agent 0.1.0-beta.25 → 0.1.0-beta.27
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.
|
|
9
|
+
var AGENT_VERSION = "0.1.0-beta.27";
|
|
10
10
|
async function prepareBrowsers() {
|
|
11
11
|
if (browsersReady()) {
|
|
12
12
|
return { ok: true, already: true, message: "chromium is already installed" };
|
|
@@ -3587,8 +3587,11 @@ var RunActors = class {
|
|
|
3587
3587
|
this.sessions.set(id, session);
|
|
3588
3588
|
await this.opts.onCreate?.(session);
|
|
3589
3589
|
}
|
|
3590
|
+
const switching = this.current !== session;
|
|
3590
3591
|
this.current = session;
|
|
3591
3592
|
this.currentId = id;
|
|
3593
|
+
if (switching && this.opts.headless === false) await session.page.bringToFront().catch(() => {
|
|
3594
|
+
});
|
|
3592
3595
|
if (this.initialized.has(id)) return;
|
|
3593
3596
|
if (startUrl) await session.page.goto(startUrl, { waitUntil: "domcontentloaded" });
|
|
3594
3597
|
if (actor?.startSignedIn) {
|
|
@@ -4092,6 +4095,11 @@ async function locateCandidates(page, step, opts = {}) {
|
|
|
4092
4095
|
async function locateAll(page, step, opts = {}) {
|
|
4093
4096
|
return fromPlan(page, step, locatorPlan(step), opts);
|
|
4094
4097
|
}
|
|
4098
|
+
var ICON_GLYPHS = "[\\s\\uE000-\\uF8FF\\u{F0000}-\\u{FFFFD}\\u{100000}-\\u{10FFFD}]*";
|
|
4099
|
+
function nameIgnoringIcons(name) {
|
|
4100
|
+
const escaped = name.trim().replace(/[.*+?^${}()|[\]\\]/g, "\\$&").replace(/\s+/g, "\\s+");
|
|
4101
|
+
return new RegExp(`^${ICON_GLYPHS}${escaped}${ICON_GLYPHS}$`, "u");
|
|
4102
|
+
}
|
|
4095
4103
|
async function fromPlan(page, step, plan, opts = {}) {
|
|
4096
4104
|
let root = rootFor(page, step);
|
|
4097
4105
|
if ((step.scope || step.scopeRole) && !plan.overridden) {
|
|
@@ -4109,7 +4117,7 @@ async function fromPlan(page, step, plan, opts = {}) {
|
|
|
4109
4117
|
loc = root.getByTestId(plan.arg);
|
|
4110
4118
|
break;
|
|
4111
4119
|
case "getByText":
|
|
4112
|
-
loc = root.getByText(plan.arg, { exact: plan.exact });
|
|
4120
|
+
loc = root.getByText(plan.exact ? nameIgnoringIcons(plan.arg) : plan.arg, { exact: plan.exact });
|
|
4113
4121
|
break;
|
|
4114
4122
|
case "getByLabel":
|
|
4115
4123
|
loc = root.getByLabel(plan.arg, { exact: true });
|
|
@@ -4124,7 +4132,12 @@ async function fromPlan(page, step, plan, opts = {}) {
|
|
|
4124
4132
|
loc = root.getByTitle(plan.arg, { exact: true });
|
|
4125
4133
|
break;
|
|
4126
4134
|
case "getByRole":
|
|
4127
|
-
loc = root.getByRole(plan.arg, {
|
|
4135
|
+
loc = root.getByRole(plan.arg, {
|
|
4136
|
+
// Unchanged when there is no name to match, or an empty one.
|
|
4137
|
+
name: plan.name ? nameIgnoringIcons(plan.name) : plan.name,
|
|
4138
|
+
exact: true,
|
|
4139
|
+
includeHidden: opts.includeHidden
|
|
4140
|
+
});
|
|
4128
4141
|
break;
|
|
4129
4142
|
case "none":
|
|
4130
4143
|
if (opts.allowRoleOnly && step.role) {
|
package/dist/cli.js
CHANGED
package/dist/engine.js
CHANGED
package/package.json
CHANGED