|
1 | 1 | Feature: filter spec |
2 | 2 |
|
3 | 3 | Background: |
4 | | - Given additional preprocessor configuration |
| 4 | + Given additional Cypress configuration |
| 5 | + """ |
| 6 | + { |
| 7 | + "e2e": { |
| 8 | + "specPattern": "**/*.{spec.js,feature}" |
| 9 | + } |
| 10 | + } |
| 11 | + """ |
| 12 | + And additional preprocessor configuration |
5 | 13 | """ |
6 | 14 | { |
7 | 15 | "filterSpecs": true |
8 | 16 | } |
9 | 17 | """ |
| 18 | + And a file named "cypress/e2e/foo.feature" with: |
| 19 | + """ |
| 20 | + @foo |
| 21 | + Feature: some feature |
| 22 | + Scenario: first scenario |
| 23 | + Given a step |
| 24 | + """ |
| 25 | + And a file named "cypress/e2e/bar.feature" with: |
| 26 | + """ |
| 27 | + @bar |
| 28 | + Feature: some other feature |
| 29 | + Scenario: second scenario |
| 30 | + Given a step |
| 31 | + """ |
| 32 | + And a file named "cypress/support/step_definitions/steps.js" with: |
| 33 | + """ |
| 34 | + const { Given } = require("@badeball/cypress-cucumber-preprocessor"); |
| 35 | + Given("a step", function() {}) |
| 36 | + """ |
| 37 | + And a file named "cypress/e2e/baz.spec.js" with: |
| 38 | + """ |
| 39 | + it("should work", () => {}); |
| 40 | + """ |
10 | 41 |
|
11 | 42 | Rule: it should filter features based on whether they contain a matching scenario |
12 | 43 |
|
13 | 44 | 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 | 45 | When I run cypress with "--env tags=@foo" |
34 | 46 | Then it passes |
35 | | - And it should appear to not have ran spec "b.feature" |
| 47 | + And it should appear to not have ran spec "bar.feature" |
| 48 | + But it should appear to have ran spec "foo.feature" |
36 | 49 |
|
37 | | - Rule: non-feature specs should be filtered as if they have tags equalling the empty set |
| 50 | + Scenario: 2 / 2 specs matching |
| 51 | + When I run cypress with "--env tags=\"@foo or @bar\"" |
| 52 | + Then it passes |
| 53 | + And it should appear to have ran spec "foo.feature" and "bar.feature" |
| 54 | + |
| 55 | + Rule: filterSpecsMixedMode: hide (default) should hide non-feature specs regardless of tag expression |
| 56 | + |
| 57 | + Scenario: positive tag expression |
| 58 | + When I run cypress with "--env tags=@foo" |
| 59 | + Then it passes |
| 60 | + And it should appear to not have ran spec "baz.spec.js" |
| 61 | + |
| 62 | + Scenario: negative tag expression |
| 63 | + When I run cypress with "--env \"tags=not @foo\"" |
| 64 | + Then it passes |
| 65 | + And it should appear to not have ran spec "baz.spec.js" |
| 66 | + |
| 67 | + Rule: filterSpecsMixedMode: show should show non-feature specs regardless of tag expression |
38 | 68 |
|
39 | 69 | Background: |
40 | | - Given additional Cypress configuration |
| 70 | + Given additional preprocessor configuration |
41 | 71 | """ |
42 | 72 | { |
43 | | - "e2e": { |
44 | | - "specPattern": "**/*.{spec.js,feature}" |
45 | | - } |
| 73 | + "filterSpecsMixedMode": "show" |
46 | 74 | } |
47 | 75 | """ |
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: |
| 76 | + |
| 77 | + Scenario: positive tag expression |
| 78 | + When I run cypress with "--env tags=@foo" |
| 79 | + Then it passes |
| 80 | + And it should appear to have ran spec "baz.spec.js" |
| 81 | + |
| 82 | + Scenario: negative tag expression |
| 83 | + When I run cypress with "--env \"tags=not @foo\"" |
| 84 | + Then it passes |
| 85 | + And it should appear to have ran spec "baz.spec.js" |
| 86 | + |
| 87 | + |
| 88 | + Rule: filterSpecsMixedMode: empty-set should filter non-feature specs as if they have tags equalling the empty set |
| 89 | + |
| 90 | + Background: |
| 91 | + Given additional preprocessor configuration |
61 | 92 | """ |
62 | | - it("should work", () => {}); |
| 93 | + { |
| 94 | + "filterSpecsMixedMode": "empty-set" |
| 95 | + } |
63 | 96 | """ |
64 | 97 |
|
65 | | - Scenario: logical not |
66 | | - When I run cypress with "--env 'tags=not @foo'" |
| 98 | + Scenario: positive tag expression |
| 99 | + When I run cypress with "--env tags=@foo" |
67 | 100 | Then it passes |
68 | | - And it should appear to have ran spec "a.feature" and "b.spec.js" |
| 101 | + And it should appear to not have ran spec "baz.spec.js" |
69 | 102 |
|
70 | | - Scenario: not logical not |
71 | | - When I run cypress with "--env tags=@bar" |
| 103 | + Scenario: negative tag expression |
| 104 | + When I run cypress with "--env \"tags=not @foo\"" |
72 | 105 | Then it passes |
73 | | - And it should appear as if only a single test ran |
| 106 | + And it should appear to have ran spec "baz.spec.js" |
0 commit comments