kuceb / cypress-plugin-retries

A Cypress plugin to retry failed tests.
MIT License
237 stars 20 forks source link

Cannot find module 'cypress-plugin-retries' from '/cypress/support' #53

Closed YemiYuma closed 4 years ago

YemiYuma commented 4 years ago

When I run cypress with this add-on locally, it works perfectly without any issues at all, however for some reason when I run cypress in a container through Jenkins, I seem to be getting the following error in my console:

'cypress_1 | Error: Cannot find module 'cypress-plugin-retries' from '/cypress/support'

This is my cypress/support/index.js file:

import './commands'

require('cypress-plugin-retries');

This is my cypress.json file:

{
    "env":
    {
        "RETRIES": 1
    },
    "supportFile":  "./cypress/support/index.js",
    "defaultCommandTimeout": 10000,
    "requestTimeout": 10000,
    "responseTimeout": 10000,
    "pageLoadTimeout": 120000,
    "chromeWebSecurity": false,
    "video": false,
    "viewportWidth": 1800,
    "viewportHeight": 1000,
    "reporter": "junit",
    "reporterOptions": {
        "mochaFile": "../test_reports/cypress-result.xml",
        "toConsole": true
    },
    "trashAssetsBeforeRuns": true,
    "screenshotsFolder": "../test_reports/cypress_screenshots"
}

This is my package.json file:

{
  "name": "guacamole-cypress",
  "version": "1.0.0",
  "dependencies": {
    "cypress-plugin-retries": "^1.5.2",
    "darwin": "0.0.5",
    "mocha": "^5.2.0",
    "mocha-junit-reporter": "^1.23.0",
    "xvfb": "0.2.3",
    "yarn": "^1.21.0"
  },
  "devDependencies": {
    "cypress": "^4.0.2"
  }
}

Dockerfile:

FROM cypress/included:4.0.2

WORKDIR /cypress

COPY /cypress/package.json .

RUN npm install --production

Could anyone provide any assistance regarding this? I feel like i've made a silly mistake somewhere, or i'm missing a line; works perfectly fine locally - it's just when ran in a container on Jenkins this issue seems to occur.

I can provide more information if needed.

Thanks

YemiYuma commented 4 years ago

Problem solved - was an error on my part :)

kuceb commented 4 years ago

@YemiYuma glad to hear that, what was the problem?

wasiqkhan786 commented 3 years ago

@YemiYuma can u tell what was the problem ? I am facing the same issue.running fine locally but on Jenkins throwing error no cypress retries command found

YemiYuma commented 3 years ago

hey guys, I changed the require to import it directly from my _nodemodules folder, so in my support/index.js file:

import '../../node_modules/cypress-plugin-retries'