Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

sometimes disable-animation.css might not applied as expected #766

Open
kodai3 opened this issue Jun 4, 2023 · 0 comments
Open

sometimes disable-animation.css might not applied as expected #766

kodai3 opened this issue Jun 4, 2023 · 0 comments

Comments

@kodai3
Copy link

kodai3 commented Jun 4, 2023

Describe the bug

We've been doing Visual Regression Test with our mui-based components. (over 200 snapshots)
We keep having some flaky snapshots with dialogs and input like below.

opacity of the background overlay is different.
image

Modal is not fully open.
image

Input caret shows up.
image

The package versions I use is this
Using puppeteer v9 because I saw this.

    "storybook": "7.0.18",
    "puppeteer": "9.1.1",
    "storycap": "4.1.1",
    "reg-suit": "0.12.1",

I'm not yet fully understand puppeteer and this codebase but
maybe this.page.addStyleTag add the css to the route but not applied to iframe ?

As workaround If I do this. (re-adding disable-animation after CapturingBrowser's initialization)
I think the problem has been solved.

export const decorators = [
  // ..., 
  // other decorators
  (Story) => {
    // https://github.com/reg-viz/storycap/issues/464
    if (isScreenshot()) {
      function addStyle(styleString) {
        const style = document.createElement('style');
        style.textContent = styleString;
        document.head.append(style);
      }
      addStyle(`
        *,
        *::before,
        *::after {
          transition: none !important;
          animation: none !important;
        }
        input {
          caret-color: transparent !important;
        }
      `);
    }
    return <Story />;
  },
];

maybe related to #327

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant