11/* eslint-disable global-require */
22/* global jest */
3- const fs = require ( "fs" ) ;
4- const { Parser } = require ( "gherkin" ) ;
3+ const { readAndParseFeatureFile } = require ( "./setup" ) ;
54const { createTestsFromFeature } = require ( "./createTestsFromFeature" ) ;
6- const {
7- defineParameterType,
8- defineStep,
9- when,
10- then,
11- given,
12- and,
13- but
14- } = require ( "./resolveStepDefinition" ) ;
15-
16- window . defineParameterType = defineParameterType ;
17- window . when = when ;
18- window . then = then ;
19- window . given = given ;
20- window . and = and ;
21- window . but = but ;
22- window . defineStep = defineStep ;
23- window . cy = {
24- log : jest . fn ( )
25- } ;
26-
27- window . Cypress = {
28- env : jest . fn ( )
29- } ;
30-
31- const readAndParseFeatureFile = featureFilePath => {
32- const spec = fs . readFileSync ( featureFilePath ) ;
33- return new Parser ( ) . parse ( spec . toString ( ) ) ;
34- } ;
355
366describe ( "Scenario Outline" , ( ) => {
377 require ( "../cypress/support/step_definitions/scenario_outline_integer" ) ;
@@ -99,41 +69,7 @@ describe("Tags implementation", () => {
9969 ) ;
10070} ) ;
10171
102- describe ( "Tags inheritance" , ( ) => {
103- window . Cypress = {
104- env : ( ) => "@inherited-tag and @own-tag"
105- } ;
106- require ( "../cypress/support/step_definitions/tags_implementation_with_env_set" ) ;
107-
108- createTestsFromFeature (
109- readAndParseFeatureFile ( "./cypress/integration/TagsInheritance.feature" )
110- ) ;
111- } ) ;
112-
113- // TODO we need to take a look why these do not work properly, but as long as they run correctly with cypress run we can skip for now.
114- describe . skip ( "Tags with env TAGS set" , ( ) => {
115- window . Cypress = {
116- env : ( ) => "@test-tag and not @ignore-tag"
117- } ;
118- require ( "../cypress/support/step_definitions/tags_implementation_with_env_set" ) ;
119-
120- createTestsFromFeature (
121- readAndParseFeatureFile (
122- "./cypress/integration/TagsImplementationWithEnvSet.feature"
123- )
124- ) ;
125-
126- createTestsFromFeature (
127- readAndParseFeatureFile (
128- "./cypress/integration/TagsImplementationWithEnvSetScenarioLevel.feature"
129- )
130- ) ;
131- } ) ;
132-
13372describe ( "Smart tagging" , ( ) => {
134- window . Cypress = {
135- env : ( ) => ""
136- } ;
13773 require ( "../cypress/support/step_definitions/smart_tagging" ) ;
13874
13975 createTestsFromFeature (
@@ -156,3 +92,22 @@ describe("defineStep", () => {
15692 readAndParseFeatureFile ( "./cypress/integration/DefineStep.feature" )
15793 ) ;
15894} ) ;
95+
96+ describe ( "Tags with env TAGS set" , ( ) => {
97+ window . Cypress = {
98+ env : ( ) => "@test-tag and not @ignore-tag"
99+ } ;
100+ require ( "../cypress/support/step_definitions/tags_implementation_with_env_set" ) ;
101+
102+ createTestsFromFeature (
103+ readAndParseFeatureFile (
104+ "./cypress/integration/TagsImplementationWithEnvSet.feature"
105+ )
106+ ) ;
107+
108+ createTestsFromFeature (
109+ readAndParseFeatureFile (
110+ "./cypress/integration/TagsImplementationWithEnvSetScenarioLevel.feature"
111+ )
112+ ) ;
113+ } ) ;
0 commit comments