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

so-acceptance

v7.0.0-beta-v4

Published

NodeJS acceptance testing for HOF Applications

Downloads

31

Readme

SO Acceptance

SO Acceptance is a NodeJS acceptance testing framework build on top of CodeceptJS and is designed to be used in SO applications

Installation

$ npm install so-acceptance --save-dev

Application configuration

Simple usage

Setup

For quickstart usage you can simply npm install the library and add the following script to your package.json.

package.json

"scripts": {
  "test:acceptance": "so-acceptance --steps"
}

Running this for the first time will create a local configuration file in your project directory.

The root of your acceptance tests will need to be located in a folder called acceptance_tests in the root of your app, features are located in a subdirectory named features.

<service name>
  |__acceptance_tests/
       |__features/
          |__your tests go here.

Running

$ npm run test:acceptance

Session Mocking

Setup

SO Acceptance comes with session mocking so you are able to test steps independently of one another. This assumes you are using hof-bootstrap and redis for session storage.

API

The I actor in CodeceptJS has been extended with the following session manipulation methods:

  • getSession(route_name): returns the session data for the given route_name (defined in bootstrap config).
  • setSessionData(route_name, {data}): sets the key: value pairs in data to session for given route_name.
  • setSessionSteps(route_name, [steps]): sets the visited steps to session for given route name.

As these API methods all return promises, they should be used within generator functions to ensure code execution is paused while the session is manipulated:

Scenario('I set session steps', function *(I) {
  yield I.setSessionSteps('journey-name', ['/', '/step-1']);
  I.amOnPage('/step-2');
});

Extensions to the actor (I)

The following methods have been added to I:

  • completeToStep(step[, values]): Completes a form as far as a given step, using values specified or default values inferred from the field names.
  • submitForm(): clicks the submit button input[type="submit"]
  • visitPage(page, [journey], [prereqs]): visits '/', then page, prepending journey if present, and setting prereq steps. Page and Prereqs are expected to be PageObjects with a url property.
  • seeErrors(errors): accepts either an array of keys or a single key, and checks for validation errors related to the element.
  • seeElements(elements): accepts either an array of selectors or a single selector and checks all elements are present on the page.
  • refreshPage(): refreshes the page - async, should be called within a generator.
  • seeEach(texts): accepts an array of text and checks all texts are present on the page`.
  • dontSeeEach(texts): accepts an array of text and checks all texts are not present on the page`.

Customisation

You can add any customisation options in your local configuration file. The default options are extended with overrides defined here.

codecept.conf.js

var path = require('path');

module.exports = require('so-acceptance').extend({
  name: 'name of your app',
  tests: './apps/**/acceptance/features/**/*.js',
  include: {
    customPage: path.resolve(__dirname, './pages/custom.js')
  }
})