codeceptjs / allure-legacy

Allure plugin for CodeceptJS
0 stars 1 forks source link

Allure Plugin

Allure plugin for CodeceptJS via allure-commons v1

Warning This plugin was deprecated in CodeceptJS as to allure-commons v1 was not maintained anymore. Documentation and source code was moved into this repository. At this moment we don't plan to migrate it to Allure v2 but community can create their own implementations

Enables Allure reporter.

Usage

To start please install allure-commandline package (which requires Java 8)

npm install -g allure-commandline --save-dev

Add this plugin to config file:

plugins: {
  allure: {
    enabled: true,
    require: '@codeceptjs/allure-legacy',
  }
}

By default, allure reports are saved to output directory. Launch Allure server and see the report like on a screenshot above:

allure serve output

Configuration

Public API

There are few public API methods which can be accessed from other plugins.

const allure = codeceptjs.container.plugins('allure');

allure object has following methods:

    allure.createStep('New created step', () => {
      allure.addAttachment(
        'Request params',
        '{"clientId":123, "name":"Tom", "age":29}',
        'application/json'
      );
    });

Created Step Image

const expectedImg = fs.readFileSync('expectedImg.png', { encoding: 'base64' });
...
allure.addScreenDiff('Screen Diff', expectedImg, actualImg, diffImg);

Overlay Diff

addAttachment

Add an attachment to the current test case

Parameters

addLabel

Adds a label with the given name and value to the current test in the Allure report

Parameters

addParameter

Adds a parameter with the given kind, name, and value to the current test in the Allure report

Parameters

addScreenDiff

Add a special screen diff block to the current test case

Parameters

createStep

A method for creating a step in a test case.

Parameters

Returns any The result of the step function.

setDescription

Set description for the current test case

Parameters

allure

Allure reporter

![][4]

Parameters

allure

Creates an instance of the allure reporter

Parameters

Returns [Object][9] Instance of the allure reporter