Allure Report In Playwright


In this blog, we will look at how to set up Allure report in our Playwright Test Automation project.

Reports are an important part of Test Automation. It helps us analyze and depict the results of test run in a pictorial manner so that it is easy to comprehend for the QA Leads/Managers.

Let's go ahead and configure the allure report


Playwright Project Setup needs to be done.

Steps to configure Allure report

Step 1

Open the Terminal in the Visual studio code

Step 2

Install allure playwright package from npm by running the below command

npm i -D @playwright/test allure-playwright

Step 3

Now install the Allure command line

npm i allure-commandline

step 4

Now add the below allure reports settings at the reporters section of the playwright.conf.js file

reporters: ['html',['allure-playwright']],

HTML reporter will already be present while installation, just put comma and add these allure report settings.

Step 5

Now run any tests from your tests folder.

After running you will see the allure-results folder created inside your project.

Step 6

Now with the help of allure commandline and allure-results folder we can generate allure results by running the below command

npx allure generate allure-results && npx allure open

The above command will access the allure modules which gets installed in your node modules and generates the report by reading the contents in allure-results folder.

npx allure open will open the report in your browser.

You will see an allure report folder generated in your project once you run this command

Every time you run the test and generate report using command you need to clean the contents of the allure-results folder to generate the report

So just add the flag --clean while generating allure report

npx allure generate --clean allure-results && npx allure open

Allure report in playwright

Allure report in playwright

If Screenshots, videos, and trace configurations are set in playwright configurations file, then the screenshot, video, trace will get attached to the allure report automatically.


Hope this blog will be helpful for generating and setting up allure reports in Playwright Test Automation Project.


Happy learning.......... 

Next Recommended Reading Reporters In Playwright