Skip to content

[Bug]: page.screencast.start() still declares removed annotate option in TypeScript types (stale type) #42234

Description

Version

1.62.1

Steps to reproduce

page.screencast.start()'s type definition still lists an annotate option, but that option was removed from the implementation in #39852 (shipped in v1.59.0). The type change was missed, so annotate is accepted by TypeScript while being silently ignored at runtime.

Minimal reproduction:

// annotate.spec.ts
import { test } from '@playwright/test';

test('screencast.start accepts annotate but ignores it', async ({ page }) => {
  // `annotate` is declared on Screencast.start() in types.d.ts, so this COMPILES with no type error:
  await page.screencast.start({
    path: 'video.webm',
    size: { width: 760, height: 420 },
    annotate: { position: 'top-left', fontSize: 30 }, // ← removed from the runtime in #39852
  });

  // Add the supported API for comparison — this one DOES draw labels:
  await page.screencast.showActions({ position: 'top-right' });

  await page.setContent('<button style="margin:150px">Click me</button>');
  await page.getByRole('button').click(); // would be labelled if `annotate` worked
  await page.screencast.stop();
});

Run it, then open video.webm:

  • showActions labels appear in the top-right.
  • annotate: { position: 'top-left' } produces nothing in the top-left, and start() throws no error.

Expected behavior

The public types should match the implementation. Since annotate was intentionally removed from Screencast.start() (#39852), it should also be removed from packages/playwright-core/types/types.d.ts so TypeScript no longer offers/accepts a non-functional option. (Alternatively, if annotate on start() was meant to stay, restore the runtime support.)

Actual behavior

Screencast.start() still declares annotate in types.d.ts, so it type-checks and autocompletes, but it is never read by the client, never sent over the protocol, and has no effect on the recording. No error is raised, the option is silently dropped.

The removal PR #39852 cleaned annotate out of every layer except the generated types.

packages/playwright-core/types/types.d.ts was not part of that commit, so the option lingers there. On current main, start() in types.d.ts still has annotate, while client/screencast.ts start() does not read it.

Ref: https://github.com/microsoft/playwright/blob/main/packages/playwright-core/types/types.d.ts#L18764-L18768

Additional context

Environment

System:
  OS: macOS 26.5
  CPU: (10) arm64 Apple M4
  Memory: 157.97 MB / 16.00 GB
Binaries:
  Node: 24.13.0 - /Users/manas/.local/share/mise/installs/node/24.13.0/bin/node
  Yarn: 1.22.22 - /Users/manas/.local/share/mise/installs/node/24.13.0/bin/yarn
  npm: 11.6.2 - /Users/manas/.local/share/mise/installs/node/24.13.0/bin/npm
npmPackages:
  @playwright/test: ^1.62.1 => 1.62.1

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions