reportportal / agent-js-cypress

Agent to integrate Cypress with ReportPortal.
https://www.npmjs.com/package/@reportportal/agent-js-cypress
Apache License 2.0
39 stars 39 forks source link

Test run is broken when there is retry for test and parameter reportHooks set to true in reporter configuration #193

Open alesya-la opened 1 month ago

alesya-la commented 1 month ago

Hello I have next error when there is a retry for test and parameter reportHooks:truein reporter configuration. Note: it is reproduced when test has hook image

Code to reproduce: configs/config.js

const {defineConfig} = require('cypress');
const registerReportPortalPlugin = require('@reportportal/agent-js-cypress/lib/plugin');

module.exports = defineConfig({
    e2e: {

        setupNodeEvents(on, config) {
            // implement node event listeners here
            registerReportPortalPlugin(on, config);
            return config;
        },

        retries: {
            runMode: 1,
            openMode: 0
        }
    },
})

configs/reporters.config

const {defineConfig} = require('cypress');

module.exports = {
  reporterEnabled: "@reportportal/agent-js-cypress",
  reportportalAgentJsCypressReporterOptions: {
    endpoint: "END_POINT",
    apiKey: 'API_KEY',
    launch: 'LAUNCH_NAME',
    project: 'PROJECT_NAME',
    description: 'RP_DESCRIPTION',
    autoMerge: true,
    skippedIssue: false,
    reportHooks: true,
    integrationFolder: "cypress/e2e",
    attributes: [
      {
        key:"build",
        value: 'RP_BUILD',
      },
    ],
  }
}

cypress/e2e/test.cy.js

describe('Test', () => {

    beforeEach('Login to project page', () => {
        cy.visit('https://www.google.com/');
    });

    it('test', () => {        
        cy.get('#lnXdpd').should('exist');
        cy.get('#lnXdpd').not('exist');       
    })
});

package.json

{
  "devDependencies": {
    "@reportportal/agent-js-cypress": "^5.3.0",
    "cypress": "^13.11.0"
  },
  "dependencies": {
    "cypress-multi-reporters": "^1.6.4"
  }
}
Pink-Bumblebee commented 4 weeks ago

@AmsterGet , could you please check?

niQo commented 4 weeks ago

same error here. The workaround is to set reportHooks to false and then it's not crashing anymore.