Skip to content

Commit 970991b

Browse files
committed
Add some tests for window.testState
1 parent b3bfdea commit 970991b

File tree

1 file changed

+51
-0
lines changed

1 file changed

+51
-0
lines changed

features/test_state.feature

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
Feature: window.testState
2+
Scenario: gherkin document
3+
Given a file named "cypress/e2e/a.feature" with:
4+
"""
5+
Feature: a feature name
6+
Scenario: a scenario name
7+
Given a step
8+
"""
9+
And a file named "cypress/e2e/a.js" with:
10+
"""
11+
const { Given } = require("@badeball/cypress-cucumber-preprocessor");
12+
Given("a step", function() {
13+
expect(testState.gherkinDocument.feature.name).to.equal("a feature name");
14+
});
15+
"""
16+
When I run cypress
17+
Then it passes
18+
19+
Scenario: pickles
20+
Given a file named "cypress/e2e/a.feature" with:
21+
"""
22+
Feature: a feature name
23+
Scenario: a scenario name
24+
Given a step
25+
"""
26+
And a file named "cypress/e2e/a.js" with:
27+
"""
28+
const { Given } = require("@badeball/cypress-cucumber-preprocessor");
29+
Given("a step", function() {
30+
expect(testState.pickles[0].name).to.equal("a scenario name");
31+
});
32+
"""
33+
When I run cypress
34+
Then it passes
35+
36+
Scenario: pickle
37+
Given a file named "cypress/e2e/a.feature" with:
38+
"""
39+
Feature: a feature name
40+
Scenario: a scenario name
41+
Given a step
42+
"""
43+
And a file named "cypress/e2e/a.js" with:
44+
"""
45+
const { Given } = require("@badeball/cypress-cucumber-preprocessor");
46+
Given("a step", function() {
47+
expect(testState.pickle.name).to.equal("a scenario name");
48+
});
49+
"""
50+
When I run cypress
51+
Then it passes

0 commit comments

Comments
 (0)