Skip to content

Disable screenshot file creation when getting base64 #6637

Open
@unional

Description

@unional

Clear and concise description of the problem

Currently, when page.screenshot({ base64: true }), the file is still being created.

I want to delegate the file creation to another code similar to jest-image-snapshot.

https://vitest.dev/guide/browser/locators.html#screenshot

Suggested solution

IMO when doing { base64: true } it should not generate the file. It should even return Promise<Buffer> like how it is done in playwright.

If we want to avoid breaking change, we can add { skipFileCreation?: true } option.

Alternative

playwright does not create the file by default:

  /**
   * The file path to save the image to. The screenshot type will be inferred from file extension. If `path` is a
   * relative path, then it is resolved relative to the current working directory. If no path is provided, the image
   * won't be saved to the disk.
   */
  path?: string;

No response

Additional context

No response

Validations

Metadata

Metadata

Assignees

No one assigned

    Labels

    p3-minor-bugAn edge case that only affects very specific usage (priority)

    Type

    No type

    Projects

    Status

    Approved

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions