@flowriki/agent 0.1.0-beta.26 → 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.26";
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" };
@@ -4095,6 +4095,11 @@ async function locateCandidates(page, step, opts = {}) {
4095
4095
  async function locateAll(page, step, opts = {}) {
4096
4096
  return fromPlan(page, step, locatorPlan(step), opts);
4097
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
+ }
4098
4103
  async function fromPlan(page, step, plan, opts = {}) {
4099
4104
  let root = rootFor(page, step);
4100
4105
  if ((step.scope || step.scopeRole) && !plan.overridden) {
@@ -4112,7 +4117,7 @@ async function fromPlan(page, step, plan, opts = {}) {
4112
4117
  loc = root.getByTestId(plan.arg);
4113
4118
  break;
4114
4119
  case "getByText":
4115
- loc = root.getByText(plan.arg, { exact: plan.exact });
4120
+ loc = root.getByText(plan.exact ? nameIgnoringIcons(plan.arg) : plan.arg, { exact: plan.exact });
4116
4121
  break;
4117
4122
  case "getByLabel":
4118
4123
  loc = root.getByLabel(plan.arg, { exact: true });
@@ -4127,7 +4132,12 @@ async function fromPlan(page, step, plan, opts = {}) {
4127
4132
  loc = root.getByTitle(plan.arg, { exact: true });
4128
4133
  break;
4129
4134
  case "getByRole":
4130
- loc = root.getByRole(plan.arg, { name: plan.name, exact: true, includeHidden: opts.includeHidden });
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
+ });
4131
4141
  break;
4132
4142
  case "none":
4133
4143
  if (opts.allowRoleOnly && step.role) {
package/dist/cli.js CHANGED
@@ -8,7 +8,7 @@ import {
8
8
  resolveCheckouts,
9
9
  start,
10
10
  status
11
- } from "./chunk-IH7KFCV4.js";
11
+ } from "./chunk-6FCAGGGY.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-IH7KFCV4.js";
12
+ } from "./chunk-6FCAGGGY.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.26",
3
+ "version": "0.1.0-beta.27",
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",