/boilerplate-e2e-cypress-cucumber

The IT4C Boilerplate for End-to-End Testing with Cypress and Cucumber

Primary LanguageJavaScriptApache License 2.0Apache-2.0

boilerplate-e2e-cypress-cucumber

IT4C Boilerplate for End-to-End Testing with Cypress utilizing:

Requirements and Commands

Building this project requires nodejs (>= v20) and npm.

Commands

Command Description
Installation
npm install Project setup
Linting
npm run test:lint:eslint Run Eslint linter
Run Cypress
npm run cypress:open Open Cypress GUI
npm run cypress:run Run all Cypress tests headless in CLI
Documentation
npm run docs:dev Run documentation locally in development mode
npm run docs:build Build static documentation
Maintenance
npm run update Check for updates

Update

Retrieve a list of updatable packages by running npm run update.

Appending -u will also update the packages in the package.json. Afterwards run npm install.

npm run update -- -u
npm install

Test Examples

To showcase Cucumber feature tests, a simple login example on the-internet is written in the feature file Login.feature.
The baseUrl is set in cypress.config.ts and the test steps are defined in this step definition file.

Testing against the demo website the-internet was chosen from the test practice recommendations of https://www.davidmello.com/best-websites-for-practicing-test-automation/.

How to use as part of a project

If you want to use this template as part of a larger project, e.g. in conjunction with a frontend also utilizing a boilerplate you cannot use the template mechanic provided by github for this repository.

You can use the following commands to include the whole git history of the boilerplate and be able to update according to changes to this repo using another remote.

git remote add xxx_boilerplate-e2e-cypress-cucumber git@github.com:IT4Change/boilerplate-backend.git
git fetch xxx_boilerplate-e2e-cypress-cucumber
git merge -s ours --no-commit --allow-unrelated-histories xxx_boilerplate-e2e-cypress-cucumber/master
git read-tree --prefix=xxx/ -u xxx_boilerplate-e2e-cypress-cucumber/master
git commit -m "Imported boilerplate-e2e-cypress-cucumber as a subtree under xxx/."

To update the subtree you can use

git subtree pull -P xxx/ xxx_boilerplate-e2e-cypress-cucumber master
git commit -m "Updated boilerplate-e2e-cypress-cucumber in subtree under xxx/."

Where xxx refers to the folder and product part you want to use the boilerplate in (e.g. cypress or e2e-tests).

This mechanic was taken from this source

License

Apache 2.0