|
1 | 1 | Feature: filter spec |
2 | 2 |
|
3 | | - Scenario: 1 / 2 specs matching |
| 3 | + Background: |
4 | 4 | Given additional preprocessor configuration |
5 | 5 | """ |
6 | 6 | { |
7 | 7 | "filterSpecs": true |
8 | 8 | } |
9 | 9 | """ |
10 | | - And a file named "cypress/e2e/a.feature" with: |
11 | | - """ |
12 | | - @foo |
13 | | - Feature: some feature |
14 | | - Scenario: first scenario |
15 | | - Given a step |
16 | | - """ |
17 | | - And a file named "cypress/e2e/b.feature" with: |
18 | | - """ |
19 | | - @bar |
20 | | - Feature: some other feature |
21 | | - Scenario: second scenario |
22 | | - Given a step |
23 | | - """ |
24 | | - And a file named "cypress/support/step_definitions/steps.js" with: |
25 | | - """ |
26 | | - const { Given } = require("@badeball/cypress-cucumber-preprocessor"); |
27 | | - Given("a step", function() {}) |
28 | | - """ |
29 | | - When I run cypress with "--env tags=@foo" |
30 | | - Then it passes |
31 | | - And it should appear to not have ran spec "b.feature" |
| 10 | + |
| 11 | + Rule: it should filter features based on whether they contain a matching scenario |
| 12 | + |
| 13 | + Scenario: 1 / 2 specs matching |
| 14 | + Given a file named "cypress/e2e/a.feature" with: |
| 15 | + """ |
| 16 | + @foo |
| 17 | + Feature: some feature |
| 18 | + Scenario: first scenario |
| 19 | + Given a step |
| 20 | + """ |
| 21 | + And a file named "cypress/e2e/b.feature" with: |
| 22 | + """ |
| 23 | + @bar |
| 24 | + Feature: some other feature |
| 25 | + Scenario: second scenario |
| 26 | + Given a step |
| 27 | + """ |
| 28 | + And a file named "cypress/support/step_definitions/steps.js" with: |
| 29 | + """ |
| 30 | + const { Given } = require("@badeball/cypress-cucumber-preprocessor"); |
| 31 | + Given("a step", function() {}) |
| 32 | + """ |
| 33 | + When I run cypress with "--env tags=@foo" |
| 34 | + Then it passes |
| 35 | + And it should appear to not have ran spec "b.feature" |
| 36 | + |
| 37 | + Rule: non-feature specs should be filtered as if they have tags equalling the empty set |
| 38 | + |
| 39 | + Background: |
| 40 | + Given additional Cypress configuration |
| 41 | + """ |
| 42 | + { |
| 43 | + "e2e": { |
| 44 | + "specPattern": "**/*.{spec.js,feature}" |
| 45 | + } |
| 46 | + } |
| 47 | + """ |
| 48 | + And a file named "cypress/e2e/a.feature" with: |
| 49 | + """ |
| 50 | + @bar |
| 51 | + Feature: some feature |
| 52 | + Scenario: first scenario |
| 53 | + Given a step |
| 54 | + """ |
| 55 | + And a file named "cypress/support/step_definitions/steps.js" with: |
| 56 | + """ |
| 57 | + const { Given } = require("@badeball/cypress-cucumber-preprocessor"); |
| 58 | + Given("a step", function() {}) |
| 59 | + """ |
| 60 | + And a file named "cypress/e2e/b.spec.js" with: |
| 61 | + """ |
| 62 | + it("should work", () => {}); |
| 63 | + """ |
| 64 | + |
| 65 | + Scenario: logical not |
| 66 | + When I run cypress with "--env 'tags=not @foo'" |
| 67 | + Then it passes |
| 68 | + And it should appear to have ran spec "a.feature" and "b.spec.js" |
| 69 | + |
| 70 | + Scenario: not logical not |
| 71 | + When I run cypress with "--env tags=@bar" |
| 72 | + Then it passes |
| 73 | + And it should appear as if only a single test ran |
0 commit comments