-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Showing
8 changed files
with
141 additions
and
0 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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
'use strict'; | ||
|
||
/** | ||
* The StepGroups precompiler is responsible | ||
* for setting the correct keywords for steps to make scenarios readable | ||
* @class | ||
* @extends DefaultConfig | ||
*/ | ||
|
||
class StepGroups { | ||
onScenario(scenario) { | ||
scenario.useReadableStepKeywords(); | ||
} | ||
|
||
onScenarioOutline(scenarioOutline) { | ||
scenarioOutline.useReadableStepKeywords(); | ||
} | ||
|
||
onBackground(background) { | ||
background.useReadableStepKeywords(); | ||
} | ||
} | ||
|
||
module.exports = StepGroups; |
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,24 @@ | ||
# StepGroups for Gherkin precompiler | ||
|
||
The StepGroups precompiler is responsible for correcting the gherkin keywords of steps to make the tests more readable. | ||
|
||
Example: | ||
```gherkin | ||
Given the page is opened | ||
Given the settings are deleted | ||
When the settings menu item is clicked | ||
When the advanced settings link is clicked | ||
Then the advanced settings should be loaded | ||
Then the basic settings link should be visible | ||
``` | ||
It will be modified to: | ||
|
||
```gherkin | ||
Given the page is opened | ||
And the settings are deleted | ||
When the settings menu item is clicked | ||
And the advanced settings link is clicked | ||
Then the advanced settings should be loaded | ||
And the basic settings link should be visible | ||
``` | ||
|
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
'use strict'; | ||
const path = require('path'); | ||
const StepGroups = require(path.resolve('lib/builtIn/StepGroups.js')); | ||
const expect = require('chai').expect; | ||
const API = require(path.resolve('lib')); | ||
|
||
describe('builtIn.StepGroups', () => { | ||
it('should be available through API', () => { | ||
expect(API.builtIn.StepGroups).to.equal(StepGroups); | ||
}); | ||
|
||
it('should process feature files with default config', () => { | ||
const baseAst = API.load('test/data/input/stepGroups.feature'); | ||
const expectedAst = API.load('test/data/output/stepGroups.feature'); | ||
const resultAst = API.process(baseAst, new StepGroups()); | ||
|
||
expect(resultAst).to.eql(expectedAst); | ||
}); | ||
|
||
}); |
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 @@ | ||
Feature: Test for stepGroups | ||
|
||
Background: | ||
Given step | ||
Given step | ||
When step | ||
And step | ||
When step | ||
Then step | ||
Then step | ||
And step | ||
|
||
Scenario: Test | ||
Given step | ||
Given step | ||
When step | ||
And step | ||
When step | ||
Then step | ||
Then step | ||
And step | ||
|
||
Scenario Outline: Test (<test>) | ||
Given step | ||
Given step | ||
When step | ||
And step | ||
When step | ||
Then step | ||
Then step | ||
And step | ||
|
||
Examples: | ||
| test | | ||
| test | |
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 @@ | ||
Feature: Test for stepGroups | ||
|
||
Background: | ||
Given step | ||
And step | ||
When step | ||
And step | ||
And step | ||
Then step | ||
And step | ||
And step | ||
|
||
Scenario: Test | ||
Given step | ||
And step | ||
When step | ||
And step | ||
And step | ||
Then step | ||
And step | ||
And step | ||
|
||
Scenario Outline: Test (<test>) | ||
Given step | ||
And step | ||
When step | ||
And step | ||
And step | ||
Then step | ||
And step | ||
And step | ||
|
||
Examples: | ||
| test | | ||
| test | |