Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@dequelabs/amaze-tdd

Package Overview
Dependencies
Maintainers
4
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@dequelabs/amaze-tdd

A tool for writing functional front-end tests for Amaze™ overlays.

  • 0.3.2
  • latest
  • npm
  • Socket score

Version published
Maintainers
4
Created
Source

Amaze test-driven development

This is a set of tools that will allow for test-driven development using the following technologies:

  • Mocha
  • Chai
  • jQuery
  • selenium-webdriver
  • Chrome and PhantomJS

It contains everything you need to write functional tests for remote URLs.

Installation

Install the testing suite into your project root directory with:

npm install @dequelabs/amaze-tdd --save

Writing tests

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...

$(Object).find('something')...

...instead of...

Amaze.jQuery(Object).find('something')...

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.

Running tests

Run tests with:

node node_modules/@dequelabs/amaze-tdd

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 headless option:

node node_modules/@dequelabs/amaze-tdd headless

Test files

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:

  • test-spec.js
  • overlay-name-spec.js
  • camelCase-spec.js
  • ALLCAPS-spec.js
  • some-folder/test-spec.js
  • some-folder/nested-folder/test-spec.js

Basically any file that ends with -spec.js will be covered in testing.

Deliverables

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.

Contributing

We want you! To help us make this great. See our wiki on contributing for more information.

Changelog

0.3.1

  • Updated the library for NPM 5 module locations + backwards compatibility

0.3.0

  • Updated NPM package module locations to use the @dequelabs scope

0.2.9

  • Removed bundled drivers as they can be found elsewhere and makes this package about 40MB smaller
  • Updated the check for local configuration files
  • Added documentation for a familiar jQuery experience
  • Renamed a folder to better suit its contents
  • Added functionality that packages all specs for delivery
  • Silenced the logging when using a headless browser (e.g. PhantomJS)
  • Added process logging for transparency with colors!

0.2.8

  • Changed the way the script checks for local configuration files

0.2.7

  • Updated the demo spec test to be more of a sanity check
  • Removed dev option; changed prod to phantomjs for PhantomJS tests
  • Will only include the demo spec as a sanity check if sanity-check option is present
  • Tests will use your projects .amazerc file rather than the one included in this package
  • Slight tweaks to this readme file, typo fixes, and added link to documentation
  • Documentation updates; copying stuff over to the Wiki
  • Moved from Google ESlint rules to a custom set based on standard rules

0.2.6

  • Removing the necessity to use a global install and removing the bin for the command
  • Instead, relying on the package.json script so we need only a single install of the files
  • Added support for an .amazerc configuration file for individual project settings
  • Removed Firefox (geckodriver) and IE (iedriver) from global object
  • Using Chrome as default and PhantomJS for phantomjs option
  • Refactored some files to use ES2016, more on the way
  • Included an ESlint config file and devDependencies
  • Increased global timeout to 30s allowing removal of individual overrides

0.2.5

  • Tweaking the global object

0.1.1

  • Moved the demo test Browser instance into a suiteSetup to fix the empty browser that spawns during tests
  • Fixed typo of this section heading :-)

0.1.0

  • Removed unused Chai.should() library
  • Added documentation
  • Various cleanup and consolidations

0.0.15

  • Added a jQuery wrapper to make working with Selenium easier

0.0.14

  • Making Chrome plugin path work regardless of project
  • Moving browser builder to individual tests. This is necessary so the browser can re-instantiate itself between tests.

0.0.13

  • Package bin path update

0.0.12

  • Directory structure updates; needed an index.js for easier module loading

0.0.11

  • Removed selenium/mocha wrapper to reduce dependencies
  • Moved to a promise-based test setup
  • Switched from BDD to TDD for clarity
  • Preferring local install to global; was previously global
  • Added changelog :-)

0.0.1 - 0.0.10

  • Regretting not starting a changelog sooner
  • Basically gets stuff setup and working through bugs

FAQs

Package last updated on 04 Aug 2017

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc