Skip to content

feat(e2e): add Grok (x.com/i/grok) to the dictation sweep target list#509

Merged
rosscado merged 2 commits into
mainfrom
feat/grok-dictation-sweep
Jul 5, 2026
Merged

feat(e2e): add Grok (x.com/i/grok) to the dictation sweep target list#509
rosscado merged 2 commits into
mainfrom
feat/grok-dictation-sweep

Conversation

@rosscado

@rosscado rosscado commented Jul 5, 2026

Copy link
Copy Markdown
Contributor

Summary

Notable gotchas fixed along the way (selector choice, not product bugs)

  1. :visible is a Playwright-only pseudo-class — works via page.click()/page.waitForSelector() but throws a SyntaxError under the native document.querySelector() the harness's transcript-landed check uses inside page.waitForFunction().
  2. The field selector can't pin the placeholder's value either: UniversalDictationModule rewrites it while dictating (e.g. to "Recording..."), and the sweep never explicitly stops dictation — so a value-pinned selector ([placeholder="Ask anything"]) stops matching the instant recording starts and never matches again, producing a false "transcript didn't land" even though it visibly did (confirmed via screenshot). Landed on a presence-only textarea[placeholder] selector — stable all session, and still disambiguates from x.com's second, placeholder-less mirror <textarea>.

Preconditions note

Grok requires the seeded CDP profile to be signed into an X/Twitter account (unlike login-free Mistral) — documented in doc/e2e-dictation-sweep.md. Google's FedCM account-chooser can't be automated (native browser dialog outside the page DOM), so it's a one-time manual sign-in, same pattern as the SayPi-account seed step in the host-sweep doc.

Test plan

  • Updated test/scripts/e2e-dictation-sweep-lib.spec.ts (target registry shape, default target list, selector-portability assertions) — fail-first, confirmed RED before each fix.
  • Live-verified twice against the real x.com/i/grok (Layer 4 CDP, headed): first run caught both gotchas above via real evidence (pageErrors, screenshot showing the transcript present despite transcriptLanded=false); final run after both fixes: decorated=true button=true transcriptLanded=true, 0 page errors.
  • npm test green: tsc --noEmit, Jest (2/2), Vitest (205 files / 1795 tests, 1 pre-existing skip).

🤖 Generated with Claude Code

https://claude.ai/code/session_01T4uuEsKVySbRV9XRQa2ebc

rosscado and others added 2 commits July 5, 2026 19:13
Grok is X's own AI assistant embedded in the X web app — not a chat host
SayPi has a ChatbotIdentifier/Chatbot.ts adapter for, so it only gets
generic universal dictation (no call button, auto-submit, or TTS). Verified
live: the extension decorates the composer, the dictation button appears,
and a synthetic utterance lands correctly in the field.

Two live-verified gotchas fixed along the way, both about selector choice
for the field config (not product bugs):
- `:visible` is a Playwright-only pseudo-class; it works through
  page.click()/page.waitForSelector() but throws a SyntaxError under the
  native document.querySelector() the transcript-landed check uses inside
  page.waitForFunction().
- The field selector must not pin the placeholder's *value* either:
  UniversalDictationModule rewrites it while dictating (e.g. to
  "Recording..."), and the sweep never explicitly stops dictation, so a
  value-pinned selector stops matching once recording starts and never
  matches again — a false "transcript didn't land" even though it did.
  Landed on a presence-only `textarea[placeholder]` selector, which still
  disambiguates from x.com's second, placeholder-less mirror textarea.

Grok also requires the seeded CDP profile to be signed into an X account
(unlike login-free Mistral) — documented in doc/e2e-dictation-sweep.md,
including that Google's FedCM account-chooser can't be automated (it's a
native browser dialog outside the page DOM), so it's a one-time manual
sign-in.

Co-Authored-By: Claude Sonnet 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01T4uuEsKVySbRV9XRQa2ebc
- Fix "both targets" -> "all targets" now that there are three.
- Note that a grok failure on an unauthenticated profile is expected
  (it's the only target requiring manual X sign-in), not a fresh defect.
- Update the Boundaries headed-mode note for two real-site targets.
- Mention Grok in AGENTS.md's dictation-sweep summary so other agents
  scoping "what does this sweep cover" aren't misled.

Co-Authored-By: Claude Sonnet 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01T4uuEsKVySbRV9XRQa2ebc
@rosscado rosscado merged commit aa48bde into main Jul 5, 2026
2 checks passed
@rosscado rosscado deleted the feat/grok-dictation-sweep branch July 5, 2026 18:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant