kuceb / cypress-plugin-retries

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

Cannot set lowercase environment variable 'retries' #35

Closed edupeeth closed 4 years ago

edupeeth commented 4 years ago

Hey @Bkucera ,

I totally appreciate your efforts and vision coming up with this much needed plugin for cypress. Infact, I believe all the e2e test frameworks must have it for sure.

I have some tests in my suite which seem/behave flaky no matter how hard I have tried to do anything/everything to fix them, but each time some would fail randomly and pass on rerun. I came across your plugin and felt it's what I needed indeed. But, doesn't seem to be working for us.

This is my cypress.json file -

{
    "baseUrl": "http://localhost:4200",
    "testFiles": "**/*.feature",
    "video": false,
    "env": {
        "auth_username": "1234",
        "auth_password": "1234",
        "retries": 2
    },
    "requestTimeout": 15000,
    "modifyObstructiveCode": false,
    "reporter": "junit",
    "reporterOptions": {
        "mochaFile": "test-reports/test-output-[hash].xml",
        "toConsole": false
    }
}

This is cypress/support/index.js -

// ***********************************************************
// This example support/index.js is processed and
// loaded automatically before your test files.
//
// This is a great place to put global configuration and
// behavior that modifies Cypress.
//
// You can change the location of this file or turn off
// automatically serving support files with the
// 'supportFile' configuration option.
//
// You can read more here:
// https://on.cypress.io/configuration
// ***********************************************************

// Import commands.js using ES2015 syntax:
import './commands';
import 'cypress-plugin-retries';
// Alternatively you can use CommonJS syntax:
// require('./commands')

I don't find it working for me. We have feature files defined in gherkin format as required by cypress-cucumber-preprocessor. Any help is much appreciated.

P.S. Please Let me know if any other information from end would help. We are using Type Script.

edupeeth commented 4 years ago

It works after I added

 "types": [
            "cypress", "cypress-wait-until", "cypress-plugin-retries"
        ]

And

env: {
"RETRIES": 2
} 

to

cypress.json

Thanks a ton for coming out with the plugin.