Skip to content

A UI around Protractor to help write E2E tests for Angular applications without needing to know JavaScript

License

Notifications You must be signed in to change notification settings

TradeMe/tractor

Repository files navigation

tractor

A UI around Protractor to help write E2E tests for Angular applications without needing to know JavaScript

Greenkeeper badge npm version Code Climate Test Coverage lerna

This repository contains the code for the underlying infrastructure of tractor, as well as some plugins that contain the main functionality.

Install

To install the cli, add @tractor/cli as a dev dependency to your Angular application:

npm install @tractor/cli -D

That will install the CLI, which can then be used inside your application.

Setup

To get started, you'll need to run the following:

./node_modules/.bin/tractor init

The initialisation can be configured with a tractor.conf.js file (described in the Config section).

Once everything has been initialised, you need to start the tractor application from the root directory of your app with:

./node_modules/.bin/tractor start

The app should then be available running at http://localhost:4000. The port can be configured in the tractor.conf.js file.

Config

If you want to change the port that tractor runs at, or the different environments you can target, you need to add a tractor.conf.js file in the root of your app directory. It might look something like the following:

module.exports = {
    port: number,                // defaults to 4000
    environments: Array<string>  // a list of URLs for the environments to run the tests in
};

The tractor.conf.js file is also used to configure any plugins you have installed.

Development

To set up development:

yarn # install dependencies and initialise workspaces
lerna run build # build and test all the packages

More information on yarn workspaces.

More information on lerna.

You can use lerna to run commands across all packages, or groups of packages:

lerna run test # run unit test in all packages
lerna run compile --scope="@tractor-plugins/*" # runs JavaScript compiler in all @tractor-plugin packages
lerna run test:e2e:ci --scope="@tractor/ui" # run end-to-end tests in the @tractor/ui package only