@cutleryapp/agent 1.0.11 → 1.0.12

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.
@@ -92,26 +92,22 @@ class TestExecutor {
92
92
  }
93
93
  }
94
94
  else if (lower.includes("fill") || lower.includes("type") || lower.includes("enter")) {
95
- const quoted = raw.match(/(?:enter|fill|type)\s+"([^"]+)"\s+(?:in|into)\s+(?:the\s+)?(?:"([^"]+)"|(\w[\w\s]*?)\s*(?:field|input|box|area)?)\s*$/i);
96
- if (quoted) {
97
- const value = quoted[1];
98
- const quotedTarget = quoted[2];
99
- const bareLabel = quoted[3];
100
- // A token in quotes is usually a human-readable label
101
- // (e.g. `Fill "standard_user" in "Username"`), not a CSS
102
- // selector. Only treat it as a CSS selector when it actually
103
- // looks like one — otherwise resolve via tryFill so the
104
- // label can match placeholder/aria/data-test/label etc.
95
+ // Support both quoted and unquoted formats:
96
+ // Fill "standard_user" in "Username"
97
+ // Fill standard_user in Username field
98
+ // Split on first " in " / " into " to separate value from field
99
+ const match = raw.match(/(?:enter|fill|type)\s+"([^"]+)"\s+(?:in|into)\s+(?:the\s+)?"?([^"]+?)"?\s*(?:field|input|box|area)?\s*$/i) ||
100
+ raw.match(/(?:enter|fill|type)\s+(\S+)\s+(?:in|into)\s+(?:the\s+)?(.+?)\s*(?:field|input|box|area)?\s*$/i);
101
+ if (match) {
102
+ const value = match[1].trim();
103
+ const fieldLabel = match[2].trim();
105
104
  const looksLikeCss = (s) => /[#.\[\]:>]/.test(s);
106
- if (quotedTarget && looksLikeCss(quotedTarget)) {
107
- await page.waitForSelector(quotedTarget, { state: "visible", timeout: 5000 });
108
- await page.fill(quotedTarget, value);
105
+ if (looksLikeCss(fieldLabel)) {
106
+ await page.waitForSelector(fieldLabel, { state: "visible", timeout: 5000 });
107
+ await page.fill(fieldLabel, value);
109
108
  }
110
- else if (quotedTarget) {
111
- await tryFill(page, quotedTarget.trim(), value);
112
- }
113
- else if (bareLabel) {
114
- await tryFill(page, bareLabel.trim(), value);
109
+ else {
110
+ await tryFill(page, fieldLabel, value);
115
111
  }
116
112
  }
117
113
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cutleryapp/agent",
3
- "version": "1.0.11",
3
+ "version": "1.0.12",
4
4
  "description": "Local agent that connects your machine to the Cutlery QA platform and runs UI tests via Playwright",
5
5
  "main": "dist/cli.js",
6
6
  "bin": {