Comments (17)
I would love to have a way to write specs that are 'Pending' in the sense of a 'TODO: Write this step'. The following is what Cypress does with Mocha tests:
describe('My First Test', function () {
// Runs and passes
it('Does something at least!', function () {
expect(true).to.equal(true)
})
// Runs and passes
it('Does nothing', function () {
})
// Is skipped, using Mocha function
it('Skips', function () {
this.skip()
})
// Is also skipped, by having no function
it('Some other step for later')
// Runs despite the skip() above
it('Does the last step', function () {
expect(true).to.equal(true)
})
})
The 2 skipped steps are reported in the pale blue highlight in the log panel and the final step runs.
So, given this feature:
Feature: My First Test
As a user I want test the Cypress syntax
Scenario: Start first app
Given I start the app
Then Does something at least!
Then Some other step for later
Then Skips
Then Does the last step
And this step def:
Given('I start the app', () => {
Then(`Does something at least!`, () => {
expect(true).to.equal(true);
})
Then(`Some other step for later`)
Then(`Skips`, function () {
this.skip()
})
Then(`Does the last step`, () => {
expect(true).to.equal(true);
})
})
Then('Some other step for later')
(no function) throws an error Error: Step implementation missing for: Some other step for later
. Removed it and ran again.
This does tell Cypress to skip:
Then('Skips', function () {
this.skip()
})
ie it displays the pale blue "skipped" style, but it also prevents any further steps from running (unlike the Mocha test above which executed the remaining step).
If I change it to this:
Then('Skips', function () {
//this.skip()
})
all steps run (and the Log entries are after 2 Passing assertions). The 'Skips' step is just logged.
If I remove that Then('Skips'...
step altogether the 2 passing assertions run (and the Log entries are after 2 Passing assertions).
So, in Mocha / Cypress, the this.skip()
can be used inside the step definition as a "To do later". In this cypress-cucumber-preprocessor we can use this.skip()
but the outcome is any steps following are not run.
Are my assumptions correct here and is there any way we can have this.step()
behave here as it does in Mocha / Cypress?
Thanks. It is just a small thing but would be great to have it work so we can visually see which feature steps are not yet implemented.
Cheers,
Murray
from cypress-cucumber-preprocessor.
I see what you are saying and I would love to have that as well, but at this moment I don't see a way to achieve that, as Cypress forces us to treat all steps as one test. you can try to introduce a warning instead of the this.skip but that will be easy to miss for example in the CI (which is the point of pending tests as far as I understand).
I think we would need some changes in the cypress runner here, possibly around the way they deal with loging.
This is something I was hoping to look at in November.
from cypress-cucumber-preprocessor.
Any update here?
My use case is the following:
I want to mark tests, which are not implemented yet, so that they do not break the CI build.
The idea was to give a custom tag and then, in the before hook, skip the whole scenario.
Of course, I would be possible to ignore the scenarios with those tags, but it would be nice to still have the steps in the cucumber report. That's why I would prefer to have them skipped.
Is there a way to do that? I came up with an approach like that, but I can not seem to get it running:
Before({ tags: '@manual' }, function() { console.log('In before hook'); this.skip(); // return 'skipped'; });
Is there a way to achieve that right now?
from cypress-cucumber-preprocessor.
Due to personal reasons, the previous maintainers of this package are stepping down and handing the reigns over to me, a long-time contributor to the project and a user of it myself. This is a responsibility I'm very excited about. Furthermore, I'd like to thank @lgandecki ++ for all the work that they've done so far.
Read more about the transfer of ownership here.
The repository has however moved and all outstanding issues are being closed. This is not a reflection of the perceived importance of your reported issue. However, if after upgrading to the new version, you still find there to be an issue, feel free to open up another ticket or comment below. Please make sure to read CONTRIBUTING.md before doing so.
from cypress-cucumber-preprocessor.
I think this is more of a cypress / mocha thing - what happens if you put this.skip() inside your step definition?
from cypress-cucumber-preprocessor.
It just skips it, and the test itself marks as passing (if only skipped steps are left)
I've tried to throw an error saying "Step pending" or just not write the step until I get to it, but both cases, it seems to override the entire test ,Cypress doesn't show the other steps that were executed before. i.e. I have a step that is pending, where I just do an 'assert.isTrue(false)'. The error emerges, but it does not show the previous steps
from cypress-cucumber-preprocessor.
return this.pending();
would be how to to it in mocha, but how to get this to be the right context from a step definition.
this.skip() does not work for me
from cypress-cucumber-preprocessor.
OK. All good. Just as long as it is on the radar!
Thanks,
Murray
from cypress-cucumber-preprocessor.
Hello - any updates on the development of this feature?
from cypress-cucumber-preprocessor.
This feature would be awesome... right now, not being able to set a scenario as "pending" with cucumber is what's hindering me from using cypress...
from cypress-cucumber-preprocessor.
Any update on this?
from cypress-cucumber-preprocessor.
It is a good feature to have. As right now, the result table of the test show pending
from cypress-cucumber-preprocessor.
Anyone here found a way to achieve the desired behaviour?
from cypress-cucumber-preprocessor.
I have used cucumber with Java and to acheive this you throw a PendingException() is there a similar concept that can be used here?
from cypress-cucumber-preprocessor.
While this doesn't address the bigger issue, this is helpful: https://github.com/cypress-io/cypress-skip-test
eg:
Then('Skip this test', () => { cy.skipOn(true) });
from cypress-cucumber-preprocessor.
hi! when using this.skip()
I get empty.cucumber.json
generated instead of some meaningful data, does anyone experiences the same?
versions
"cypress": "^9.0.0",
"cypress-cucumber-preprocessor": "^4.3.0",
config
"cypress-cucumber-preprocessor": {
"nonGlobalStepDefinitions": true,
"cucumberJson": {
"generate": true,
"outputFolder": "cypress/cucumber-json",
"filePrefix": "",
"fileSuffix": ".cucumber"
}
}
from cypress-cucumber-preprocessor.
While this doesn't address the bigger issue, this is helpful: https://github.com/cypress-io/cypress-skip-test eg:
Then('Skip this test', () => { cy.skipOn(true) });
Yeah i use the skip-test plugin too.
And in CLI the testcases with the cy.skipOn("true") are marked as pending.
but in my json file is every expected "status": "pending"
testcase missing.
from cypress-cucumber-preprocessor.
Related Issues (20)
- When running a mixed set of specs, test reports exclude the test results of non-cucumber specs HOT 1
- Error: Unexpected state in afterSpecHandler when chrome browser crashes HOT 2
- config cypress js HOT 1
- parallel run HOT 1
- Useless logs after each step with cypress-if HOT 1
- is it possible to generate multiple cucumber json file HOT 1
- Json & HTML report are not generated HOT 3
- IParameterTypeDefinition should have parameter "transformer" set to optional HOT 2
- Dependency on Deprecated Version of reflect-metadata in @cucumber/[email protected] HOT 2
- Run with tag is not working on Windows 11 but in MacOs yes HOT 2
- Allure result is failed to be generated when use allure-cypress HOT 1
- Unexpected state in afterSpecHandler after an AssertionError and after each hook throws CypressError when trying to invoke cy.task() HOT 2
- explicit user configuration is not loaded in 20.0.5 HOT 6
- Error: Unexpected state in afterSpecHandler: step-finished HOT 7
- Stack trace is not working HOT 1
- Cypress-cucumber-preprocessor with Cypress-split HOT 3
- Enhancement request: remove reversal of After hooks order HOT 2
- @bahmutov/cypress-esbuild-preprocessor not installed with v20.0.5, 'Quick start' guide out of date? HOT 2
- [filepath] not including subfolders in resolution HOT 2
- Error on node_modules/@badeball/cypress-cucumber-preprocessor/dist/registry.js: HOT 7
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from cypress-cucumber-preprocessor.