npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@dequelabs/amaze-tdd

v0.3.2

Published

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

Downloads

7

Readme

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