-
1 feature (feature file)
-
2 Scenarios
-
Simple login scenario with valid credentials and with invalid credentials
-
Parameterization has been used for providing login credentials.
Directory Structure
-
Clone the repository using "git clone "
-
Change "Username" and "Password" in both scenarios in feature file
-
npm install
-
npm run test
To do so, we would have to use some external plugins. Please follow the steps mentioned below.
-
Install the cucumber plugin by running the following command.
npm install cypress-cucumber-preprocessor
-
After installing the plugin, add this code snippet in the index.js file under the plugins folder.
const cucumber = require('cypress-cucumber-preprocessor').default module.exports = (on, config) => { on('file:preprocessor', cucumber()) }
-
Then to make cypress recognise the .feature extension, we would have to add this in our cypress.json file.
{ "testFiles": "**/*.feature" }
-
After that, we also have to add the following in the package.json file.
"cypress-cucumber-preprocessor": { "nonGlobalStepDefinitions": true }