npm i -D @playwright/test allure-playwright
or via yarn:
yarn add @playwright/test allure-playwright --dev
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
or inside the config via:
const config = {
reporter: [ ['allure-playwright', { outputFolder: 'my-allure-results' }] ],
};
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
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");
});
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",
});
});
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" });
});