Skip to content
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

Support to imperatively skip scenario Fixes #873 #912

Merged
merged 6 commits into from
Sep 23, 2017
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
61 changes: 61 additions & 0 deletions features/skipped_steps.feature
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
Feature: Skipped steps

Background:
Given a file named "features/skipped.feature" with:
"""
Feature: a feature
Scenario: a scenario
Given a skipped step
"""

Scenario: Synchronous pending step
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

pending -> skipped

Given a file named "features/step_definitions/skipped_steps.js" with:
"""
import {defineSupportCode} from 'cucumber'

defineSupportCode(({Given}) => {
Given(/^a skipped step$/, function() {
return 'skipped'
})
})
"""
When I run cucumber.js
Then it passes
And the step "a skipped step" has status "skipped"


Scenario: Callback pending step
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

pending -> skipped

Given a file named "features/step_definitions/skipped_steps.js" with:
"""
import {defineSupportCode} from 'cucumber'

defineSupportCode(({Given}) => {
Given(/^a skipped step$/, function(callback) {
callback(null, 'skipped')
})
})
"""
When I run cucumber.js
Then it passes
And the step "a skipped step" has status "skipped"

Scenario: Promise pending step
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

pending -> skipped

Given a file named "features/step_definitions/skipped_steps.js" with:
"""
import {defineSupportCode} from 'cucumber'

defineSupportCode(({Given}) => {
Given(/^a skipped step$/, function(){
return {
then: function(onResolve, onReject) {
setTimeout(function() {
onResolve('skipped')
})
}
}
})
})
"""
When I run cucumber.js
Then it passes
And the step "a skipped step" has status "skipped"
4 changes: 3 additions & 1 deletion src/runtime/step_runner.js
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,9 @@ async function run({

const testStepResult = { duration: endTiming() }

if (result === 'pending') {
if (result === 'skipped') {
testStepResult.status = Status.SKIPPED
} else if (result === 'pending') {
testStepResult.status = Status.PENDING
} else if (error) {
testStepResult.exception = error
Expand Down