-
-
Notifications
You must be signed in to change notification settings - Fork 149
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Update plugin to be compatible with Cypress 10 #722
Comments
Hey @admah, thanks for the heads up! |
@badeball I'm game for helping test the changes if you like :) |
This looks painful. Glad I have not updated to cypress 10.0 |
@admah can I confirm the current v4.3.1 is not supported for cypress > v10? |
@badeball, any idea how to resolve this issue since I just want to add this library into dev dependencies?
|
Version 10 just isn’t supported yet. No ETA. |
I can help with migrating the plugin to Cypress 10. The main challenge I see so far is that this plugin wants to write to We have code internally that does something like: updateCypressConfigWithField('e2e', { foo: 'bar' }) Which would do
Include parsing the module to an AST and handle all the edge cases, etc. We can expose a nice API to update the |
Hey, @lmiller1990, thanks for reaching out. I don't believe there's anything in the plugin that writes back to the config, but if it was, then such API as you describe would definitely be helpful. The biggest challenge will be updating badeball/cypress-configuration, which is a complete re-implementation of Cypress' configuration resolvement. As explained in its readme, this powers some other tools, including this preprocessor. Most helpful would be to expose an API for this and make |
I just did a quick scan and saw this
Interesting, I had not seen https://github.com/badeball/cypress-configuration. I'm not super clear on why this is necessary - if you can tell me what you want exposed, we can work on a nice way to expose it. The config resolution is complicated (ugh, too complicated, lol) so it's definitely better if we provide something, rather than try to reverse engineer it. |
Hi gays, as usual, yesterday updated the cypress as usually do when working with the project and I didn't expect so many changes at the same time. All my stuff has been migrated and all the folder structure has been changed which have done a big impact on my environment. |
I have tried some experimentations inside the code base to see exactly what is needed and I gathered the following:
The code based itself on the fact that integrationFolder is an absolute path, but e2e.specPattern is, a the name suggest, a pattern. I don't think Cypress team can help much, this is about rewriting completely the way .feature files paths are resolved. On my side I don't have the necessary knowledge about file resolutions to do a good job, if someone with more expertise can try it would be better. Please note that you can clone the two repositories and link them using npm link + enabling the file watch. |
I think all three of these can be solved in one go - I wonder if we can expose something in Cypress that gives plugins like cucumber whatever it needs. It sounds like this plugin just needs a list of specs. If this is written as a plugin, it should have access to |
I'm using Cypress v10.0.2 with cucumber preprocessor v4.x.x which works fine for me I just keep my stepdefinitions in "integration" folder and it doesn't matter where you keep your feature files if you use "specPattern" correctly |
I tried upgrading cypress to v10 with cucumber-preprocessor plugin (v10.0.2) Leaving my feature files in /e2e/ folder and the steps within the /integration/ The features are detected by cypress but when running it I end up with a "TypeError [ERR_INVALID_ARG_TYPE]: The "path" argument must be of type string. Received undefined" |
@danbord I'm using Take a look here: https://github.com/far11ven/Cypress-TestFramework/tree/develop/v10 |
I'm running 4.3.1 with Cypress 10 with everything in the e2e folder which seems to work fine as long as I add "stepDefinitions": "cypress/e2e" in package.json so I'll probably use the previous version of the preprocessor in this configuration until there's an update to this version so I can use it for component testing also. Commented here in case it would help anyone and to follow this issue. |
The fix @ericcmmi suggested is working great for me! |
I can't get @ericcmmi's solution working. When running a feature I get
which is surprising because I have no instance of the word 'integration' anywhere in my project. I'll follow along in case my situation is useful in diagnosis. I set stepDefinitions in package.json to "cypress/e2e". |
Here's my cypress-cucumber-preprocessor section. Adding that stepDefinitions line was the only change I made after going through all of the Cypress 10 recommended conversions.
|
Oh silly, I put the stepDefinitions outside the cypress-cucumber-preprocessor section. That's got me in a working state, thanks! |
Posting for reference, from badeball/cypress-configuration#2 (comment):
@lmiller1990 and @admah, can either of you comment on this? |
@badeball my recommendation would be to file an issue in the core repo outlining the problem here. That way, more users can see it, and the core team can address it accordingly. I definitely understand the ask and the importance of the feature request, but neither me or @lmiller1990 can unilaterally say how/when something like this could get done. |
In that case, can you perhaps open up cypress-io/cypress#9014 with a reference to my comment? I’ll be frank too, with you and everyone else here. I don’t at all expect you to expose anything to benefit v10 compatibility and that the configuration module need to be continued. Furthermore, I am well aware of what needs to be done and fully prepared to do the remaining work after @Anthony-Champagne-Wiztivi has been so kind and to start, I just haven’t gotten around to it yet. |
I'm more interested in exposing an API, not just for this plugin specifically, but for generally making it easier to build Cypress plugins. From what I'm seeing here, it's not too difficult to get this working with Cypress 10 as it stands - maybe we don't need to expose anything, after all. I'm guessing the reason the #9014 is a lot of work is less how much code we need to expose it, but more around the documentation/commitment to not breaking something that becomes part of the public API... |
FYI, for my part, you may very well consider it experimental and not subject to semver, as long as you also expose a version number enabling me to create conditions. |
@lmiller1990, I realize now that the mentioned Edit: Feel free to obscure the location of such member, as to make it apparent it not a member of the public API. |
@badeball not sure, but can look into it - with a bunch of things to fix around our latest release, I don't think it'll be something that happens in the next few weeks, since documented or not, we will need to consider the ramifications of exposing such an API. What is the main use case here? What field(s) do you need to add/remove? Maybe there's a more lightweight and simple way to do it in user land. |
Is it working fine then ? |
I have a function in my test called
.. but I can work around it. |
@bjoshi-codal it works for the e2e tests but not the component tests. I tried setting the stepDefinitions to cypress/component but it wouldn't run the tests in that configuration. |
@ericcmmi this got me closer, but I’m getting ‘step implementation missing’ error. My folder structure is: Feature file: e2e/myFirstTest.feature Can you share your file/folder structure within e2e, and the contents of your cypress.config.ts? EDIT: nevermind, I got it. I was one word off on the feature wording vs the spec wording. My test appears to work properly now with Cypress 10 and cypress-cucumber-preprocessor - at least so far. Thanks @ericcmmi |
I'm pleased to announce that I've published There's no changes to configuration options, but if your configuration looked like this pre-10 {
"stepDefinitions": [
"cypress/integration/[filepath].{js,ts}",
"cypress/support/step_definitions/**/*.{js,ts}"
]
} .. then it should look like this post-10 (notice the removal of {
"stepDefinitions": [
"[filepath].{js,ts}",
"cypress/support/step_definitions/**/*.{js,ts}"
]
} If you need help getting Please try it out and provide feedback here, both if it works and how it doesn't. |
Cucumber has a built in |
I said I don't want to clutter up the issue with nonsense, so the next person who comments on this issue about workarounds using the previous implementation / old versions is insta-banned from the issue tracker. |
Feedback: After following #722 (comment)
|
Is any change required to generate XRAY report with Cypress 10 and @badeball/[email protected]? |
Got it to work too with rc1 and cypress 10.1. Thank you @badeball & @Anthony-Champagne-Wiztivi! |
RC1 has been published as v11.0.0 and support for 10 officially (and finally) added, hence closing. |
@badeball the release notes says "Added support for Cypress v11" cypress v11 isn't out right now, is that right? |
I think it's "v11 of this plugin supports Cypress v10" 👍 |
If we decide to use Oldschool/Legacy Cucumber style, is it works too? |
I doubt it, but why would you? |
To reorganize the features in our own way and not necessarily put them in the E2E folder
|
On a completely general note I would say that you should never refrain from updating in order to achieve something and you certainly won’t get any support when doing so. |
Hello 👋 I'm writing on behalf of the Cypress DX team. We wanted to notify you that some changes may need to be made to this plugin to ensure that it works in Cypress 10.
For more information, here is our official plugin update guide.
--
Note from @badeball (12.06.22):
v11.0.0-rc1
compatible with Cypress 10 is relased, ref. #722 (comment).The text was updated successfully, but these errors were encountered: