Permalink
Show file tree
Hide file tree
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): scenarios are tagged with Feature, Capability and The…
…me tags affects: @serenity-js/cucumber, @integration/cucumber
- Loading branch information
Showing
5 changed files
with
120 additions
and
5 deletions.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
Feature: Serenity/JS recognises capabilities | ||
|
||
This feature file is nested in a 1-level deep directory structure. | ||
The name of the folder becomes the name of the Capability. | ||
|
||
Scenario: A passing scenario | ||
|
||
Given a step that passes | ||
|
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
Feature: Serenity/JS recognises capabilities and themes | ||
|
||
This feature file is nested in a 2-level deep directory structure. | ||
The name of the folder in which the feature file lives becomes the name of the Capability. | ||
The name of the folder in which the capability folder lives becomes the name of the Theme. | ||
|
||
Scenario: A passing scenario | ||
|
||
Given a step that passes | ||
|
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
import { expect, ifExitCodeIsOtherThan, logOutput } from '@integration/testing-tools'; | ||
import { SceneDescriptionDetected, SceneFinished, SceneTagged } from '@serenity-js/core/lib/events'; | ||
import { CapabilityTag, Description, ExecutionSuccessful, FeatureTag } 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([ | ||
'promise', | ||
'callback', | ||
'synchronous', | ||
]). | ||
it('recognises directories features are grouped in as capabilities', (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/example_capability/example.feature', | ||
). | ||
then(ifExitCodeIsOtherThan(0, logOutput)). | ||
then(res => { | ||
expect(res.exitCode).to.equal(0); | ||
|
||
Pick.from(res.events) | ||
.next(SceneTagged, event => expect(event.tag).to.equal(new CapabilityTag('example capability'))) | ||
.next(SceneTagged, event => expect(event.tag).to.equal(new FeatureTag('Serenity/JS recognises capabilities'))) | ||
; | ||
})); | ||
}); |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
import { expect, ifExitCodeIsOtherThan, logOutput } from '@integration/testing-tools'; | ||
import { SceneDescriptionDetected, SceneFinished, SceneTagged } from '@serenity-js/core/lib/events'; | ||
import { CapabilityTag, Description, ExecutionSuccessful, FeatureTag, ThemeTag } 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([ | ||
'promise', | ||
'callback', | ||
'synchronous', | ||
]). | ||
it('recognises directories that group capabilities as themes', (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/example_theme/example_capability/example.feature', | ||
). | ||
then(ifExitCodeIsOtherThan(0, logOutput)). | ||
then(res => { | ||
expect(res.exitCode).to.equal(0); | ||
|
||
Pick.from(res.events) | ||
.next(SceneTagged, event => expect(event.tag).to.equal(new ThemeTag('example theme'))) | ||
.next(SceneTagged, event => expect(event.tag).to.equal(new CapabilityTag('example capability'))) | ||
.next(SceneTagged, event => expect(event.tag).to.equal(new FeatureTag('Serenity/JS recognises capabilities and themes'))) | ||
; | ||
})); | ||
}); |
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