-
Notifications
You must be signed in to change notification settings - Fork 3.3k
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Ability to define your own DSL in order to promote BDD (stimulate business and IT cooperation) #197
Comments
This has come up a few times before, but integration with cucumber isn't considerably straightforward and will likely end up creating a ton of indirection. Cypress isn't really a 1:1 replacement for e2e testing - it's able to do things much lower on the pyramid akin to unit tests. Because of that its not necessarily a great fit for cucumber. If you were only writing e2e tests, its possible it could work - but the majority of our users do things like mocking, stubbing, or yielding DOM objects directly and asserting on them. Can you provide some of your Cypress tests and the cucumber / gauge code you wish you could write? Having some examples would be helpful. You can also look at some of our example repos. How would those convert? |
My example would be:
In my spec file (pseduo code): feature(' Language Selection', function () {
beforeEach(function () {
cy.visit('http://myapplication.com')
})
scenario('User can view the application in French Canadian', function () {
given('I am on the login page', function () {
expect(language).to.be.equal('English')
})
when('When I switch language to "(*)"', function (lanuage) {
cy.get('#langSelector').value(language).click()
})
then('I should see welcome message as "(*)" in the login page', function (message) {
expect(api.langService).to.be.called
cy.get('#welcomeMessage')
.and('equal', message)
})
then('I click the log in button', function (message) {
cy.get('#loginButton').click()
})
then('the module title should equal "Panneau de contrôle"', function (message) {
cy.get('#moduleTitle')
.and('equal', message)
})
}) But then my hope, everything else would work just as it is marketed today. For my team, unfortunately, the BDD is a hard requirement. Also, even in the e2e testing, I'm hoping that there could be a capability of stubbing/mocking server-side code. We are exploring that to increase the speed of our testing at least in certain scenarios such as regression tests after code deployments but then run the exact same tests nightly or weekly without mocking. |
Is there any update on this issue? I'm really looking forward to bring my feature teams onboard with this solution, but as eaustin mentioned, BDD is part of our definition of done. |
This is not something that would go into Cypress core. These functions just appear as aliases around mocha's |
@paulpruteanu @eaustin @EddyBruin Hey guys! I made a plugin for this. Please give it a try and let me know what you think. https://github.com/TheBrainFamily/cypress-cucumber-preprocessor You can check a working example here: https://github.com/TheBrainFamily/cypress-cucumber-example @brian-mann I'd love an input from you, especially around the folder structure (which is hardcoded to support/spec_definitions/ now) Also, I probably abuse the plugin flow, maybe I should be somehow plugin this in your browserify, instead of calling it from my plugin. Anyway , I felt like those changes, even though breaking, would be easy to make, so people can start writing their tests already and adjust they plugin configuration/directory structure when needed |
@jennifer-shehane could you elaborate a bit more besides changing a label to wontfix? :) |
Hey @lgandecki cucumber-js already supports it, may be you need to do little processing in your code. |
@lgandecki We feel this is best solved through the plugin provided. We provide flexibility to Cypress so that it can be extended to fit users needs that are outside of Cypress' current roadmap. I'm closing this issue and suggest referring to https://github.com/TheBrainFamily/cypress-cucumber-preprocessor for use. If there are issues that come from the plugin usage, feel free to open a new issue for more closely integrated support. |
Currently it's possible to write scripts using mocha and chai style. However this is not a DSL to write more human friendly specs. Would be nice if Cypress would hve a DSL like cucumber or gauge
The text was updated successfully, but these errors were encountered: