You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
TLDR: Reduce duplication, confusion, and non-deterministic code.
Currently our version of cypress-cucumber-preprocessor is far outdated and has some inherent deficiencies which required structuring the tests in a non-intuitive fashion.
This ticket is to update the preprocessor to the latest version (Note: the project maintainer changed hands a while ago and it's now @badeball/cypress-cucumber-preprocessor) and refactor the test cases to follow best practices where ideal.
There have been several breaking changes in the preprocessor and the version is now at v20.0.5 while we are at v4. We don't need to upgrade to the latest version but we should at the very least update to a version that allows us to have a sane directory structure.
Newer versions follow a well defined approach for matching step definitions:
We currently have several duplicated step definitions, in the version we're using the preprocessor uses the first step definition it finds and ignores the rest, however looking statically at the code a developer would have no idea which definition to update in order make changes, nor know which ones not to change in order not to break something.
In later versions the preprocessor was updated to explicitly disallow step definitions from having duplicates-- this is the approach that cucumber itself follows (https://cucumber.io/docs/community/faq/?lang=java#duplicate-step-definition). Note this applies across defineStep types ('Given', 'Then' etc).
Note:
From version 13.0.0 onward support for AND and BUT is removed.
Update the config and pattern matching for the preprocessor -- pull it out of package.json
Restructure features so they live in the same folder as their isolated step definition js
Move the location of common cross cutting step definitions
Deduplicate step definitions and move common ones to the same location
If a step should preferably keep the same gherkin but it has different logic for a specific component then the function itself should be abstracted and overridden
Nitty Gritty
Identical Step Definition Text and Functions
common/index.js identical duplications:
Given('trial info displays {string}', (infoText) => {...}):
Identical step definition text, differing function definition
The following are areas for potential abstraction where the step definition text is the same but the logic is different. The text should either be updated to be something different, or the function should be made non-anonymous and overridden where necessary.
Given('{string} no trial info is displayed', (noTrialsText) => {...}):
* Update the preprocessor
* Update the config and pattern matching for the preprocessor -- pull it out of package.json
* Restructure features so they live in the same folder as their isolated step defintions
* Move the location of common cross cutting step definitions
* Deduplicate step definitions and move common ones to the same location
Closes#629
* Update the preprocessor
* Update the config and pattern matching for the preprocessor -- pull it out of package.json
* Restructure features so they live in the same folder as their isolated step defintions
* Move the location of common cross cutting step definitions
* Deduplicate step definitions and move common ones to the same location
Closes#629
TLDR: Reduce duplication, confusion, and non-deterministic code.
Currently our version of cypress-cucumber-preprocessor is far outdated and has some inherent deficiencies which required structuring the tests in a non-intuitive fashion.
This ticket is to update the preprocessor to the latest version (Note: the project maintainer changed hands a while ago and it's now @badeball/cypress-cucumber-preprocessor) and refactor the test cases to follow best practices where ideal.
There have been several breaking changes in the preprocessor and the version is now at v20.0.5 while we are at v4. We don't need to upgrade to the latest version but we should at the very least update to a version that allows us to have a sane directory structure.
Newer versions follow a well defined approach for matching step definitions:
https://github.com/badeball/cypress-cucumber-preprocessor/blob/master/docs/step-definitions.md
Note:
We currently have several duplicated step definitions, in the version we're using the preprocessor uses the first step definition it finds and ignores the rest, however looking statically at the code a developer would have no idea which definition to update in order make changes, nor know which ones not to change in order not to break something.
In later versions the preprocessor was updated to explicitly disallow step definitions from having duplicates-- this is the approach that cucumber itself follows (https://cucumber.io/docs/community/faq/?lang=java#duplicate-step-definition). Note this applies across defineStep types ('Given', 'Then' etc).
Note:
From version 13.0.0 onward support for AND and BUT is removed.
badeball/cypress-cucumber-preprocessor#821
See Release Notes for v13.0.0 https://github.com/badeball/cypress-cucumber-preprocessor/releases
Sub-Tasks
Nitty Gritty
Identical Step Definition Text and Functions
common/index.js identical duplications:
Given('trial info displays {string}', (infoText) => {...}):
Given('the criteria table displays the following', (dataTable) => {...}):
When('user clicks on Modify Search Criteria button', () => {...}):
locationSection.js identical duplications:
Given('trial info displays {string}', (infoText) => {...}):
Given('the criteria table displays the following', (dataTable) => {...}):
When('user clicks on Modify Search Criteria button', () => {...}):
common/MetaTags.js identical duplications:
Then('the title tag should be {string}', (expectedTitle) => {...}):
Identical step definition text, differing function definition
The following are areas for potential abstraction where the step definition text is the same but the logic is different. The text should either be updated to be something different, or the function should be made non-anonymous and overridden where necessary.
Given('{string} no trial info is displayed', (noTrialsText) => {...}):
Given('text {string} is displayed', (text) => {...}):
Given('search criteria table is not displayed', () => {...}):
When('user clicks on {int} trial link', (resItemIndex) => {...}):
When('user clicks on {string} section of accordion', (section) => {...}):
The text was updated successfully, but these errors were encountered: