• Stars
    star
    320
  • Rank 130,453 (Top 3 %)
  • Language
    JavaScript
  • License
    MIT License
  • Created almost 12 years ago
  • Updated over 9 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Selenium-driven, cucumber-powered CSS testing.

Hardy

(The Not-quite-ready-yet release)

This is almost entirely working but not 100%. If you spot a problem, please file an issue.

Hardy is a collection of CSS testing steps and a boilerplate testing setup to get you up-and-running with automated CSS testing as quickly as possible. Tests are written in Cucumber and use Selenium. Hardy runs on Node.js and therefore all the example CSS test helpers are written in JS. The functionality behind them can easily be reused in any test setup, whether your tests are written in Java, Ruby or anything else.

This is a refactor of the original GhostStory project to run against Selenium using WebDriverIO. The original collection of CSS testing steps were written specifically for CasperJS and PhantomJS but now that PhantomJS supports the WebDriver protocol, we're now going via Selenium so that tests can be run against any browser.

The structure of this project and the WebDriverIO bindings are from WebDriverIO.

image

Read more at Hardy.io.

Installation

The recommended way to install Hardy is via npm:

npm install -g hardy

This will install Hardy as a global node module and put an executable hardy in your path. It will also include a local version of [Selenium v2.32.0]((http://docs.seleniumhq.org/) in case you don't have that already and a local copy of PhantomJS v1.9.0 for image diff test processing.

NOTE: Currently, the local install of PhantomJS will not be available for testing against unless you add it to your path.

For best results, you'll also need a Selenium–capable browser. Firefox supports the WebDriver protocol by default so without specifying otherwise, tests will be run against Firefox. PhantomJS also supports WebDriver.

To run tests against Chrome, you will need to install ChromeDriver.

To run tests against Internet Explorer, you will need InternetExplorerDriver.

To run Selenium at all, you'll need Java.

Finally, for (significantly) faster visual image compares, install GraphicsMagick. On OSX:

brew install graphicsmagick

Getting started

For full details on how to get started with Hardy, check out the documentation at hardy.io

Commands / usage

hardy init
  initialises an empty test directory

hardy selenium start
  starts the local selenium server (essential before tests)

hardy selenium stop
  stops the local selenium server

hardy .
  run all the tests in the current folder with the default browser (Firefox)

hardy --browser=phantomjs .
  specify the browser to test with

hardy --browser=phantomjs,chrome .
  specify multiple browsers to test with

Tests

To verify Hardy is working as it should, unit and acceptance tests are available. They can be run via Grunt from the project root:

grunt unit
grunt acceptance

# Or, to run both:
grunt test

The tests are automatically run on every commit to the main repo. Currently building on Travis CI:

Build Status

Travis Integration

To include Hardy in a Travis CI pipeline, import it as a devDependency:

npm install --save-dev hardy

Add the following to your .travis.yml:

before_script:
  - export DISPLAY=:99.0
  - sh -e /etc/init.d/xvfb start
  - node_modules/hardy/bin/hardy selenium start
  - {BUILD YOUR STATIC SITE HERE}
  - python -m SimpleHTTPServer&

And finally, add this to your package.json scripts object:

"scripts": {
  "test": "node_modules/hardy/bin/hardy --browser=firefox,phantom <PATH TO YOUR TEST FOLDER>"
},

For more detail, read the continuous integration guide on the Hardy site.

More Repositories

1

devtools-extension

Basic example of a Chrome Devtools extension with communication between the inspected page and the panel
JavaScript
222
star
2

jQuery-Scoped-CSS-plugin

DEPRECATED: A jQuery plugin to enable the scoped attribute on style blocks
JavaScript
170
star
3

csstest

NOT MAINTAINED: A collection of resources on automated CSS testing
HTML
101
star
4

cssert

DEPRECATED: CSS verification testing
JavaScript
32
star
5

jQTouch-Calendar

DEPRECATED: Calendar Extension for jQTouch
CSS
17
star
6

Transmission.bundle

Python
15
star
7

opensourcesnacks

Collection of open-source snack recipes
HTML
9
star
8

8bitalpha

Web Service to convert 24bit PNGs into 8bit PNGs while maintaining the alpha channel
JavaScript
7
star
9

pushbolig

DEPRECATED: Very basic integration of boligportal.dk apartment search with pushbullet.com notifications.
JavaScript
6
star
10

AppCMS

Drupal 6 theme and modules to create a flattened site that can be embedded in PhoneGap
JavaScript
5
star
11

coordinate-tz

Node module to map latitude/longitude to an IANA timezone
JavaScript
5
star
12

map-playground

Map Playground for jHERE
HTML
4
star
13

Cobalt.vim

(Yet another) port of the Cobalt colorscheme to Vim
Vim Script
4
star
14

Proximity

Proximity search API.
JavaScript
3
star
15

GrowlBird

A plugin to send Growl notifications to a Twitter account
Objective-C
3
star
16

CodeExamples

Example code for a tutorial on the Web Audio API presented at a Nokia Tech Talk
JavaScript
3
star
17

HashtagHeatmap

Display density for tweets on a Nokia map
JavaScript
2
star
18

TweetArchiver

Searches Twitter for a specified hashtag and saves, caches and displays the results. Source code for http://memories.museum140.com/
PHP
2
star
19

here-map

Web Component to embed a HERE map
JavaScript
2
star
20

sponsored-event

Managed sponsored events through an Ethereum smart contract
Vue
2
star
21

scrimshaw

Bare-bones API tests using cURL
Shell
2
star
22

SeadragonHotspots

Enabling hotspots on the AJAX version of Microsoft's Seadragon
JavaScript
2
star
23

Knot

Multi-touch knot tying and untying game
JavaScript
2
star
24

hardy.io

Website for Hardy
CSS
1
star
25

winterwiki

Test Repo for messing around with the wiki API
Shell
1
star
26

GhostKnife

A little PhantomJS helper script to slice up page renders
JavaScript
1
star
27

CoverMapMe

Source of the website http://covermap.me/
PHP
1
star
28

planets-api

Simple REST API that returns altitude and azimuth for planets
JavaScript
1
star
29

HighlightBlock.vim

Vim plugin to highlight CSS and JS blocks in html with a full line highlight
Vim Script
1
star