forked from Klaveness-Digital/cypress-cucumber-preprocessor
-
-
Notifications
You must be signed in to change notification settings - Fork 153
Closed
Description
Current behavior
Step definitions can be defined with Given
, When
, Then
, And
and But
- see
cypress-cucumber-preprocessor/lib/index.ts
Lines 65 to 71 in b629567
export { | |
defineStep as Given, | |
defineStep as When, | |
defineStep as Then, | |
defineStep as And, | |
defineStep as But, | |
}; |
Desired behavior
Step definitions can be defined with Given
, When
and Then
. This is what Cucumber.js does: https://github.com/cucumber/cucumber-js/blob/01368ca6e3c9b097a7a88bb72de5beeddb4a0326/src/index.ts#L45-L51
Here is an example illustrating why:
Feature: banking
Scenario: Overdraft
Given I have an overdraft limit of 50
And I have a balance of 300
When I withdraw 330
Then my balance should be -30
With the currentl API, people might implement step definitions this way:
Given('I have an overdraft limit of {int}')
And('I have a balance of {int}')
But what if I add a new scenario:
Scenario: No overdraft
Given I have a balance of 300
When I withdraw 330
Then my balance should be 300
And I should be told my overdraft limit is 0
It no longer makes sense that the step defnition is defined with And
.
The And
and But
keywords only belong in Gherkin. Step definitions are reusable in any order, and should therefore not use And
and But
.
Checklist
- I've read the FAQ.
- I've read Instructions for logging issues.
- I'm not using
[email protected]
(package name has changed and it is no longer the most recent version, see #689).
Metadata
Metadata
Assignees
Labels
No labels