To fully benefit from Serenity/JS and to implement test scenarios using the Screenplay Pattern and either Cucumber or Mocha you'll need the core serenity-js module, but also a couple of other dependencies.

To get them, execute the terminal command below:

$> npm install serenity-js serenity-cli typescript ts-node protractor@ @types/node --save-dev

To implement your test scenarios using Cucumber you'll also need the following dependencies:

$> npm install cucumber@1.x @types/cucumber --save-dev

or, to use Mocha, install the following instead:

$> npm install mocha @types/mocha --save-dev

The last thing you need is an assertion library, such as Chai.js, which can be used with either one of the above test frameworks:

$> npm install chai chai-as-promised chai-smoothie @types/chai @types/chai-as-promised --save-dev


Let's have a quick look at the roles and responsibilities of the Node.js modules you've just installed.

module roles and responsibilities

Acceptance testing library

  • acts as an integration layer between Protractor and a test framework of your choice
  • provides building blocks of the Screenplay Pattern
  • records the execution of your test scenarios

A Node.js wrapper around Serenity BDD CLI

  • downloads, configures and executes the Serenity BDD CLI jar, which is responsible for processing the JSON reports recorded by serenity-js and producing a HTML version

A typed super-set of JavaScript ES6


TypeScript Execution environment and REPL for Node.js

  • allows for in-memory execution of TypeScript code on Node.js, without the need for any additional transpilers such as Babel, or intermediate files that you'd get with the TypeScript compiler alone

A wrapper around Selenium/WebDriver

  • enables end-to-end and integration testing of web applications
  • manages Selenium/WebDriver binaries
  • manages the lifecycle of the browser used in web-based tests
  • provides support for Angular-based applications
  • can be used to drive non-Angular apps too

Collaboration library

  • helps with introducing BDD
  • allows for expressing test scenarios in a human-readable language, such as English
  • parses the human-readable scenarios, links their steps with the test automation code provided by serenity-js
  • executes Serenity/JS test scenarios

Test execution library

  • a light-weight test execution library, excellent for regression testing of existing apps
  • executes Serenity/JS test scenarios

Assertion library

  • a BDD-style assertion library, providing highly readable assertion functions

Promise-specific assertions for Chai

  • assertions for functions and methods returning Promises

Protractor-specific assertions for Chai

  • assertions verifying visibility of web elements
  • improve Protractor's error messages
  • comes with type definitions

Type definitions for Chai

  • IntelliSense support for Chai

Type definitions for Chai-as-promised

  • IntelliSense support for Chai-as-promised

Type definitions for Cucumber.js

  • IntelliSense support for Cucumber.js

Type definitions for Node.js

  • IntelliSense support for Node.js core libraries

Type definitions for Mocha

  • IntelliSense support for Mocha

Your feedback matters!

Suggest features and improvements on github, get in touch on twitter, and if you found Serenity/JS useful - don't forget to give it a star! ★


results matching ""

    No results matching ""