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

totoro-server

v2.0.3

Published

Server side of totoro.

Downloads

27

Readme

totoro

totoro-server

Server side of totoro.

Latest stable version:v2.0


1. Installation

Node requirement

>= 0.10.12

Install from npm

$ npm install totoro-server -g

If it not works, you may add sudo before the command, as follows.

Install from github

To get the latest function (may not be stable)

$ git clone [email protected]:totorojs/totoro-server.git
$ cd totoro-server
$ npm install -g

2. Quick Start

  1. Launch server.

    $ totoro-server

    You should see an output like bellow:

    Start server <{{yourIP}}:9999>
  2. Start a driver

    Use any browser to visit {{yourIP}}:9999, then it registers as a web driver that can drive the browser of this kind run test.

    If you use it on pc, be mind that allow popup from {{yourIP}}, refer to popup settings.

Want to run some test? See the quick start of totoro.

3. What Is A Driver?

In a word, a driver is something open specified browser to visit specified URL and close it by directives from server.

Available drivers

Official drivers
  • web driver: any browser opens {{yourIP}}:9999 becomes a web driver, it's for temporary use only.
  • totoro-driver: a stable driver written in node, be able to drive chrome, safari, firefox and ie both on windows and mac.
Third party drivers

Add your driver here

How to write a driver?

If you know how to open and close a browser(or some other application), it's very very easy to write a driver for it.

All steps with pseudo-code.

  1. Set command line options

    • -s, --server: default is http://server.totorojs.org:9999
  2. Link to server by socket and init.

    var socket = socketClient.connect({{server}} + '/__labor')
    // NOTE: the namespace of socket is '/__labor'
    
    socket.on('connect', function() {
      var initInfo = {
        // if the app you drive is not a browser
        // group is required, it could be any string you like
        group: 'groupName',
        device: { name: 'mac' },
        os: { name: 'macosx', version: '13.1.0' },
        agent: { name: 'chrome', version:'35.0.1916.114' }
      }
    
      socket.emit('init', initInfo)
    })
  3. Open or close specified browser when received corresponding directives.

    socket.on('add', function(data) {
      /*
       * structure of data
       * {
       *   orderId: {{orderId}},
       *   laborId: {{laborId}},
       *   laborTrait: {{labor trait info, the same as init info}},
       *   runner: {{test runner, typically be a url}}
       * }
       */
      var key = data.orderId + '-' + data.laborId
      orders[key] = open(runner)
    })
    
    socket.on('remove', function(data) {
      // the data structure is the same as 'add' event's but without the laborTrait
      var key = data.orderId + '-' + data.laborId
      close(orders[key])
      ;delete orders[key]
    })
  4. Close all browsers when dirver exits.

4. Cli Options

-H, --host

Server host。

Default: IP of this computer.

-P, --port

Server port。

Default: 9999

-d, --debug

Show debug log.

Default: false

5. Config File

If you need a config file, just place totoro-srever-config.json in the CWD, all options are written in lower camel case.

Data flow

1