Playwright 1.62 Adds AbortSignal Cancellation and Isolated Retries for Safer Proxy Tests

Proxy tests fail differently from ordinary UI tests. A page may be healthy while one exit route is slow, a tunnel may connect but never deliver a response body, or an authentication retry may keep a worker occupied long after the result has stopped being useful. Playwright 1.62 adds two controls that are especially relevant to these cases: an AbortSignal option for most operations and web-first assertions, and an isolated retry strategy that runs retries separately after the main test pass.

Neither feature makes a proxy reliable by itself. Together, however, they make failure boundaries explicit. Teams can stop work when a business deadline is exceeded, distinguish cancellation from a network error, and prevent repeated proxy failures from competing with healthy first-attempt tests.

What changed in Playwright 1.62

Most actions, navigations, waits, and web-first assertions can now receive an AbortSignal. The signal can cancel an operation before its ordinary timeout expires. The default timeout still applies unless it is explicitly disabled.

The new testConfig.retryStrategy option also supports isolated. With this setting, failed tests are collected and retried at the end, one at a time in a single worker. The default remains immediate retrying when a worker is available.

For proxy validation, these controls address two different layers:

  • AbortSignal limits the lifetime of one operation or one business workflow.
  • Isolated retries control when and where failed test cases are re-executed.

Why a normal timeout is not always enough

A test often contains several time budgets. There may be a connection timeout, a navigation timeout, an assertion timeout, a test timeout, and an overall batch deadline. If each layer only knows its own timer, a request can remain technically valid after the measurement window has already expired.

Consider a regional availability check that must finish in 20 seconds. The navigation timeout is 15 seconds and a later assertion can wait another 10 seconds. Without a shared cancellation signal, the workflow can consume 25 seconds even though its business result became late at second 20.

An abort controller can represent that outer deadline and pass the same signal to the operations that belong to it:

import { test, expect } from '@playwright/test';

test('regional route meets the purchase-flow budget', async ({ page }) => {
  const controller = new AbortController();
  const deadline = setTimeout(() => controller.abort('workflow deadline'), 20_000);

  try {
    await page.goto('https://en.98ip.com/', {
      waitUntil: 'domcontentloaded',
      timeout: 15_000,
      signal: controller.signal,
    });

    await expect(page.locator('body')).toBeVisible({
      timeout: 5_000,
      signal: controller.signal,
    });
  } finally {
    clearTimeout(deadline);
  }
});

Use a test endpoint you are authorized to access, and keep proxy credentials in environment variables or a secret manager. Do not write credentials into code, traces, screenshots, or test names.

Cancellation is a result, not a generic failure

Do not merge aborted operations into a single “proxy error” counter. At minimum, record:

  • operation name and route label;
  • planned deadline and elapsed time;
  • whether the abort was manual, budget-driven, or caused by parent cleanup;
  • proxy session identifier without credentials;
  • exit geography and network family when available;
  • last completed phase: tunnel, TLS, headers, body, or assertion;
  • retry attempt and final disposition.

This distinction matters during procurement. A route that consistently misses a 20-second business budget is different from a route that refuses authentication, and both differ from a target returning a policy response. Combining them hides the action the buyer should take.

When isolated retries help

Immediate retries are useful when a brief transient failure is expected. They can also amplify a problem. If many workers encounter the same slow exit pool, immediate retries add more traffic while the pool is already unhealthy. They may consume new proxy sessions, distort success rates, and increase cost.

Isolated retries provide a cleaner second measurement:

import { defineConfig } from '@playwright/test';

export default defineConfig({
  retries: 1,
  retryStrategy: 'isolated',
  workers: 6,
});

The first pass measures normal concurrency. The isolated pass asks whether failures persist when contention is removed. A test that fails under six workers but passes alone suggests a concurrency, quota, or shared-resource issue. A test that fails again in isolation is more likely to reflect the route, target compatibility, configuration, or a deterministic test defect.

A rollout plan for proxy test suites

1. Define business deadlines

Set a maximum useful duration for login, search, checkout, data collection, or ad-verification workflows. Do not derive it only from the largest technical timeout.

2. Keep layered timeouts

An AbortSignal should complement connection, navigation, assertion, and test timeouts. Each timer explains a different failure boundary. Avoid disabling the default timeout unless another enforced deadline is guaranteed.

3. Add structured abort reasons

Use stable reason codes such as workflow_deadline, quota_guard, or operator_cancelled. Do not rely only on exception text.

4. Separate first attempts from retries

Report first-pass success, retry recovery, and final success independently. A 99% final success rate can conceal an expensive 15% retry rate.

5. Compare immediate and isolated modes

Run the same controlled sample with identical destinations, concurrency, and session rules. Compare recovery, latency, exit reuse, bytes transferred, and cost per usable result.

6. Roll out by route cohort

Start with a small set of regions and workflows. Confirm that cancellation closes pages, releases sessions, and does not leave background requests running.

Procurement and operations checklist

  • Is the business deadline documented for every critical workflow?
  • Can an operator tell a cancelled workflow from a proxy connection failure?
  • Are first attempts and retries reported separately?
  • Does retrying preserve or replace the proxy session intentionally?
  • Are concurrency limits enforced per account, region, and destination?
  • Are aborted requests included in bandwidth and cost calculations?
  • Can the test be repeated in an isolated worker without changing other variables?
  • Are credentials absent from traces, screenshots, logs, and article examples?

Common mistakes

Using cancellation as a substitute for cleanup. Always close pages, contexts, streams, and timers in finally blocks.

Retrying every abort. A deliberately cancelled workflow may have exceeded a business deadline. Retrying it automatically can be wasteful or unsafe.

Changing the exit and concurrency at the same time. That makes the cause of recovery impossible to identify.

Reporting only final success. Buyers need the first-attempt rate, latency distribution, retry recovery, and cost per usable outcome.

Compliance note

Use proxy testing only on systems and data you are authorized to access. Respect destination terms, rate limits, privacy obligations, and regional rules. Cancellation and retry controls should reduce unnecessary traffic, not enable attempts to bypass access controls.

FAQ

Does AbortSignal replace Playwright timeouts?

No. It adds an independent cancellation path. Keep sensible operation and test timeouts so failures remain diagnosable.

Should every proxy failure be retried in isolation?

No. Retry only transient, idempotent work. Authentication failures, policy denials, invalid configuration, and deliberate cancellations usually require inspection rather than automatic repetition.

Does an isolated retry prove the proxy was at fault?

No. It removes some concurrency interference, but the target, test logic, DNS path, TLS negotiation, and session policy can still cause failure.

What should a buyer compare across providers?

Compare first-attempt success, p50 and p95 latency, unexpected rotation, retry recovery, cancellation rate, transferred bytes, and cost per usable workflow under the same test matrix.

Related 98IP guides