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

spectre-test-runner

v0.0.4

Published

Test runner for Spectre style test definitions in casperjs and phantomjs

Downloads

5

Readme

Build Status

Description

The Spectre test runner is a node script that will run Spectre style tests against your frontend code.

Spectre style tests?

Spectre style tests are simple JSON files that include a list of steps to run, this spec file is then used to generate a full blown CasperJS test, meaning that you can create frontend tests quickly and easily without having to write tedious test type code.

A typical Spectre test would look something like this, this is a working sample and can be run using Spectre:

{
	"url": "https://en.wikipedia.org/wiki/Main_Page",
	"title": "Wikipedia example",
	"steps": [
		{
			"action": "fillSelectors",
			"value": "Spectre",
			"selector": "#searchInput",
			"order": 10
		},
		{
			"action": "click",
			"selector": "#searchButton",
			"order": 20
		},
		{
			"action": "assertSelectorHasText",
			"selector": "#mw-content-text",
			"value": "Spectre or specter usually refers to a ghost or other apparition.",
			"order": 30
		}
	]
}

This test will open wikipedia, enter a search term of "Spectre" and click the search button, we will then assert that the correct text is shown on the page.

The output of this test in the terminal looks like this:

Wikipedia example
...
3 steps total, 3 passed, 0 failed

Stay tuned to the Spectre repo, for a cool web app that will allow you to create these Spectre files using an easy interface.

Prerequisites

In order for the tests to run successfully, you need to globally install the following modules:

  • PhantomJS npm install -g phantomjs
  • CasperJS npm install -g casperjs

If you are having trouble, you may be missing prerequisites for either PhantomJS or CasperJS, you can find a list of CasperJS prerequisites here

Installation

npm install -g spectre-test-runner

Usage

Running a test is easy, simply run the following command with the path to the spec file that you want to run:

spectre spec/wikipedia.spec.json

TODO list

The following list is in the priority order of things that are still on the the TODO list:

  • Step failures actually log some useful information so you can see where your script failed and why.
  • Testing against more inbuilt Casperjs actions and asserts.
  • Ability to have steps that export a variable for use in later steps.
  • Running multiple tests at once (i.e. just running spectre runs all your tests).
  • Command line and file based config for options.
  • Ability to watch files for changes and automatically rerun tests.