Skip to content

feat: Allow to pass custom options to Puppeteer screenshot function #3145

Closed as not planned

Description

@ryuran

Prerequisites

Describe the Feature Request

We expect to be able to pass any options possible to puppeteer screenshot option.

Currently we have only ScreenshotOptions interface.
https://github.com/ionic-team/stencil/blob/main/src/testing/puppeteer/puppeteer-screenshot.ts#L138-L156

function createPuppeteerScreenshopOptions(opts: ScreenshotOptions) {
  const puppeteerOpts: puppeteer.ScreenshotOptions = {
    type: 'png',
    fullPage: opts.fullPage,
    omitBackground: opts.omitBackground,
    encoding: 'binary',
  };

  if (opts.clip) {
    puppeteerOpts.clip = {
      x: opts.clip.x,
      y: opts.clip.y,
      width: opts.clip.width,
      height: opts.clip.height,
    };
  }

  return puppeteerOpts;
}

Describe the Use Case

We spot this issue : puppeteer/puppeteer#7251

A resize event happen just before screenshot so it trigger some resize event listener able to redraw the component we try to screenshot.

This resize is unwanted but, with the current stencil testing API, we are not able to avoid it by the solution proposed in the issue: pass the option captureBeyondViewport: false

Activity

  1. Perronef5 commented on Nov 18, 2021

    @Perronef5

    We need this fix urgently 🙏🙏

  2. added
    Feature: Want this? Upvote it!
    on Dec 2, 2021
  3. ryuran commented on Jan 7, 2022

    @ryuran
    Author

    We use this monkey patch to temporary workaround this issue waiting for an internal fix into stencil:
    #3188 (comment)

  4. christian-bromann commented on Jun 12, 2024

    @christian-bromann
    Member

    Hi @ryuran 👋

    We apologize for the delay in addressing this issue. The StencilJS team has been hard at work, and we appreciate your patience.

    As StencilJS has undergone significant updates and improvements since this issue was originally posted, we are now supporting more frameworks to test Stencil components, e.g. WebdriverIO or Playwright. For visual screenshot testing we recommend to use their visual capabilities as we are about to deprecate Stencils screenshot feature.

    Please let me know if you have any questions!

    Thank you for your understanding and support of StencilJS!

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    Feature: Want this? Upvote it!

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions