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 40 forks source link

Auto merge: plugin is not installed. Use reporterOptions settings for calculation. Configuration property not set! Neither for cypress <= 9 nor cypress >= 10 #175

Open praveentata opened 10 months ago

praveentata commented 10 months ago

I see that this issue was submitted: https://github.com/reportportal/agent-js-cypress/issues/170 but was closed without an answer.

I am curious to know if others are also having the same problem or encountered the same problem and how they fixed it

Cypress version: 13.3.0 Report Portal Version: 5.1.3

cypress.config.js:

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

module.exports = defineConfig({
  reporter: "@reportportal/agent-js-cypress",
  reporterOptions: {
    endpoint: 'http://<IP>:8080/api/v1',
    apiKey: 'apiKey',
    launch: 'LAUNCH_NAME',
    project: 'PROJECT_NAME',
    description: 'Description',
    autoMerge: true,
  },
  defaultCommandTimeout: 300000,
  responseTimeout: 300000,
  pageLoadTimeout: 300000,
  headless: false,
  numTestsKeptInMemory: 1,
  chromeWebSecurity: false,
  viewportHeight: 1080,
  viewportWidth: 1920,
  video: false,
  videoCompression: false,
  videoUploadOnPasses: false,
  screenshotOnRunFailure: true,
  experimentalSessionSupport: true,
  screenshotsFolder: 'cypress/screenshots',
  env: {
    dev: {
      baseUrl: 'url',
      username: 'username',
      password: 'password',
    },
    uat: {
      baseUrl: 'url',
      username: 'username',
      password: 'password',
    },
  },
  e2e: {
    setupNodeEvents(on, config) {
      // implement node event listeners here
      // return require('./cypress/plugins/index.js')(on, config)
      on('file:preprocessor', tagify(config));
      on('before:browser:launch', (browser = {}, launchOptions) => {
        if (browser.family === 'chrome') {
          console.log('Adding --disable-dev-shm-usage...');
          launchOptions.args.push('--disable-dev-shm-usage');
        }

        return launchOptions;
      });
      return registerReportPortalPlugin(on, config);
    },
    specPattern: 'cypress/e2e/**/**_spec.js',
    excludeSpecPattern: [
      '**/login_spec.js',
      '**/lighthouse_audit_spec.js',
    ],
  },
});

package.json

{
  "name": "my-project",
  "version": "1.0.0",
  "description": "",
  "main": "index.js",
  "scripts": {
    "test": "echo \"Error: no test specified\" && exit 1"
  },
  "author": "",
  "license": "ISC",
  "dependencies": {
    "@testing-library/cypress": "^10.0.1",
    "chai": "^4.3.6",
    "chai-as-promised": "^7.1.1",
    "cypress-xpath": "^1.6.2",
    "dayjs": "^1.10.6",
    "pretty-format": "^27.0.6"
  },
  "devDependencies": {
    "@reportportal/agent-js-cypress": "^5.1.3",
    "cypress": "^13.3.0",
    "cypress-audit": "^1.0.0",
    "cypress-downloadfile": "^1.2.1",
    "cypress-iframe": "^1.0.1",
    "cypress-localstorage-commands": "^1.6.1",
    "cypress-multi-reporters": "^1.5.0",
    "cypress-tags": "^1.1.2",
    "cypress-wait-until": "^1.7.2",
    "eslint": "^7.32.0",
    "eslint-config-prettier": "^8.3.0",
    "eslint-plugin-cypress": "^2.11.3",
    "eslint-plugin-prettier": "^3.4.0",
    "eslint-plugin-react": "^7.24.0",
    "junit-report-merger": "^3.0.2",
    "mocha-junit-reporter": "^2.0.2",
    "mochawesome": "^7.0.1",
    "mochawesome-merge": "^4.2.1",
    "mochawesome-report-generator": "^6.0.1",
    "prettier": "^2.3.2",
    "typescript": "^4.3.5"
  }
}

Error:

Auto merge: plugin is not installed. Use reporterOptions settings for calculation.
Configuration property not set! Neither for cypress <= 9 nor cypress >= 10
Error: Configuration property not set! Neither for cypress <= 9 nor cypress >= 10
    at getTotalSpecs (/automation/folder/node_modules/@reportportal/agent-js-cypress/lib/utils.js:228:11)
    at CypressReporter.calcTotalLaunches (/Users/tatap/Git/UIAutomation/qa-ui-automation/s1-atlas/node_modules/@reportportal/agent-js-cypress/lib/cypressReporter.js:202:39)
    at L.<anonymous> (/automation/folder/node_modules/@reportportal/agent-js-cypress/lib/cypressReporter.js:155:23)
    at L.emit (node:events:525:35)
    at S.emit (<embedded>:4515:16494)
    at Object.onMocha (<embedded>:4562:27715)
    at p.<anonymous> (<embedded>:4515:45184)
    at p.emit (node:events:513:28)
    at <embedded>:4515:24385
praveentata commented 10 months ago

