allure-codeceptjs
TypeScript icon, indicating that this package has built-in type declarations

3.0.0-beta.3 • Public • Published

allure-codeceptjs

Allure framework integration for CodeceptJS

Allure Report logo


Installation

npm i -D allure-codeceptjs

Usage

Add the allure plugin inside you plugins section of your CodeceptJS config file. For instance the config file is codecept.config.(js|ts) then:

module.exports.config = {
  plugins: {
    // ...
    allure: {
      enabled: true,
      require: "allure-codeceptjs",
    },
    // ...
  }
};

Allure Runtime API usage

Right now you can access allure API through codeceptjs container.

import { label, tag, tags, issue, owner, layer, allureId, description, story, feature, epic, attachment } from "allure-js-commons";

Feature("login-feature");
Scenario("login-scenario1", async () => {
  await label("name", "value");
  await tag("tag1");
  await tags("tag2", "tag3");
  await issue("issueName", "google.com");
  await owner("eroshenkoam");
  await layer("UI");
  await allureId("228");
  await description("aga");
  await story("aga");
  await feature("aga");
  await epic("aga");
  await attachment("data.txt", "some data", "text/plain");
});

You can also use tags to manage labels on scenarios.

Links usage

import { link, issue, tms } from "allure-js-commons";

Feature("login-feature");
Scenario("login-scenario1", async () => {
  await link("link_type", "https://allurereport.org", "Allure Report");
  await issue("Issue Name", "https://github.com/allure-framework/allure-js/issues/352");
  await tms("Task Name", "https://github.com/allure-framework/allure-js/tasks/352");
});

You can also configure links formatters to make usage much more convenient. %s in urlTemplate parameter will be replaced by given value.

module.exports.config = {
  // ...
  plugins: {
    allure: {
      enabled: true,
      require: "allure-codeceptjs",
+      links: [
+        {
+          type: "${LinkType.ISSUE}",
+          urlTemplate: "https://example.org/issues/%s",
+          nameTemplate: "Issue: %s",
+        },
+        {
+          type: "${LinkType.TMS}",
+          urlTemplate: "https://example.org/tasks/%s",
+        }
+      ]
    },
  },
  // ...
};

Then you can assign link using shorter notation:

import { link, issue, tms } from "allure-js-commons";

Feature("login-feature");
Scenario("login-scenario1", async () => {
  await issue("351");
  await issue("352", "Issue Name");
  await tms("351");
  await tms("352", "Task Name");
  await link("custom", "352");
  await link("custom", "352", "Link name");
});

Tags metadata API

You also can mark up your tests with Allure metadata using CodeceptJS tags API.

Id

Feature("login-feature");
Scenario("login-scenario1", async () => {
  // your test
}).tag("@allure.id:228");

Label

Feature("login-feature");
Scenario("login-scenario1", async () => {
  // your test
}).tag("@allure.label.{{labelName}}:{{labelValue}}");

Story

Feature("login-feature");
Scenario("login-scenario1", async () => {
  // your test
}).tag("@allure.label.story:storyName");

Suite

Feature("login-feature");
Scenario("login-scenario1", async () => {
  // your test
}).tag("@allure.label.suite:suiteName");

Owner

Feature("login-feature");
Scenario("login-scenario1", async () => {
  // your test
}).tag("@allure.label.owner:ownerName");

Tag

Feature("login-feature");
Scenario("login-scenario1", async () => {
  // your test
}).tag("@allure.label.tag:tagName");

or keep it simple:

Feature("login-feature");
Scenario("login-scenario1", async () => {
  // your test
}).tag("tagName");

Readme

Keywords

Package Sidebar

Install

npm i allure-codeceptjs

Weekly Downloads

5,603

Version

3.0.0-beta.3

License

Apache-2.0

Unpacked Size

126 kB

Total Files

34

Last publish

Collaborators

  • qameta-bot