# gherkincafe

> Support for Gherking style test suits using Testcafe

Latest version **0.0.1** (published 2018-01-11) · MIT license · 0 weekly downloads

## Install

```sh
npm install gherkincafe
pnpm add gherkincafe
yarn add gherkincafe
bun add gherkincafe
```

Provides the command `gherkin-testcafe`.

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.0.1 |
| Published | 2018-01-11 |
| First published | 2018-01-11 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 5 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | Albino Cordeiro |
| Maintainers | albinocordeiro |
| Keywords | gherkin, bdd, testcafe |

## Links

- npm: https://www.npmjs.com/package/gherkincafe
- npm.io page: https://npm.io/package/gherkincafe

## Dependencies (5)

- [glob](https://npm.io/package/glob.md) ^7.1.2
- [yargs](https://npm.io/package/yargs.md) ^10.0.3
- [gherkin](https://npm.io/package/gherkin.md) ^5.0.0
- [testcafe](https://npm.io/package/testcafe.md) ^0.18.5
- [cucumber-expressions](https://npm.io/package/cucumber-expressions.md) ^5.0.7

## Recent versions

- 0.0.1 (latest) — 2018-01-11

## README

# gherkincafe

> Run testcafe tests with gherkin syntax based on sitegist's gherkin-testcafe (on npmjs.com)

### Author
Albino Cordeiro albino.cordeirojr@gemalto.com

### Disclaimer

Currently, this tool is still under development and very likely present bugs and doesn't support some features supported by cucumberjs, etc

## Motivation

Uses TestCafe as testrunner,  avoiding dependency on cucumberjs.  Support more modern javascript syntax (very close to Typescript). Modify some behaviors of gherkin-testcafe that seemed wrong to me.

## Installation

```sh
npm install --save-dev gherkcafe
```

## Usage with CLI

Take a look at the `examples/` folder in this repo, to get an idea of how to write gherkin specs and step definitions.

Example:
```sh
gherkin-testcafe --specs ./tests/**/*.feature --steps ./tests/**/*.js --browsers chrome
```

### Supported Parameters

`--specs [list of file patterns]` - One or more paths or glob patterns to the `*.feature` files to be tested.

`--steps [list of file patterns]` - One or more paths or glob patterns to the `*.js` files containing the step definitions.

`--browsers` - A space-separated list of browsers to run the tests in (see [Testcafe Browser Support](http://devexpress.github.io/testcafe/documentation/using-testcafe/common-concepts/browsers/browser-support.html#locally-installed-browsers))

`--ports` - Up to 2 ports that will be used by testcafe to serve tested webpages

## Writing step definitions

With the `--steps` parameter you can specify where to find your step definitions. These are contained in a file of the following form:

```js
module.exports = function defineSteps({given, when, then}) {
	given(`I have a step definition with parameter {string}`, async (t, myParameter) => {
		// Test implementation here
	});
}
```

`given`, `when` and `then` refer to their gherkin counterparts. Each of these functions takes two parameters.

The first one expects a parameterized step expression. You'll find more on that in the [cucumber-expressions Documentation](https://github.com/cucumber/cucumber/tree/master/cucumber-expressions#cucumber-expressions).

The second one expects a function (that is allowed to be be `async`), which executes the actual test. That function
will get the testcafe test controller as its first parameter (`t` in the example). With that you can use the entirety
of test cafes [Test API](http://devexpress.github.io/testcafe/documentation/test-api/).

All subsequent parameters for the test function are resolved from the given step expression.

## License

see [LICENSE.md](./LICENSE.md)

---
_Source: https://npm.io/package/gherkincafe · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
