badeball / cypress-cucumber-preprocessor

Run cucumber/gherkin-syntaxed specs with Cypress
MIT License
1.32k stars 149 forks source link

Cannot provide Background steps for more than one Rule #652

Closed dpresiana closed 2 years ago

dpresiana commented 2 years ago

Current behavior

Adding more than one Background steps within one feature file, even when each Background is within different Rule section resolves in error

expected: #EOF, #TableRow, #DocStringSeparator, #StepLine, #TagLine, #ScenarioLine, #ScenarioOutlineLine, #Comment, #Empty, got 'Rule: ***'
(32:9): expected: #EOF, #TableRow, #DocStringSeparator, #StepLine, #TagLine, #ScenarioLine, #ScenarioOutlineLine, #Comment, #Empty, got 'Background:'

Desired behavior

Different Background steps should be supported within different Rule section. Cucumber documentation: https://cucumber.io/docs/gherkin/reference/#background

You can only have one set of Background steps per Feature or Rule. If you need different Background steps for different scenarios, consider breaking up your set of scenarios into more Rules or more Features.

Test code to reproduce

Feature: Test Multiple Backgrounds
      Rule: First Section
           Background: First Background
               Given: Do something for the first scenario

           Scenario: Test first section
                 When I do something 
                  ...

      Rule: Second Section
           Background: Second Background
               Given: Do something for the second scenario

           Scenario: Test second section
               When I do something 
                ...

Versions

irahov commented 2 years ago

It seems the real reason is that Rule: is not supported at all. See #143

amitguptagwl commented 2 years ago

@dpresiana You can probably try Cytorus which supports multiple rules. Check this for an example

badeball commented 2 years ago

Due to personal reasons, the previous maintainers of this package are stepping down and handing the reigns over to me, a long-time contributor to the project and a user of it myself. This is a responsibility I'm very excited about. Furthermore, I'd like to thank @lgandecki ++ for all the work that they've done so far.

Read more about the transfer of ownership here.

The repository has however moved and all outstanding issues are being closed. This is not a reflection of the perceived importance of your reported issue. However, if after upgrading to the new version, you still find there to be an issue, feel free to open up another ticket or comment below. Please make sure to read CONTRIBUTING.md before doing so.