So, it seems like the cypress-tags library is causing this issue. When I don't use the CYPRESS_INCLUDE flag in my command, it works fine and autoMerge error goes away. This library also seemed to be interfering with @aws-sdk libraries and causing the following issue: https://github.com/aws/aws-sdk-js-v3/issues/5349

For now, I have stopped using the cypress-tags library to move forward

praveentata commented 9 months ago

Update: It worked initially without the cypress-tags library but I am facing the same issue when I specify the --spec <file_name> in the command. So, this doesn't seem completely related to the cypress-tags library. It will be great if someone can look into it

Thanks

Zenin-Dmitry commented 9 months ago

Hi! I have the same problems. no errors npx cypress run error exists npx cypress run --spec cypress/e2e/*cy.js Have you found how to run tests from the required folders?

Zenin-Dmitry commented 9 months ago

I studied the problem a little and this is the result. These run I see in reportportal. I run it with this command npx cypress run --spec cypress/e2e/api/endpoints/Attributes/test1.cy.js There is no error in this test, data is sent

describe('Test_describe', ()=> {
it ('Test1',() => {
    cy.visit('/')
    })
})

There is an error in this test npm verb exit 1 npm verb code 1

describe('Test_describe', ()=> {
it ('Test1',() => {
    cy.request('/')
    })
})
diegoarena commented 8 months ago

Hi. Any update on this ? I'm having the same issue using cypress 13 npx cypress run --browser chrome --env grepTags=@login,grepFilterSpecs=true,grepOmitFiltered=true

Configuration property not set! Neither for cypress <= 9 nor cypress >= 10
Error: Configuration property not set! Neither for cypress <= 9 nor cypress >= 10
    at getTotalSpecs (/home/diego/Documents/trabajo/revai/web-e2e-tests/node_modules/@reportportal/agent-js-cypress/lib/utils.js:229:11)
    at CypressReporter.calcTotalLaunches (/home/diego/Documents/trabajo/revai/web-e2e-tests/node_modules/@reportportal/agent-js-cypress/lib/cypressReporter.js:205:39)
    at L.<anonymous> (/home/diego/Documents/trabajo/revai/web-e2e-tests/node_modules/@reportportal/agent-js-cypress/lib/cypressReporter.js:158:23)
    at L.emit (node:events:525:35)
    at A.emit (<embedded>:4479:18259)
    at Object.onMocha (<embedded>:4526:27943)
    at p.<anonymous> (<embedded>:4479:47429)
    at p.emit (node:events:513:28)
    at <embedded>:4479:26630

Thanks!

niQo commented 7 months ago

same issue using cypress 13 and cypress-cucumber-preprocessor when the first test containt tag @skip

AmsterGet commented 7 months ago

Hi guys! @Zenin-Dmitry , @diegoarena , @niQo Could you share your Cypress configuration files? As far as I remember, Cypress didn't pass information about the CLI arguments to reporters, so we expect to find it in the configuration. I understand the usability of the CLI, let us think about possible solutions. I'll let you know. Thanks.

xpersky commented 7 months ago

I've also encountered this error on cypress 13.6.1 with webpack preprocessor, as far as I managed to debug the problem, it seems that ipc connection did not succeed to retry on time, therefore changing:

lib/plugin/ipcClient.js:28
  ipc.config.retry = 1500;

To anything close to 100 seem to be working fine each time.

Zenin-Dmitry commented 7 months ago

@xpersky Your solution is interesting, but I run tests in Docker and install packages with the command npm ci. Of course, you can change this line in the container, but it seems to me that we need to look for another solution. @AmsterGet Here are my settings

reporterOptions: {
    endpoint: 'http://mydomen.local:8080/api/v1',
    apiKey: 'tests_bUazvjzBQeywFoQvHH',
    launch: 'AAA',
    project: 'AAA',
    description: process.env.CI_JOB_URL || 'autotest Cypress',
    debug: true,
    "autoMerge": true,
    attributes: [
      { key: "runType",
        value: process.env.CI_PIPELINE_SOURCE || "Manual"
      },
      { key: "branch",
        value: process.env.CI_COMMIT_BRANCH || "Unknown"
      },
      { key: "commit",
        value: process.env.CI_COMMIT_SHORT_SHA || "Unknown"
      },
      { 
        value: process.env.CI_JOB_NAME || "Unknown"
      },       
    ],
  },
govindd06 commented 3 months ago

We got the same issue, we were using the snowflake-sdk plugins for snowfalke database connectivity, which was having transitive dependency of @aws-sdk and some cloud depenencies. We have eliminated those dependencies by using other plugins naturalcycles/snowflake-sdk and resolved our issues.

Fixes https://github.com/snowflakedb/snowflake-connector-nodejs/issues/449 by moving non-mandatory dependencies to peerDependencies. So, folks who don't need e.g AWS SDK don't have to "download the whole internet"

Check your node_modules contains @aws-sdk, then add those dependencies in the peerDependencies and try it out. All the Best.