reportportal / agent-js-cucumber

Agent to integrate CucumberJS with ReportPortal.
https://www.npmjs.com/package/@reportportal/agent-js-cucumber
Apache License 2.0
12 stars 17 forks source link

How can I integrate with cucumber typescript framework? #141

Closed deeprqa closed 2 months ago

Ihor-Ratsuk commented 8 months ago

@deeprqa I use @cucumber/cucumber@9.1.2 with typescript, standard recommendations worked for me well (https://github.com/reportportal/agent-js-cucumber/blob/develop/README.md)

  1. added latest @reportportal/agent-js-cucumber npm install --save-dev @reportportal/agent-js-cucumber
  2. created Report Portal configuration file ./reportportal.config.json for details look at https://github.com/reportportal/agent-js-cucumber/blob/develop/README.md
    {
    "apiKey": "RP API KEY HERE",
    "endpoint": "https://your.reportportal.server/api/v1",
    "launch": "Your launch name",
    "project": "Your reportportal project name",
    "description": "Awesome launch description.",
    "attributes": [],
    "takeScreenshot": "onFailure"
    }
  3. created Report Portal formatter in a new js file, ./reportportal.formatter.js:

    const { createRPFormatterClass } = require('@reportportal/agent-js-cucumber');
    const config = require('./reportportal.config.json');
    
    module.exports = createRPFormatterClass(config);
  4. I use CustomWorld, need to updated parent class for CustomWorld in my custom-world.ts from

    import { World, IWorldOptions } from '@cucumber/cucumber';
    
    export class CustomWorld extends World {
    constructor(options: IWorldOptions) {
    super(options);
    }
    ...
    }

    to

    import { IWorldOptions } from '@cucumber/cucumber';
    import { RPWorld } from '@reportportal/agent-js-cucumber';
    
    export class CustomWorld extends RPWorld {
    constructor(options: IWorldOptions) {
    super(options);
    }
    ...
    }
  5. run cucmberjs cucumber-js -f ./reportportal.formatter.js -p default
mbryl6 commented 6 months ago

Hello @deeprqa , Is this issue still relevant or we can close it? Thanks in advance for the answer!

AmsterGet commented 2 months ago

Hello @deeprqa ! Please refer comment from @Ihor-Ratsuk. I'll close the issue, feel free to open new one in case of more questions.