playwright icon indicating copy to clipboard operation
playwright copied to clipboard

[Feature] add Allure reporter

Open mxschmitt opened this issue 5 years ago • 22 comments

See here for instructions: https://github.com/allure-framework/allure-js/blob/master/packages/allure-playwright/README.md

mxschmitt avatar May 18 '21 00:05 mxschmitt

The link to allure-js library is obsolete.

A new allure-js is here https://github.com/allure-framework/allure-js

BorisOsipov avatar Jun 09 '21 14:06 BorisOsipov

This is possible?->, add screenshots to the report with allure in the version 1.13.0 of @playwright/test

mpuertao avatar Jun 24 '21 12:06 mpuertao

I would like to second the need for screenshots to the report for each test 'it' statement, for both passing and failing tests.

kshrestha99 avatar Jun 26 '21 14:06 kshrestha99

For instructions see here: https://github.com/allure-framework/allure-js/blob/master/packages/allure-playwright/README.md

pavelfeldman avatar Jul 21 '21 18:07 pavelfeldman

@pavelfeldman Could you please share JS example ?

vsravuri avatar Jul 21 '21 18:07 vsravuri

@pavelfeldman Please provide the code example for output directory definition.

AlexKomanov avatar Jul 21 '21 19:07 AlexKomanov

it doesn't work for me with V1.13.0

image

Has someone worked for you and can you share some example code?

mpuertao avatar Jul 22 '21 01:07 mpuertao

You have to npm i experimental-allure-playwright first.

JoelEinbinder avatar Jul 22 '21 02:07 JoelEinbinder

Ok, thanks @JoelEinbinder. Question: Where is the HTML generated?

mpuertao avatar Jul 22 '21 02:07 mpuertao

allure reports are looking good.. with traces and screenshots also embedded in the report.. still needs to be explore a bit more.

mailtogagan avatar Jul 22 '21 05:07 mailtogagan

Ok, thanks @JoelEinbinder. Question: Where is the HTML generated?

@mpuertao It depends on your definition of the directories. Allure requires installation of the server (local or remote) or it can be used as a plugin in the case of Jenkins. See more here I used the local installation of the allure server.

Then I defined the report (still experimental):

image

Then, performed this command (the path to the directory is up to you):

image

After the test run - the defined folder will be created:

image

But the created results are kind of RAW data. In order to generate a report in the case of the local server, we need to run another command - 'allure generate -o <path-to-output-directory:

image

It will generate a folder with the report files:

image

Then, in order to open the report - we need to open a server with the command 'allure open , as the following:

image

And then - the report will open in the browser:

image

Hope it is clear enough.

AlexKomanov avatar Jul 22 '21 06:07 AlexKomanov

Very thanks @AlexKomanov . I was missing the: allure open. I worked perfect for me. thanks again

image

mpuertao avatar Jul 23 '21 02:07 mpuertao

Following @pavelfeldman post, my local allure results were being saved to allure-results (vs allure-result) so for the report to load with results I had to adjust the run commands as

npx playwright test --reporter=line,experimental-allure-playwright
allure generate ./allure-results --clean
allure open ./allure-report

Great work on this, super easy to get allure wired up!!!

BMayhew avatar Jul 23 '21 19:07 BMayhew

Facing error on ubuntu allure: command not found when running allure generate ./allure-results --clean

ssurabhi10 avatar Jul 30 '21 11:07 ssurabhi10

You need to install Allure, see here for instructions: https://docs.qameta.io/allure/

mxschmitt avatar Jul 30 '21 11:07 mxschmitt

Get this error Exception in thread "main" java.lang.UnsatisfiedLinkError: Can't load library: /usr/lib/jvm/java-16-openjdk-amd64/lib/libawt_xawt.so while running allure open ./allure-report in ubuntu 20

ssurabhi10 avatar Jul 31 '21 07:07 ssurabhi10

Is there any other way to open reports other than allure open ./allure-report ?

ssurabhi10 avatar Jul 31 '21 07:07 ssurabhi10

This is not an Playwright related error, please use the Allure support channels e.g. on their GitHub for that.

Allure is required to open an allure report.

mxschmitt avatar Jul 31 '21 08:07 mxschmitt

I tried to use it but it's giving image

itasworkshop avatar Aug 06 '21 23:08 itasworkshop

btw https://www.npmjs.com/package/allure-playwright was released

baev avatar Aug 07 '21 20:08 baev