Skip to content

test(playwright): QA helpers batch 2 (appRequest, readInertiaPage, shot, probeRoutes, signOut) - #586

Merged
aixle-com[bot] merged 3 commits into
developfrom
feature/qa-helpers-batch-2
Oct 27, 2026
Merged

aixle-com[bot] merged 3 commits into
developfrom
feature/qa-helpers-batch-2

Conversation

@aixle-com

@aixle-com aixle-com Bot commented Oct 27, 2026

Copy link
Copy Markdown
Contributor

Board task #186. This builds on #584 (#182).

What changed

test/playwright/helpers/helpers.js gets five new paste-in helpers for browser_run_code_unsafe. README.md documents each one with its arguments, return value and an example. It also adds a table of sandbox limits (no require/import()/process/setTimeout/URL/URLSearchParams/Buffer) and a per-role table of baseline redirects.

  • appRequest(page, { method, path, json, form, csrf, maxRedirects = 0, headers }) returns { status, location, contentType, json, text } through page.request, using the context's cookies. Where it gets the CSRF token, in order:

    1. the XSRF-TOKEN cookie, as apiFetch.ts does, because an Inertia visit after sign-in leaves a stale meta tag;
    2. meta[name="csrf-token"];
    3. input[name="authenticity_token"];
    4. the HTML of /login.

    form is URL-encoded and carries authenticity_token plus _method for PATCH/PUT/DELETE. csrf: false sends no token at all. text is capped by textLimit (default 2000).

  • readInertiaPage(page, { path, pick }) fetches the HTML and parses <script data-page="app" type="application/json">. It returns { url, status, component, version, appVersion, props }, and pick limits the result to the dotted paths you ask for.

  • shot(page, { round, name, banner }) sets the viewport to 1920×1080 and writes /workspace/outputs/screenshots_<round>/<name>.png. It reads the size from the PNG header and throws unless it is 1920×1080. The optional banner overlay is removed after the capture. round and name are restricted to [A-Za-z0-9._-], so they cannot be used for path traversal.

  • probeRoutes(page, { requests }) returns one { method, path, status, location } row per request, using maxRedirects: 0.

  • signOut(page, { baseUrl }) clears cookies and local/session storage, loads /login, and checks that GET /company/projects redirects to /login. It returns { signedOut, landedOn }.

How the base URL is chosen (the new helpers take a relative path, not env): options.baseUrl if given, otherwise the origin of the open page, otherwise staging.

How it was tested

  • Every helper was run on staging through browser_run_code_unsafe at 1920×1080, as anonymous, CompanyEmployee and CompanyAdmin. The table is in the task comment.
  • On Coder, at a2743d5: node --check, prettier --check (helpers.js + README.md) and eslint helpers.js all exit 0.
  • No credential appears in any output: I grepped the outputs and the repo for the asset values.

Nothing in the app changes. No workflow files are touched.

Comment thread test/playwright/helpers/helpers.js Resolved
Comment thread test/playwright/helpers/helpers.js Resolved
…t base URL

probeRoutes no longer caches the CSRF token for the whole batch, so a row that resets the session (DELETE /logout, a sign-in) cannot give later rows false 422s.

The request helpers resolve paths against options.baseUrl, else staging, as the #182 helpers do, instead of the origin of the open page, which can be a foreign host. readInertiaPage defaults path to the open page only when it is on the base; shot takes baseUrl for its banner's appVersion lookup.

Signed-off-by: Aixle Flow <[email protected]>
@aixle-com
aixle-com Bot merged commit c9597d6 into develop Oct 27, 2026
16 checks passed
artempartos added a commit to Hitin/flow that referenced this pull request Oct 28, 2026
* origin/develop:
  docs(workflows): describe workflows as sessions made of steps (AixleHQ#595)
  feat(workflows): open archived workflows read-only in the builder (AixleHQ#594)
  feat(task-comments): let authors delete their own recent comments (AixleHQ#593)
  feat(mcp): log the JSON-RPC method and tool name of each MCP call (AixleHQ#592)
  fix(board): show a run waiting for a session slot as Queued on its card (AixleHQ#591)
  feat(brand): use the new Aixle Flow lockup and route fonts through tokens (AixleHQ#590)
  feat(overview): show tokens used and session time instead of token cost (AixleHQ#589)
  fix(agents): pre-acknowledge Claude Code's cost-threshold notice (AixleHQ#587)
  test(playwright): QA helpers batch 2 (appRequest, readInertiaPage, shot, probeRoutes, signOut) (AixleHQ#586)
  test(playwright): plain-JS QA helpers for browser_run_code on staging (AixleHQ#584)
  feat(runners): add the runners table and the Runner model (AixleHQ#583)
  refactor(feature-flags): plain cached reads, no usage tooling (AixleHQ#579)

# Conflicts:
#	CHANGELOG.md
artempartos added a commit to Hitin/flow that referenced this pull request Oct 28, 2026
* origin/develop:
  docs(workflows): describe workflows as sessions made of steps (AixleHQ#595)
  feat(workflows): open archived workflows read-only in the builder (AixleHQ#594)
  feat(task-comments): let authors delete their own recent comments (AixleHQ#593)
  feat(mcp): log the JSON-RPC method and tool name of each MCP call (AixleHQ#592)
  fix(board): show a run waiting for a session slot as Queued on its card (AixleHQ#591)
  feat(brand): use the new Aixle Flow lockup and route fonts through tokens (AixleHQ#590)
  feat(overview): show tokens used and session time instead of token cost (AixleHQ#589)
  fix(agents): pre-acknowledge Claude Code's cost-threshold notice (AixleHQ#587)
  test(playwright): QA helpers batch 2 (appRequest, readInertiaPage, shot, probeRoutes, signOut) (AixleHQ#586)
  test(playwright): plain-JS QA helpers for browser_run_code on staging (AixleHQ#584)
  feat(runners): add the runners table and the Runner model (AixleHQ#583)
  refactor(feature-flags): plain cached reads, no usage tooling (AixleHQ#579)

# Conflicts:
#	CHANGELOG.md
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.

0 participants