Skip to content

chore(testrunner): only diff big strings#1155

Closed
JoelEinbinder wants to merge 1 commit into
microsoft:masterfrom
JoelEinbinder:only_diff_big_strings
Closed

chore(testrunner): only diff big strings#1155
JoelEinbinder wants to merge 1 commit into
microsoft:masterfrom
JoelEinbinder:only_diff_big_strings

Conversation

@JoelEinbinder

Copy link
Copy Markdown
Contributor

I don't need to know how many letters granted and denied share.

@dgozman

dgozman commented Mar 2, 2020

Copy link
Copy Markdown
Collaborator

I am not so sure about this, the difference between <div>hi</div> and <div>Hi</div> is not immediately obvious to my eye.

@aslushnikov

Copy link
Copy Markdown
Contributor

Yeah I'd keep this as-is.

@aslushnikov aslushnikov closed this Mar 3, 2020
debs-obrien pushed a commit to debs-obrien/playwright that referenced this pull request Jun 10, 2025
2015kmadanap added a commit to Sapoto-Health/playwright-new that referenced this pull request May 28, 2026
…oto Tracer microsoft#1155 / Unit G-ops) (#6)

Adds four operational MCP CLI flags + matching env vars:

  --filter-internal-urls       PLAYWRIGHT_MCP_FILTER_INTERNAL_URLS
  --disable-downloads          PLAYWRIGHT_MCP_DISABLE_DOWNLOADS
  --timeout-download <ms>      PLAYWRIGHT_MCP_TIMEOUT_DOWNLOAD
  --allowed-tools <list>       PLAYWRIGHT_MCP_ALLOWED_TOOLS

Internal-URL filter: `file://`, `data:`, `chrome-extension://`, and the
exact hostname `localhost` (not prefix — `localhost.example.com` is a
real domain and stays visible). Reuses Unit I's `WeakSet<Page>`
persistent-hide pattern so navigating an internal-URL page to a real
URL keeps it hidden from `browser_tabs`.

Disable-downloads: skips `page.on('download')` listener registration
entirely, letting ADF's Electron-side capture stack own downloads
exclusively.

Timeout-download: tool responses block on pending downloads up to the
budget. `Download.savePromise` field stores `download.saveAs()` for the
wait; `waitForCompletion(callback)` captures `beforeCount` and calls
`_waitForPendingDownloads` with the budget.

CRITICAL deadlock-avoidance invariant (PRD user story microsoft#24):
`_waitForPendingDownloads` early-returns at the very top when
`disableDownloads` is true, BEFORE any loop or promise allocation.
Reason: when `disableDownloads=true` no `savePromise` is ever created,
so waiting on it deadlocks the tool response indefinitely. Pinned by
the Test 1 regression in `tests/mcp/download-wait.spec.ts` which
asserts <2500ms elapsed on a `--disable-downloads
--timeout-download=5000` invocation (would be 5000ms on regression).

Allowed-tools: comma-separated allowlist applied AFTER capability gate.
`--allowed-tools=browser_pdf_save` without `--caps=pdf` advertises ZERO
pdf tools — the allowlist cannot re-introduce a capability-gated tool.
CLI overrides env. Empty / unset = all tools (no regression).

Test plan:
  - `opsFilters.spec.ts` — 14 pure-logic tests for `isInternalUrl()` +
    `parseAllowedTools()` covering edge cases (whitespace, trailing
    commas, `localhost.example.com` rejection, `about:blank` not
    filtered).
  - `filter-internal-urls.spec.ts` — 3 MCP integration tests including
    the navigate-survives persistence regression.
  - `allowed-tools.spec.ts` — 3 MCP tests for allowlist semantics,
    capability-gate-first ordering, CLI-over-env precedence.
  - `download-wait.spec.ts` — 3 MCP tests pinning the deadlock-avoidance
    invariant + the wait-for-completion happy path + the upstream-default
    no-wait fallback.
  - `config-resolve.spec.ts` — 11 new wiring tests for all 4 flags + env
    vars + numeric parser handling.

`npm run flint`: clean. All affected tests pass.

Part of Sapoto-Health/automatic-document-fetcher#1150. Closes
Sapoto-Health/automatic-document-fetcher#1155.
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.

3 participants