npm i -D allure-codeceptjs
Add the allure plugin inside you plugins section of your CodeceptJS config file.
For instance the config file is codecept.config.(js|ts)
then:
plugins: {
...
allure: {
enabled: true,
require: "allure-codeceptjs",
},
...
}
};
Right now you can access allure API through codeceptjs container.
Feature("login-feature");
Scenario("login-scenario1", async () => {
const allure = codeceptjs.container.plugins("allure");
allure.label("name", "value");
allure.tag("tag1");
allure.tags("tag2", "tag3");
allure.issue("issueName", "google.com");
allure.owner("eroshenkoam");
allure.layer("UI");
allure.id("228");
allure.description("aga");
allure.story("aga");
allure.feature("aga");
allure.epic("aga");
allure.epic("severity");
allure.addAttachment("data.txt", "some data", "text/plain");
});
You can also use tags to manage labels on scenarios.
Feature("login-feature");
Scenario("login-scenario1", async () => {
// your test
}).tag("@allure.id:228");
Feature("login-feature");
Scenario("login-scenario1", async () => {
// your test
}).tag("@allure.label.{{labelName}}:{{labelValue}}");
Feature("login-feature");
Scenario("login-scenario1", async () => {
// your test
}).tag("@allure.label.story:storyName");
Feature("login-feature");
Scenario("login-scenario1", async () => {
// your test
}).tag("@allure.label.suite:suiteName");
Feature("login-feature");
Scenario("login-scenario1", async () => {
// your test
}).tag("@allure.label.owner:ownerName");
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");