Closed CharalamposSam closed 2 years ago
Given that you're following @alapanme's examples, I think you should ask them about the issue. Open up a ticket in their tracker.
@badeball the provided code is just an example. If you need from me to upload my own example, no problem. The question is if the "Common Steps" feature exists in version 11.0.0 for Cypress 10. If yes, does it have different syntax from version 4.3.1? If no, will it be implemented?
Thank you in advance.
These questions are answered in #689 (Upgrade guide from TheBrainFamily/cypress-cucumber-preprocessor
). TLDR: Yes, you can still have common steps.
I am quite confused, too, and I did not manage to get the common steps to work.
I might be able to help if you provide me a reproducible example, IE. a Git repo.
@uaru I have below snippet on my package.json
. My common step definitions are undercypress/e2e/common/
folder and feature specific steps are under sub folder on cypress/e2e/features/
.
"cypress-cucumber-preprocessor": {
"nonGlobalStepDefinitions": true,
"stepDefinitions": [
"cypress/e2e/common/*.{js,ts}",
"cypress/e2e/features/**/*.{js,ts}"
]
},
I am running into a situation where a global step is missing implementation in one test and another global step (in same file) is used in another test. Any idea on what I could be doing wrong? I added the file quite explicitly to the step definitions.
"stepDefinitions": [
"[filepath]/**/*.{js,ts}",
"[filepath].{js,ts}",
"cypress/features/global/**/*.{js,ts}",
"cypress/features/global/login.{js,ts}"
]
EDIT
I was able to figure out the issue. The one test imported from the file with the global steps and other did not import. I am using webpack. Hope this helps if anyone else runs into the issue.
@fras2560, you're making it impossible for me to help you. You have to show me an example that I can correct (and don't make it difficult by doing that with screenshots or large bodies of code, give me a cloneable repository that illustrates your folder structure).
Thank you, @tinu-harbr. I copied your snippet. I think I had something similar before, but this time it worked.
I extracted the configuration and example from my project, if anyone is interested.
Current behavior
I have downloaded the project of Alapan, from the following link: https://github.com/alapanme/Cypress-Automation I executed "login.feature" test scenario and is working fine.
I have added a common folder under the e2e folder and inside that I have add a common.js file. Inside common.js, I have import cucumber and added the first step from the scenario (meaning that this step does not exist anymore at login.js)
Executing the scenario again, this is what I get:
Desired behavior
This should be working, as it was working before Cypress 10
Test code to reproduce
Versions
Checklist
cypress-cucumber-preprocessor@4.3.1
(package name has changed and it is no longer the most recent version, see #689).