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

[qase-cypress-v2] Error when using the reporter without cypress-multi-reporters #597

Open
gibiw opened this issue May 27, 2024 · 1 comment
Labels
bug Something isn't working

Comments

@gibiw
Copy link
Contributor

gibiw commented May 27, 2024

If you do not use cypress-multi-reporters, an error appears when running tests.

'[object Object]' reporter not found
invalid reporter '[object Object]'
TypeError: invalid reporter '[object Object]'
    at createInvalidReporterError (<embedded>:2764:123502)
    at k.reporter (<embedded>:2769:3431)
    at new k (<embedded>:2769:1480)
    at A.setRunnables (<embedded>:4445:15437)
    at Object.onTestsReceivedAndMaybeRecord (<embedded>:4498:28550)
    at p.<anonymous> (<embedded>:4445:47245)
    at p.emit (node:events:514:28)
    at <embedded>:4445:26630
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)

Example of cypress config:

const cypress = require('cypress');
const plugins = require('./cypress/plugins/index.js');

module.exports = cypress.defineConfig({
  reporter: 'cypress-qase-reporter',
  reporterOptions: {
    mode: 'testops',
    debug: true,
    testops: {
      api: {
        token: 'token',
      },

      project: 'project_code',
      uploadAttachments: true,
      run: {
        complete: true,
      },
    },

    framework: {
      cypress: {
        screenshotsFolder: 'cypress/screenshots',
      },
    },

  },
  video: false,
  e2e: {
    setupNodeEvents(on, config) {
      return require('./cypress/plugins/index.js')(on, config);
    },
  }
});

As a workaround use cypress-multi-reporters.

@gibiw gibiw added the bug Something isn't working label May 27, 2024
@NickVolynkin
Copy link
Contributor

Solution: use the cypress-multi-reporters config.

Using other reporters is entirely optional: it works with multiple reporters and with just

import cypress from 'cypress';

import plugins from './cypress/plugins/index.js';

module.exports = cypress.defineConfig({
+  reporter: 'cypress-multi-reporters',
-  reporter: 'cypress-qase-reporter',
  reporterOptions: {
+    reporterEnabled: 'cypress-qase-reporter',
+    cypressQaseReporterReporterOptions: {
      mode: 'testops'
      debug: true,
      
      testops: {
        api: {
          token: 'api_key',
        },
        project: 'project_code',
        uploadAttachments: true,

        run: {
          complete: true,
        },
      },

      framework: {
        cypress: {
          screenshotsFolder: 'cypress/screenshots',
        }
      }
    },
+  },
  video: false,
  e2e: {
    // We've imported your old cypress plugins here.
    // You may want to clean this up later by importing these.
    setupNodeEvents(on, config) {
      return plugins(on, config);
    },
  },
});

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants