Issue
I am trying to implement cucumber into modular angular project but cant figure out how.
I have few modules and e2e folder to test them lets call them tools

But I cant configure cucumber to work with simple google example from their GitHub. Some of cypress.json
{
"reporter": "junit",
"baseUrl": "https://localhost/",
"reporterOptions": {
"mochaFile": "../../test-results/tool3/reports/[hash].xml",
"testsuitesTitle": "tool3",
"useFullSuiteTitle": false
},
"fileServerFolder": "./",
"testFiles": "**/*.{feature,features}",
"fixturesFolder": "./src/fixtures",
"integrationFolder": "./src/integration",
"pluginsFile": "./src/plugins/index.js",
"supportFile": "./src/support/index.ts",
"chromeWebSecurity": false,
"viewportHeight": 799,
"viewportWidth": 1199,
"retries": {
"runMode": 1,
"openMode": 0
},
"responseTimeout": 90000,
"env": {
"ServerAddress": "localhost"
}
}
added to package.json inside e2e folder
"cypress-cucumber-preprocessor": {
"nonGlobalStepDefinitions": true
}
plugins/index.js
const browserify = require('@cypress/browserify-preprocessor');
const cucumber = require('cypress-cucumber-preprocessor').default;
const resolve = require('resolve');
module.exports = (on, config) => {
const options = {
...browserify.defaultOptions,
typescript: resolve.sync('typescript', { baseDir: config.projectRoot }),
};
on('file:preprocessor', cucumber(options));
};
and Google.feature and google.ts are from github demo (Given, Then)
Now depending on "nonGlobalStepDefinitions" configuration i am getting errors.
When true - Error: We've tried to resolve your step definitions at cypress\integration, but that doesn't seem to exist. As of version 2.0.0 it's required to set step_definitions in your cypress-cucumber-preprocessor configuration. Look for nonGlobalStepDefinitions and add stepDefinitions right next to it. It should match your cypress configuration has set for integrationFolder. We no longer rely on getting information from that file as it was unreliable and problematic across Linux/MacOS/Windows especially since the config file could have been passed as an argument to cypress.
When false with stepDefinition
Step implementation missing for: I open Google page
Cypress without cucumber works fine. Thanks for any help.
Solution
I needed to rename src folder to cypress for god sake
Answered By - Juraj Jakubov
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.