@cutleryapp/agent 1.0.10 → 1.0.11

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.
@@ -223,11 +223,12 @@ async function tryClick(page, nameRe, label) {
223
223
  }
224
224
  async function tryClickScoped(page, nameRe, target, scope) {
225
225
  const FAST = 3000;
226
- // Find a container that contains the scope text, then click the target inside it
226
+ // Strip trailing generic nouns that won't appear verbatim on the page
227
+ const cleanScope = scope.replace(/\s+(?:product|item|section|card|row|container|element|button|link|area|panel|block)$/i, '').trim();
227
228
  const strategies = [
228
- () => page.locator(`:has-text("${scope}")`).last().getByRole('button', { name: nameRe }).first().click({ timeout: FAST }),
229
- () => page.locator(`:has-text("${scope}")`).last().getByRole('link', { name: nameRe }).first().click({ timeout: FAST }),
230
- () => page.locator(`:has-text("${scope}")`).last().getByText(nameRe).first().click({ timeout: FAST }),
229
+ () => page.locator(`:has-text("${cleanScope}")`).last().getByRole('button', { name: nameRe }).first().click({ timeout: FAST }),
230
+ () => page.locator(`:has-text("${cleanScope}")`).last().getByRole('link', { name: nameRe }).first().click({ timeout: FAST }),
231
+ () => page.locator(`:has-text("${cleanScope}")`).last().getByText(nameRe).first().click({ timeout: FAST }),
231
232
  // Fallback: ignore scope and click anywhere
232
233
  () => page.getByRole('button', { name: nameRe }).first().click({ timeout: FAST }),
233
234
  () => page.getByText(nameRe).first().click({ timeout: FAST }),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cutleryapp/agent",
3
- "version": "1.0.10",
3
+ "version": "1.0.11",
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": {