-
Notifications
You must be signed in to change notification settings - Fork 403
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
139 changed files
with
3,075 additions
and
540 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,6 @@ | ||
**/*.js | ||
**/*.d.ts | ||
!examples/**/* | ||
!features/**/* | ||
!cucumber.d.ts | ||
!cucumber.js | ||
|
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
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 |
---|---|---|
@@ -1 +1,3 @@ | ||
declare module "@cypress/browserify-preprocessor"; | ||
|
||
declare module "pngjs"; |
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,57 @@ | ||
# Configuration | ||
|
||
The preprocessor uses [cosmiconfig](https://github.com/davidtheclark/cosmiconfig), which means you can place configuration options in EG. `.cypress-cucumber-preprocessorrc.json` or `package.json`, with corresponding examples shown below. | ||
|
||
``` | ||
// .cypress-cucumber-preprocessorrc.json | ||
{ | ||
"json": { | ||
"enabled": true | ||
} | ||
} | ||
``` | ||
|
||
``` | ||
// package.json | ||
{ | ||
"dependencies": { | ||
"@klaveness/cypress-cucumber-preprocessor": "latest" | ||
}, | ||
"cypress-cucumber-preprocessor": { | ||
"json": { | ||
"enabled": true | ||
} | ||
} | ||
} | ||
``` | ||
|
||
## Configuration overrides | ||
|
||
Configuration options can be overriden using (Cypress-) [environment variable](https://docs.cypress.io/guides/guides/environment-variables). The `filterSpecs` options (described in [docs/tags.md](tags.md)) can for instance be overriden by running Cypress like shown below. | ||
|
||
``` | ||
$ cypress run -e filterSpecs=true | ||
``` | ||
|
||
Cypress environment variables can also be configured through ordinary environment variables, like shown below. | ||
|
||
``` | ||
$ CYPRESS_filterSpecs=true cypress run | ||
``` | ||
|
||
Every configuration option has a similar key which can be use to override it, shown in the table below. | ||
|
||
| JSON path | Environment key | Example(s) | | ||
|--------------------|-------------------|------------------------------------------| | ||
| `stepDefinitions` | `stepDefinitions` | `[filepath].{js,ts}` | | ||
| `messages.enabled` | `messagesEnabled` | `true`, `false` | | ||
| `messages.output` | `messagesOutput` | `cucumber-messages.ndjson` | | ||
| `json.enabled` | `jsonEnabled` | `true`, `false` | | ||
| `json.formatter` | `jsonFormatter` | `/usr/bin/cucumber-json-formatter` | | ||
| `json.output` | `jsonOutput` | `cucumber-report.json` | | ||
| `filterSpecs` | `filterSpecs` | `true`, `false` | | ||
| `omitFiltered` | `omitFiltered` | `true`, `false` | | ||
|
||
## Test configuration | ||
|
||
Some of Cypress' [configuration options](https://docs.cypress.io/guides/references/configuration) can be overridden per-test, [Test configuration](test-configuration.md). |
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
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
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,37 @@ | ||
# Test configuration | ||
|
||
Some of Cypress' [configuration options](https://docs.cypress.io/guides/references/configuration) can be overridden per-test by leveraging tags. Below are all supported configuration options shown. | ||
|
||
```gherkin | ||
@animationDistanceThreshold(5) | ||
@blockHosts('http://www.foo.com','http://www.bar.com') | ||
@defaultCommandTimeout(5) | ||
@execTimeout(5) | ||
@includeShadowDom(true) | ||
@includeShadowDom(false) | ||
@keystrokeDelay(5) | ||
@numTestsKeptInMemory(5) | ||
@pageLoadTimeout(5) | ||
@redirectionLimit(5) | ||
@requestTimeout(5) | ||
@responseTimeout(5) | ||
@retries(5) | ||
@retries(runMode=5) | ||
@retries(openMode=5) | ||
@retries(runMode=5,openMode=10) | ||
@retries(openMode=10,runMode=5) | ||
@screenshotOnRunFailure(true) | ||
@screenshotOnRunFailure(false) | ||
@scrollBehavior('center') | ||
@scrollBehavior('top') | ||
@scrollBehavior('bottom') | ||
@scrollBehavior('nearest') | ||
@slowTestThreshold(5) | ||
@viewportHeight(720) | ||
@viewportWidth(1280) | ||
@waitForAnimations(true) | ||
@waitForAnimations(false) | ||
Feature: a feature | ||
Scenario: a scenario | ||
Given a table step | ||
``` |
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
File renamed without changes.
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,20 @@ | ||
const { defineConfig } = require("cypress"); | ||
const preprocessor = require("@klaveness/cypress-cucumber-preprocessor"); | ||
const browserify = require("@klaveness/cypress-cucumber-preprocessor/browserify"); | ||
|
||
async function setupNodeEvents(on, config) { | ||
await preprocessor.addCucumberPreprocessorPlugin(on, config); | ||
|
||
on("file:preprocessor", browserify.default(config)); | ||
|
||
// Make sure to return the config object as it might have been modified by the plugin. | ||
return config; | ||
} | ||
|
||
module.exports = defineConfig({ | ||
e2e: { | ||
specPattern: "**/*.feature", | ||
supportFile: false, | ||
setupNodeEvents, | ||
}, | ||
}); |
File renamed without changes.
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,15 @@ | ||
const { When, Then } = require("@klaveness/cypress-cucumber-preprocessor"); | ||
|
||
When("I visit duckduckgo.com", () => { | ||
cy.visit("https://duckduckgo.com/"); | ||
}); | ||
|
||
Then("I should see a search bar", () => { | ||
cy.get("input").should( | ||
"have.attr", | ||
"placeholder", | ||
"Search the web without being tracked" | ||
); | ||
|
||
assert.deepEqual({}, {}); | ||
}); |
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,7 @@ | ||
{ | ||
"dependencies": { | ||
"@klaveness/cypress-cucumber-preprocessor": "latest", | ||
"@cypress/browserify-preprocessor": "latest", | ||
"cypress": "latest" | ||
} | ||
} |
File renamed without changes.
Oops, something went wrong.