Skip to content

Commit

Permalink
initial
Browse files Browse the repository at this point in the history
  • Loading branch information
Tallyb committed Feb 3, 2021
0 parents commit cd97d14
Show file tree
Hide file tree
Showing 17 changed files with 4,000 additions and 0 deletions.
72 changes: 72 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
.DS_Store
.idea/

# Logs
logs
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*
test-results.html
test-results.html.json

# Runtime data
pids
*.pid
*.seed
*.pid.lock

# Directory for instrumented libs generated by jscoverage/JSCover
lib-cov

# Coverage directory used by tools like istanbul
coverage

# nyc test coverage
.nyc_output

# Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files)
.grunt

# Bower dependency directory (https://bower.io/)
bower_components

# node-waf configuration
.lock-wscript

# Compiled binary addons (http://nodejs.org/api/addons.html)
build/Release

# Dependency directories
node_modules/
jspm_packages/

# Typescript v1 declaration files
typings/

# Optional npm cache directory
.npm

# Optional eslint cache
.eslintcache

# Optional REPL history
.node_repl_history

# Output of 'npm pack'
*.tgz

# Yarn Integrity file
.yarn-integrity

# dotenv environment variables file
.env

#reports
reports/*.html
reports/*.json

#build
build
dist/
docs/
19 changes: 19 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# Changelog

All notable changes to this project will be documented in this file.

The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/)
and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html).

## [1.1.0] - 2021-01-20

### Added

- added @cucumber/pretty-formatter

## [1.0.0] - 2021-01-18

### Added

- use this template only with cucumber-js v7
- this template is migrated from [cucumber6-ts-starter](https://github.com/hdorgeval/cucumber6-ts-starter)
21 changes: 21 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2021 Henri d'Orgeval

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
89 changes: 89 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,89 @@
# cucumber7-ts-starter

[![Build Status](https://travis-ci.org/hdorgeval/cucumber7-ts-starter.svg?branch=main)](https://travis-ci.org/hdorgeval/cucumber7-ts-starter)
[![Build status](https://ci.appveyor.com/api/projects/status/v7ing1c5m9fr0fjf?svg=true)](https://ci.appveyor.com/project/hdorgeval/cucumber7-ts-starter)

Starter project to write and debug cucumber-js v7 features in TypeScript language

## After cloning the repo

- run the command `npm install`.

## To execute the tests locally

- run the command `npm test`.

## To choose a reporter

The last reporter/formatter found on the cucumber-js command-line wins:

```text
--format summary --format @cucumber/pretty-formatter --format cucumber-console-formatter
```

In [package.json](package.json) file, modify the `cucumber` script to keep only your preferred formatter.

## To debug a scenario in Visual Studio Code

- tag the scenario with `@debug`
- set the breakpoints in the typescript code
- Start debugging

## To run only specific scenarios

- tag the scenario(s) with `@only`
- run the command `npm run only`.

## To ignore a scenario

- tag the scenario with `@ignore`

## To check for typescript, linting and gherkin errors

- run the command `npm run build`.

## To view the steps usage

- run the command `npm run steps-usage`.

## To view the html report of the last run

- run the command `npm run report`.

## To create a new step

- first write the Given/When/Then sentence:

```gherkin
Given I push "foo" on "bar"
```

- run the npm script:

```sh
npm run snippets
```

- the script will report the missing step(s): you just need to copy and paste them in the step definitions file:

```sh
Given('I push {string} on {string}', async function (string, string2) {
// Write code here that turns the phrase above into concrete actions
return 'pending';
});
```
## To use a custom option on the CLI
With cucumber-js v7, you cannot have anymore custom options on the CLI.
This is a breaking change with cucumber-js v6.
You must instead use environment variables.
When running your tests localy, you can setup environment variables by customizing the file [set-environment-variables.ts](env/set-environment-variables.ts).
When running on a CI, you should setup your jobs with the expected environment variables.
## To use a custom World Objet
- cutomize the given Custom World Object : [custom-world](world/custom-world.ts)
24 changes: 24 additions & 0 deletions cucumber.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
const common = `
--require-module ts-node/register
--require src/hooks/*.ts
--require src/steps/**/*.steps.ts
--format json:reports/cucumber-report.json
--format summary
--format progress-bar
--format-options ${JSON.stringify({ snippetInterface: 'async-await' })}
--publish-quiet
`;

// --format node_modules/cucumber-pretty

const getWorldParams = () => {
const params = {
foo: 'bar',
};

return `--world-parameters ${JSON.stringify({ params })}`;
};

module.exports = {
default: `${common} ${getWorldParams()}`,
};
2 changes: 2 additions & 0 deletions env/set-environment-variables.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
process.env['--logLevel'] = 'error';
process.env['SimpleConsoleFormatter.printEnvelopes'] = 'false';
10 changes: 10 additions & 0 deletions features/search.feature
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
@foo
Feature: Playwright docs

Background: Navigation
Given Go to the playwright docs website

Scenario: Search documents
When Enter search term "checkbox"
Then Snapshot "checkbox search"

Loading

0 comments on commit cd97d14

Please sign in to comment.