This is a set of tools that will allow for test-driven development using the following technologies:
It contains everything you need to write functional tests for remote URLs.
Install the testing suite into your project root directory with:
npm install @dequelabs/amaze-tdd --save
Ensure the testing suite is required at the top of the test. We use ES2016. Instantiate a global variable for Browser.
var Amaze = require('@dequelabs/amaze-tdd'); var Browser; var $;
Instantiate the browser object in the
suiteSetup function. You should look at another test to see an example.
Browser = Amaze.Client.build();
Optionally, you may instantiate a
$ variable for a more familiar jQuery interface.
$ = Amaze.jQuery;
If you do this, you can then target web objects like you would a jQuery object, like...
It's not much, but it's something :-)
Tests should be written asynchronously due to Selenium's asynchronous nature. We should return something or use an expectation/assertion which returns a promise. An example test has been included for reference. We have also created further documentation on writing tests to help you write good tests.
Run tests with:
You may pass in additional flags, such as
sanity-check to include the demo test. This may help with sanity checks if you're getting a bunch of test failures:
node node_modules/@dequelabs/amaze-tdd sanity-check
Additionally, you may use PhantomJS to headlessly test the interfaces. No browser plugin is required and no browsers will spawn, which may speed up tests. Add the
node node_modules/@dequelabs/amaze-tdd headless
Our process will run Mocha on any files in the specified path with the format
*-spec.js. This means that the following examples will work:
Basically any file that ends with
-spec.js will be covered in testing.
Along with the standard compiled
.js file, you may also deliver the
specs folder. When you run your tests, they're copied into this folder for easy delivery. The only thing your customer will need to do is install this NPM suite.
We want you! To help us make this great. See our wiki on contributing for more information.
phantomjsfor PhantomJS tests
sanity-checkoption is present
.amazercfile rather than the one included in this package
binfor the command
scriptso we need only a single install of the files
.amazercconfiguration file for individual project settings