Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to Set Environment details for a Codeceptjs project #978

Closed
samaysimantbarik opened this issue Aug 6, 2019 · 4 comments
Closed

How to Set Environment details for a Codeceptjs project #978

samaysimantbarik opened this issue Aug 6, 2019 · 4 comments

Comments

@samaysimantbarik
Copy link

samaysimantbarik commented Aug 6, 2019

Currently, the environment section in the report for a codecept js project shows blank.
What is the way to add the environment details?

image

My config file:
image

@samaysimantbarik
Copy link
Author

Can anyone help.

@Mooksc
Copy link

Mooksc commented Oct 25, 2019

looking at allure environment documentation - the environment widget can be configured with an environment.properties or environment.xml file in the report directory.

heres an example using Codeceptjs event listener API to generate this file into the output directory after all tests have run:

const event = require('codeceptjs').event;
const conf = require('./codecept.conf.js').config;
const fs = require('fs');
  
  event.dispatcher.on(event.all.after, () => {
    let data = 'Environment=STAGE\nBrowser='+conf.helpers.WebDriver.browser
    fs.writeFile(conf.output+'/environment.properties', data, (err) => {
      if (err) throw err;
    });
  });

note: using the Codeceptjs API requires a local codeceptjs installation

@baev
Copy link
Member

baev commented May 8, 2024

will be fixed via allure-framework/allure-js#909

@baev
Copy link
Member

baev commented Jul 3, 2024

since [email protected] you can specify environment info and categories via plugin config:

exports.config = {
  plugins: {
    allure: {
      require: require.resolve("allure-codeceptjs"),
      enabled: true,
      environmentInfo: {
        "app version": "123.0.1",
        "some other key": "some other value",
      },
      categories: [...],
    },
  },
};

@baev baev closed this as completed Jul 3, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants