forked from Klaveness-Digital/cypress-cucumber-preprocessor
-
-
Notifications
You must be signed in to change notification settings - Fork 149
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
8 changed files
with
225 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
[ | ||
{ | ||
"description": "", | ||
"elements": [ | ||
{ | ||
"description": "", | ||
"id": "a-feature;a-scenario", | ||
"keyword": "Scenario", | ||
"line": 2, | ||
"name": "a scenario", | ||
"steps": [ | ||
{ | ||
"arguments": [], | ||
"keyword": "Given ", | ||
"line": 3, | ||
"name": "a preceding step", | ||
"match": { | ||
"location": "not available:0" | ||
}, | ||
"result": { | ||
"status": "passed", | ||
"duration": 0 | ||
} | ||
}, | ||
{ | ||
"arguments": [], | ||
"keyword": "And ", | ||
"line": 4, | ||
"name": "a skipped step", | ||
"match": { | ||
"location": "not available:0" | ||
}, | ||
"result": { | ||
"status": "skipped", | ||
"duration": 0 | ||
} | ||
}, | ||
{ | ||
"arguments": [], | ||
"keyword": "And ", | ||
"line": 5, | ||
"name": "a succeeding step", | ||
"match": { | ||
"location": "not available:0" | ||
}, | ||
"result": { | ||
"status": "skipped", | ||
"duration": 0 | ||
} | ||
} | ||
], | ||
"tags": [], | ||
"type": "scenario" | ||
} | ||
], | ||
"id": "a-feature", | ||
"line": 1, | ||
"keyword": "Feature", | ||
"name": "a feature", | ||
"tags": [], | ||
"uri": "cypress/e2e/a.feature" | ||
} | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
{"testRunStarted":{"timestamp":{"seconds":0,"nanos":0}}} | ||
{"source":{"data":"Feature: a feature\n Scenario: a scenario\n Given a preceding step\n And a skipped step\n And a succeeding step","uri":"cypress/e2e/a.feature","mediaType":"text/x.cucumber.gherkin+plain"}} | ||
{"gherkinDocument":{"feature":{"tags":[],"location":{"line":1,"column":1},"language":"en","keyword":"Feature","name":"a feature","description":"","children":[{"scenario":{"id":"id","tags":[],"location":{"line":2,"column":3},"keyword":"Scenario","name":"a scenario","description":"","steps":[{"id":"id","location":{"line":3,"column":5},"keyword":"Given ","keywordType":"Context","text":"a preceding step"},{"id":"id","location":{"line":4,"column":5},"keyword":"And ","keywordType":"Conjunction","text":"a skipped step"},{"id":"id","location":{"line":5,"column":5},"keyword":"And ","keywordType":"Conjunction","text":"a succeeding step"}],"examples":[]}}]},"comments":[],"uri":"cypress/e2e/a.feature"}} | ||
{"pickle":{"id":"id","uri":"cypress/e2e/a.feature","astNodeIds":["id"],"tags":[],"name":"a scenario","language":"en","steps":[{"id":"id","text":"a preceding step","type":"Context","astNodeIds":["id"]},{"id":"id","text":"a skipped step","type":"Context","astNodeIds":["id"]},{"id":"id","text":"a succeeding step","type":"Context","astNodeIds":["id"]}]}} | ||
{"stepDefinition":{"id":"id","pattern":{"type":"CUCUMBER_EXPRESSION","source":"a preceding step"},"sourceReference":{"uri":"not available","location":{"line":0}}}} | ||
{"stepDefinition":{"id":"id","pattern":{"type":"CUCUMBER_EXPRESSION","source":"a skipped step"},"sourceReference":{"uri":"not available","location":{"line":0}}}} | ||
{"stepDefinition":{"id":"id","pattern":{"type":"CUCUMBER_EXPRESSION","source":"a succeeding step"},"sourceReference":{"uri":"not available","location":{"line":0}}}} | ||
{"testCase":{"id":"id","pickleId":"id","testSteps":[{"id":"id","pickleStepId":"id","stepDefinitionIds":["id"]},{"id":"id","pickleStepId":"id","stepDefinitionIds":["id"]},{"id":"id","pickleStepId":"id","stepDefinitionIds":["id"]}]}} | ||
{"testCaseStarted":{"id":"id","testCaseId":"id","attempt":0,"timestamp":{"seconds":0,"nanos":0}}} | ||
{"testStepStarted":{"testStepId":"id","testCaseStartedId":"id","timestamp":{"seconds":0,"nanos":0}}} | ||
{"testStepFinished":{"testStepId":"id","testCaseStartedId":"id","testStepResult":{"status":"PASSED","duration":0},"timestamp":{"seconds":0,"nanos":0}}} | ||
{"testStepStarted":{"testStepId":"id","testCaseStartedId":"id","timestamp":{"seconds":0,"nanos":0}}} | ||
{"testStepFinished":{"testStepId":"id","testCaseStartedId":"id","testStepResult":{"status":"SKIPPED","duration":0},"timestamp":{"seconds":0,"nanos":0}}} | ||
{"testStepStarted":{"testStepId":"id","testCaseStartedId":"id","timestamp":{"seconds":0,"nanos":0}}} | ||
{"testStepFinished":{"testStepId":"id","testCaseStartedId":"id","testStepResult":{"status":"SKIPPED","duration":0},"timestamp":{"seconds":0,"nanos":0}}} | ||
{"testCaseFinished":{"testCaseStartedId":"id","timestamp":{"seconds":0,"nanos":0},"willBeRetried":false}} | ||
{"testRunFinished":{"timestamp":{"seconds":0,"nanos":0}}} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
Feature: skipped steps | ||
Background: | ||
Given a file named "cypress/e2e/a.feature" with: | ||
""" | ||
Feature: a feature | ||
Scenario: a scenario | ||
Given a skipped step | ||
""" | ||
And a file named "cypress/support/step_definitions/steps.js" with: | ||
""" | ||
const { Given } = require("@badeball/cypress-cucumber-preprocessor") | ||
Given("a skipped step", function() { | ||
return "skipped" | ||
}) | ||
""" | ||
|
||
Rule: skipped steps make the test skipped | ||
|
||
Scenario: basic skipped step | ||
When I run cypress | ||
Then it passes | ||
And it should appear to have skipped the scenario "a scenario" | ||
|
||
Scenario: with step hooks returning strings | ||
Given a file named "cypress/support/step_definitions/hooks.js" with: | ||
""" | ||
const { BeforeStep, AfterStep } = require("@badeball/cypress-cucumber-preprocessor") | ||
BeforeStep(function() { | ||
return "foobar" | ||
}) | ||
AfterStep(function() { | ||
return "foobar" | ||
}) | ||
""" | ||
When I run cypress | ||
Then it passes | ||
And it should appear to have skipped the scenario "a scenario" | ||
|
||
Scenario: with step hooks returning chains | ||
Given a file named "cypress/support/step_definitions/hooks.js" with: | ||
""" | ||
const { BeforeStep, AfterStep } = require("@badeball/cypress-cucumber-preprocessor") | ||
BeforeStep(function() { | ||
return cy.wrap("foobar") | ||
}) | ||
AfterStep(function() { | ||
return cy.wrap("foobar") | ||
}) | ||
""" | ||
When I run cypress | ||
Then it passes | ||
And it should appear to have skipped the scenario "a scenario" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters