Is there a code-coverage plugin(like istanbul - used for cypress) or a flag (similar to jest coverage 'yarn jest --test-coverage) for playwright? I have almost 90 test cases (assertions, url match and so on.) I referred to docs, https://playwright.dev/docs/api/class-coverage but this seems like we need to write some 7-8 lines of code at each test file.
Any inputs/help would be highly appreciated.
This thread is trying to answer question "Is there a code-coverage plugin or a flag for Playwright?"
You can create fixtures to write those 7-8 lines just once 😉
Or use the plugin that exists: https://www.npmjs.com/package/playwright-test-coverage
I just wanted to leave here my experience getting code coverage to work for my scenario in case it helps others.
https://github.com/microsoft/playwright/issues/7030#issuecomment-1575606073
The above issue comment details my journey to get code coverage working.
I've used https://github.com/bcoe/c8 (which leverages v8's code coverage within node)
Rayrun is a community for QA engineers. I am constantly looking for new ways to add value to people learning Playwright and other browser automation frameworks. If you have feedback, email [email protected].