← Back to Discord Forum

Code coverage for playwright

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?"

6 replies

You can create fixtures to write those 7-8 lines just once 😉



I just wanted to leave here my experience getting code coverage to work for my scenario in case it helps others.


The above issue comment details my journey to get code coverage working.

@kakashi could you please answer me in direct messages?



I've used https://github.com/bcoe/c8 (which leverages v8's code coverage within node)

Related Discord Threads

AboutQuestionsDiscord ForumBrowser ExtensionTagsQA Jobs

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 luc@ray.run.