Skip to content

kubbafox/protractor-cucumber-typescript-example

Repository files navigation

protractor-cucumber-typescript-example

A simple example to use protractor, cucumber.js and typescript to preform E2E testing.

Introduction

Hello, this is an end-to-end testing sample project by using protractor (Selenium wrapper) and cucumber.js to test web applications. I am using an Angular 5 SPA as the test target, but you can use it and test any web application. It is not an Angular depended project.

Dependencies

This project needs Node.js and Java to run.

It is built with following npm dependencies.

"chai": "^4.2.0",
"chai-as-promised": "^7.1.1",
"cucumber": "^5.1.0",
"protractor": "^5.1.2",
"typescript": "^3.2.4"
"protractor-cucumber-framework": "^6.1.1",
"ts-node": "^3.0.2",
"@types/node": "~6.0.60"

File Structures

.circleci Configuration to run E2E as part of CI/CD pipe. Using CircleCi as an example.

data Where we load test data, it can (should) be replaced by a API service to get data from DB. For now we use a test-actors.json to mock the response.

features Cucumber test features are located here.

pages Page objects

step_definitions The test specs which are invoked by features.

conf.ts Configuration for protractor and cucumber

package.json Project dependencies

+-- .circleci
|   +-- config.yml
+-- data
|   +-- test-actors.json
|   +-- user.data.ts
+-- feature
|   +-- register.feature
+-- pages
|   +-- register-page.po.ts
+-- step_definitions
|   +-- register-step-definitions.ts
+-- package.json
+-- tsconfig.json
+-- conf.ts

Setup Project in 2 minutes

Run the following commands to setup project.

$ cd /path/to/new-repository
$ git clone https://github.com/kubbafox/protractor-cucumber-typescript-example.git
$ npm install
$ npm run dev
$ npm run pretest
$ npm run startTest 

About

A sample project to setup E2E Test using protractor, cucumber.js and typescript

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published