Skip to content

hexode/allure-playwright-test

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

15 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

allure-playwright

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

or inside the config via:

const config = {
  reporter: [ ['allure-playwright', { outputFolder: 'my-allure-results' }] ],
};

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" });
});

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published