Skip to content

Commit fe4f137

Browse files
sawasawasawalgandecki
authored andcommitted
Bug/inherit feature tags (#176)
feat: Inherit feature tags for expression evaluation
1 parent 788946d commit fe4f137

File tree

3 files changed

+21
-1
lines changed

3 files changed

+21
-1
lines changed
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
@inherited-tag
2+
Feature: Tags Implementation
3+
4+
As a cucumber user I can use tag expression using both feature and scenario tags
5+
6+
@own-tag
7+
Scenario: This scenario should run if @inherited-tag and @own-tag is present in env
8+
Given '@inherited-tag and @own-tag' is in current TAGS environmental variable
9+
Then this should run

lib/createTestsFromFeature.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ const createTestsFromFeature = parsedFeature => {
2020
section =>
2121
section.tags &&
2222
section.tags.length &&
23-
shouldProceedCurrentStep(section.tags)
23+
shouldProceedCurrentStep(section.tags.concat(featureTags))
2424
);
2525
} else if (!sectionsWithTagsExist) {
2626
everythingShouldRun = true;

lib/resolveStepDefinition.test.js

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,17 @@ describe("Tags implementation", () => {
9797
);
9898
});
9999

100+
describe("Tags inheritance", () => {
101+
window.Cypress = {
102+
env: () => "@inherited-tag and @own-tag"
103+
};
104+
require("../cypress/support/step_definitions/tags_implementation_with_env_set");
105+
106+
createTestsFromFeature(
107+
readAndParseFeatureFile("./cypress/integration/TagsInheritance.feature")
108+
);
109+
});
110+
100111
describe("Tags with env TAGS set", () => {
101112
window.Cypress = {
102113
env: () => "@test-tag and not @ignore-tag"

0 commit comments

Comments
 (0)