-
Notifications
You must be signed in to change notification settings - Fork 7
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
Integration with cypress-multi-reporters
#280
Comments
Hey @hugo-gc, yes, this is possible. You will need to install the following packages
npm i --save-dev cypress-multi-reporters cypress-mochawesome-reporter mocha-junit-reporter cypress-on-fix Important Why Here is what a somewhat minimal configuration could look like:
import { defineConfig } from "cypress";
import { addXrayResultUpload, configureXrayPlugin } from "cypress-xray-plugin";
export default defineConfig({
reporter: "cypress-multi-reporters",
reporterOptions: {
reporterEnabled: "cypress-mochawesome-reporter, mocha-junit-reporter",
cypressMochawesomeReporterReporterOptions: {
charts: true,
reportDir: "cypress/reports/mochawesome",
},
mochaJunitReporterReporterOptions: {
mochaFile: "cypress/reports/junit/results-[hash].xml",
},
},
e2e: {
async setupNodeEvents(on, config) {
const fixedOn = require("cypress-on-fix")(on);
// https://www.npmjs.com/package/cypress-mochawesome-reporter
require("cypress-mochawesome-reporter/plugin")(fixedOn);
// https://qytera-gmbh.github.io/projects/cypress-xray-plugin/section/setup/installation
await configureXrayPlugin(config, {
jira: {
projectKey: "CYP",
url: "https://myorg.atlassian.net",
testExecutionIssueSummary: `Execution ${new Date().toLocaleString()}`,
},
xray: {
uploadResults: true,
},
});
await addXrayResultUpload(fixedOn);
},
},
});
// https://www.npmjs.com/package/cypress-mochawesome-reporter
import "cypress-mochawesome-reporter/register";
import "./commands";
describe("template spec", () => {
// https://qytera-gmbh.github.io/projects/cypress-xray-plugin/section/guides/targetingExistingIssues/
it("CYP-529 passes", () => {
cy.visit("https://example.org");
});
}); When I run this project using my Jira/Xray authentication data: CYPRESS_JIRA_USERNAME=abc@def.com \
CYPRESS_JIRA_API_TOKEN=secret123 \
CYPRESS_XRAY_CLIENT_ID=id \
CYPRESS_XRAY_CLIENT_SECRET=secret456 \
npx cypress run I get:
I hope this is what you were looking for. |
Hi @csvtuda Thanks! |
Is it possible to use this plugin along with any other reporter using cypress-multi-reporters? If so, could you provide an example for the set up? In my case, I need to generate a mochawesome html report.
The text was updated successfully, but these errors were encountered: