zuke.tools.playwright

← Python API reference

@zuke/playwright 1.2.0: @zuke/playwright — typed PlaywrightTasks wrappers for the Playwright CLI, for use in Zuke build targets (end-to-end browser testing).

Symbols

#

PlaywrightCodegenSettings

class
class PlaywrightCodegenSettings(PlaywrightSettings)

Settings for playwright codegen.

  • url(value: str) -> Self

    The URL to open for recording; omit to start blank.

  • target(language: str) -> Self

    The output language (--target=, e.g. javascript, python).

  • output(path: str) -> Self

    Write the generated script to a file (--output=).

#

PlaywrightInstallSettings

class
class PlaywrightInstallSettings(PlaywrightSettings)

Settings for playwright install (browser binaries).

  • browsers(*names: str) -> Self

    Browsers to install (e.g. chromium); omit to install all.

  • with_deps() -> Self

    Also install the OS dependencies (--with-deps).

#

PlaywrightSettings

class
class PlaywrightSettings(ToolSettings)

Base for all Playwright subcommand settings: binary is playwright.

#

PlaywrightShowReportSettings

class
class PlaywrightShowReportSettings(PlaywrightSettings)

Settings for playwright show-report.

  • dir(path: str) -> Self

    The report directory to open; omit for the default.

#

PlaywrightTasks

class
class PlaywrightTasks

Typed task functions for the Playwright CLI.

  • static async test(ctx: ServiceContext, configure: Callable[[PlaywrightTestSettings], PlaywrightTestSettings] | None=None) -> ExecResult

    Run the test suite: playwright test.

  • static async install(ctx: ServiceContext, configure: Callable[[PlaywrightInstallSettings], PlaywrightInstallSettings] | None=None) -> ExecResult

    Install browser binaries: playwright install.

  • static async show_report(ctx: ServiceContext, configure: Callable[[PlaywrightShowReportSettings], PlaywrightShowReportSettings] | None=None) -> ExecResult

    Open the HTML report: playwright show-report.

  • static async codegen(ctx: ServiceContext, configure: Callable[[PlaywrightCodegenSettings], PlaywrightCodegenSettings] | None=None) -> ExecResult

    Record interactions into a script: playwright codegen.

#

PlaywrightTestSettings

class
class PlaywrightTestSettings(PlaywrightSettings)

Settings for playwright test.

  • project(*names: str) -> Self

    Restrict to the named project(s) (--project=); repeatable.

  • grep(pattern: str) -> Self

    Only run tests matching the pattern (--grep).

  • headed() -> Self

    Run in headed browsers (--headed).

  • ui() -> Self

    Open the interactive UI mode (--ui).

  • workers(count: float) -> Self

    Set the number of parallel workers (--workers=).

  • reporter(name: str) -> Self

    Choose the reporter (--reporter=).

  • update_snapshots() -> Self

    Update snapshots instead of failing on a mismatch (--update-snapshots).

  • config(path: str) -> Self

    Use a specific config file (--config=).

  • paths(*filters: str) -> Self

    Test file or directory filters to run; omit to run all tests.