|
| 1 | +Feature: Tag parameters |
| 2 | + |
| 3 | + Background: |
| 4 | + Given a file named "step_definitions/steps.ts" with: |
| 5 | + """ts |
| 6 | + import * as assert from 'assert'; |
| 7 | + import {binding, then, ScenarioInfo} from 'cucumber-tsflow'; |
| 8 | +
|
| 9 | + @binding([ScenarioInfo]) |
| 10 | + class Steps { |
| 11 | + public constructor(private readonly scenario: ScenarioInfo) {} |
| 12 | +
|
| 13 | + @then("the flag {string} is enabled") |
| 14 | + public checkEnabled(name: string) { |
| 15 | + assert.ok(this.scenario.getFlag(name)) |
| 16 | + } |
| 17 | +
|
| 18 | + @then("the flag {string} is disabled") |
| 19 | + public checkDisabled(name: string) { |
| 20 | + assert.ok(!this.scenario.getFlag(name)) |
| 21 | + } |
| 22 | +
|
| 23 | + @then("the option tag {string} is set to {string}") |
| 24 | + public checkOption(name: string, value: string) { |
| 25 | + assert.strictEqual(this.scenario.getOptionTag(name), value); |
| 26 | + } |
| 27 | +
|
| 28 | + @then("the option tag {string} is unset") |
| 29 | + public checkOptionUnset(name: string) { |
| 30 | + assert.strictEqual(this.scenario.getOptionTag(name), undefined); |
| 31 | + } |
| 32 | +
|
| 33 | + @then("the attribute tag {string} is set to {}") |
| 34 | + @then("the attribute tag {string} is set to:") |
| 35 | + public checkAttributes(name: string, values: string) { |
| 36 | + assert.deepStrictEqual(this.scenario.getAttributeTag(name), JSON.parse(values)); |
| 37 | + } |
| 38 | +
|
| 39 | + @then("the attribute tag {string} is unset") |
| 40 | + public checkAttributesUnset(name: string) { |
| 41 | + assert.deepStrictEqual(this.scenario.getAttributeTag(name), undefined); |
| 42 | + } |
| 43 | + } |
| 44 | +
|
| 45 | + export = Steps; |
| 46 | + """ |
| 47 | + |
| 48 | + Scenario: Checking for an absent flag |
| 49 | + Given a file named "features/a.feature" with: |
| 50 | + """feature |
| 51 | + Feature: Feature |
| 52 | + Scenario: example |
| 53 | + Then the flag "enableFoo" is disabled |
| 54 | + """ |
| 55 | + When I run cucumber-js |
| 56 | + Then it passes |
| 57 | + |
| 58 | + Scenario: Checking for a flag on the feature |
| 59 | + Given a file named "features/a.feature" with: |
| 60 | + """feature |
| 61 | + @enableFoo |
| 62 | + Feature: Feature |
| 63 | + Scenario: One |
| 64 | + Then the flag "enableFoo" is enabled |
| 65 | + Scenario: Two |
| 66 | + Then the flag "enableFoo" is enabled |
| 67 | + """ |
| 68 | + When I run cucumber-js |
| 69 | + Then it passes |
| 70 | + |
| 71 | + Scenario: Checking for a flag on the scenario |
| 72 | + Given a file named "features/a.feature" with: |
| 73 | + """feature |
| 74 | + Feature: Feature |
| 75 | + @enableFoo |
| 76 | + Scenario: One |
| 77 | + Then the flag "enableFoo" is enabled |
| 78 | + Then the flag "enableBar" is disabled |
| 79 | + @enableBar |
| 80 | + Scenario: Two |
| 81 | + Then the flag "enableFoo" is disabled |
| 82 | + Then the flag "enableBar" is enabled |
| 83 | + """ |
| 84 | + When I run cucumber-js |
| 85 | + Then it passes |
| 86 | + |
| 87 | + Scenario: Checking for an absent option |
| 88 | + Given a file named "features/a.feature" with: |
| 89 | + """feature |
| 90 | + Feature: Feature |
| 91 | + Scenario: example |
| 92 | + Then the option tag "foo" is unset |
| 93 | + """ |
| 94 | + When I run cucumber-js |
| 95 | + Then it passes |
| 96 | + |
| 97 | + Scenario: Checking for an option on the feature |
| 98 | + Given a file named "features/a.feature" with: |
| 99 | + """feature |
| 100 | + @foo(bar) |
| 101 | + Feature: Feature |
| 102 | + Scenario: One |
| 103 | + Then the option tag "foo" is set to "bar" |
| 104 | + Scenario: Two |
| 105 | + Then the option tag "foo" is set to "bar" |
| 106 | + """ |
| 107 | + When I run cucumber-js |
| 108 | + Then it passes |
| 109 | + |
| 110 | + Scenario: Checking for an option on the scenario |
| 111 | + Given a file named "features/a.feature" with: |
| 112 | + """feature |
| 113 | + Feature: Feature |
| 114 | + @foo(bar) |
| 115 | + Scenario: One |
| 116 | + Then the option tag "foo" is set to "bar" |
| 117 | + @foo(baz) |
| 118 | + Scenario: Two |
| 119 | + Then the option tag "foo" is set to "baz" |
| 120 | + """ |
| 121 | + When I run cucumber-js |
| 122 | + Then it passes |
| 123 | + |
| 124 | + Scenario: Checking for an option on the scenario overriding one on the feature |
| 125 | + Given a file named "features/a.feature" with: |
| 126 | + """feature |
| 127 | + @foo(bar) |
| 128 | + Feature: Feature |
| 129 | + Scenario: One |
| 130 | + Then the option tag "foo" is set to "bar" |
| 131 | + @foo(baz) |
| 132 | + Scenario: Two |
| 133 | + Then the option tag "foo" is set to "baz" |
| 134 | + """ |
| 135 | + When I run cucumber-js |
| 136 | + Then it passes |
| 137 | + |
| 138 | + Scenario: Checking for an absent attribute tag |
| 139 | + Given a file named "features/a.feature" with: |
| 140 | + """feature |
| 141 | + Feature: Feature |
| 142 | + Scenario: example |
| 143 | + Then the attribute tag "foo" is unset |
| 144 | + """ |
| 145 | + When I run cucumber-js |
| 146 | + Then it passes |
| 147 | + |
| 148 | + Scenario: Checking for an attribute tag on the feature |
| 149 | + Given a file named "features/a.feature" with: |
| 150 | + """feature |
| 151 | + @foo({"bar":1}) |
| 152 | + Feature: Feature |
| 153 | + Scenario: One |
| 154 | + Then the attribute tag "foo" is set to { "bar": 1 } |
| 155 | + Scenario: Two |
| 156 | + Then the attribute tag "foo" is set to { "bar": 1 } |
| 157 | + """ |
| 158 | + When I run cucumber-js |
| 159 | + Then it passes |
| 160 | + |
| 161 | + Scenario: Checking for an attribute tag on the scenario |
| 162 | + Given a file named "features/a.feature" with: |
| 163 | + """feature |
| 164 | + Feature: Feature |
| 165 | + @foo({"bar":1}) |
| 166 | + Scenario: One |
| 167 | + Then the attribute tag "foo" is set to { "bar": 1 } |
| 168 | + @foo({"bar":2}) |
| 169 | + Scenario: Two |
| 170 | + Then the attribute tag "foo" is set to { "bar": 2 } |
| 171 | + """ |
| 172 | + When I run cucumber-js |
| 173 | + Then it passes |
| 174 | + |
| 175 | + Scenario: Checking for an attribute tag on the scenario overriding one on the feature |
| 176 | + Given a file named "features/a.feature" with: |
| 177 | + """feature |
| 178 | + @foo({"bar":1}) |
| 179 | + Feature: Feature |
| 180 | + Scenario: One |
| 181 | + Then the attribute tag "foo" is set to { "bar": 1 } |
| 182 | + @foo({"not-bar":2}) |
| 183 | + Scenario: Two |
| 184 | + Then the attribute tag "foo" is set to { "not-bar": 2 } |
| 185 | + """ |
| 186 | + When I run cucumber-js |
| 187 | + Then it passes |
0 commit comments