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

Doesn't generate reports #162

Open
Designer023 opened this issue Jan 22, 2024 · 3 comments
Open

Doesn't generate reports #162

Designer023 opened this issue Jan 22, 2024 · 3 comments

Comments

@Designer023
Copy link

Hi,

I have been trying to get the tests to work and generate the reports, but it's not working. Do you have any more detailed instructions on how to get the coverage from the window.__coverage__ and saved? If I debug my tests, I can see the coverage appearing on the window, but when they complete nothing is saving to disc.

I have tried the plugin, and I have also tried the original script, and I have followed your instructions from the example repo.

The only coverage I am getting is the nyc coverage which is all the serverside code, and not client side (using Next.js 13 if that helps)

I would love to share my repo, but can't due to sensitive data, so I'm just looking for any guidence/suggestions if you have any. If in the meantime I solve the issue, I'll update the issue 👍

@Designer023
Copy link
Author

Currently I have added the following to my test to get it to retrieve the coverage from the window.__coverage__

This is in a test step

await test.step(`Collect the coverage`, async () => {
const coverageJSON = await page.evaluate(async () => {
      const cov = window.__coverage__;

      return JSON.stringify(cov);
    });

    if (coverageJSON)
      fs.writeFileSync(
        path.join(
          istanbulCLIOutput,
          `playwright_coverage_${generateUUID()}.json`,
        ),
        coverageJSON,
      );
})

Ideally this would be done in the baseFixtures. Do you have any suggestions 👍

@Designer023
Copy link
Author

It seems that the beforeunload event isn't firing in the baseFixtures. I am on the latest Chrome and FireFox

@Designer023
Copy link
Author

Apologies for spamming the issue. I am just updating things as I discover/learn so hopefully it can help resolve the issue or help someone else in the future

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