1.4.0 • Published 3 years ago

jest-puppeteer-allure v1.4.0

Weekly downloads
814
License
MIT
Repository
-
Last release
3 years ago

jest-puppeteer-allure

NPM version NPM Downloads

This package allows you to generate an allure report. The allure report contains screenshots and errors from the browser console if the test fails.

Getting Started

Prerequisites

The following packages must be installed in your project: jest and puppeteer (playwright). And page variable should be global variable.

Installing

npm install --save-dev jest-puppeteer-allure

Usage

Add to jest config:

reporters: ["default", "jest-puppeteer-allure"]

or

setupFilesAfterEnv: ['jest-puppeteer-allure/src/registerAllureReporter']

If you have your own setupTestFrameworkScriptFile file, you need to manually register reporter, for it you need add import:

import registerAllureReporter from 'jest-puppeteer-allure/src/registerAllureReporter';

Advanced features

You can add description, screenshots, steps, severity and lots of other fancy stuff to your reports.

Global variable reporter available in your tests with such methods:

    description(description: string): this;
    severity(severity: Severity): this;
    epic(epic: string): this;
    feature(feature: string): this;
    story(story: string): this;
    startStep(name: string): this;
    endStep(status?: Status): this;
    addArgument(name: string): this;
    addEnvironment(name: string, value: string): this;
    addAttachment(name: string, buffer: any, type: string): this;
    addLabel(name: string, value: string): this;
    addParameter(paramName: string, name: string, value: string): this;

Example:

it('Test', async () => {
  reporter
    .feature('Feature')
    .story('Story');
  await page.goto('http://example.com');
  const screenshot = await page.screenshot();
  reporter.addAttachment('Screenshot', screenshot, 'image/jpg');
})

If you use jest-image-snapshot then diff image attach to test report.
If you use WebStorm install Toolbox and open tests from report.

1.4.0

3 years ago

1.3.1

4 years ago

1.3.0

4 years ago

1.2.0

5 years ago

1.1.1

5 years ago

1.1.0

5 years ago

1.0.4

5 years ago

1.0.3

5 years ago

1.0.2

5 years ago

1.0.1

5 years ago

1.0.0

5 years ago