Example usage of Nemo automation for a node.js web application (using kraken-js)
Install and start the application.
$ git clone https://github.com/paypal/nemo-example-app.git
$ cd nemo-example-app
$ npm install
$ grunt build
$ npm startRun Nemo
$ grunt automationIf you didn't get a successful test run, where you saw a browser open on your desktop, then please refer to this document for instructions on setting up a webdriver.
This application has one route: http://localhost:8000
It simulates a one-page app, with latency between navigations and simulated "add" operations, and success/failure messages printed to screen.
- successful login: provide any email address except "fail@fail.com"
- failed login: use "fail@fail.com"
- successful add card: provide any card number except 1001001
- failed add card: use 1001001
- successful add bank: provide any account number except 1001001
- failed add bank: use 1001001
As mentioned above, an identical application is hosted here: https://fast-castle-8102.herokuapp.com
There are three suite files:
generic-spec.jsuses inline locator strings and genericnemo-viewmethods (see here). Illustrates a first pass of automation.view-spec.jsuses JSON locator files whichnemo-viewturns into convenience methods (see here). Illustrates a second pass of automation where inline locator strings are separated into JSON locator files.page-spec.jsuses JSON locator files which nemo-page(likenemo-view) uses to build a model to allow you to do element-level methods in a simple, concise, and precise way.flow-spec.js- uses
flow/*.jsmodules to illustrate how to abstract functionality into shareable modules - uses
util/index.jsmodule to abstract error handling and callback management
- uses
Using grunt auto runs mocha via the intermediate grunt-loop-mocha task.
Sometimes, for debugging purposes, it is nice to strip that layer away and run the tests via mocha directly. To do that
in this repo, do the following:
$ export nemoBaseDir=/path/to/this/repo/nemo-example-app/test/functional
$ node_modules/.bin/mocha test/functional/spec/*.js --timeout 30000 --grep @flow