How to integrate Allure report with Playwright

KailashPathak
3 min readSep 10, 2022

--

Why is Allure Reporting to Playwright?

  • Easy to install
  • Allure reports provide great presentational diagrams
  • Clear and nice reporting UI
  • Can easily investigate test run

Playwright Installation

Create a new folder, which I called project playwright_With_JavaScripts

Step to Install Playwright

  1. To install playwright, in the project folder i.e playwright_With_JavaScripts:> run npm init playwright.
  2. In the terminal below option display either select TypeScript Or JavaScript (In our case I am selecting JavaScript)

Once Installation is done we can see in package.json playwright dependency is added

https://QAAutomationLabs.com/blogs/

Some of the Commands in Playwright

npx playwright test
Runs the end-to-end tests.

npx playwright test — project=chromium
Runs the tests only on Desktop Chrome.

npx playwright test example
Runs the tests in a specific file.

npx playwright test — debug
Runs the tests in debug mode.

npx playwright codegen
Auto generate tests with Codegen.

Test Case for Automation

Let’s take a simple example of execution

  1. Open the site qaautomationlabs.com/
  2. Verify the title of the page
  3. After opening the site click on the Menu “Blogs”
https://QAAutomationLabs.com/blogs/

Allure Playwright Installation

Enter the below commands in your command line to install allure

npm i -D @playwright/test allure-playwright

or via yarn:

yarn add @playwright/test allure-playwright --dev

After installation, we can see allure-playwright dependency in package.json

Run Test cases and Generate Allure Report

To generate an Allure report we have to follow the below steps

i) We have to pass reporter=”line” which will generate a report in plain text format in command npx playwright test

ii) Once we get data in plain text (How many test cases pass/how many fail ) using this data allure generate the report with the help of command allure-playwright

Steps 1

npx playwright test — reporter=line,allure-playwright

Above command generate Folder allure-results

Steps 2

The below command is used to generate an allure report using the folder allure-results

allure generate ./allure-results — clean

Steps 3

The below command is used to open the allure report

allure open ./allure-report

Once we run the above command it will generate the Allure report

Report

Test cases Pass report

Failed /Broken Test case report

See more blogs Under the below link

https://qaautomationlabs.com/

--

--

KailashPathak
KailashPathak

Written by KailashPathak

|| Applitools Ambassador || https://qaautomationlabs.com/blog || PMI-ACP® |ITIL® || PRINCE2® || Cypress|| Selenium| WebdriverIO |API Automation QATube®

Responses (2)