Step definitions with the same expression but different keyword conflict with each other. Seems that the first one that is defined in the file is the one that's used while running the tests.
For example, given these two step definitions,
Given("the user is authenticated", function () {
// code to set up user authentication
});
// Later in the file, this next `Then` is defined for a different scenario
Then("the user is authenticated", function () {
// code that checks the user is authenticated
});
Clearly, the above step definitions run significantly different code. However, when both are defined in the same file, the first one (Given), is always run for all scenarios with any step with the text "the user is authenticated".
Desired behavior
Each step definition should only run for the keyword it is defined with.
Current behavior
Step definitions with the same expression but different keyword conflict with each other. Seems that the first one that is defined in the file is the one that's used while running the tests.
For example, given these two step definitions,
Clearly, the above step definitions run significantly different code. However, when both are defined in the same file, the first one (
Given
), is always run for all scenarios with any step with the text"the user is authenticated"
.Desired behavior
Each step definition should only run for the keyword it is defined with.
Test code to reproduce
https://github.com/aryzing/repro-cypress-cucumber-preprocessor-same-name-bug
Versions