Skip to content

Automate browser based workflows with AI

Correct why the fitted-launch recording size is pinned (SKY-14736) (#8269)

Aaron Perez02ed2aad3ba0
diff --git a/site_fixtures/code_host/README.md b/site_fixtures/code_host/README.md
new file mode 100644
index 000000000..9273ec4fa
--- /dev/null
+++ b/site_fixtures/code_host/README.md
@@ -0,0 +1,60 @@
+# code_host — Wyrmhold
+
+A code-hosting site with two repos under one SPA (`index.html`, repo parsed from the URL
+path), built for **SKY-12764** to exercise a public-vs-private repo split and a
+passkey-first two-factor chain.
+
+| Repo | Entry | Auth |
+| --- | --- | --- |
+| `Skyvern-AI/skyvern` (Public) | `/code_host/skyvern/` | none |
+| `Skyvern-AI/skyvern-cloud` (Private) | `/code_host/skyvern-cloud/` | sign-in + 2FA, always on |
+
+Both repos have a **Code** home (README render, file rows, About sidebar) and an
+**Insights → Pulse** view (period heading, Overview stat bars, and the
+"Excluding merges, N authors have pushed M commits…" summary). Tab switches are in-SPA;
+the entry URL is never rewritten (Skyvern re-anchors on it between steps).
+
+## The properties that make this fixture worth having
+
+- **The logged-out private repo is a 404, not a login redirect.** The real host hides the
+ repo's existence: "This is not the web page you are looking for.", title "Page not
+ found", an inline **Sign in** popover, and a find-code search. The repo name appears
+ nowhere on that page, and a test pins that.
+- **2FA is passkey-first, with the authenticator hidden behind "More options".** The code
+ screen is not reachable directly; the agent must decline the passkey path. This is a
+ different discovery problem from the analytics_console tenants, where the token field
+ is the first and only 2FA surface.
+- **The code input auto-verifies at six digits** (mirroring the real input's
+ auto-submit) — an agent that fills the code and then hunts for a Verify button will
+ find the page already moved on.
+
+## Auth contracts (from saved DOM captures)
+
+- Sign-in: `input name="login" id="login_field" autocomplete="username"`,
+ `input name="password" id="password" autocomplete="current-password"`,
+ `input type="submit" name="commit" value="Sign in"`, "Username or email address",
+ "Forgot password?", "or continue with other methods". Wrong credentials show
+ `Incorrect username or password.`
+- 2FA landing: `h1` "Two-factor authentication", "Authenticate using your passkey.",
+ a passkey button (declines with a partial-support notice), and **More options**
+ expanding Authenticator app / Recovery code.
+- Authenticator screen: "Enter the code from your two-factor authentication app or
+ browser extension below.", sr-only label "Enter the verification code",
+ `input name="app_otp" id="app_totp" inputmode="numeric"
+ pattern="([0-9]{6})|([0-9a-fA-F]{5}-?[0-9a-fA-F]{5})" placeholder="XXXXXX"`,
+ **Verify** button. Any six digits pass, so any authenticator seed on the saved
+ credential works (`mock-portal-login-totp`).
+
+Demo login: `demo_business_user` / `Demo!Pass123`, matching the repo-wide mock login.
+
+## Evidence basis
+
+Auth pages, the 404, and the Pulse layout follow user-saved DOM captures of the real
+host (login, both 2FA screens, logged-out private repo, repo home, both Pulse pages).
+The captures are real vendor markup and stay out of the repo per the `wpid-to-fixture`
+privacy rule. Branding ("Wyrmhold") is fixture-owned.
+
+Repo content: the public repo's README text and Pulse summary are our own open-source
+project's (public data). The **private repo's Pulse numbers are fixture-owned** —
+synthesized, not the real private repo's — so no internal activity data lands in the
+mock. Structure matches the capture; numbers do not.
diff --git a/site_fixtures/code_host/index.html b/site_fixtures/code_host/index.html
new file mode 100644
index 000000000..ac9c9a0a1
--- /dev/null
+++ b/site_fixtures/code_host/index.html
@@ -0,0 +1,408 @@
+<!doctype html>
+<html lang="en">
+<head>
+<meta charset="utf-8" />
+<meta name="viewport" content="width=device-width, initial-scale=1" />
+<title>Wyrmhold</title>
+<style>
+ :root { --bg:#0d1117; --panel:#161b22; --line:#30363d; --ink:#e6edf3; --muted:#8d96a0; --link:#4493f8;
+ --green:#238636; --btn:#21262d; --badge:#30363d; --done:#8957e5; }
+ * { box-sizing:border-box; }
+ body { margin:0; font-family:-apple-system,Segoe UI,Roboto,Helvetica,Arial,sans-serif; background:var(--bg); color:var(--ink); font-size:14px; }
+ a, .linklike { color:var(--link); text-decoration:none; cursor:pointer; background:none; border:none; font-size:inherit; font-family:inherit; padding:0; }
+ a:hover, .linklike:hover { text-decoration:underline; }
+ button { font-family:inherit; }
+
+ /* ---------- Chrome ---------- */
+ .topbar { display:flex; align-items:center; gap:14px; padding:12px 18px; border-bottom:1px solid var(--line); background:#010409; }
+ .topbar .mark { font-size:26px; }
+ .topbar .crumb { font-size:15px; }
+ .topbar .crumb strong { font-weight:600; }
+ .topbar .spacer { flex:1; }
+ .topbar input { background:var(--bg); border:1px solid var(--line); border-radius:6px; color:var(--ink); padding:6px 10px; width:240px; }
+ .repotabs { display:flex; gap:4px; padding:0 12px; border-bottom:1px solid var(--line); background:#010409; }
+ .repotabs button { background:none; border:none; color:var(--ink); padding:10px 14px; font-size:14px; cursor:pointer;
+ border-bottom:2px solid transparent; display:flex; gap:7px; align-items:center; }
+ .repotabs button:hover { border-bottom-color:var(--muted); }
+ .repotabs button.on { border-bottom-color:#f78166; font-weight:600; }
+ .repotabs .count { background:var(--badge); border-radius:10px; padding:1px 8px; font-size:12px; }
+
+ /* ---------- Repo home ---------- */
+ .layout { display:flex; gap:28px; max-width:1280px; margin:0 auto; padding:22px 24px 60px; }
+ .maincol { flex:1; min-width:0; }
+ .sidecol { width:300px; flex:0 0 300px; }
+ .repohead { display:flex; align-items:center; gap:10px; margin-bottom:16px; flex-wrap:wrap; }
+ .repohead h1 { font-size:20px; font-weight:600; margin:0; }
+ .vis { border:1px solid var(--line); border-radius:12px; padding:1px 8px; font-size:12px; color:var(--muted); }
+ .repohead .actions { margin-left:auto; display:flex; gap:8px; }
+ .pill { background:var(--btn); border:1px solid var(--line); border-radius:6px; color:var(--ink); padding:5px 12px; font-size:13px; cursor:pointer; }
+ .pill .n { background:var(--badge); border-radius:10px; padding:0 7px; margin-left:6px; font-size:12px; }
+ .files { border:1px solid var(--line); border-radius:6px; overflow:hidden; margin-bottom:18px; }
+ .files .commitrow { background:var(--panel); padding:10px 14px; display:flex; gap:10px; font-size:13px; color:var(--muted); }
+ .files .commitrow strong { color:var(--ink); font-weight:600; }
+ .files .row { display:flex; padding:9px 14px; border-top:1px solid var(--line); font-size:14px; }
+ .files .row .name { width:280px; color:var(--ink); }
+ .files .row .msg { flex:1; color:var(--muted); overflow:hidden; white-space:nowrap; text-overflow:ellipsis; }
+ .files .row .when { color:var(--muted); width:120px; text-align:right; }
+ .readme { border:1px solid var(--line); border-radius:6px; }
+ .readme__tabs { border-bottom:1px solid var(--line); padding:10px 16px; font-weight:600; font-size:14px; }
+ .readme__body { padding:28px 34px; line-height:1.6; }
+ .readme__body h1 { text-align:center; font-size:26px; letter-spacing:.08em; }
+ .readme__body .dragon { text-align:center; font-size:44px; margin:6px 0; }
+ .readme__body .tagline { text-align:center; font-size:16px; margin:4px 0 22px; }
+ .readme__body h2 { border-bottom:1px solid var(--line); padding-bottom:8px; margin-top:34px; font-size:22px; }
+ .readme__body p { font-size:15px; }
+ .about h3 { font-size:16px; margin:0 0 10px; }
+ .about p { font-size:14px; margin:0 0 12px; }
+ .about .tags { display:flex; flex-wrap:wrap; gap:7px; margin-bottom:16px; }
+ .about .tag { background:rgba(56,139,253,.15); color:var(--link); border-radius:12px; padding:3px 10px; font-size:12px; }
+ .about ul { list-style:none; padding:0; margin:0; border-top:1px solid var(--line); }
+ .about li { padding:8px 0; color:var(--muted); font-size:13px; }
+ .about li strong { color:var(--ink); }
+
+ /* ---------- Pulse ---------- */
+ .pulse h2.period { font-size:22px; font-weight:600; margin:0; }
+ .pulse .periodrow { display:flex; align-items:center; justify-content:space-between; border-bottom:1px solid var(--line); padding-bottom:14px; margin-bottom:18px; }
+ .pulse .periodbtn { background:var(--btn); border:1px solid var(--line); border-radius:6px; color:var(--ink); padding:6px 12px; font-size:13px; cursor:pointer; }
+ .pulse .periodbtn .k { color:var(--muted); }
+ .overview { border:1px solid var(--line); border-radius:6px; }
+ .overview h3 { margin:0; padding:12px 16px; border-bottom:1px solid var(--line); font-size:14px; background:var(--panel); }
+ .ovgrid { display:flex; flex-wrap:wrap; }
+ .ovcell { width:50%; padding:18px 20px; }
+ .bar { display:flex; height:10px; border-radius:5px; overflow:hidden; margin-bottom:12px; }
+ .bar span { display:block; height:100%; }
+ .stat { display:inline-block; margin-right:26px; }
+ .stat .n { font-size:22px; font-weight:600; display:block; }
+ .stat .k { color:var(--muted); font-size:13px; }
+ .summary { padding:16px 20px; border-top:1px solid var(--line); font-size:15px; }
+ .summary strong { font-weight:600; }
+ .authors { padding:0 20px 18px; color:var(--muted); font-size:13px; }
+
+ /* ---------- 404 (logged-out private) ---------- */
+ .nf { position:relative; }
+ .nf__hero { background:linear-gradient(180deg,#79b8ff 0%,#e8d9b5 55%,#d8c49a 100%); color:#2f4858; padding:70px 40px 90px; text-align:center; }
+ .nf__404 { font-size:96px; font-weight:800; color:#fff; text-shadow:0 2px 0 rgba(0,0,0,.15); }
+ .nf__bubble { display:inline-block; background:#fff; border-radius:10px; padding:16px 22px; font-size:24px; font-weight:700; margin-top:8px; }
+ .signin-pop { position:absolute; top:26px; right:40px; width:340px; background:#010409; border:1px solid var(--line); border-radius:10px; padding:22px; text-align:left; box-shadow:0 8px 28px rgba(0,0,0,.5); }
+ .signin-pop h2 { font-size:19px; margin:0 0 14px; }
+ .signin-pop label { display:block; font-size:14px; font-weight:600; margin:12px 0 6px; }
+ .signin-pop .lblrow { display:flex; justify-content:space-between; align-items:baseline; }
+ .signin-pop input[type=text], .signin-pop input[type=password] {
+ width:100%; padding:8px 10px; background:var(--bg); border:1px solid var(--line); border-radius:6px; color:var(--ink); font-size:14px; }
+ .signin-pop .go { width:100%; margin-top:16px; padding:9px; background:var(--green); border:1px solid rgba(240,246,252,.1); border-radius:6px; color:#fff; font-size:14px; font-weight:600; cursor:pointer; }
+ .signin-pop .alt { display:block; text-align:center; margin-top:14px; }
+ #signinError { color:#ff7b72; font-size:13px; min-height:18px; margin:10px 0 0; }
+ .nf__search { padding:34px 40px 50px; border-bottom:1px solid var(--line); }
+ .nf__search p { margin:0 0 10px; font-size:16px; }
+ .nf__search .row { display:flex; gap:10px; }
+ .nf__search input { flex:1; background:var(--bg); border:1px solid var(--line); border-radius:6px; color:var(--ink); padding:9px 12px; }
+ .nf__search button { background:var(--btn); border:1px solid var(--line); border-radius:6px; color:var(--ink); padding:9px 18px; cursor:pointer; }
+ .nf__foot { text-align:center; color:var(--muted); padding:22px; font-size:14px; }
+
+ /* ---------- 2FA ---------- */
+ .tfa { max-width:340px; margin:60px auto; text-align:center; }
+ .tfa .coin { font-size:44px; }
+ .tfa h1 { font-size:24px; font-weight:300; margin:12px 0 6px; }
+ .tfa .sub { color:var(--muted); font-size:14px; margin:0 0 22px; }
+ .tfa .card { background:var(--panel); border:1px solid var(--line); border-radius:6px; padding:18px; text-align:center; }
+ .tfa .primary { width:100%; padding:9px; background:var(--green); border:1px solid rgba(240,246,252,.1); border-radius:6px; color:#fff; font-size:14px; font-weight:600; cursor:pointer; }
+ .tfa .secondary { width:100%; padding:9px; background:var(--btn); border:1px solid var(--line); border-radius:6px; color:var(--ink); font-size:14px; cursor:pointer; margin-top:14px; }
+ .tfa input#app_totp { width:100%; padding:10px; background:var(--bg); border:1px solid var(--line); border-radius:6px; color:var(--ink);
+ font-size:20px; text-align:center; letter-spacing:.2em; margin-bottom:10px; }
+ .tfa .alts { list-style:none; margin:12px 0 0; padding:0; display:none; }
+ .tfa .alts.open { display:block; }
+ .tfa .alts li button { width:100%; padding:9px; background:var(--btn); border:1px solid var(--line); border-radius:6px; color:var(--ink); font-size:14px; cursor:pointer; margin-top:8px; }
+ .tfa .notice { color:var(--muted); font-size:13px; margin-top:12px; }
+ #tfaError { color:#ff7b72; font-size:13px; min-height:18px; margin-top:10px; }
+ .sr-only { position:absolute; width:1px; height:1px; overflow:hidden; clip:rect(0 0 0 0); }
+</style>
+</head>
+<body>
+<div id="app"></div>
+<script>
+/* Wyrmhold — a code-hosting fixture (SKY-12764): a public repo (home + Pulse) and a
+ private repo behind sign-in -> passkey screen -> "More options" -> authenticator
+ code. Auth pages follow saved DOM captures of a real code host; branding is
+ fixture-owned and repo content comes from our own open-source README. */
+
+const BRAND = "Wyrmhold";
+const ORG = "Skyvern-AI";
+const REPO = (location.pathname.split("/").filter(Boolean)[1] || "skyvern");
+const IS_PRIVATE = REPO === "skyvern-cloud";
+
+const DEMO_USERS = ["demo_business_user", "[email protected]"];
+const DEMO_PASS = "Demo!Pass123";
+const BAD_CREDS = "Incorrect username or password.";
+
+// Public repo carries our real OSS pulse shape; the private repo's numbers are
+// fixture-owned so no internal data lands in the mock.
+const PULSE = {
+ "skyvern": { authors:17, main:195, all:232, activePRs:12, activeIssues:34,
+ merged:209, openPRs:15, closed:24, newIssues:31 },
+ "skyvern-cloud": { authors:21, main:301, all:640, activePRs:58, activeIssues:22,
+ merged:298, openPRs:41, closed:12, newIssues:9 },
+};
+const FILES = [
+ { name:".github", msg:"ci: skip sdk-release when target version…", when:"last month" },
+ { name:"docs", msg:"Copilot uses a saved credential matchin…", when:"4 hours ago" },
+ { name:"skyvern", msg:"Keep date-driven row select…", when:"2 hours ago" },
+ { name:"skyvern-frontend", msg:"Copilot chat reads run-outcome facts fr…", when:"4 hours ago" },
+ { name:"tests", msg:"Keep date-driven row select…", when:"2 hours ago" },
+ { name:"README.md", msg:"Add packaged UI pip install flow", when:"2 months ago" },
+];
+
+const app = document.getElementById("app");
+const S = sessionStorage;
+
+function chrome(tab) {
+ const counts = { Issues: 39, "Pull requests": 186 };
+ const tabs = ["Code", "Issues", "Pull requests", "Actions", "Insights"];
+ return `
+ <div class="topbar">
+ <span class="mark">&#128009;</span>
+ <span class="crumb">${ORG} / <strong>${REPO}</strong></span>
+ <div class="spacer"></div>
+ <input placeholder="Type / to search" />
+ <span style="color:var(--muted)">demo_business_user</span>
+ </div>
+ <div class="repotabs">
+ ${tabs.map(t => `<button class="${t === tab ? "on" : ""}" onclick="onTab('${t}')">${t}${counts[t] ? `<span class=\"count\">${counts[t]}</span>` : ""}</button>`).join("")}
+ </div>`;
+}
+
+function onTab(tab) {
+ if (tab === "Insights") { renderPulse(); return; }
+ renderRepo();
+}
+
+/* ===================== Gate chain (private repo only) ===================== */
+function advancePastGates() {
+ if (!IS_PRIVATE) { S.getItem("wh_view") === "pulse" ? renderPulse() : renderRepo(); return; }
+ if (S.getItem("wh_authed") !== "1") { renderNotFound(); return; }
+ if (S.getItem("wh_mfa_passed") !== "1") { renderTfaPasskey(); return; }
+ S.getItem("wh_view") === "pulse" ? renderPulse() : renderRepo();
+}
+
+/* ===================== 404 + sign-in (logged-out private repo) =====================
+ The real host answers a logged-out private-repo URL with a 404 that hides the
+ repo's existence, carrying an inline sign-in popover — not a login redirect. */
+function renderNotFound(errorText) {
+ document.title = `Page not found · ${BRAND}`;
+ app.innerHTML = `
+ <div class="nf">
+ <div class="nf__hero">
+ <div class="nf__404">404</div>
+ <div class="nf__bubble">This is not the web page you are looking for.</div>
+ </div>
+ <div class="signin-pop">
+ <h2>Sign in to ${BRAND}</h2>
+ <form onsubmit="event.preventDefault(); onSignIn();">
+ <label for="login_field">Username or email address</label>
+ <input type="text" name="login" id="login_field" autocapitalize="off" autocorrect="off" autocomplete="username" autofocus />
+ <div class="lblrow"><label for="password">Password</label><a href="javascript:void(0)">Forgot password?</a></div>
+ <input type="password" name="password" id="password" autocomplete="current-password" />
+ <p id="signinError" role="alert">${errorText || ""}</p>
+ <input type="submit" name="commit" value="Sign in" class="go" data-disable-with="Signing in&#8230;" />
+ </form>
+ <button class="linklike alt" onclick="onOtherMethods()">or continue with other methods</button>
+ </div>
+ <div class="nf__search">
+ <p>Find code, projects, and people on ${BRAND}:</p>
+ <div class="row"><input id="not-found-search" name="q" type="text" /><button>Search</button></div>
+ </div>
+ <div class="nf__foot">Contact Support &mdash; ${BRAND} Status</div>
+ </div>`;
+}
+
+function onOtherMethods() {
+ document.getElementById("signinError").textContent =
+ "Other sign-in methods are unavailable for this workspace. Use your username and password.";
+}
+
+function onSignIn() {
+ const u = (document.getElementById("login_field").value || "").trim();
+ const p = document.getElementById("password").value || "";
+ if (!DEMO_USERS.includes(u) || p !== DEMO_PASS) {
+ document.getElementById("signinError").textContent = BAD_CREDS;
+ return;
+ }
+ S.setItem("wh_authed", "1");
+ advancePastGates();
+}
+
+/* ===================== Two-factor: passkey first, then authenticator ===================== */
+function tfaShell(subtitle, cardHtml) {
+ document.title = `Two-factor authentication · ${BRAND}`;
+ return `
+ <div class="tfa">
+ <div class="coin">&#128009;</div>
+ <h1>Two-factor authentication</h1>
+ <p class="sub">${subtitle}</p>
+ ${cardHtml}
+ </div>`;
+}
+
+function renderTfaPasskey() {
+ app.innerHTML = tfaShell("Authenticate using your passkey.", `
+ <div class="card">
+ <button class="primary" data-retry-message="Retry passkey" onclick="onPasskey()">Use passkey</button>
+ <p id="tfaError" role="alert"></p>
+ <button class="secondary" aria-expanded="false" aria-controls="two-factor-alternatives-body" onclick="onMoreOptions(this)">More options &#9662;</button>
+ <ul class="alts" id="two-factor-alternatives-body">
+ <li><button onclick="renderTfaTotp()">Authenticator app</button></li>
+ <li><button onclick="onAltUnavailable()">Recovery code</button></li>
+ </ul>
+ </div>`);
+}
+
+function onPasskey() {
+ document.getElementById("tfaError").textContent =
+ "This browser or device is reporting partial passkey support. Use another method below.";
+}
+
+function onMoreOptions(btn) {
+ const list = document.getElementById("two-factor-alternatives-body");
+ const open = list.classList.toggle("open");
+ btn.setAttribute("aria-expanded", open ? "true" : "false");
+}
+
+function onAltUnavailable() {
+ document.getElementById("tfaError").textContent = "That method is unavailable for this account.";
+}
+
+// Input contract from the saved capture: name=app_otp, id=app_totp, numeric six
+// digits or a 5-5 recovery code, XXXXXX placeholder, auto-verify at six digits.
+function renderTfaTotp(errorText) {
+ app.innerHTML = tfaShell("Enter the code from your two-factor authentication app or browser extension below.", `
+ <div class="card">
+ <form onsubmit="event.preventDefault(); onVerify();">
+ <label id="session-otp-input-label" class="sr-only" for="app_totp">Enter the verification code</label>
+ <input type="text" name="app_otp" id="app_totp" aria-labelledby="session-otp-input-label"
+ autocomplete="off" autofocus inputmode="numeric"
+ pattern="([0-9]{6})|([0-9a-fA-F]{5}-?[0-9a-fA-F]{5})" placeholder="XXXXXX"
+ oninput="if(/^[0-9]{6}$/.test(this.value)) onVerify();" />
+ <button class="primary" type="submit" data-disable-with="Verifying&#8230;">Verify</button>
+ </form>
+ <p id="tfaError" role="alert">${errorText || ""}</p>
+ <button class="secondary" aria-expanded="false" aria-controls="two-factor-alternatives-body" onclick="onMoreOptions(this)">More options &#9662;</button>
+ <ul class="alts" id="two-factor-alternatives-body">
+ <li><button onclick="renderTfaPasskey()">Passkey</button></li>
+ <li><button onclick="onAltUnavailable()">Recovery code</button></li>
+ </ul>
+ </div>`);
+}
+
+function onVerify() {
+ const code = (document.getElementById("app_totp").value || "").trim();
+ if (!/^([0-9]{6})|([0-9a-fA-F]{5}-?[0-9a-fA-F]{5})$/.test(code) || !/^[0-9]{6}$/.test(code)) {
+ renderTfaTotp("Two-factor authentication failed. Enter the six-digit code from your app.");
+ return;
+ }
+ S.setItem("wh_mfa_passed", "1");
+ advancePastGates();
+}
+
+/* ===================== Repo home ===================== */
+function renderRepo() {
+ S.setItem("wh_view", "code");
+ document.title = `${ORG}/${REPO}: Automate browser based workflows with AI`;
+ const vis = IS_PRIVATE ? "Private" : "Public";
+ app.innerHTML = chrome("Code") + `
+ <div class="layout">
+ <div class="maincol">
+ <div class="repohead">
+ <h1>${REPO}</h1><span class="vis">${vis}</span>
+ <div class="actions">
+ <button class="pill">&#128065; Watch<span class="n">101</span></button>
+ <button class="pill">&#127860; Fork<span class="n">2.1k</span></button>
+ <button class="pill">&#11088; Star<span class="n">${IS_PRIVATE ? "3" : "22.6k"}</span></button>
+ </div>
+ </div>
+ <div class="files">
+ <div class="commitrow"><strong>pedrohsdb</strong> Render the copil&#8230; <span style="margin-left:auto">6,073 Commits</span></div>
+ ${FILES.map(f => `<div class="row"><span class="name">&#128193; ${f.name}</span><span class="msg">${f.msg}</span><span class="when">${f.when}</span></div>`).join("")}
+ </div>
+ <div class="readme">
+ <div class="readme__tabs">README</div>
+ <div class="readme__body">
+ <div class="dragon">&#128009;</div>
+ <h1>SKYVERN</h1>
+ <p class="tagline">&#128009; Automate Browser-based workflows using LLMs and Computer Vision &#128009;</p>
+ <p><a>Skyvern</a> automates browser-based workflows using LLMs and computer vision. It provides a
+ Playwright-compatible SDK that adds AI functionality on top of playwright, as well as a no-code
+ workflow builder to help both technical and non-technical users automate manual workflows on any
+ website, replacing brittle or unreliable automation solutions.</p>
+ <p>Traditional approaches to browser automations required writing custom scripts for websites,
+ often relying on DOM parsing and XPath-based interactions which would break whenever the website
+ layouts changed.</p>
+ <p>Instead of only relying on code-defined XPath interactions, Skyvern relies on Vision LLMs to
+ learn and interact with the websites.</p>
+ <h2>How it works</h2>
+ <p>Skyvern was inspired by the Task-Driven autonomous agent design popularized by BabyAGI and
+ AutoGPT &mdash; with one major bonus: we give Skyvern the ability to interact with websites using
+ browser automation libraries like Playwright.</p>
+ <p>Skyvern uses a swarm of agents to comprehend a website, and plan and execute its actions.</p>
+ </div>
+ </div>
+ </div>
+ <div class="sidecol about">
+ <h3>About</h3>
+ <p>${IS_PRIVATE ? "Cloud service layer for the Skyvern platform." : "Automate browser based workflows with AI"}</p>
+ <div class="tags">${["python","api","workflow","automation","browser","ai","playwright","llm"].map(t => `<span class="tag">${t}</span>`).join("")}</div>
+ <ul>
+ <li>&#128214; <strong>Readme</strong></li>
+ <li>&#9878; <strong>AGPL-3.0</strong> license</li>
+ <li>&#11088; <strong>${IS_PRIVATE ? "3" : "22.6k"}</strong> stars</li>
+ <li>&#128065; <strong>101</strong> watching</li>
+ <li>&#127860; <strong>2.1k</strong> forks</li>
+ </ul>
+ </div>
+ </div>`;
+}
+
+/* ===================== Pulse (Insights) ===================== */
+function renderPulse() {
+ S.setItem("wh_view", "pulse");
+ document.title = `Pulse · ${ORG}/${REPO}`;
+ const p = PULSE[REPO];
+ const prTotal = p.merged + p.openPRs, isTotal = p.closed + p.newIssues;
+ const mergedPct = Math.round(100 * p.merged / prTotal), closedPct = Math.round(100 * p.closed / isTotal);
+ app.innerHTML = chrome("Insights") + `
+ <div class="layout"><div class="maincol pulse">
+ <div class="periodrow">
+ <h2 class="period">July 15, 2026 &ndash; July 22, 2026</h2>
+ <button class="periodbtn"><span class="k">Period:</span> 1 week &#9662;</button>
+ </div>
+ <div class="overview">
+ <h3>Overview</h3>
+ <div class="ovgrid">
+ <div class="ovcell">
+ <div class="bar">
+ <span role="progressbar" aria-label="Merged pull requests" aria-valuenow="${mergedPct}" style="width:${mergedPct}%;background:var(--done)"></span>
+ <span role="progressbar" aria-label="Open pull requests" aria-valuenow="${100 - mergedPct}" style="width:${100 - mergedPct}%;background:var(--green)"></span>
+ </div>
+ <span class="stat"><span class="n">${p.merged}</span><span class="k">Merged pull requests</span></span>
+ <span class="stat"><span class="n">${p.openPRs}</span><span class="k">Open pull requests</span></span>
+ </div>
+ <div class="ovcell">
+ <div class="bar">
+ <span role="progressbar" aria-label="Closed issues" aria-valuenow="${closedPct}" style="width:${closedPct}%;background:#f78166"></span>
+ <span role="progressbar" aria-label="New issues" aria-valuenow="${100 - closedPct}" style="width:${100 - closedPct}%;background:var(--green)"></span>
+ </div>
+ <span class="stat"><span class="n">${p.closed}</span><span class="k">Closed issues</span></span>
+ <span class="stat"><span class="n">${p.newIssues}</span><span class="k">New issues</span></span>
+ </div>
+ </div>
+ <div class="summary">
+ <span>Excluding merges, </span><strong>${p.authors} authors</strong><span> have pushed </span>
+ <strong>${p.main} commits</strong><span> to main and </span><strong>${p.all} commits</strong><span> to all branches.</span>
+ </div>
+ <div class="authors">${p.activePRs} Active pull requests &middot; ${p.activeIssues} Active issues</div>
+ </div>
+ </div></div>`;
+}
+
+advancePastGates();
+</script>
+</body>
+</html>
diff --git a/skyvern/forge/sdk/encrypt/bootstrap.py b/skyvern/forge/sdk/encrypt/bootstrap.py
index 6450c675d..26e606c6f 100644
--- a/skyvern/forge/sdk/encrypt/bootstrap.py
+++ b/skyvern/forge/sdk/encrypt/bootstrap.py
@@ -46,9 +46,9 @@ def create_aes_encryptor(
"secret; empty values and the default placeholder 'fillmein' both fail closed."
)
fallback_parameters = list(fallback_decrypt_keys or ())
- # Legacy ciphertext has no version marker. Always retry the pre-SHA-normalization
- # parameters on decrypt, including explicit deployment salt/IV settings.
- fallback_parameters.insert(0, (salt, iv))
+ if not (salt and iv):
+ # Legacy ciphertext has no version marker, so retry the pre-derivation parameters on decrypt.
+ fallback_parameters.insert(0, (salt, iv))
return AES(
secret_key=secret_key,
salt=salt or _derive_from_secret_key(secret_key, _SALT_DERIVATION_LABEL),
diff --git a/skyvern/forge/taskv3/tools.py b/skyvern/forge/taskv3/tools.py
index 5962af670..293b0e0ee 100644
--- a/skyvern/forge/taskv3/tools.py
+++ b/skyvern/forge/taskv3/tools.py
@@ -57,6 +57,23 @@ _STOPWORDS_JS = (
"'inc','llc','ltd','corp'])"
)
+# The roles this engine treats as controls. observe enumerates exactly these (its `q` selector is
+# this list expanded) and reports them on each record, so it is the single answer to "is this a
+# control?" rather than each probe keeping its own.
+_WIDGET_ROLES_JS = (
+ "['button','checkbox','radio','combobox','option','menuitem',"
+ "'menuitemcheckbox','menuitemradio','listbox','switch','spinbutton','tab']"
+)
+
+# The subset of those that can be a ROW in an opened menu. Derived rather than restated so the two
+# cannot drift. Excluded: combobox/listbox/spinbutton, which are the control or its container and
+# never one of its rows; and tab, which is navigational -- _FIND_SUGGESTION_JS refuses it for the
+# same reason, and a probe that called a tab strip a menu of options would invite a wrong move.
+_MENU_ROW_ROLES_JS = (
+ "new Set(" + _WIDGET_ROLES_JS + ".filter((r) => ['combobox','listbox','spinbutton','tab'].indexOf(r) === -1))"
+)
+
+
# Every open shadow root on the page, document first, then each root in depth-first order. Web-component libraries put the
# real input/button inside a shadow root, and `document.querySelector*` does not cross that boundary
# while Playwright's selector engine does — so any probe that must agree with what an action tool
@@ -685,6 +702,13 @@ _CLICK_PRECHECK_JS = (
el.getAttribute('style'), kids,
].join('|');
};
+ // Fixed-arity on purpose: every component is one attribute of the row itself, so a row that
+ // restructures cannot change this string, and only being picked can.
+ const selState = (el) => {
+ return [
+ el.getAttribute('aria-checked'), el.getAttribute('aria-selected'), el.getAttribute('aria-pressed'),
+ ].join('|');
+ };
const openRows = [];
for (const el of pQSA('[data-tv3-menu]')) if (vis(el)) openRows.push(el);
let target = null;
@@ -693,6 +717,9 @@ _CLICK_PRECHECK_JS = (
let containsMenu = false;
let optText = '';
let optState = '';
+ let optSel = '';
+ let optKids = -1;
+ let optH = -1;
if (target && openRows.length) {
for (const el of openRows) {
// The target being the row or inside it is an option pick. The target merely CONTAINING rows
@@ -702,6 +729,9 @@ _CLICK_PRECHECK_JS = (
isOption = true;
optText = (el.innerText || '').trim().slice(0, 80);
optState = state(el);
+ optSel = selState(el);
+ optKids = el.children.length;
+ optH = Math.round(el.getBoundingClientRect().height);
break;
}
if (pContains(target, el)) containsMenu = true;
@@ -709,7 +739,7 @@ _CLICK_PRECHECK_JS = (
}
preReset();
pScopeEach((el, inShadow) => { if (vis(el)) preMark(el, inShadow); });
- return { menuOpen: openRows.length > 0, isOption, containsMenu, optText, optState };
+ return { menuOpen: openRows.length > 0, isOption, containsMenu, optText, optState, optSel, optKids, optH };
}"""
)
@@ -741,18 +771,34 @@ _MENU_AFTER_JS = (
el.getAttribute('style'), kids,
].join('|');
};
+ // Fixed-arity on purpose: every component is one attribute of the row itself, so a row that
+ // restructures cannot change this string, and only being picked can.
+ const selState = (el) => {
+ return [
+ el.getAttribute('aria-checked'), el.getAttribute('aria-selected'), el.getAttribute('aria-pressed'),
+ ].join('|');
+ };
let stillOpen = 0;
const rows = [];
for (const el of pQSA('[data-tv3-menu]')) if (vis(el)) { stillOpen++; rows.push(el); }
let target = null;
try { target = pQS(clicked) || (arg.el && arg.el.isConnected ? arg.el : null); } catch (e) { target = (arg.el && arg.el.isConnected ? arg.el : null); }
let optState = '';
+ let optSel = '';
+ let optKids = -1;
+ let optH = -1;
if (target) {
for (const el of rows) {
- if (el === target || pContains(el, target)) { optState = state(el); break; }
+ if (el === target || pContains(el, target)) {
+ optState = state(el);
+ optSel = selState(el);
+ optKids = el.children.length;
+ optH = Math.round(el.getBoundingClientRect().height);
+ break;
+ }
}
}
- return { stillOpen, optState };
+ return { stillOpen, optState, optSel, optKids, optH };
}"""
)
@@ -770,6 +816,9 @@ _FIND_MENU_JS = (
const clicked = arg.sel;"""
+ _PIERCED_QUERY_JS
+ r"""
+ const MENU_ROW_ROLES = """
+ + _MENU_ROW_ROLES_JS
+ + r""";
const vis = (r) => r.width > 0 && r.height > 0;
let trigger = null;
try { trigger = pQS(clicked) || (arg.el && arg.el.isConnected ? arg.el : null); } catch (e) { return null; }
@@ -792,11 +841,14 @@ _FIND_MENU_JS = (
if (!txt || txt.length > 80) continue;
// Options are individually actionable rows. Requiring it per-row keeps a dialog's title/body
// text from being listed as "options" (and a horizontal Confirm/Cancel button pair then fails
- // the stacked-rows check below).
+ // the stacked-rows check below). The role set is observe's, minus the container and
+ // navigational ones: a single-select built as a radiogroup and a multi-select built as
+ // checkboxes are menus, and a probe that disagreed with observe about that left their rows
+ // untagged -- which silently disarms every commit check in _click_reaction.
const role = el.getAttribute('role');
let ptr = false;
try { ptr = getComputedStyle(el).cursor === 'pointer'; } catch (e) { ptr = false; }
- const clickable = tag === 'BUTTON' || tag === 'A' || role === 'option' || role === 'menuitem' || role === 'menuitemcheckbox' || role === 'menuitemradio' || ptr;
+ const clickable = tag === 'BUTTON' || tag === 'A' || MENU_ROW_ROLES.has(role) || ptr;
if (!clickable) continue;
rows.push({ el, r, txt });
}
@@ -874,8 +926,9 @@ _OBSERVE_JS = (
+ r""";
// [role=textbox] is deliberately absent: on a div without contenteditable it names a control that
// cannot be filled, and the ones that can are already matched by [contenteditable=true].
- const _WIDGET_ROLES = ['button', 'checkbox', 'radio', 'combobox', 'option', 'menuitem',
- 'menuitemcheckbox', 'menuitemradio', 'listbox', 'switch', 'spinbutton', 'tab'];
+ const _WIDGET_ROLES = """
+ + _WIDGET_ROLES_JS
+ + r""";
const q = 'input,textarea,select,button,a[href],[role=button],[role=checkbox],[role=radio],[role=combobox],[role=option],[role=menuitem],[role=menuitemcheckbox],[role=menuitemradio],[role=listbox],[role=switch],[role=spinbutton],[role=tab],[contenteditable=true]';
// Set wherever we learn that some region of the page cannot be read. Declared here because the
// walk below is one of those places and it runs before the marker gather.
@@ -1596,7 +1649,7 @@ _OBSERVE_JS = (
)
-def _menu_open_note(found: dict[str, Any], selector: str) -> str:
+def _menu_open_note(found: dict[str, Any], selector: str, *, clicked_row: bool = False) -> str:
count = int(found.get("count") or 0)
parts = []
for o in (found.get("options") or [])[:15]:
@@ -1604,10 +1657,15 @@ def _menu_open_note(found: dict[str, Any], selector: str) -> str:
text = _DOWNLOAD_NOTICE_SANITIZE_RE.sub("", str(o.get("text", "")))
parts.append(f'[data-tv3-menu="{o.get("n")}"] {text!r}')
overflow = f" (+{count - len(parts)} more — re-observe for the full list)" if count > len(parts) else ""
+ # Naming the raw selector would contradict the next sentence when the caller IS a menu row:
+ # this note has just renumbered every data-tv3-menu, so the selector clicked to get here is one
+ # of the ones it is about to declare stale.
+ closer = "the row you just clicked" if clicked_row else selector
return (
f"This click opened a menu of {count} options: {'; '.join(parts)}{overflow}. To select one, click "
- f'its [data-tv3-menu="N"] selector NOW — clicking {selector} again or elsewhere closes the menu '
- "and destroys these options."
+ f'its [data-tv3-menu="N"] selector NOW — clicking {closer} again or elsewhere closes the menu '
+ "and destroys these options. These numbers are freshly assigned: any data-tv3-menu selector "
+ "from an earlier result now points at a different row or at nothing."
)
@@ -1936,20 +1994,72 @@ def build_browser_tools(
# submenu opening (a cascading option commits nothing yet — reporting the child menu beats
# a false error).
baseline = pre.get("optState") or ""
+ sel_baseline = pre.get("optSel") or ""
+ kids_baseline = pre.get("optKids")
+ height_baseline = pre.get("optH")
def _committed_state(after: dict[str, Any]) -> bool:
return bool(after.get("optState")) and after.get("optState") != baseline
- async def _state_holds(state: str) -> bool:
- # A real commit settles into its new state; self-updating row content (a countdown,
- # a live price) keeps moving. Only a state that holds across two reads is evidence.
+ def _picked(after: dict[str, Any]) -> bool:
+ # One of the row's own selection attributes moved. Nothing a restructuring row does
+ # can reach these, so this is commit evidence on its own.
+ return bool(after.get("optSel")) and after.get("optSel") != sel_baseline
+
+ def _grew(after: dict[str, Any]) -> bool:
+ # The row got bigger of its own accord, which is the one shape where "it committed"
+ # has a competitor. Height as well as child count, because a row whose single wrapper
+ # is REPLACED by an expanded one keeps its count and still grows taller.
+ def _up(now: Any, before: Any, by: int) -> bool:
+ ok = (int, float)
+ if isinstance(now, bool) or isinstance(before, bool):
+ return False
+ return isinstance(now, ok) and isinstance(before, ok) and before >= 0 and now - before > by
+
+ return _up(after.get("optKids"), kids_baseline, 0) or _up(after.get("optH"), height_baseline, 2)
+
+ async def _state_holds(state: str, fallback: dict[str, Any]) -> dict[str, Any] | None:
+ # A real commit settles; self-updating content (a countdown, a live price) keeps
+ # moving, so only a state that holds across two reads is evidence. The second read is
+ # returned because 150ms later is the difference between measuring a CSS expansion
+ # and measuring it mid-flight.
await asyncio.sleep(0.15)
try:
again_raw = await page.evaluate(_MENU_AFTER_JS, await _probe_arg(page, selector))
except Exception:
- return True
+ return fallback
again = again_raw if isinstance(again_raw, dict) else {}
- return bool(again.get("optState") == state)
+ return again if again.get("optState") == state else None
+
+ async def _child_menu_note() -> str | None:
+ # A row that expands a sub-list mutates ITSELF, so the fingerprint cannot tell
+ # "committed" from "expanded" and the child rows can -- a cascading click that opened
+ # them committed nothing yet.
+ try:
+ found = await page.evaluate(_FIND_MENU_JS, await _probe_arg(page, selector))
+ except Exception:
+ return None
+ if isinstance(found, dict) and found.get("count"):
+ return _menu_open_note(found, selector, clicked_row=True)
+ return None
+
+ async def _state_change_note(opt_text: str, after: dict[str, Any]) -> str:
+ picked = f"Selected option {opt_text!r} — its state changed (the menu stayed open)."
+ # A row that did not grow cannot have expanded into itself, so nothing competes with
+ # the commit reading and the probe is not worth its page walk -- which is the
+ # ordinary multi-select click.
+ if not _grew(after):
+ return picked
+ child = await _child_menu_note()
+ if not child:
+ return picked
+ # It grew AND opened child rows, so a selection attribute means it did both and
+ # dropping either half would be a false report. Without the "menu stayed open" clause:
+ # the child note has just renumbered the markers, so what the model was holding is
+ # precisely what did not stay.
+ if _picked(after):
+ return f"Selected option {opt_text!r} — its state changed.\n{child}"
+ return child
url_now = await _url(page)
if url_before and url_now and url_now != url_before:
@@ -1962,8 +2072,10 @@ def build_browser_tools(
after = after_raw if isinstance(after_raw, dict) else {}
if not after.get("stillOpen"):
return f"Selected option {opt!r} — the menu closed.", None
- if _committed_state(after) and await _state_holds(after.get("optState") or ""):
- return f"Selected option {opt!r} — its state changed (the menu stayed open).", None
+ if _committed_state(after):
+ held = await _state_holds(after.get("optState") or "", after)
+ if held is not None:
+ return await _state_change_note(opt, held), None
# Menus routinely close through a fade or an async server ack; declaring "did not commit"
# off the instantaneous read would turn those healthy commits into false errors. One
# bounded settle, only on this would-be-error path.
@@ -1975,16 +2087,15 @@ def build_browser_tools(
settled = settled_raw if isinstance(settled_raw, dict) else {}
if not settled.get("stillOpen"):
return f"Selected option {opt!r} — the menu closed.", None
- if _committed_state(settled) and await _state_holds(settled.get("optState") or ""):
- return f"Selected option {opt!r} — its state changed (the menu stayed open).", None
+ if _committed_state(settled):
+ held = await _state_holds(settled.get("optState") or "", settled)
+ if held is not None:
+ return await _state_change_note(opt, held), None
# No-commit evidence is already established: a crash of this last informational probe must
- # not fall through to the caller's fail-open bare ok.
- try:
- submenu = await page.evaluate(_FIND_MENU_JS, await _probe_arg(page, selector))
- except Exception:
- submenu = None
- if isinstance(submenu, dict) and submenu.get("count"):
- return _menu_open_note(submenu, selector), None
+ # not fall through to the caller's fail-open bare ok (_child_menu_note swallows).
+ late_child = await _child_menu_note()
+ if late_child:
+ return late_child, None
return None, (
f"clicked option {opt!r} ({selector}) but the selection did not commit — the menu is "
"still open and unchanged. Do not repeat this click; press Enter on the option, or "
@@ -2052,6 +2163,13 @@ def build_browser_tools(
hovered = await page.evaluate(_MENU_AFTER_JS, await _probe_arg(page, selector))
if isinstance(hovered, dict) and hovered.get("optState"):
pre["optState"] = hovered["optState"]
+ # Every baseline the commit checks read, not some of them: whichever is left
+ # behind describes the row before the hover, so the hover's own doing -- an
+ # aria-selected mark, a row-hover toolbar that grows the row -- reads as the
+ # click's.
+ for key in ("optSel", "optKids", "optH"):
+ if key in hovered:
+ pre[key] = hovered[key]
except Exception:
pass
url_before = await _url(page)
diff --git a/tests/unit/fixtures/copilot/sky_14419_code_host_collapsed_2fa.html b/tests/unit/fixtures/copilot/sky_14419_code_host_collapsed_2fa.html
deleted file mode 100644
index f49b402fc..000000000
--- a/tests/unit/fixtures/copilot/sky_14419_code_host_collapsed_2fa.html
+++ /dev/null
@@ -1,24 +0,0 @@
-<!doctype html>
-<html lang="en">
- <head>
- <meta charset="utf-8" />
- <title>Two-factor authentication · Wyrmhold</title>
- </head>
- <body>
- <main>
- <h1>Two-factor authentication</h1>
- <p>Authenticate using your passkey.</p>
- <button class="primary">Use passkey</button>
- <button
- class="secondary"
- aria-expanded="false"
- aria-controls="two-factor-alternatives-body"
- >
- More options ▾
- </button>
- <ul id="two-factor-alternatives-body" hidden>
- <li><button>Authenticator app</button></li>
- </ul>
- </main>
- </body>
-</html>
diff --git a/tests/unit/fixtures/copilot/sky_14419_code_host_collapsed_2fa_structured.json b/tests/unit/fixtures/copilot/sky_14419_code_host_collapsed_2fa_structured.json
index eba4d7684..97cee2fbd 100644
--- a/tests/unit/fixtures/copilot/sky_14419_code_host_collapsed_2fa_structured.json
+++ b/tests/unit/fixtures/copilot/sky_14419_code_host_collapsed_2fa_structured.json
@@ -1,8 +1,9 @@
{
"capture_contract": {
"ticket": "SKY-14419",
- "fixture": "tests/unit/fixtures/copilot/sky_14419_code_host_collapsed_2fa.html",
- "fixture_sha256": "156172d67f9cd3fdb3d555a79482817ca6569de6e2a27a60211ebe037d20c1e3",
+ "fixture": "site_fixtures/code_host/index.html",
+ "fixture_git_blob": "ac9c9a0a100e010b448e1683c09f053e8a75d8f5",
+ "fixture_sha256": "4254cbe4ed44c1cfc691763cac6b0f122d3bbc9d3d9595432918037948594ffb",
"fixture_url": "http://localhost:8900/code_host/skyvern-cloud/",
"capture_state": "signed in, passkey-first two-factor page, More options not expanded",
"extractor": "COMPOSITION_STRUCTURED_EVIDENCE_EXPRESSION"
diff --git a/tests/unit/test_aes_fallback_decrypt.py b/tests/unit/test_aes_fallback_decrypt.py
index 5c8d29cf8..27a0eafd2 100644
--- a/tests/unit/test_aes_fallback_decrypt.py
+++ b/tests/unit/test_aes_fallback_decrypt.py
@@ -7,18 +7,6 @@ PRIMARY_SALT = "primary_salt_value_xxxxxxxxxxxxxxx"
PRIMARY_IV = "primary_iv_xxxxxxxxx"
PRIOR_SALT = "prior_salt_value_xxxxxxxxxxxxxxxxx"
PRIOR_IV = "prior_iv_value_xxxxx"
-LEGACY_PRIMARY_CIPHERTEXT = "rvmea7ou1gzyata3OwKEQg=="
-
-
-async def test_decrypts_ciphertext_created_with_legacy_primary_normalization() -> None:
- aes = AES(
- secret_key=SECRET,
- salt=PRIMARY_SALT,
- iv=PRIMARY_IV,
- fallback_decrypt_keys=[(PRIMARY_SALT, PRIMARY_IV)],
- )
- assert await aes.decrypt(LEGACY_PRIMARY_CIPHERTEXT) == "legacy primary"
@pytest.mark.asyncio
diff --git a/tests/unit/test_taskv3_tools.py b/tests/unit/test_taskv3_tools.py
index ef0fc29a5..e3b8499fb 100644
--- a/tests/unit/test_taskv3_tools.py
+++ b/tests/unit/test_taskv3_tools.py
@@ -2357,6 +2357,9 @@ class _ClickFakePage:
is_option: bool = False,
opt_text: str = "",
opt_state: str = "",
+ opt_sel: str = "|||",
+ opt_kids: int = 0,
+ opt_h: int = 26,
after_states: list[dict[str, Any]] | None = None,
found_menu: dict[str, Any] | None = None,
probe_raises: bool = False,
@@ -2370,6 +2373,9 @@ class _ClickFakePage:
self._is_option = is_option
self._opt_text = opt_text
self._opt_state = opt_state
+ self._opt_sel = opt_sel
+ self._opt_kids = opt_kids
+ self._opt_h = opt_h
self._after_states = after_states or [{"stillOpen": 0, "optState": ""}]
self._after_i = 0
self._found_menu = found_menu
@@ -2388,6 +2394,11 @@ class _ClickFakePage:
"isOption": self._is_option,
"optText": self._opt_text,
"optState": self._opt_state,
+ # The precheck carries the commit baselines; omitting them here left `_grew` unable
+ # to fire anywhere in the mocked suite, so the branch it gates went unexercised.
+ "optSel": self._opt_sel,
+ "optKids": self._opt_kids,
+ "optH": self._opt_h,
}
if "stillOpen" in js:
state = self._after_states[min(self._after_i, len(self._after_states) - 1)]
@@ -2596,9 +2607,12 @@ async def test_click_multiselect_option_state_change_is_commit() -> None:
is_option=True,
opt_text="In stock",
opt_state="aria-checked=false",
+ opt_sel="false|||",
after_states=[
- {"stillOpen": 7, "optState": "aria-checked=false"}, # post-hover baseline
- {"stillOpen": 7, "optState": "aria-checked=true"}, # post-click: marked
+ # The row is marked but does not grow, which is what makes this the "it was picked"
+ # path: no expansion competes with the commit reading, so no child-menu probe runs.
+ {"stillOpen": 7, "optState": "aria-checked=false", "optSel": "false|||", "optKids": 0, "optH": 26},
+ {"stillOpen": 7, "optState": "aria-checked=true", "optSel": "true|||", "optKids": 0, "optH": 26},
],
)
tools = build_browser_tools(_fixed_page_provider(page))
@@ -2607,6 +2621,132 @@ async def test_click_multiselect_option_state_change_is_commit() -> None:
assert "Selected option 'In stock'" in r.content
+async def test_click_option_that_is_marked_and_also_grows_reports_both(monkeypatch: pytest.MonkeyPatch) -> None:
+ # A branch row can mark itself AND expand. Reporting only the mark hides that more picks are
+ # needed; reporting only the child menu hides a mark the page really made. Say both — and drop
+ # the "menu stayed open" clause, because the child note has just renumbered the markers.
+ import asyncio as _a
+
+ monkeypatch.setattr(_a, "sleep", _instant_sleep)
+ page = _ClickFakePage(
+ menu_open=True,
+ is_option=True,
+ opt_text="Referral",
+ opt_state="s0",
+ opt_sel="false|||",
+ opt_kids=0,
+ opt_h=26,
+ after_states=[
+ {"stillOpen": 4, "optState": "s0", "optSel": "false|||", "optKids": 0, "optH": 26},
+ {"stillOpen": 4, "optState": "s1", "optSel": "true|||", "optKids": 1, "optH": 78},
+ ],
+ found_menu={"count": 2, "options": [{"n": 1, "text": "Current employee"}, {"n": 2, "text": "Former"}]},
+ )
+ tools = build_browser_tools(_fixed_page_provider(page))
+ r = await _tool(tools, "click").handler({"selector": '[data-tv3-menu="1"]'})
+ assert r.status == "ok"
+ assert "Selected option 'Referral' — its state changed." in r.content
+ assert "the menu stayed open" not in r.content
+ assert "opened a menu of 2 options" in r.content
+
+
+async def test_click_option_that_grows_without_being_marked_reports_only_its_children(
+ monkeypatch: pytest.MonkeyPatch,
+) -> None:
+ # Same shape, no selection attribute: the growth is all there is, so calling it a selection
+ # would be the false report this exists to prevent. A row that grew only in HEIGHT counts —
+ # a wrapper replaced by an expanded one keeps its child count.
+ import asyncio as _a
+
+ monkeypatch.setattr(_a, "sleep", _instant_sleep)
+ page = _ClickFakePage(
+ menu_open=True,
+ is_option=True,
+ opt_text="Referral",
+ opt_state="s0",
+ opt_sel="|||",
+ opt_kids=1,
+ opt_h=26,
+ after_states=[
+ {"stillOpen": 4, "optState": "s0", "optSel": "|||", "optKids": 1, "optH": 26},
+ {"stillOpen": 4, "optState": "s1", "optSel": "|||", "optKids": 1, "optH": 78},
+ ],
+ found_menu={"count": 2, "options": [{"n": 1, "text": "Current employee"}, {"n": 2, "text": "Former"}]},
+ )
+ tools = build_browser_tools(_fixed_page_provider(page))
+ r = await _tool(tools, "click").handler({"selector": '[data-tv3-menu="1"]'})
+ assert r.status == "ok"
+ assert "opened a menu of 2 options" in r.content
+ assert "Selected option" not in r.content
+
+
+async def test_click_option_whose_row_grew_on_HOVER_is_not_read_as_expanding(
+ monkeypatch: pytest.MonkeyPatch,
+) -> None:
+ # Playwright hovers before it clicks, and list rows routinely reveal an edit/remove pair on
+ # hover. That growth is the hover's, not the click's — measured from a pre-hover baseline it
+ # would turn an ordinary commit into "this opened a menu", naming hover chrome as options.
+ import asyncio as _a
+
+ monkeypatch.setattr(_a, "sleep", _instant_sleep)
+ grown = {"stillOpen": 4, "optState": "s1", "optSel": "true|||", "optKids": 2, "optH": 60}
+ page = _ClickFakePage(
+ menu_open=True,
+ is_option=True,
+ opt_text="In stock",
+ opt_state="s0",
+ opt_sel="false|||",
+ opt_kids=0,
+ opt_h=26,
+ after_states=[
+ {"stillOpen": 4, "optState": "s0", "optSel": "false|||", "optKids": 2, "optH": 60},
+ grown,
+ grown,
+ ],
+ found_menu={"count": 2, "options": [{"n": 1, "text": "Edit"}, {"n": 2, "text": "Remove"}]},
+ )
+ tools = build_browser_tools(_fixed_page_provider(page))
+ r = await _tool(tools, "click").handler({"selector": '[data-tv3-menu="2"]'})
+ assert r.status == "ok"
+ assert "Selected option 'In stock'" in r.content
+ assert "opened a menu of" not in r.content
+
+
+async def test_click_option_expanding_by_animation_is_judged_on_the_settled_read(
+ monkeypatch: pytest.MonkeyPatch,
+) -> None:
+ # An expansion driven by a CSS transition has barely started when the first post-click read
+ # lands, so judging on that read reports a plain commit and never looks for the child rows.
+ # The hold check already pays for a newer read; the verdict is taken from that one.
+ import asyncio as _a
+
+ monkeypatch.setattr(_a, "sleep", _instant_sleep)
+ page = _ClickFakePage(
+ menu_open=True,
+ is_option=True,
+ opt_text="Referral",
+ opt_state="s0",
+ opt_sel="|||",
+ opt_kids=1,
+ opt_h=26,
+ after_states=[
+ {"stillOpen": 4, "optState": "s0", "optSel": "|||", "optKids": 1, "optH": 26},
+ {"stillOpen": 4, "optState": "s1", "optSel": "|||", "optKids": 1, "optH": 26},
+ {"stillOpen": 4, "optState": "s1", "optSel": "|||", "optKids": 1, "optH": 78},
+ ],
+ found_menu={"count": 2, "options": [{"n": 1, "text": "Current employee"}, {"n": 2, "text": "Former"}]},
+ )
+ tools = build_browser_tools(_fixed_page_provider(page))
+ r = await _tool(tools, "click").handler({"selector": '[data-tv3-menu="1"]'})
+ assert r.status == "ok"
+ assert "opened a menu of 2 options" in r.content
+ assert "Selected option" not in r.content
+
+
@pytest.mark.asyncio
async def test_click_option_opening_submenu_is_not_a_false_error(monkeypatch: pytest.MonkeyPatch) -> None:
# An option click that spawns a child menu (cascading filter, date-picker) commits nothing yet
@@ -2645,6 +2785,277 @@ async def test_click_trigger_reclick_reports_menu_closed_no_selection() -> None:
assert "no option was selected" in r.content
+# A dropdown whose rows are a RADIOGROUP: role="radio" per row, no cursor:pointer, no
+# option/menuitem role anywhere -- the accessible single-select pattern, and a shape the menu finder
+# used to walk straight past. Categories (rows with children) expand in place; leaves commit.
+_ROLE_MENU_FIXTURE_HTML = """
+<!doctype html><html><body style="margin:0">
+ <div id="trigger" tabindex="0"
+ style="position:absolute;top:40px;left:40px;width:320px;height:28px;border:1px solid #888">
+ Choose one</div>
+ <script>
+ window.__commits = 0;
+ const TREE = {'Referral': ['Current employee', 'Former employee'], 'Job board': null,
+ 'Search engine': null, 'Event': ['Career fair', 'Conference']};
+ const ROW = 'min-height:26px;padding:2px 6px;'; // deliberately no cursor:pointer
+ let _n = 0;
+ function leaf(txt, host) {
+ const el = document.createElement('div');
+ el.id = 'row-' + (++_n);
+ el.setAttribute('role', window.__rowRole || 'radio');
+ el.setAttribute('aria-checked', 'false');
+ el.setAttribute('style', ROW + 'padding-left:18px;');
+ // A real listbox row is often a native control in a label, not a bare div -- and a branch row
+ // that expands one of these into itself is the only way the row acquires an <input>.
+ if (window.__nativeKids) {
+ const lab = document.createElement('label');
+ const box = document.createElement('input');
+ box.type = 'checkbox';
+ lab.appendChild(box);
+ lab.appendChild(document.createTextNode(' ' + txt));
+ el.appendChild(lab);
+ } else {
+ el.textContent = txt;
+ }
+ el.addEventListener('click', (ev) => {
+ ev.stopPropagation();
+ if (window.__noCommit) return;
+ // Commits by flipping its own aria-checked and leaving the list open, the way a
+ // multi-select does -- so the commit reading is exercised, not the menu-closed shortcut.
+ el.setAttribute('aria-checked', 'true');
+ document.getElementById('trigger').textContent = txt;
+ window.__commits++;
+ if (!window.__revealOnPick) return;
+ const extra = document.createElement('div');
+ for (const t of ['Add-on A', 'Add-on B']) {
+ const x = document.createElement('div');
+ x.id = 'row-' + (++_n);
+ x.setAttribute('role', window.__rowRole || 'radio');
+ x.setAttribute('aria-checked', 'false');
+ x.setAttribute('style', ROW + 'padding-left:30px;');
+ x.textContent = t;
+ extra.appendChild(x);
+ }
+ el.parentNode.insertBefore(extra, el.nextSibling);
+ });
+ host.appendChild(el);
+ }
+ document.getElementById('trigger').addEventListener('click', () => {
+ const ex = document.getElementById('list');
+ if (ex) { ex.remove(); return; }
+ _n = 0;
+ const list = document.createElement('div');
+ list.id = 'list';
+ list.setAttribute('style', 'position:absolute;top:74px;left:40px;width:320px;background:#fff;'
+ + 'border:1px solid #ccc');
+ for (const name of Object.keys(TREE)) {
+ const kids = TREE[name];
+ if (!kids) { leaf(name, list); continue; }
+ const row = document.createElement('div');
+ row.id = 'row-' + (++_n);
+ row.setAttribute('role', window.__rowRole || 'radio');
+ row.setAttribute('aria-checked', 'false');
+ row.setAttribute('style', ROW);
+ row.textContent = name;
+ // Some listboxes mark the hovered row aria-selected; Playwright hovers before it clicks.
+ if (window.__ariaOnHover) {
+ row.addEventListener('mouseenter', () => { row.setAttribute('aria-selected', 'true'); });
+ }
+ row.addEventListener('click', (ev) => {
+ ev.stopPropagation();
+ if (row.querySelector('div')) return;
+ // A tree-shaped listbox marks the branch you opened as the current one AND expands it.
+ if (window.__ariaOnPick) row.setAttribute('aria-selected', 'true');
+ const sub = document.createElement('div');
+ for (const k of kids) leaf(k, sub);
+ row.appendChild(sub);
+ });
+ list.appendChild(row);
+ }
+ document.body.appendChild(list);
+ });
+ </script>
+</body></html>
+"""
+
+
+async def _role_menu_page(row_role: str = "radio", *, native_kids: bool = False) -> AsyncIterator[Any]:
+ from playwright.async_api import async_playwright # noqa: PLC0415
+
+ async with async_playwright() as pw:
+ browser = await pw.chromium.launch(headless=True)
+ try:
+ context = await browser.new_context(viewport={"width": 1024, "height": 900})
+ page = await context.new_page()
+ await page.set_content(_ROLE_MENU_FIXTURE_HTML)
+ await page.evaluate("(r) => { window.__rowRole = r; }", row_role)
+ await page.evaluate("(n) => { window.__nativeKids = n; }", native_kids)
+ yield page
+ finally:
+ await browser.close()
+
+
+@_skip_no_browser
[email protected]("row_role", ["radio", "checkbox", "button", "switch"])
+async def test_dom_a_dropdown_of_widget_role_rows_is_reported_as_a_menu(row_role: str) -> None:
+ # observe already treats these four as controls (_WIDGET_ROLES); the menu finder used to honour
+ # only option/menuitem, so these lists opened silently and nothing was ever tagged.
+ async with _role_menu_page(row_role) as page:
+ tools = build_browser_tools(_fixed_page_provider(page))
+ r = await _tool(tools, "click").handler({"selector": "#trigger"})
+ assert r.status == "ok"
+ assert "opened a menu of 4 options" in r.content
+ assert '[data-tv3-menu="2"]' in r.content and "Job board" in r.content
+
+
+@_skip_no_browser
+async def test_dom_a_radiogroup_option_that_does_not_commit_errors_loud() -> None:
+ # THE discriminating negative. Unrecognised rows are never tagged, so the whole commit path in
+ # _click_reaction is gated off and the click returns a bare ok while the field stays empty --
+ # the exact "every click returns ok" this must never do again.
+ async with _role_menu_page() as page:
+ await page.evaluate("() => { window.__noCommit = 1; }")
+ tools = build_browser_tools(_fixed_page_provider(page))
+ click = _tool(tools, "click")
+ await click.handler({"selector": "#trigger"})
+ # Addressed by the row's own selector, not by a data-tv3-menu tag, so this asks the same
+ # question of a build that never tags it: what does clicking a dead option row report?
+ r = await click.handler({"selector": "#row-2"})
+ assert await page.evaluate("() => window.__commits") == 0
+ assert await page.eval_on_selector("#trigger", "e => e.textContent.trim()") == "Choose one"
+ assert r.status == "error"
+ assert "did not commit" in r.content
+
+
+@_skip_no_browser
+async def test_dom_a_radiogroup_category_reports_its_children_and_the_leaf_commits() -> None:
+ # The hierarchical case end to end: a category commits nothing, so its child rows are reported
+ # (never a false "selected"), and the leaf then commits in one more click.
+ async with _role_menu_page() as page:
+ tools = build_browser_tools(_fixed_page_provider(page))
+ click = _tool(tools, "click")
+ assert "opened a menu of 4 options" in (await click.handler({"selector": "#trigger"})).content
+ r2 = await click.handler({"selector": '[data-tv3-menu="1"]'})
+ assert r2.status == "ok"
+ assert "opened a menu of 2 options" in r2.content
+ assert "Current employee" in r2.content and "Former employee" in r2.content
+ assert await page.evaluate("() => window.__commits") == 0
+ r3 = await click.handler({"selector": '[data-tv3-menu="2"]'})
+ assert r3.status == "ok"
+ # The full sentence, not its prefix: "the menu closed" shares that prefix and would let this
+ # pass without ever reaching the reading under test.
+ assert "Selected option 'Former employee' — its state changed (the menu stayed open)." in r3.content
+ assert await page.evaluate("() => window.__commits") == 1
+
+
+@_skip_no_browser
+async def test_dom_a_real_commit_survives_the_click_also_revealing_more_rows() -> None:
+ # A row can commit AND reveal dependent options in one click. The selection attribute settles
+ # it, so the commit must still be reported -- reading the new rows as "this only expanded"
+ # would swallow a selection that really happened.
+ async with _role_menu_page() as page:
+ await page.evaluate("() => { window.__revealOnPick = 1; }")
+ tools = build_browser_tools(_fixed_page_provider(page))
+ click = _tool(tools, "click")
+ assert "opened a menu of 4 options" in (await click.handler({"selector": "#trigger"})).content
+ r = await click.handler({"selector": '[data-tv3-menu="2"]'})
+ assert r.status == "ok"
+ assert "Selected option 'Job board' — its state changed (the menu stayed open)." in r.content
+ assert "opened a menu of" not in r.content
+ assert await page.evaluate("() => window.__commits") == 1
+
+
+@_skip_no_browser
+async def test_dom_hover_marking_a_row_selected_is_not_read_as_the_click_committing() -> None:
+ # Playwright hovers before it clicks, so a row the widget marks aria-selected on hover would
+ # otherwise hand the commit check a selection that the click did not make -- and a parent that
+ # only expanded would report a commit instead of its child rows.
+ async with _role_menu_page() as page:
+ await page.evaluate("() => { window.__ariaOnHover = 1; }")
+ tools = build_browser_tools(_fixed_page_provider(page))
+ click = _tool(tools, "click")
+ assert "opened a menu of 4 options" in (await click.handler({"selector": "#trigger"})).content
+ r = await click.handler({"selector": '[data-tv3-menu="1"]'})
+ assert r.status == "ok"
+ assert "opened a menu of 2 options" in r.content
+ assert "its state changed" not in r.content
+ assert await page.evaluate("() => window.__commits") == 0
+
+
+@_skip_no_browser
+async def test_dom_a_category_that_marks_itself_selected_reports_the_mark_AND_its_children() -> None:
+ # A tree-shaped listbox marks the branch it opened as current. Both readings are true, so both
+ # are reported: calling it only a selection hides that more picks are needed, and calling it
+ # only a submenu hides a mark the page really did make.
+ async with _role_menu_page() as page:
+ await page.evaluate("() => { window.__ariaOnPick = 1; }")
+ tools = build_browser_tools(_fixed_page_provider(page))
+ click = _tool(tools, "click")
+ assert "opened a menu of 4 options" in (await click.handler({"selector": "#trigger"})).content
+ r = await click.handler({"selector": '[data-tv3-menu="1"]'})
+ assert r.status == "ok"
+ assert "Selected option 'Referral' — its state changed." in r.content
+ # Not "the menu stayed open": the child note below has just renumbered the markers, so the
+ # menu the model was holding is exactly what did not stay.
+ assert "the menu stayed open" not in r.content
+ assert "opened a menu of 2 options" in r.content
+ assert "Current employee" in r.content
+ assert await page.evaluate("() => window.__commits") == 0
+
+
+@_skip_no_browser
+async def test_dom_a_branch_row_that_reveals_native_checkboxes_is_not_called_a_selection() -> None:
+ # Expanding a branch row moves native <input>s INTO it, and a selection read that counted them
+ # would call that growth a pick. Nothing here is checked and nothing commits, so the child rows
+ # are the whole answer.
+ async with _role_menu_page(native_kids=True) as page:
+ tools = build_browser_tools(_fixed_page_provider(page))
+ click = _tool(tools, "click")
+ assert "opened a menu of 4 options" in (await click.handler({"selector": "#trigger"})).content
+ r = await click.handler({"selector": '[data-tv3-menu="1"]'})
+ assert r.status == "ok"
+ assert "opened a menu of 2 options" in r.content
+ assert "its state changed" not in r.content
+ assert await page.evaluate("() => window.__commits") == 0
+ assert await page.evaluate("() => document.querySelectorAll('#row-1 input:checked').length") == 0
+
+
+@_skip_no_browser
+async def test_dom_a_menu_note_for_a_clicked_row_does_not_name_the_selector_it_just_invalidated() -> None:
+ # The note renumbers every data-tv3-menu, so naming the row's own selector as the way to close
+ # the menu contradicts the sentence right after it, which declares that selector stale.
+ async with _role_menu_page() as page:
+ tools = build_browser_tools(_fixed_page_provider(page))
+ click = _tool(tools, "click")
+ assert "opened a menu of 4 options" in (await click.handler({"selector": "#trigger"})).content
+ r = await click.handler({"selector": '[data-tv3-menu="1"]'})
+ assert r.status == "ok"
+ assert "opened a menu of 2 options" in r.content
+ assert "the row you just clicked" in r.content
+ assert 'clicking [data-tv3-menu="1"] again' not in r.content
+
+
+@_skip_no_browser
+async def test_dom_a_tab_strip_is_still_not_a_menu() -> None:
+ # The exclusion half: role=tab is navigational (_FIND_SUGGESTION_JS refuses it too), so widening
+ # to the widget roles must NOT start calling a vertical tab strip a menu of options.
+ async with _role_menu_page("tab") as page:
+ tools = build_browser_tools(_fixed_page_provider(page))
+ r = await _tool(tools, "click").handler({"selector": "#trigger"})
+ assert r.status == "ok"
+ assert "opened a menu of" not in r.content
+
+
@pytest.mark.asyncio
async def test_click_stale_marker_fast_fails_without_15s_wait() -> None:
# A [data-tv3=...] marker is minted only by our own enrichment: if it matches nothing now, it can