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

webbot

v1.0.17

Published

WebBot helps you to test web sites

Downloads

11

Readme

Build Status NPM version

What's WebBot?

WebBot provides a beautiful way to automate web functional tests.

Features :

  • Works with embedded phantomjs browser, any installed usual browser, or any available selenium grid hub
  • Provides a clean frame to separate config data and scenario
  • Provides a simple command line to execute web tests, easily integrate them into a CI, and create industrial testing projects
  • Provides a browser object augmented with useful methods (see client-commands.js)

Installation :

Globally :

# npm install -g webbot
# webbot

Or local to your project :

# cd myproject
# npm install webbot --save
# $(npm bin)/webbot

How to use WebBot :

1. Create a test project :

# mkdir myproject && cd myproject

2. Create expected directory structure :

  • scenarii (this is where to place test scripts)
    • mywebtest.js
  • config (optionnal place for test scripts configurations)
    • default (default environment)
      • mywebtest.js or .json
    • live (an environment called 'live')
      • mywebtest.js or .json (will override default config)

Example of directory structure :

3. Create a web test script :

scenarii/mywebtest.js :

var chai = require('chai')
  , webbot = require('webbot')
  , expect = chai.expect
  , browser, scenario;

browser = webbot.getBrowser();
scenario = webbot.getScenario();

describe('Simple web test', function () {
  after(function (done) {
    browser
      .end(done);
  });
  it('should check web page title', function (done) {
    browser
      .log('Connect to %s', scenario.config.url)
      .url(scenario.config.url)
      .log('Check page title : %s', scenario.config.title)
      .getTitle(function (err, value) {
        expect(err).to.be.undefined;
        expect(value).to.equal(scenario.config.title);
      })
      .call(done);
  });
});

4. Create test config :

config/scenarii/default/mywebtest.json :

{ "timeout": 10000 }

config/scenarii/live/mywebtest.json

{ "url": "http://www.google.com", "title": "Google" }

5. Now play :

Find available scenarii :

# webbot -f

Result :

mywebtest

Run a scenario :

# webbot -e live -s mywebtest

Result :

webbot:info webbot - using browser : phantomjs [platform : ANY] +0ms

Simple web test
webbot:info browser - #1 - Connect to http://www.google.com +1s
webbot:info browser - #2 - Check page title : Google +827ms
✓ should home page (1782ms)


1 passing (2s)

Command line options :

  • --dir (-d) : base directory of scenarii and configuration files, it should respect directory structure (default : current dir)
  • --env (-e) : environnement name to use for configuration, it should be a child of config directory where to find configuration json files (example : live)
  • --scenario (-s) : scenario to execute, it should be placed under scenarii directory (example : mywebtest)
  • --options (-o) : webdriver browser options, in JSON string format, as specified in WebdriverIO remote options
  • --commands (-c) : extra client commands module to register, it should be a collection of functions to add to the browser object as specified in WebdriverIO custom commands (example : lib/myCustomCommands)
  • --loglevel (-l) : log level to enable (error|warn|info|debug|trace)

Use cases :

See log details

# webbot -e live -s mywebtest -l trace

Execute with Firefox

# webbot -e live -s mywebtest -o '{"desiredCapabilities":{"browserName": "firefox"}}'

Execute with Chrome

# webbot -e live -s mywebtest -o '{"desiredCapabilities":{"browserName": "chrome"}}'

Execute with IE 11 / VM

VM is registered to a selenium hub server

# webbot -e live -s mywebtest -o '{"desiredCapabilities":{"browserName": "internet explorer","version":"11"},"host":"myseleniumserver.com","port":4445}' -l trace

Execute with extra client commands

Specified module provides functions used as extra client commands

# cd mycustomproject
# webbot -e live -s mywebtest -c lib/myCustomCommands

WebBot is mainly powered by WebdriverIO and Mocha

Enjoy !