'Is there a way to integrate Cypress reporter with "report portal" and "mochawesome"

I am trying to integrate cypress resporting with report portal and mochawaesome. The goal is to get both reports. I have tried this in the

cypress.json

"reporter": "cypress-multi-reporters",
    "reporterOptions": {
        "reporterEnabled": "mochawesome, @reportportal/agent-js-cypress",
        "mochawesomeReporterOptions": {
            "reportDir": "cypress/reports/mocha",
            "quite": true,
            "overwrite": false,
            "html": false,
            "json": true
        },
        "reportPortalReporterOptions": {
            "endpoint": "abc",
            "token": "123",
            "launch": "launcher",
            "project": "project-name",
            "autoMerge": true,
            "description": "QA"
        }

    }

it doesnt work. Is there another way to integrate 2 reporting tools together in cypress



Solution 1:[1]

Currently in our project we're using below

config.json

{
"reporterEnabled": "mocha-junit-reporter",
"mochaJunitReporterReporterOptions": {
    "mochaFile": "/results/junit-custom-[hash].xml"
},
"reportportalAgentJsCypressReporterOptions": {
    "endpoint": "http://<remote_IP>:8080/api/v1",
    "token": "c6a4015e-61fa-4506-b1de-cfc24e93b2ba",
    "launch": "apps_dr",
    "project": "my_test_app",
    "description": "Sample",
    "autoMerge": false,
    "isLaunchMergeRequired": true,
    "attributes": [
        {
            "key": "domain",
            "value": "Apps"
        },
        {
            "key": "name",
            "value": "my test app"
        },
        {
            "key": "type",
            "value": "UI"
        }
    ]
    }
}

in

cypress.json

added below parameter:

 "reporter": "@reportportal/agent-js-cypress",

And, its working well for us.

Solution 2:[2]

There are two quirks you need to be aware of with Cypress/Mocha and Report portal:

  1. ReportPortal need to be first in the reporterEnabled array and the options for report portal also need to be first

  2. This second one got me good since I wasnt familiar with mocha coming from a Java shop that did selenium. You need to name the options identically to the reporter name. So instead of reportPortalReporterOptions, you should name it reportPortalAgentJsCypressReporterOptions. this is a quirk of Mocha.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1
Solution 2 Cody Polera