@aarwitz/tapp 0.20.2 → 0.21.0
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.
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "tapp",
|
|
3
3
|
"description": "Give Claude hands and eyes on iOS, Android, and web apps, with exploration, replayable flows, evidence, and deterministic CI gates.",
|
|
4
|
-
"version": "0.
|
|
4
|
+
"version": "0.21.0",
|
|
5
5
|
"author": {
|
|
6
6
|
"name": "Aaron Horowitz",
|
|
7
7
|
"url": "https://github.com/aarwitz"
|
|
@@ -24,7 +24,7 @@
|
|
|
24
24
|
"command": "npx",
|
|
25
25
|
"args": [
|
|
26
26
|
"-y",
|
|
27
|
-
"@aarwitz/tapp@0.
|
|
27
|
+
"@aarwitz/tapp@0.21.0",
|
|
28
28
|
"mcp"
|
|
29
29
|
],
|
|
30
30
|
"cwd": "${CLAUDE_PROJECT_DIR}"
|
|
@@ -389,6 +389,71 @@ export function webStateSignature(info) {
|
|
|
389
389
|
return `${h1.toString(36)}${h2.toString(36)}`.slice(0, 12);
|
|
390
390
|
}
|
|
391
391
|
|
|
392
|
+
// What a dismissal looks like, in the order we would rather press it.
|
|
393
|
+
//
|
|
394
|
+
// Consent first, and declining: a crawler must not grant permissions or accept tracking on
|
|
395
|
+
// someone's behalf, so "reject" beats "accept" and "Allow Device Location" is never a candidate
|
|
396
|
+
// however prominent it is. Then the ordinary ways out of an intake modal. A bare "no" or "close"
|
|
397
|
+
// is last because it is the most likely to mean something else on a page.
|
|
398
|
+
const OVERLAY_DISMISSALS = [
|
|
399
|
+
/^(reject|decline)( all| cookies| non-essential)?$/i,
|
|
400
|
+
/^(necessary|essential) (cookies )?only$/i,
|
|
401
|
+
/^(manage |cookie )?(preferences|settings)$/i,
|
|
402
|
+
/^(not now|no thanks?|maybe later|later|skip|skip for now)$/i,
|
|
403
|
+
/^(dismiss|close|got it|ok|okay|continue without|don't ask again)$/i,
|
|
404
|
+
/^(×|✕|✖|x)$/i,
|
|
405
|
+
];
|
|
406
|
+
// Never press these to get past an overlay: each one grants something on the person's behalf.
|
|
407
|
+
const OVERLAY_NEVER = /allow|accept|enable|agree|subscribe|sign ?up|turn on|share (my )?location|grant/i;
|
|
408
|
+
|
|
409
|
+
export function chooseOverlayDismissal(labels = []) {
|
|
410
|
+
const cleaned = labels.map((label) => String(label || "").replace(/\s+/g, " ").trim()).filter(Boolean);
|
|
411
|
+
for (const pattern of OVERLAY_DISMISSALS) {
|
|
412
|
+
const match = cleaned.find((label) => pattern.test(label) && !OVERLAY_NEVER.test(label));
|
|
413
|
+
if (match) return match;
|
|
414
|
+
}
|
|
415
|
+
return null;
|
|
416
|
+
}
|
|
417
|
+
|
|
418
|
+
/**
|
|
419
|
+
* Clear whatever is covering the page, by pressing its own way out.
|
|
420
|
+
*
|
|
421
|
+
* Cookie banners and intake modals sit in front of a large share of real sites, and a crawler
|
|
422
|
+
* that cannot get past them never sees the application at all — on one real site this left every
|
|
423
|
+
* control on the home page unreachable and the coach search, sign-in and booking flows entirely
|
|
424
|
+
* undiscovered. Escape closes a well-built dialog and nothing else, so find the dismissal the
|
|
425
|
+
* overlay itself offers.
|
|
426
|
+
*/
|
|
427
|
+
export async function dismissBlockingOverlay(page) {
|
|
428
|
+
const choice = await page.evaluate(() => {
|
|
429
|
+
const covering = [...document.querySelectorAll("div,section,aside,dialog")].filter((element) => {
|
|
430
|
+
const style = window.getComputedStyle(element);
|
|
431
|
+
if (style.position !== "fixed" && style.position !== "sticky") return false;
|
|
432
|
+
if (style.display === "none" || style.visibility === "hidden") return false;
|
|
433
|
+
const rect = element.getBoundingClientRect();
|
|
434
|
+
return rect.width > window.innerWidth * 0.4 && rect.height > window.innerHeight * 0.2;
|
|
435
|
+
});
|
|
436
|
+
if (!covering.length) return null;
|
|
437
|
+
const topmost = covering.sort((a, b) => (Number(window.getComputedStyle(b).zIndex) || 0) - (Number(window.getComputedStyle(a).zIndex) || 0))[0];
|
|
438
|
+
return [...topmost.querySelectorAll("button,a,[role=button]")]
|
|
439
|
+
.map((element) => (element.innerText || element.getAttribute("aria-label") || "").replace(/\s+/g, " ").trim())
|
|
440
|
+
.filter(Boolean)
|
|
441
|
+
.slice(0, 20);
|
|
442
|
+
}).catch(() => null);
|
|
443
|
+
if (!choice || !choice.length) return null;
|
|
444
|
+
const label = chooseOverlayDismissal(choice);
|
|
445
|
+
if (!label) return null;
|
|
446
|
+
try {
|
|
447
|
+
await page.getByRole("button", { name: label, exact: true }).first().click({ timeout: 2500 });
|
|
448
|
+
return label;
|
|
449
|
+
} catch {
|
|
450
|
+
try {
|
|
451
|
+
await page.getByText(label, { exact: true }).first().click({ timeout: 2000 });
|
|
452
|
+
return label;
|
|
453
|
+
} catch { return null; }
|
|
454
|
+
}
|
|
455
|
+
}
|
|
456
|
+
|
|
392
457
|
export function webScreenTitle(info, fallback) {
|
|
393
458
|
return String(info?.heading || info?.title || fallback || "").trim();
|
|
394
459
|
}
|
|
@@ -1067,6 +1132,14 @@ export async function exploreWeb({ url, maxActions = 40, timeoutSec = 300, outDi
|
|
|
1067
1132
|
}
|
|
1068
1133
|
if (watch) await showWebWatchAction(page, { action: "Open", target });
|
|
1069
1134
|
await waitForWebStability(page);
|
|
1135
|
+
// Clear whatever greets a first visit before looking at the page, rather than discovering
|
|
1136
|
+
// it control by control. A cookie banner or intake modal covering the viewport otherwise
|
|
1137
|
+
// makes every control on the page unreachable and the application behind it invisible.
|
|
1138
|
+
const greeting = await dismissBlockingOverlay(page).catch(() => null);
|
|
1139
|
+
if (greeting) {
|
|
1140
|
+
narrate(`Dismissed an overlay with "${greeting}"`, { screen: target });
|
|
1141
|
+
await waitForWebStability(page);
|
|
1142
|
+
}
|
|
1070
1143
|
if (nav && typeof nav.status === "function" && nav.status() === 404) {
|
|
1071
1144
|
issue("broken_link", "medium", `Broken link: ${target} → 404`, target);
|
|
1072
1145
|
}
|
|
@@ -1175,6 +1248,12 @@ export async function exploreWeb({ url, maxActions = 40, timeoutSec = 300, outDi
|
|
|
1175
1248
|
id: await b.getAttribute("id").catch(() => ""),
|
|
1176
1249
|
}).slice(0, 40);
|
|
1177
1250
|
if (/log ?out|sign ?out|delete|remove/i.test(label)) continue; // don't destroy test state
|
|
1251
|
+
// Nor consent on anyone's behalf. Probing clicks every button it can reach, which on a
|
|
1252
|
+
// real site means pressing "Allow Device Location", "Accept all cookies" or "Subscribe"
|
|
1253
|
+
// — granting a permission, accepting tracking, or signing someone up, none of which an
|
|
1254
|
+
// observation should do. Dismissals ("Not now", "Reject all") stay clickable, so an
|
|
1255
|
+
// overlay can still be got past; see chooseOverlayDismissal.
|
|
1256
|
+
if (OVERLAY_NEVER.test(label)) continue;
|
|
1178
1257
|
// Capture only durable, user-visible semantics around this control. A global
|
|
1179
1258
|
// MutationObserver is intentionally avoided: carousels, chat launchers, and live
|
|
1180
1259
|
// counters can mutate while an unrelated dead button is clicked, creating verdict jitter.
|
|
@@ -1193,8 +1272,13 @@ export async function exploreWeb({ url, maxActions = 40, timeoutSec = 300, outDi
|
|
|
1193
1272
|
// opened by a button probed moments ago. Every remaining control on the page used to
|
|
1194
1273
|
// be clicked into that overlay and silently skipped, so a page with a modal reported
|
|
1195
1274
|
// no dead controls at all however many it had. Clear the overlay and try once more.
|
|
1196
|
-
await page
|
|
1275
|
+
const dismissed = await dismissBlockingOverlay(page).catch(() => null);
|
|
1276
|
+
if (dismissed) narrate(`Dismissed an overlay with "${dismissed}"`, { screen: ob.screen });
|
|
1277
|
+
else await page.keyboard.press("Escape").catch(() => {});
|
|
1197
1278
|
await waitForWebStability(page);
|
|
1279
|
+
// Clearing the obstruction is itself a change to the page, so anything compared against
|
|
1280
|
+
// the snapshot taken before it would look as though this control had done something.
|
|
1281
|
+
beforeState = await captureWebControlState(page, b);
|
|
1198
1282
|
try {
|
|
1199
1283
|
await b.click({ timeout: 2000 });
|
|
1200
1284
|
clickSucceeded = true;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@aarwitz/tapp",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.21.0",
|
|
4
4
|
"mcpName": "io.github.aarwitz/tapp",
|
|
5
5
|
"description": "Let coding agents verify UI changes on real iOS, Android, and web surfaces, then enforce reviewed proof in deterministic CI.",
|
|
6
6
|
"license": "MIT",
|