Package Exports
- allure-playwright
- allure-playwright/dist/index.js
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (allure-playwright) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
allure-playwright
This project implements Allure integration with Playwright Test framework.
Installation
npm i -D @playwright/test allure-playwright
or via yarn:
yarn add @playwright/test allure-playwright --dev
Usage
Either add allure-playwright into playwright.config.ts:
{
reporter: "allure-playwright";
}
Or pass the same value via command line:
npx playwright test --reporter=line,allure-playwright
Specify location for allure results:
Mac / Linux
ALLURE_RESULTS_DIR=my-allure-results npx playwright test --reporter=line,allure-playwright
Windows
set ALLURE_RESULTS_DIR=my-allure-results
npx playwright test --reporter=line,allure-playwright
Proving extra information
You can use allure labels to provide extra information about tests such via
- label
- link
- id
- epic
- feature
- story
- suite
- parentSuite
- subSuite
- owner
- severity
- tag
- issue
- tms
Labels Usage
import { test, expect } from "@playwright/test";
import { allure } from "allure-playwright";
test("basic test", async ({ page }, testInfo) => {
allure.epic("Some Epic");
allure.story("Some Story");
});
Links Usage
import { test, expect } from "@playwright/test";
import { allure } from "allure-playwright";
test("basic test", async ({ page }, testInfo) => {
allure.link({ url: "https://playwright.dev", name: "playwright-site" });
allure.issue({
url: "https://github.com/allure-framework/allure-js/issues/352",
name: "Target issue",
});
});
Attachments Usage
import { test, expect } from "@playwright/test";
test("basic test", async ({ page }, testInfo) => {
const path = testInfo.outputPath("screenshot.png");
await page.screenshot({ path });
testInfo.attachments.push({ name: "screenshot", path, contentType: "image/png" });
});