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

kasmir

v0.6.5

Published

Amazing multi-browser automation tool

Downloads

12

Readme

Kasmir

Travis David Codecov Code Climate Prs

Node npm

Kasmir is an amazingly powerful browser automation tool and end-to-end test runner. It gives you complete control over the outcome of your browser based tests, producing a JSON report that includes extended information about each step. You can use the output to handle very flexible failure conditions in your tests and perform complex automation tasks.

It wraps NightwatchJS so every browser command supported by it is also supported by Kasmir. It allows you to launch multiple clients with a single instance, run custom functions between steps and even specify when to continue running if some steps fail.

✦ Easy configuration ✦ Multiple browsers ✦ Reusable steps ✦ Flexible conditions ✦ Robust

See some Examples on GitHub or view Full documentation

Also, check out these interesting topics!

HOWTO run multiple browsers
HOWTO long running automation
HOWTO execute custom functions between steps

Installation

You will need a selenium server to run browser actions. Kasmir can download and launch one for you during initialization, so make sure you have Java installed on your system to run the server.

To install Kasmir itself simply do:

npm install kasmir

Simple example

To automate browser actions, you will need to define your actions and pass them to Kasmir during initialization. Actions consist of tasks which contain your browser commands. For example:

var myactions = {
  'Open page': {
    tasks: [{name: 'open github.com', handler: 'open', args: ['https://www.github.com']}]
  },
  'Close page': {
    tasks: [{name: 'close client', handler: 'close'}]
  }
}

var Kasmir = require('kasmir');
var runner = new Kasmir({actions: myactions});

Once your actions are defined you can simply call the run() method for whatever actions you wish to perform. Here we open github.com and then close the browser:

runner.run(['Open page', 'Close page']).then(() => {
  console.log('Done running!');
});

You can then fetch the report for actions using any of the report functions, for example:

runner.getReport();

Output

Example output report from the test above:

{
  actions: [...]
  tasks:
   [{
      id: 'dj9vp58oup3mvrpq77gb9',
      action: 'Open page',
      name: 'open github.com',
      state: 'success',
      startTime: 1488383856803,
      endTime: 1488383860119,
      runTime: 3315,
      error: null,
      value: true
    },
    ...
  errors: [...]
}

See below for more examples & documentation

Examples

See some examples on GitHub

Documentation

See the full documentation

Questions

Why would I want to use it?

Browser automation has never been this easy! You can perform very complex tasks with simple configuration. You can run actions in multiple browsers that can depend on each other. You can perform long running automation tasks with arbitrary callbacks between actions. Pretty cool!

Why would I want to use it for testing?

Kasmir tests are very robust. One goal of this project is to combat test flakiness and allow you to skip steps and continue running the test on certain conditions. Kasmir also allows you to define very flexible action patterns that are reusable and repeatable.

But Nightwatch already makes writing tests very easy?

Yes indeed, but you still need to write your tests in code and implement your own structure for complex cases. Let's say you want to continue running actions even if some steps fail. Or you might want to fail a test in case some steps take too long. With Kasmir you only have to provide a configuration file, run the test and do whatever you want with the output.

What are some example cases where Kasmir is useful?

✦ Want perform complex browser automation tasks with simple configuration?
✦ Want to easily run actions in multiple browsers in parallel?
✦ Want to run pre-defined action patterns multiple times without repeating youself?
✦ Want to run custom sync/async functions between actions?
✦ Want to fail an e2e test if rendering a page or element takes too long?

License

The MIT License