@aarwitz/tapp 0.31.0 → 0.33.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.
- package/.claude-plugin/plugin.json +2 -2
- package/browser/app.js +44 -1
- package/browser/index.html +4 -0
- package/docs/BROWSER-PRODUCT.md +19 -0
- package/mcp-server/src/alerts.js +97 -0
- package/mcp-server/src/android-flow.js +13 -1
- package/mcp-server/src/browser-product.js +47 -5
- package/mcp-server/src/index.js +4 -3
- package/mcp-server/src/journeys.js +16 -4
- package/mcp-server/src/sign-in.js +91 -0
- package/mcp-server/src/web-explorer.js +41 -15
- package/mcp-server/src/web-flow.js +13 -5
- package/package.json +2 -2
|
@@ -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.33.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.33.0",
|
|
28
28
|
"mcp"
|
|
29
29
|
],
|
|
30
30
|
"cwd": "${CLAUDE_PROJECT_DIR}"
|
package/browser/app.js
CHANGED
|
@@ -174,6 +174,7 @@ function applyAccessMode() {
|
|
|
174
174
|
$("#actors-panel")?.classList.toggle("hidden", !signedIn);
|
|
175
175
|
$("#journeys-panel")?.classList.toggle("hidden", !signedIn);
|
|
176
176
|
$("#agent-panel")?.classList.toggle("hidden", !signedIn);
|
|
177
|
+
$("#alerts-panel")?.classList.toggle("hidden", !signedIn);
|
|
177
178
|
$("#admin-nav")?.classList.toggle("hidden", !state.session?.admin);
|
|
178
179
|
}
|
|
179
180
|
|
|
@@ -286,6 +287,43 @@ function renderAdmin() {
|
|
|
286
287
|
</section>`;
|
|
287
288
|
}
|
|
288
289
|
|
|
290
|
+
// Being told, rather than having to look. The URL is write-only: once set, the Studio shows
|
|
291
|
+
// which host it points at and when it last delivered, never the URL — anyone holding it can post
|
|
292
|
+
// into that channel.
|
|
293
|
+
async function loadAlerts() {
|
|
294
|
+
if (state.session?.access !== "account") { state.alerts = null; return; }
|
|
295
|
+
state.alerts = await api("/api/alerts").catch(() => null);
|
|
296
|
+
}
|
|
297
|
+
|
|
298
|
+
function renderAlerts() {
|
|
299
|
+
const node = $("#alerts-body");
|
|
300
|
+
if (!node) return;
|
|
301
|
+
const alerts = state.alerts;
|
|
302
|
+
const delivery = alerts?.lastDelivery;
|
|
303
|
+
const last = delivery
|
|
304
|
+
? `<p class="muted">Last post: ${esc(compactDate(delivery.at))} · ${esc(delivery.journey || "")} · ${delivery.delivered ? "delivered" : `not delivered — ${esc(delivery.reason || "")}`}</p>`
|
|
305
|
+
: "";
|
|
306
|
+
node.innerHTML = alerts?.configured
|
|
307
|
+
? `<div class="actor-row"><span><strong>Posting to ${esc(alerts.host)}</strong><br><small>set ${esc(compactDate(alerts.updatedAt))}</small></span><span></span><span class="journey-actions"><button class="quiet" type="button" data-alert-test>Send a test</button><button class="quiet" type="button" data-alert-clear>Stop</button></span></div>${last}`
|
|
308
|
+
: `<form id="alerts-form" class="signin-row"><input id="alert-webhook" type="url" placeholder="https://hooks.slack.com/services/…" required><button class="primary" type="submit">Save</button></form><p class="muted">tapp posts a test message when you save, so you know it works before anything breaks.</p>${last}`;
|
|
309
|
+
}
|
|
310
|
+
|
|
311
|
+
async function saveAlerts(webhook) {
|
|
312
|
+
try {
|
|
313
|
+
state.alerts = await api("/api/alerts", { method: "POST", body: JSON.stringify({ webhook }) });
|
|
314
|
+
renderAlerts();
|
|
315
|
+
toast(webhook ? "Saved — check the channel for the test message." : "Stopped posting.");
|
|
316
|
+
} catch (error) { toast(error.message, true); }
|
|
317
|
+
}
|
|
318
|
+
|
|
319
|
+
async function testAlerts() {
|
|
320
|
+
try {
|
|
321
|
+
state.alerts = await api("/api/alerts/test", { method: "POST", body: "{}" });
|
|
322
|
+
renderAlerts();
|
|
323
|
+
toast("Posted. Check the channel.");
|
|
324
|
+
} catch (error) { toast(error.message, true); }
|
|
325
|
+
}
|
|
326
|
+
|
|
289
327
|
async function loadTokens() {
|
|
290
328
|
if (state.session?.access !== "account") { state.tokens = []; return; }
|
|
291
329
|
state.tokens = (await api("/api/tokens").catch(() => ({ tokens: [] }))).tokens || [];
|
|
@@ -605,6 +643,7 @@ function renderObservations(audit) {
|
|
|
605
643
|
|
|
606
644
|
function renderRuns() {
|
|
607
645
|
renderAdmin();
|
|
646
|
+
renderAlerts();
|
|
608
647
|
renderJourneys();
|
|
609
648
|
renderActors();
|
|
610
649
|
renderTokens();
|
|
@@ -889,7 +928,7 @@ async function refresh() {
|
|
|
889
928
|
state.audits = runs.audits || [];
|
|
890
929
|
state.explores = runs.explores || [];
|
|
891
930
|
state.actors = actors.apps || [];
|
|
892
|
-
await Promise.all([loadJourneys(), loadTokens(), loadAdmin()]);
|
|
931
|
+
await Promise.all([loadJourneys(), loadTokens(), loadAdmin(), loadAlerts()]);
|
|
893
932
|
renderAdmin();
|
|
894
933
|
renderProject();
|
|
895
934
|
return;
|
|
@@ -1074,6 +1113,8 @@ document.addEventListener("submit", (event) => {
|
|
|
1074
1113
|
if (prompt) { event.preventDefault(); startFromPrompt(prompt.elements.input.value).catch((error) => toast(error.message, true)); }
|
|
1075
1114
|
const ask = event.target.closest("#chat-ask");
|
|
1076
1115
|
if (ask) { event.preventDefault(); answerAsk(ask, "submit"); }
|
|
1116
|
+
const alertsForm = event.target.closest("#alerts-form");
|
|
1117
|
+
if (alertsForm) { event.preventDefault(); saveAlerts(alertsForm.elements.webhook?.value || $("#alert-webhook")?.value || ""); }
|
|
1077
1118
|
const signin = event.target.closest("#signin-form");
|
|
1078
1119
|
if (signin) { event.preventDefault(); requestSignInLink(signin.elements.email.value.trim()); }
|
|
1079
1120
|
const keep = event.target.closest("#chat-keep");
|
|
@@ -1096,6 +1137,8 @@ document.addEventListener("click", (event) => {
|
|
|
1096
1137
|
const forgetJ = event.target.closest("[data-forget-journey]");
|
|
1097
1138
|
if (forgetJ) { event.preventDefault(); forgetJourney(forgetJ.dataset.forgetJourney).catch((error) => toast(error.message, true)); }
|
|
1098
1139
|
if (event.target.closest("[data-open-owned]")) { event.preventDefault(); showProduct(); activateView("runs"); renderRuns(); }
|
|
1140
|
+
if (event.target.closest("[data-alert-test]")) { event.preventDefault(); testAlerts(); }
|
|
1141
|
+
if (event.target.closest("[data-alert-clear]")) { event.preventDefault(); saveAlerts(""); }
|
|
1099
1142
|
if (event.target.closest("#create-token")) { event.preventDefault(); createToken(); }
|
|
1100
1143
|
const revoke = event.target.closest("[data-revoke-token]");
|
|
1101
1144
|
if (revoke) { event.preventDefault(); revokeToken(revoke.dataset.revokeToken).catch((error) => toast(error.message, true)); }
|
package/browser/index.html
CHANGED
|
@@ -183,6 +183,10 @@
|
|
|
183
183
|
<div class="section-heading compact"><div><p class="eyebrow">Test accounts</p><h2>What tapp can sign in as <i id="actor-count" class="zero">0</i></h2><p>Kept encrypted. Shown here is only the name and whether a password or a signed-in session is held — never the values. Forget one and tapp will ask again next time.</p></div></div>
|
|
184
184
|
<div id="actors-list"><div class="empty">None yet. Explore a site with a sign-in and tapp will ask.</div></div>
|
|
185
185
|
</section>
|
|
186
|
+
<section class="panel section hidden" id="alerts-panel">
|
|
187
|
+
<div class="section-heading compact"><div><p class="eyebrow">When something breaks</p><h2>Tell me, don't make me look</h2><p>Paste a Slack or Discord webhook (anything that accepts a POST works). tapp posts when a journey <b>stops working</b>, and again when it <b>works again</b> — never on every check.</p></div></div>
|
|
188
|
+
<div id="alerts-body"></div>
|
|
189
|
+
</section>
|
|
186
190
|
<section class="panel section hidden" id="agent-panel">
|
|
187
191
|
<div class="section-heading compact">
|
|
188
192
|
<div><p class="eyebrow">Your coding agent</p><h2>Let your agent check these journeys <i id="token-count" class="zero">0</i></h2><p>A token lets your coding agent ask “is everything still passing?” and replay a journey — as you, without a browser. It is shown once and can be revoked at any time.</p></div>
|
package/docs/BROWSER-PRODUCT.md
CHANGED
|
@@ -181,3 +181,22 @@ committed Flows (subfolders and all) or this machine's kept journeys. The MCP to
|
|
|
181
181
|
two abilities on the existing tools — `tapp_report { journeys: true }` and
|
|
182
182
|
`tapp_run { journey }` — never new tools (ADR-0007). Both are implemented by
|
|
183
183
|
`mcp-server/src/studio-client.js`.
|
|
184
|
+
|
|
185
|
+
## Alerts
|
|
186
|
+
|
|
187
|
+
A kept journey that goes red is only news if someone hears about it. `alerts.js` posts to a
|
|
188
|
+
webhook the owner pastes in (`POST /api/alerts`, `GET` returns a summary, `POST /api/alerts/test`
|
|
189
|
+
sends one on demand) — Slack and Discord both accept the body, which carries `text` and `content`
|
|
190
|
+
plus the journey, state and step counts.
|
|
191
|
+
|
|
192
|
+
Rules that keep it worth reading:
|
|
193
|
+
|
|
194
|
+
- **Only on a change.** `alertForChange` compares the previous result with the new one; a journey
|
|
195
|
+
that has been failing for a week does not produce a message every day, and a first run produces
|
|
196
|
+
none at all because nothing has changed yet.
|
|
197
|
+
- **Proved before promised.** Saving a webhook posts a message to it; if that fails the webhook is
|
|
198
|
+
not saved and the error says why.
|
|
199
|
+
- **Write-only.** The stored URL never leaves the store: the summary gives the host and the last
|
|
200
|
+
delivery. Anyone holding the URL can post into that channel.
|
|
201
|
+
- **Public https only.** The post comes from the server, so a webhook on localhost or a private
|
|
202
|
+
range is refused, the same rule the egress proxy enforces for exploration.
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
// Telling someone their journey stopped working, without tapp sending email.
|
|
2
|
+
//
|
|
3
|
+
// A monitoring product that only shows you a failure when you happen to open the page is not one.
|
|
4
|
+
// tapp has no mail provider by design (see ADR-0009 slice 2b), so the way out is a webhook: the
|
|
5
|
+
// owner pastes a URL — Slack and Discord both give you one, and so does anything else that can
|
|
6
|
+
// receive a POST — and tapp posts to it when a journey changes state.
|
|
7
|
+
//
|
|
8
|
+
// Only on a CHANGE. A journey that has been failing for a week does not deserve a message every
|
|
9
|
+
// day; what is news is "this used to pass and now it does not", and "it is working again".
|
|
10
|
+
import fs from "node:fs";
|
|
11
|
+
import path from "node:path";
|
|
12
|
+
|
|
13
|
+
export const ALERT_EVENTS = Object.freeze(["broke", "recovered"]);
|
|
14
|
+
|
|
15
|
+
/** Did this result change anything worth telling someone about? */
|
|
16
|
+
export function alertForChange({ previous, current }) {
|
|
17
|
+
if (!current) return null;
|
|
18
|
+
// A journey's first run is not news: nothing has changed yet, it has only started.
|
|
19
|
+
if (!previous) return null;
|
|
20
|
+
if (previous.passed === current.passed) return null;
|
|
21
|
+
return current.passed ? "recovered" : "broke";
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
/** What the message says. Plain words, and never a credential — a journey holds none. */
|
|
25
|
+
export function alertMessage({ kind, journey, status, origin = "" }) {
|
|
26
|
+
const where = origin ? `${origin.replace(/\/$/, "")}/#runs` : "";
|
|
27
|
+
if (kind === "broke") {
|
|
28
|
+
const detail = status.total ? ` It got ${status.executed} of ${status.total} steps in.` : "";
|
|
29
|
+
return {
|
|
30
|
+
text: `❌ “${journey}” stopped working.${detail}${where ? ` Evidence: ${where}` : ""}`,
|
|
31
|
+
journey, state: "failing", at: status.at, executed: status.executed, total: status.total,
|
|
32
|
+
};
|
|
33
|
+
}
|
|
34
|
+
return {
|
|
35
|
+
text: `✅ “${journey}” is working again.${where ? ` ${where}` : ""}`,
|
|
36
|
+
journey, state: "passing", at: status.at, executed: status.executed, total: status.total,
|
|
37
|
+
};
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
/**
|
|
41
|
+
* Post one message. Slack and Discord both accept a JSON body with `text`/`content`, so send
|
|
42
|
+
* both keys and let the receiver pick; anything else gets the whole thing as JSON anyway.
|
|
43
|
+
*/
|
|
44
|
+
export async function deliverAlert({ webhook, message, fetchImpl = fetch, timeoutMs = 8000 }) {
|
|
45
|
+
if (!webhook) return { delivered: false, reason: "no webhook configured" };
|
|
46
|
+
let url;
|
|
47
|
+
try { url = new URL(webhook); } catch { return { delivered: false, reason: "that is not a URL" }; }
|
|
48
|
+
if (url.protocol !== "https:") return { delivered: false, reason: "a webhook must be https" };
|
|
49
|
+
// The Studio posts this from the server, so the same rule as every other outbound call applies:
|
|
50
|
+
// public addresses only. A webhook pointing at localhost would reach this machine's own services.
|
|
51
|
+
if (/^(localhost|127\.|0\.|10\.|192\.168\.|169\.254\.|\[?::1)/i.test(url.hostname) || /\.local$/i.test(url.hostname)) {
|
|
52
|
+
return { delivered: false, reason: "a webhook must be a public address" };
|
|
53
|
+
}
|
|
54
|
+
const controller = new AbortController();
|
|
55
|
+
const timer = setTimeout(() => controller.abort(), timeoutMs);
|
|
56
|
+
try {
|
|
57
|
+
const response = await fetchImpl(url.href, {
|
|
58
|
+
method: "POST",
|
|
59
|
+
headers: { "content-type": "application/json" },
|
|
60
|
+
body: JSON.stringify({ text: message.text, content: message.text, ...message }),
|
|
61
|
+
signal: controller.signal,
|
|
62
|
+
});
|
|
63
|
+
return response.ok ? { delivered: true, status: response.status } : { delivered: false, reason: `the webhook answered ${response.status}` };
|
|
64
|
+
} catch (error) {
|
|
65
|
+
return { delivered: false, reason: String(error?.name === "AbortError" ? "the webhook did not answer in time" : error.message || error).slice(0, 120) };
|
|
66
|
+
} finally { clearTimeout(timer); }
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
/** Where an account's alert settings live: beside its journeys, 0600, no secret but its own URL. */
|
|
70
|
+
export class AlertStore {
|
|
71
|
+
constructor({ file }) { this.file = file; }
|
|
72
|
+
|
|
73
|
+
static forAccount(accountsRoot, accountId) {
|
|
74
|
+
if (!/^[a-f0-9]{24}$/.test(String(accountId || ""))) throw new Error("Not an account id");
|
|
75
|
+
return new AlertStore({ file: path.join(accountsRoot, "alerts", `${accountId}.json`) });
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
read() {
|
|
79
|
+
try { return JSON.parse(fs.readFileSync(this.file, "utf8")); } catch { return { webhook: "", updatedAt: null, lastDelivery: null }; }
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
write(settings) {
|
|
83
|
+
const next = { ...this.read(), ...settings, updatedAt: new Date().toISOString() };
|
|
84
|
+
fs.mkdirSync(path.dirname(this.file), { recursive: true, mode: 0o700 });
|
|
85
|
+
fs.writeFileSync(this.file, JSON.stringify(next), { mode: 0o600 });
|
|
86
|
+
return next;
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
/** The URL is a secret of sorts — anyone holding it can post into that channel. Show its shape. */
|
|
90
|
+
summary() {
|
|
91
|
+
const settings = this.read();
|
|
92
|
+
if (!settings.webhook) return { configured: false, host: null, updatedAt: null, lastDelivery: settings.lastDelivery || null };
|
|
93
|
+
let host = "a webhook";
|
|
94
|
+
try { host = new URL(settings.webhook).host; } catch { /* keep the generic word */ }
|
|
95
|
+
return { configured: true, host, updatedAt: settings.updatedAt || null, lastDelivery: settings.lastDelivery || null };
|
|
96
|
+
}
|
|
97
|
+
}
|
|
@@ -2,6 +2,7 @@ import fs from "node:fs";
|
|
|
2
2
|
import path from "node:path";
|
|
3
3
|
import { AndroidDriver, findAndroidElement, isAndroidAppSnapshot } from "./android-driver.js";
|
|
4
4
|
import { FlowLog, flowVariables, normalizeFlowStep, substituteFlowValue } from "./flow-runtime.js";
|
|
5
|
+
import { chooseSignInSubmit } from "./sign-in.js";
|
|
5
6
|
|
|
6
7
|
const DEFAULT_TIMEOUT = 6000;
|
|
7
8
|
|
|
@@ -56,7 +57,18 @@ export async function runAndroidFlow({ flow, appId, apkPath, serial, logPath, sc
|
|
|
56
57
|
const passwordResult = await d.type(passwordField.id || passwordField.label, passwordValue, snap);
|
|
57
58
|
if (passwordResult.status !== "ok") throw new Error(passwordResult.detail || "could not fill the password field");
|
|
58
59
|
snap = await d.settle();
|
|
59
|
-
|
|
60
|
+
// Same rule as the web runner: rule out "Forgot password" and "Continue with Google" by
|
|
61
|
+
// name, prefer a sign-in name, and otherwise take the first clickable control after the
|
|
62
|
+
// password field — Android apps name that button after the product too.
|
|
63
|
+
const passwordIndex = snap.elements.indexOf(passwordField);
|
|
64
|
+
const choice = chooseSignInSubmit(snap.elements.map((element, index) => ({
|
|
65
|
+
index,
|
|
66
|
+
name: `${element.text || ""} ${element.label || ""}`.replace(/\s+/g, " ").trim() || String(element.id || ""),
|
|
67
|
+
visible: Boolean(element.clickable),
|
|
68
|
+
disabled: element.enabled === false,
|
|
69
|
+
after: index > passwordIndex,
|
|
70
|
+
})));
|
|
71
|
+
const submit = choice ? snap.elements[choice.index] : null;
|
|
60
72
|
if (!submit) throw new Error("could not identify a sign-in control");
|
|
61
73
|
const submitResult = await d.tap(submit.id || submit.description || submit.text, snap);
|
|
62
74
|
if (submitResult.status !== "ok") throw new Error(submitResult.detail || "could not submit the login form");
|
|
@@ -23,6 +23,7 @@ import { createMailer, signInMessage } from "./mailer.js";
|
|
|
23
23
|
import { accessConfig, createAccessVerifier } from "./access-jwt.js";
|
|
24
24
|
import { oauthProviders, oauthAuthorizeUrl, oauthEmailFromCode, isOauthProvider } from "./oauth.js";
|
|
25
25
|
import { journeyFromCapture, JourneyStore, slugify } from "./journeys.js";
|
|
26
|
+
import { AlertStore, alertForChange, alertMessage, deliverAlert } from "./alerts.js";
|
|
26
27
|
|
|
27
28
|
const packageRoot = path.resolve(path.dirname(fileURLToPath(import.meta.url)), "../..");
|
|
28
29
|
const assetRoot = path.join(packageRoot, "browser");
|
|
@@ -158,7 +159,9 @@ function anonymousAllows(method, pathname) {
|
|
|
158
159
|
function accountAllows(method, pathname) {
|
|
159
160
|
if (anonymousAllows(method, pathname)) return true;
|
|
160
161
|
if (method === "POST" && (pathname === "/api/auth/signout" || /^\/api\/jobs\/[a-f0-9]{20}\/input$/.test(pathname))) return true;
|
|
161
|
-
if (method === "GET" && (pathname === "/api/actors" || pathname === "/api/journeys" || pathname === "/api/tokens" || pathname === "/api/admin/overview")) return true;
|
|
162
|
+
if (method === "GET" && (pathname === "/api/actors" || pathname === "/api/journeys" || pathname === "/api/tokens" || pathname === "/api/admin/overview" || pathname === "/api/alerts")) return true;
|
|
163
|
+
// Where to be told that a journey stopped working.
|
|
164
|
+
if (method === "POST" && (pathname === "/api/alerts" || pathname === "/api/alerts/test")) return true;
|
|
162
165
|
// Personal access tokens: the owner's coding agent acting as them (ADR-0009 slice 4).
|
|
163
166
|
if (method === "POST" && pathname === "/api/tokens") return true;
|
|
164
167
|
if (method === "DELETE" && /^\/api\/tokens\/[a-f0-9]{12}$/.test(pathname)) return true;
|
|
@@ -281,7 +284,7 @@ export function journeySignInPlan(flow = {}) {
|
|
|
281
284
|
|
|
282
285
|
// Replay one web journey and record how it went. Shared by the Studio's Run button and the
|
|
283
286
|
// daily check, so both leave the same status and the same evidence behind.
|
|
284
|
-
async function replayJourney({ store, slug, flow, actorRoot = "", ownerKey = null, progress = () => {} }) {
|
|
287
|
+
async function replayJourney({ store, slug, flow, actorRoot = "", ownerKey = null, progress = () => {}, alerts = null, origin = "" }) {
|
|
285
288
|
// A journey that signs in does so as the test account tapp was told about for that site: the
|
|
286
289
|
// values come from the encrypted actor store at replay and never from the file.
|
|
287
290
|
const variables = {};
|
|
@@ -329,8 +332,19 @@ async function replayJourney({ store, slug, flow, actorRoot = "", ownerKey = nul
|
|
|
329
332
|
if (/^OCQA_(FLOW_RESULT|ISSUE):/.test(raw)) continue;
|
|
330
333
|
if (raw) progress({ phase: "replay", text: raw });
|
|
331
334
|
}
|
|
335
|
+
// Read the old result before writing the new one: the news is the change, not the state.
|
|
336
|
+
const previous = store.status(slug);
|
|
332
337
|
const status = store.recordRun(slug, { passed: result.passed, captureId, executed: result.executed, total: result.total, failed: result.failed });
|
|
333
|
-
|
|
338
|
+
const change = alertForChange({ previous, current: status });
|
|
339
|
+
let alert = null;
|
|
340
|
+
if (change && alerts) {
|
|
341
|
+
const settings = alerts.read();
|
|
342
|
+
if (settings.webhook) {
|
|
343
|
+
alert = await deliverAlert({ webhook: settings.webhook, message: alertMessage({ kind: change, journey: flow.name || slug, status, origin }) });
|
|
344
|
+
alerts.write({ lastDelivery: { at: new Date().toISOString(), journey: flow.name || slug, change, ...alert } });
|
|
345
|
+
}
|
|
346
|
+
}
|
|
347
|
+
return { kind: "journey", name: flow.name || slug, slug, passed: result.passed, executed: result.executed, total: result.total, failed: result.failed, status, change, ...(alert ? { alert } : {}), capture: { id: captureId, path: evidenceDir } };
|
|
334
348
|
}
|
|
335
349
|
|
|
336
350
|
// "Make sure this always works": kept journeys on a public Studio are replayed on a schedule,
|
|
@@ -719,7 +733,7 @@ export async function startBrowserProduct({ projectDir, port = 0, launch = false
|
|
|
719
733
|
try { const { loadFlowFile } = await import("./flow-runtime.js"); flow = loadFlowFile(flowPath); } catch { continue; }
|
|
720
734
|
let job;
|
|
721
735
|
try {
|
|
722
|
-
job = startJob("check-journey", (progress) => replayJourney({ store, slug: journey.slug, flow, actorRoot: accounts.actorRoot(accountId), ownerKey, progress }), null, { lane: ownerKey });
|
|
736
|
+
job = startJob("check-journey", (progress) => replayJourney({ store, slug: journey.slug, flow, actorRoot: accounts.actorRoot(accountId), ownerKey, progress, alerts: AlertStore.forAccount(accounts.root, accountId), origin: publicOrigins[0] || "" }), null, { lane: ownerKey });
|
|
723
737
|
} catch { continue; /* the owner is busy; next tick */ }
|
|
724
738
|
job.ownerKey = ownerKey;
|
|
725
739
|
// One at a time per owner: wait for this check before starting the next.
|
|
@@ -1183,6 +1197,34 @@ export async function startBrowserProduct({ projectDir, port = 0, launch = false
|
|
|
1183
1197
|
});
|
|
1184
1198
|
return;
|
|
1185
1199
|
}
|
|
1200
|
+
// Where to be told when something breaks. The URL is write-only here: the summary says
|
|
1201
|
+
// which host it points at and when it last delivered, never the URL itself, because anyone
|
|
1202
|
+
// holding it can post into that channel.
|
|
1203
|
+
if (account && url.pathname === "/api/alerts") {
|
|
1204
|
+
const alerts = AlertStore.forAccount(accounts.root, account.id);
|
|
1205
|
+
if (request.method === "GET") { json(response, 200, alerts.summary()); return; }
|
|
1206
|
+
guardMutation(request);
|
|
1207
|
+
const body = await readJsonBody(request);
|
|
1208
|
+
const webhook = String(body.webhook || "").trim();
|
|
1209
|
+
if (webhook) {
|
|
1210
|
+
const probe = await deliverAlert({ webhook, message: alertMessage({ kind: "recovered", journey: "tapp alerts", status: { at: new Date().toISOString(), executed: 0, total: 0 }, origin: publicOrigins[0] || "" }) });
|
|
1211
|
+
if (!probe.delivered) { json(response, 400, { error: `tapp could not post there — ${probe.reason}.` }); return; }
|
|
1212
|
+
}
|
|
1213
|
+
alerts.write({ webhook });
|
|
1214
|
+
logUsage("alerts.set", { account: account.id.slice(0, 8), configured: !!webhook });
|
|
1215
|
+
json(response, 200, alerts.summary());
|
|
1216
|
+
return;
|
|
1217
|
+
}
|
|
1218
|
+
if (account && url.pathname === "/api/alerts/test" && request.method === "POST") {
|
|
1219
|
+
guardMutation(request);
|
|
1220
|
+
const alerts = AlertStore.forAccount(accounts.root, account.id);
|
|
1221
|
+
const settings = alerts.read();
|
|
1222
|
+
if (!settings.webhook) { json(response, 400, { error: "There is nowhere to send it yet." }); return; }
|
|
1223
|
+
const sent = await deliverAlert({ webhook: settings.webhook, message: alertMessage({ kind: "broke", journey: "a test from tapp", status: { at: new Date().toISOString(), executed: 3, total: 7 }, origin: publicOrigins[0] || "" }) });
|
|
1224
|
+
alerts.write({ lastDelivery: { at: new Date().toISOString(), journey: "a test from tapp", change: "test", ...sent } });
|
|
1225
|
+
json(response, sent.delivered ? 200 : 400, sent.delivered ? alerts.summary() : { error: `tapp could not post there — ${sent.reason}.` });
|
|
1226
|
+
return;
|
|
1227
|
+
}
|
|
1186
1228
|
if (account && url.pathname === "/api/tokens" && request.method === "GET") {
|
|
1187
1229
|
json(response, 200, { tokens: accounts.listTokens(account.id) });
|
|
1188
1230
|
return;
|
|
@@ -1468,7 +1510,7 @@ export async function startBrowserProduct({ projectDir, port = 0, launch = false
|
|
|
1468
1510
|
}
|
|
1469
1511
|
const slug = root ? name : slugify(name);
|
|
1470
1512
|
const job = startJob(operation, async (progress) => {
|
|
1471
|
-
const result = await replayJourney({ store, slug, flow, actorRoot: actorRootFor() || "", ownerKey, progress });
|
|
1513
|
+
const result = await replayJourney({ store, slug, flow, actorRoot: actorRootFor() || "", ownerKey, progress, alerts: account ? AlertStore.forAccount(accounts.root, account.id) : null, origin: publicOrigins[0] || "" });
|
|
1472
1514
|
logUsage("journey.run", { owner: (ownerKey || "operator").slice(0, 13), passed: result.passed });
|
|
1473
1515
|
return result;
|
|
1474
1516
|
}, null, { lane: ownerKey || OPERATOR_LANE });
|
package/mcp-server/src/index.js
CHANGED
|
@@ -30,6 +30,7 @@ const workspaceRoot = (() => {
|
|
|
30
30
|
})();
|
|
31
31
|
const scriptsDir = path.join(repoRoot, "scripts");
|
|
32
32
|
import { writeCaptureProvenance, readCaptureProvenance, captureBelongsToProject, provenanceLabel } from "./capture-provenance.js";
|
|
33
|
+
import { findSignInSubmit } from "./sign-in.js";
|
|
33
34
|
// TAPP_HOME (set by the `tapp` CLI when installed) redirects writable output to a user directory.
|
|
34
35
|
// The old alias remains a read-only fallback; unset repository development stays local.
|
|
35
36
|
const tappHome = (process.env.TAPP_HOME || "").trim();
|
|
@@ -1145,10 +1146,10 @@ async function sessionAct(cmd) {
|
|
|
1145
1146
|
} else {
|
|
1146
1147
|
await email.fill(emailValue);
|
|
1147
1148
|
await password.fill(passwordValue);
|
|
1148
|
-
const submit = session.page
|
|
1149
|
-
if (!
|
|
1149
|
+
const submit = await findSignInSubmit(session.page);
|
|
1150
|
+
if (!submit) { status = "not_found"; detail = "Could not identify a sign-in control"; }
|
|
1150
1151
|
else {
|
|
1151
|
-
await submit.click();
|
|
1152
|
+
await submit.locator.click();
|
|
1152
1153
|
await session.page.waitForTimeout(500);
|
|
1153
1154
|
if (await password.isVisible().catch(() => false)) { status = "still_on_login"; detail = "Submit left the app on the login screen"; }
|
|
1154
1155
|
}
|
|
@@ -35,7 +35,13 @@ function readMarkers(captureDir) {
|
|
|
35
35
|
}
|
|
36
36
|
|
|
37
37
|
// tapp names a revisited screen "Orders (refreshed)"; the page itself still says "Orders".
|
|
38
|
-
|
|
38
|
+
// A screen name is one line. A headline that wraps in the page's source arrives with its
|
|
39
|
+
// newlines and indentation attached, and a journey step that pins that string can never match
|
|
40
|
+
// again — the browser reports the heading with its whitespace collapsed.
|
|
41
|
+
/** A route, not something a person pressed: "/", "/orders", "https://…", "#pricing". */
|
|
42
|
+
const isAddress = (via) => /^([/#]|https?:)/i.test(String(via || "").trim());
|
|
43
|
+
|
|
44
|
+
const pageName = (screen) => String(screen || "").replace(/\s*\((?:refreshed|again|\d+)\)\s*$/i, "").replace(/\s+/g, " ").trim();
|
|
39
45
|
|
|
40
46
|
/**
|
|
41
47
|
* Build a Flow from an exploration capture. Returns null when the run did nothing worth
|
|
@@ -59,13 +65,19 @@ export function journeyFromCapture(captureDir, { name = "", actor = "default" }
|
|
|
59
65
|
};
|
|
60
66
|
let acted = false;
|
|
61
67
|
let signedIn = false;
|
|
62
|
-
|
|
68
|
+
let stop = false;
|
|
69
|
+
for (let i = 0; i < markers.length && steps.length < MAX_STEPS && !stop; i += 1) {
|
|
63
70
|
const marker = markers[i];
|
|
64
71
|
if (marker.kind === "OCQA_STATE") { waitFor(marker.screen); continue; }
|
|
65
72
|
switch (marker.type) {
|
|
66
73
|
case "open":
|
|
67
|
-
// The first open is the journey's URL
|
|
68
|
-
|
|
74
|
+
// The first open is the journey's URL. A later one is either a link somebody pressed —
|
|
75
|
+
// which a person can repeat — or the crawler jumping to a route by address, which nobody
|
|
76
|
+
// can. A journey is the path a user could walk, so it ends at the first jump rather than
|
|
77
|
+
// pretending the previous tap led there. (Found by filming: a kept journey had "tap Area"
|
|
78
|
+
// followed by the marketing home page, and the replay rightly refused to believe it.)
|
|
79
|
+
if (!marker.via || marker.via === marker.target || isAddress(marker.via)) { if (acted) stop = true; break; }
|
|
80
|
+
steps.push({ tap: marker.via }); acted = true;
|
|
69
81
|
break;
|
|
70
82
|
case "login":
|
|
71
83
|
steps.push({ login: { email: "$TEST_EMAIL", password: "$TEST_PASSWORD" } });
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
// Pressing the button that signs you in.
|
|
2
|
+
//
|
|
3
|
+
// This used to be a word list — `sign in|log in|login|continue|submit` — in three separate
|
|
4
|
+
// places, and a CSS selector that looked for `button[type=submit]` or a button inside a `<form>`.
|
|
5
|
+
// Measured against a real customer's sign-in page, every one of those assumptions was wrong:
|
|
6
|
+
//
|
|
7
|
+
// • the page has no <form> at all (a React component with an onClick handler);
|
|
8
|
+
// • the buttons carry no `type` ATTRIBUTE, so `button[type=submit]` never matches, even though
|
|
9
|
+
// the DOM *property* reads "submit" — which is what made this look fine when probed by hand;
|
|
10
|
+
// • the button is called "Open My Profile", because products name their buttons after what the
|
|
11
|
+
// product does, not after the verb a test author had in mind.
|
|
12
|
+
//
|
|
13
|
+
// So the page offered a perfectly ordinary sign-in form and tapp could not press it. It said so
|
|
14
|
+
// honestly — a high-severity "the sign-in attempt did not leave the login form" — but honest and
|
|
15
|
+
// useless is still useless: the whole promise is that tapp gets *inside* the application.
|
|
16
|
+
//
|
|
17
|
+
// What is actually reliable is not the button's name but its position: the control that signs you
|
|
18
|
+
// in comes after the password field, and the controls that must never be pressed (forgot password,
|
|
19
|
+
// create an account, continue with Google) say so in their own words. So: rule out the dangerous
|
|
20
|
+
// ones by name, then prefer by name, then fall back to position.
|
|
21
|
+
|
|
22
|
+
/** Names that mean "this is the sign-in button". Deliberately short — structure does the rest. */
|
|
23
|
+
export const SIGN_IN_NAME = /\b(sign ?in|log ?in|login|submit|continue)\b/i;
|
|
24
|
+
|
|
25
|
+
/**
|
|
26
|
+
* Names that mean "never press this to sign in". Some are merely wrong (forgot password); some
|
|
27
|
+
* are actively harmful — "Continue with Google" would hand a third-party identity provider a
|
|
28
|
+
* session, which a machine must never do on someone's behalf.
|
|
29
|
+
*/
|
|
30
|
+
export const NOT_SIGN_IN = /forgot|reset|recover|remember|show password|hide password|cancel|go back|back to|sign ?up|create (an |your |a )?account|register|get started free|privacy|terms|need help|help\?|continue with|with google|with apple|with facebook|with github|with microsoft|single sign|\bsso\b|close|dismiss|skip/i;
|
|
31
|
+
|
|
32
|
+
/** Every control that can plausibly be clicked, in document order. */
|
|
33
|
+
export const SUBMIT_CANDIDATE_SELECTOR = "button, input[type=submit], input[type=button], input[type=image], [role=button]";
|
|
34
|
+
|
|
35
|
+
/**
|
|
36
|
+
* Pick the sign-in control out of the page's clickable controls. Pure, so the ordering rules are
|
|
37
|
+
* testable without a browser.
|
|
38
|
+
*
|
|
39
|
+
* @param {Array<{index:number,name:string,visible:boolean,disabled:boolean,after:boolean}>} candidates
|
|
40
|
+
* `after` means the control follows the visible password field in document order.
|
|
41
|
+
*/
|
|
42
|
+
export function chooseSignInSubmit(candidates = []) {
|
|
43
|
+
const usable = candidates.filter((c) => c && c.visible && !c.disabled && String(c.name || "").trim() && !NOT_SIGN_IN.test(c.name));
|
|
44
|
+
const pick = usable.find((c) => c.after && SIGN_IN_NAME.test(c.name))
|
|
45
|
+
|| usable.find((c) => SIGN_IN_NAME.test(c.name))
|
|
46
|
+
// Named for what the product does, not for the verb: position is what is left to go on.
|
|
47
|
+
|| usable.find((c) => c.after)
|
|
48
|
+
|| usable[0]
|
|
49
|
+
|| null;
|
|
50
|
+
if (!pick) return null;
|
|
51
|
+
return { ...pick, reason: SIGN_IN_NAME.test(pick.name) ? "name" : "position" };
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
/** Read the page's clickable controls and say which one signs you in. */
|
|
55
|
+
export async function findSignInSubmit(page) {
|
|
56
|
+
let candidates;
|
|
57
|
+
try {
|
|
58
|
+
candidates = await page.evaluate((selector) => {
|
|
59
|
+
const visible = (el) => {
|
|
60
|
+
if (!el.getClientRects().length) return false;
|
|
61
|
+
const style = getComputedStyle(el);
|
|
62
|
+
return style.visibility !== "hidden" && style.display !== "none" && Number(style.opacity ?? 1) > 0.05;
|
|
63
|
+
};
|
|
64
|
+
const password = Array.from(document.querySelectorAll("input[type=password]")).find(visible) || null;
|
|
65
|
+
return Array.from(document.querySelectorAll(selector)).map((el, index) => ({
|
|
66
|
+
index,
|
|
67
|
+
name: (el.innerText || el.value || el.getAttribute("aria-label") || el.getAttribute("title") || "").replace(/\s+/g, " ").trim().slice(0, 80),
|
|
68
|
+
visible: visible(el),
|
|
69
|
+
disabled: el.disabled === true || el.getAttribute("aria-disabled") === "true",
|
|
70
|
+
// DOCUMENT_POSITION_FOLLOWING (4): the control comes after the password field.
|
|
71
|
+
after: password ? Boolean(password.compareDocumentPosition(el) & 4) : false,
|
|
72
|
+
}));
|
|
73
|
+
}, SUBMIT_CANDIDATE_SELECTOR);
|
|
74
|
+
} catch { return null; }
|
|
75
|
+
const pick = chooseSignInSubmit(candidates);
|
|
76
|
+
if (!pick) return null;
|
|
77
|
+
// querySelectorAll and Playwright's locator both resolve in document order, so the index carries.
|
|
78
|
+
return { locator: page.locator(SUBMIT_CANDIDATE_SELECTOR).nth(pick.index), name: pick.name, reason: pick.reason };
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
/**
|
|
82
|
+
* Fill nothing, press once. Returns what was pressed so a caller can say so in a report, or null
|
|
83
|
+
* when the page offers no sign-in control at all.
|
|
84
|
+
*/
|
|
85
|
+
export async function submitSignIn(page, beforeClick = null) {
|
|
86
|
+
const found = await findSignInSubmit(page);
|
|
87
|
+
if (!found) return null;
|
|
88
|
+
if (beforeClick) await beforeClick(found.locator);
|
|
89
|
+
await found.locator.click({ timeout: 3000 });
|
|
90
|
+
return { name: found.name, reason: found.reason };
|
|
91
|
+
}
|
|
@@ -19,6 +19,7 @@ import fs from "fs";
|
|
|
19
19
|
import path from "path";
|
|
20
20
|
import { createRequire } from "module";
|
|
21
21
|
import { execFileSync } from "child_process";
|
|
22
|
+
import { submitSignIn } from "./sign-in.js";
|
|
22
23
|
|
|
23
24
|
const CLICK_SETTLE_MS = 700;
|
|
24
25
|
export const NAV_TIMEOUT_MS = 15_000;
|
|
@@ -194,7 +195,18 @@ async function captureWebControlState(page, locator) {
|
|
|
194
195
|
.sort();
|
|
195
196
|
return {
|
|
196
197
|
title: document.title,
|
|
197
|
-
heading:
|
|
198
|
+
heading: (() => {
|
|
199
|
+
// The same definition the flow runner uses when it checks a screen: the first h1 a
|
|
200
|
+
// person can actually see. A sign-in headline left hidden in the DOM used to go on
|
|
201
|
+
// naming every later screen, and the replay could never agree.
|
|
202
|
+
const shown = (el) => {
|
|
203
|
+
if (!el.getClientRects().length) return false;
|
|
204
|
+
const style = getComputedStyle(el);
|
|
205
|
+
return style.visibility !== "hidden" && style.display !== "none";
|
|
206
|
+
};
|
|
207
|
+
const h1 = Array.from(document.querySelectorAll("h1")).find(shown);
|
|
208
|
+
return (h1 ? h1.innerText || h1.textContent || "" : "").replace(/\s+/g, " ").trim();
|
|
209
|
+
})(),
|
|
198
210
|
dialogs: JSON.stringify(dialogs),
|
|
199
211
|
};
|
|
200
212
|
}).catch(() => ({ title: "", heading: "", dialogs: "" }));
|
|
@@ -333,18 +345,10 @@ export async function loadPlaywright() {
|
|
|
333
345
|
}
|
|
334
346
|
|
|
335
347
|
export async function submitWebLogin(page, beforeClick = null) {
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
for (const candidate of candidates) {
|
|
341
|
-
if (await candidate.isVisible().catch(() => false)) {
|
|
342
|
-
if (beforeClick) await beforeClick(candidate);
|
|
343
|
-
await candidate.click({ timeout: 3000 });
|
|
344
|
-
return true;
|
|
345
|
-
}
|
|
346
|
-
}
|
|
347
|
-
return false;
|
|
348
|
+
// One implementation, shared with the flow runner and the MCP login command, so a page that can
|
|
349
|
+
// be signed into by one of them can be signed into by all three. See mcp-server/src/sign-in.js
|
|
350
|
+
// for why a name-only rule was not enough.
|
|
351
|
+
return Boolean(await submitSignIn(page, beforeClick).catch(() => null));
|
|
348
352
|
}
|
|
349
353
|
|
|
350
354
|
// How many distinct in-page states one URL may contribute before we stop splitting it. A
|
|
@@ -751,7 +755,18 @@ export async function inspectWebPage({ url, timeoutMs = NAV_TIMEOUT_MS, screensh
|
|
|
751
755
|
})
|
|
752
756
|
.filter((control) => control.label || control.identifier);
|
|
753
757
|
return {
|
|
754
|
-
heading:
|
|
758
|
+
heading: (() => {
|
|
759
|
+
// The same definition the flow runner uses when it checks a screen: the first h1 a
|
|
760
|
+
// person can actually see. A sign-in headline left hidden in the DOM used to go on
|
|
761
|
+
// naming every later screen, and the replay could never agree.
|
|
762
|
+
const shown = (el) => {
|
|
763
|
+
if (!el.getClientRects().length) return false;
|
|
764
|
+
const style = getComputedStyle(el);
|
|
765
|
+
return style.visibility !== "hidden" && style.display !== "none";
|
|
766
|
+
};
|
|
767
|
+
const h1 = Array.from(document.querySelectorAll("h1")).find(shown);
|
|
768
|
+
return (h1 ? h1.innerText || h1.textContent || "" : "").replace(/\s+/g, " ").trim();
|
|
769
|
+
})(),
|
|
755
770
|
title: document.title.trim(),
|
|
756
771
|
controls,
|
|
757
772
|
};
|
|
@@ -986,7 +1001,18 @@ export async function exploreWeb({ url, maxActions = 40, timeoutSec = 300, outDi
|
|
|
986
1001
|
})
|
|
987
1002
|
.filter((control) => control.label || control.id || control.testId);
|
|
988
1003
|
return {
|
|
989
|
-
heading:
|
|
1004
|
+
heading: (() => {
|
|
1005
|
+
// The same definition the flow runner uses when it checks a screen: the first h1 a
|
|
1006
|
+
// person can actually see. A sign-in headline left hidden in the DOM used to go on
|
|
1007
|
+
// naming every later screen, and the replay could never agree.
|
|
1008
|
+
const shown = (el) => {
|
|
1009
|
+
if (!el.getClientRects().length) return false;
|
|
1010
|
+
const style = getComputedStyle(el);
|
|
1011
|
+
return style.visibility !== "hidden" && style.display !== "none";
|
|
1012
|
+
};
|
|
1013
|
+
const h1 = Array.from(document.querySelectorAll("h1")).find(shown);
|
|
1014
|
+
return (h1 ? h1.innerText || h1.textContent || "" : "").replace(/\s+/g, " ").trim();
|
|
1015
|
+
})(),
|
|
990
1016
|
title: document.title.trim(),
|
|
991
1017
|
controlCount: document.querySelectorAll("a[href], button, [role=button], input, select, textarea").length,
|
|
992
1018
|
textLen: (document.body?.innerText || "").trim().length,
|
|
@@ -4,6 +4,7 @@ import fs from "node:fs";
|
|
|
4
4
|
import path from "node:path";
|
|
5
5
|
import { FlowLog, flowVariables, normalizeFlowStep, substituteFlowValue } from "./flow-runtime.js";
|
|
6
6
|
import { loadPlaywright, webContextOptions } from "./web-explorer.js";
|
|
7
|
+
import { findSignInSubmit } from "./sign-in.js";
|
|
7
8
|
|
|
8
9
|
const DEFAULT_TIMEOUT = 6000;
|
|
9
10
|
|
|
@@ -91,12 +92,19 @@ async function screenCandidates(page) {
|
|
|
91
92
|
const url = new URL(page.url());
|
|
92
93
|
values.push(url.pathname, url.pathname.split("/").filter(Boolean).at(-1) || "Home");
|
|
93
94
|
} catch {}
|
|
94
|
-
return values.map(
|
|
95
|
+
return values.map(normalizeScreenName).filter(Boolean);
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
// Compare screen names with their whitespace collapsed on both sides: a journey kept before
|
|
99
|
+
// tapp normalized headings holds "Find the right coach.\n Any goal." where the browser
|
|
100
|
+
// now reports "Find the right coach. Any goal." Those are the same screen.
|
|
101
|
+
export function normalizeScreenName(value) {
|
|
102
|
+
return String(value || "").replace(/\s+/g, " ").trim();
|
|
95
103
|
}
|
|
96
104
|
|
|
97
105
|
async function waitForScreen(page, target, timeout) {
|
|
98
106
|
const deadline = Date.now() + timeout;
|
|
99
|
-
const wanted = target.toLowerCase();
|
|
107
|
+
const wanted = normalizeScreenName(target).toLowerCase();
|
|
100
108
|
while (Date.now() < deadline) {
|
|
101
109
|
if ((await screenCandidates(page)).some((v) => v.toLowerCase() === wanted)) return true;
|
|
102
110
|
const el = await locateWebElement(page, target);
|
|
@@ -108,7 +116,7 @@ async function waitForScreen(page, target, timeout) {
|
|
|
108
116
|
|
|
109
117
|
async function waitForExactScreen(page, target, timeout) {
|
|
110
118
|
const deadline = Date.now() + timeout;
|
|
111
|
-
const wanted = target.toLowerCase();
|
|
119
|
+
const wanted = normalizeScreenName(target).toLowerCase();
|
|
112
120
|
while (Date.now() < deadline) {
|
|
113
121
|
if ((await screenCandidates(page)).some((v) => v.toLowerCase() === wanted)) return true;
|
|
114
122
|
await page.waitForTimeout(150);
|
|
@@ -223,9 +231,9 @@ export async function executeWebFlowStep({ page, step, vars = {}, defaultTimeout
|
|
|
223
231
|
if (!email || !password) throw new Error("could not identify email and password fields");
|
|
224
232
|
await email.fill(emailValue);
|
|
225
233
|
await password.fill(passwordValue);
|
|
226
|
-
const submit = await
|
|
234
|
+
const submit = await findSignInSubmit(page);
|
|
227
235
|
if (!submit) throw new Error("could not identify a sign-in control");
|
|
228
|
-
await submit.click();
|
|
236
|
+
await submit.locator.click();
|
|
229
237
|
await page.waitForTimeout(400);
|
|
230
238
|
if (await password.isVisible().catch(() => false)) throw new Error("submit left the app on the login screen");
|
|
231
239
|
} else if (action === "swipe") {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@aarwitz/tapp",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.33.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",
|
|
@@ -96,7 +96,7 @@
|
|
|
96
96
|
"mobile"
|
|
97
97
|
],
|
|
98
98
|
"scripts": {
|
|
99
|
-
"test": "node --test tests/report.test.js tests/regression.test.js tests/engine.test.js tests/project-config.test.js tests/application-model.test.js tests/ui-map.test.js tests/focused-navigation.test.js tests/task-runtime.test.js tests/release-contract.test.js tests/pr-selection.test.js tests/flow-runtime.test.js tests/web-explorer.test.js tests/web-session.test.js tests/web-link-audit.test.js tests/web-overlay.test.js tests/web-audit.test.js tests/page-observations.test.js tests/capture-provenance.test.js tests/capture-frames.test.js tests/actor-store.test.js tests/account-store.test.js tests/access-jwt.test.js tests/oauth.test.js tests/studio-client.test.js tests/journeys.test.js tests/ios-crash-attribution.test.js tests/ios-simulator-selection.test.js tests/ios-recording-stop.test.js tests/web-flow.test.js tests/scenario-runtime.test.js tests/android-driver.test.js tests/android-explorer.test.js tests/android-flow.test.js tests/android-primitives-protocol.test.js tests/managed-web.test.js tests/product-operations.test.js tests/job-lanes.test.js tests/browser-product.test.js tests/browser-chat-narration.test.js tests/browser-onboarding.test.js tests/managed-operation.test.js tests/ci-setup.test.js tests/ci-install.test.js tests/cli.test.js tests/mcp-workspace.test.js tests/action.test.js tests/package-surface.test.js tests/agent-surface.test.js tests/presentation-contract.test.js tests/landing-brand.test.js tests/ci-gate.test.js tests/ci-report.test.js tests/desktop-protocol.test.js tests/ios-flow-protocol.test.js tests/feedback-triage-0919.test.js vscode-extension/test/bridge.test.js",
|
|
99
|
+
"test": "node --test tests/report.test.js tests/regression.test.js tests/engine.test.js tests/project-config.test.js tests/application-model.test.js tests/ui-map.test.js tests/focused-navigation.test.js tests/task-runtime.test.js tests/release-contract.test.js tests/pr-selection.test.js tests/flow-runtime.test.js tests/web-explorer.test.js tests/web-session.test.js tests/web-link-audit.test.js tests/web-overlay.test.js tests/web-audit.test.js tests/page-observations.test.js tests/capture-provenance.test.js tests/capture-frames.test.js tests/actor-store.test.js tests/account-store.test.js tests/alerts.test.js tests/access-jwt.test.js tests/oauth.test.js tests/studio-client.test.js tests/journeys.test.js tests/ios-crash-attribution.test.js tests/ios-simulator-selection.test.js tests/ios-recording-stop.test.js tests/web-flow.test.js tests/scenario-runtime.test.js tests/android-driver.test.js tests/android-explorer.test.js tests/android-flow.test.js tests/android-primitives-protocol.test.js tests/managed-web.test.js tests/product-operations.test.js tests/job-lanes.test.js tests/browser-product.test.js tests/browser-chat-narration.test.js tests/browser-onboarding.test.js tests/managed-operation.test.js tests/ci-setup.test.js tests/ci-install.test.js tests/cli.test.js tests/mcp-workspace.test.js tests/action.test.js tests/package-surface.test.js tests/agent-surface.test.js tests/presentation-contract.test.js tests/landing-brand.test.js tests/ci-gate.test.js tests/ci-report.test.js tests/desktop-protocol.test.js tests/ios-flow-protocol.test.js tests/feedback-triage-0919.test.js vscode-extension/test/bridge.test.js",
|
|
100
100
|
"test:browser-journey": "node --test tests/browser-journey.test.js",
|
|
101
101
|
"test:browser-native": "TAPP_RUN_NATIVE_BROWSER=1 node --test tests/browser-native-journey.test.js"
|
|
102
102
|
}
|