reset puppeteer's page for each test

282 Views Asked by At

I'm running jest tests using puppeteer. On some of them I manually add some specific css styles and other tweaks like the following:

  const content = `
    *,
    *::after,
    *::before {
        transition-delay: 0s !important;
        transition-duration: 0s !important;
        animation-delay: -0.0001s !important;
        animation-duration: 0s !important;
        animation-play-state: paused !important;
        caret-color: transparent !important;
    }`;

  page.addStyleTag({ content });

as well as some listeners. I would like to remove everything by "resetting" the page to its pristine status for each test. What's the best way to accomplish this?

0

There are 0 best solutions below