Skip to content

Minimalistic template project to kick start Gherkin style E2E tests written in Screenplay pattern using CucumberJS + Protractor.

License

Notifications You must be signed in to change notification settings

alertbox/todomvc-cucumber-protractor

Repository files navigation

Contributor Covenant Gitpod Ready-to-Code

CucumberJS + Protractor - Starter

ES6 / Vanilla Javascript version

Minimalistic template project to kick start Behavior-driven/Gherkin style End-to-End tests automation, written in Screenplay pattern using cucumberjs + protractor.

todomvc

Important!

To get started with your own Test Automation Project, you don't need to clone this repo anymore. Just click the Use this template button from the top. To learn more about GitHub Template Projects, visit this link.

What's included:

Table of Content

Quick Start

If you want to understand how starter kit works or want to debug an issue or build your automation test suite, you'll want to get the source code, build it, and run it locally.

Prerequisites

In order to download necessary tools, clone the repo, install dependencies via yarn, you need internet access.

You'll need the following tools:

  • Chrome, version >=76
  • Git
  • NodeJS, x64, version >=10.15
  • Yarn, version >=1.17, follow the installation guide
  • Python, version 2.7

    macOS ships with Python v2.7. Above link is only for contributors that are not on macOS.

  • JDK, version >=8
  • Visual Studio Code

    Recommended extensions are mentioned in the extensions.json. This should automatically appear in your Extensions pane once open the code base.

Build and run from source

First, fork or create a new repo using the starter template. Then, clone your repo locally.

With VS Code:

  • Install and build all the dependencies using yarn.
git clone https://github.com/<your-github-account>/todomvc-cucumber-protractor
cd todomvc-cucumber-protractor
  • Run yarn install to install all the dependencies.
  • Run yarn start to boot the webdriver manager.
  • Run yarn test from a new terminal to run tests.

Occasionally, you will want to merge changes in the upstream repo, the official starter kit repo.

cd todomvc-cucumber-protractor
git checkout master
git pull

Manage any merge conflicts, commit, and then push them to your upstream repo.

Available yarn scripts

  • install - install all project dependencies only.
  • start - update and run the webdriver manager.
  • test - run all the tests fast in headless mode, and external tests.
  • reset - remove temp data, cache, and install everything as needed, then run the webdriver-manager for you.
  • prepare - update and run webdriver-manager for you.
  • test:fast - run all the tests fast in headless mode.
  • test:slow - run all the tests in slow-mo mode.
  • lint - check for code violations.

File structure of starter kit

todomvc-cucumber-protractor
│
├── .vscode/                                 # VS Code workspace configurations
│   ├── extensions.json
│   ├── launch.json
│   ├── settings.json
│   └── tasks.json
│
├── actions/                                 # Contains all Interactions
│   ├── helpers/                             # Helper modules and methods
│   │   └── strings.js                       # Example string manipulator for Todos
│   │
│   ├── questions/                           # Questions to ask about the State
│   │   ├── index.js
│   │   └── *.ask.js                         # Example Questions to ask about the state of the Todo app
│   │
│   └── tasks/                               # Steps performed by the Actor
│       ├── index.js
│       └── *.task.js                        # Example Tasks to interact with the Todo app
│
├── config/                                  # Contains all Ptor test configurations
│   ├── config.headless.js                   # Ptor headless configuration
│   └── config.slowmo.js                     # Ptor slow-mo configuration
│
├── docs/                                    # Contains all documentation
│
├── features/                                # Gherkin style features and scenarios
│   ├── steps/                               # Step definition scripts
│   │   └── *.steps.js                       # Example steps to interact with the Todo app
│   │
│   └── *.feature                            # Example features and scenarios to play
│
├── hooks/                                   # Contains all the hooks for Cucumber
│   ├── capture-screenshot.hook.js           # Capture and attache a screenshot when assertion fails
│   └── skip-or-deprecated.hook.js           # Skip any scenario if tagged as @skip/@ignore/@deprecated
│
├── plugins/                                 # Contains all the Ptor plugins 
│   ├── chai-as-promised.plugin.js           # Plugin to configure chai and chai-as-promised
│   └── ng-optout-browser.plugin.js          # Plugin to configure protractor browser
│
├── public/                                  # Public access folder which can be published if needed
│   └── report                               # Contains all the assets of the test report
│       └── index.html                       # Main page of the test report
│
├── .babelrc                                 # Defines presets for Modern Javascript support
├── .eslintignore                            # Everything that must be excluded from coding styles
├── .eslintrc                                # Defines javascript coding styles
├── .gitignore                               # Everything that must be excluded from the git repo
├── .npmrc                                   # Node configurations for workspace
├── package.json                             # Our javascript and node dependencies
└── README.md                                # This file!

Contributing

There are many ways in which you can participate in the project, for example:

If you are interested in fixing issues and contributing directly to the code base, please see the Prerequisites and How to build and run from source.

Code of Conduct

This project has adopted the Contributor Covenant template for Open Source Code of Conduct. This same template is used by over 350,000 open source projects such as Linux, .NET Foundation, Google, and others in their open source projects.

Feedback

Related Projects

Many of the core components and dependencies live in their own repositories on GitHub. For example, the cucumberjs and the protractor have their own repositories. For a complete list, please have a look at the dependencies on the project.json.

Backers

Thank you to all our Open Collective backers! Become a backer!

License

Copyright (c) Alertbox Inc. All rights reserved. Licensed under the MIT license.