Writing test cases using Cypress and Cucumber.
I have a few test cases written in Cucumber Syntax like following:
@focus
Scenario: All Accessibility tabs (Color scheme, Font size, Zoom) are visible when a user configures navigation.show_accessibility to be true
Given Set navigation.show_accessibility to true
When Trigger Accessibility configuration window
Then Accessibility window has three tabs
@focus
Scenario: All Accessibility tabs (Color scheme, Font size, Zoom) are visible when a user configures navigation.show_accessibility to be false
Given Set navigation.show_accessibility to false
When Trigger Accessibility configuration window
Then Accessibility window has three tabs
As we can see, among the two test cases, there are two testing steps that is present in all of them.
In implementation files, it is a better practice to group steps that belong to a test case together in the same order as they are in the Cucumber file. In my case, I would have something similar to this:
//All Accessibility tabs (Color scheme, Font size, Zoom) are visible when a user configures navigation.show_accessibility to be true
Given('Set navigation.show_accessibility to true', () => {
});
When('Trigger Accessibility configuration window', () => {
});
Then('Accessibility window has three tabs', () => {
});
//All Accessibility tabs (Color scheme, Font size, Zoom) are visible when a user configures navigation.show_accessibility to be false
Given('Set navigation.show_accessibility to false', () => {
});
When('Trigger Accessibility configuration window', () => {
});
Then('Accessibility window has three tabs', () => {
});
As we can see, I would end up with a few identical step implementations in my file. My question is:
- How do I organize my implementation steps in a logical manner as in its Cucumber and not have any duplicated steps in my implementation file?