Permalink
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
feat(cucumber): cucumber adapter reports pending scenarios
affects: @integration/cucumber
- Loading branch information
Showing
with
95 additions
and 19 deletions.
- +10 −0 integration/cucumber/features/pending_scenarios.feature
- +2 −6 integration/cucumber/features/step_definitions/callback.steps.ts
- +2 −6 integration/cucumber/features/step_definitions/promise.steps.ts
- +2 −6 integration/cucumber/features/step_definitions/synchronous.steps.ts
- +1 −1 integration/cucumber/spec/recognises_descriptions.ts
- +78 −0 integration/cucumber/spec/recognises_pending_scenarios.spec.ts
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@@ -0,0 +1,10 @@ | ||
Feature: Serenity/JS recognises pending scenarios | ||
|
||
Scenario: A scenario with steps marked as pending | ||
|
||
Given a step that's marked as pending | ||
|
||
Scenario: A scenario with steps that have not been implemented yet | ||
|
||
Given a step that hasn't been implemented yet | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@@ -0,0 +1,78 @@ | ||
import { expect, ifExitCodeIsOtherThan, logOutput } from '@integration/testing-tools'; | ||
import { | ||
ActivityFinished, | ||
ActivityStarts, | ||
SceneFinished, | ||
SceneStarts, | ||
SceneTagged, | ||
TestRunnerDetected, | ||
} from '@serenity-js/core/lib/events'; | ||
import { FeatureTag, ImplementationPending, Name } from '@serenity-js/core/lib/model'; | ||
|
||
import 'mocha'; | ||
import { given } from 'mocha-testdata'; | ||
|
||
import { cucumber, Pick } from '../src'; | ||
|
||
describe('@serenity-js/cucumber', function() { | ||
|
||
this.timeout(5000); | ||
|
||
given([ | ||
'synchronous', | ||
'promise', | ||
'callback', | ||
]). | ||
it(`recognises a pending scenario where some steps are marked as 'pending'`, (stepInterface: string) => | ||
cucumber( | ||
'--require', 'features/support/configure_serenity.ts', | ||
'--require', `features/step_definitions/${ stepInterface }.steps.ts`, | ||
'--require', 'node_modules/@serenity-js/cucumber/register.js', | ||
'features/pending_scenarios.feature', | ||
'--name', 'A scenario with steps marked as pending', | ||
). | ||
then(ifExitCodeIsOtherThan(0, logOutput)). | ||
then(res => { | ||
expect(res.exitCode).to.equal(0); | ||
|
||
expect(res.events).to.have.lengthOf(6); | ||
|
||
Pick.from(res.events) | ||
.next(SceneStarts, event => expect(event.value.name).to.equal(new Name('A scenario with steps marked as pending'))) | ||
.next(TestRunnerDetected, event => expect(event.value).to.equal(new Name('Cucumber'))) | ||
.next(SceneTagged, event => expect(event.tag).to.equal(new FeatureTag('Serenity/JS recognises pending scenarios'))) | ||
.next(ActivityStarts, event => expect(event.value.name).to.equal(new Name(`Given a step that's marked as pending`))) | ||
.next(ActivityFinished, event => expect(event.outcome).to.equal(new ImplementationPending())) | ||
.next(SceneFinished, event => expect(event.outcome).to.equal(new ImplementationPending())) | ||
; | ||
})); | ||
|
||
given([ | ||
'synchronous', | ||
'promise', | ||
'callback', | ||
]). | ||
it(`recognises a pending scenario where some steps are marked as 'pending'`, (stepInterface: string) => | ||
cucumber( | ||
'--require', 'features/support/configure_serenity.ts', | ||
'--require', `features/step_definitions/${ stepInterface }.steps.ts`, | ||
'--require', 'node_modules/@serenity-js/cucumber/register.js', | ||
'features/pending_scenarios.feature', | ||
'--name', 'A scenario with steps that have not been implemented yet', | ||
). | ||
then(ifExitCodeIsOtherThan(0, logOutput)). | ||
then(res => { | ||
expect(res.exitCode).to.equal(0); | ||
|
||
expect(res.events).to.have.lengthOf(6); | ||
|
||
Pick.from(res.events) | ||
.next(SceneStarts, event => expect(event.value.name).to.equal(new Name('A scenario with steps that have not been implemented yet'))) | ||
.next(TestRunnerDetected, event => expect(event.value).to.equal(new Name('Cucumber'))) | ||
.next(SceneTagged, event => expect(event.tag).to.equal(new FeatureTag('Serenity/JS recognises pending scenarios'))) | ||
.next(ActivityStarts, event => expect(event.value.name).to.equal(new Name(`Given a step that hasn't been implemented yet`))) | ||
.next(ActivityFinished, event => expect(event.outcome).to.equal(new ImplementationPending())) | ||
.next(SceneFinished, event => expect(event.outcome).to.equal(new ImplementationPending())) | ||
; | ||
})); | ||
}); |