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

sharpeye

v5.3.0

Published

This tool goes through a list of tasks with URLs or click paths, makes screenshots of them and compares them.

Downloads

5

Readme

SharpEye

This tool goes through a list of tasks with URLs or click paths, makes screenshots of them and compares them.

Installation

You need to install selenium and the browsers you want to test.

Usage

npm install burdamagazinorg/sharpeye

Configure your project as described in this document

Execute./node_modules/.bin/sharpeye once to create reference images.
If you execute it again, the new screenshots will be compared to the reference.
(You can also add sharpeye to the scripts section in you package.json)

If there is a difference, the diff image will be placed in the screenshot subdirectory diff.

Configuration

Create a file sharpeye.conf.js and sharpeye.tasks.js in your project directory, with following contents:

sharpeye.conf.js:

// Options for sharpeye
exports.options = {
  // The base URL of the website.
  baseUrl: 'http://thunder.dd:8083',
  // Specify directories, in which screenshots should be saved.
  // They will get a postfix of '/screen', '/reference' and '/diff', respectively.
  screenBaseDirectory: process.cwd() + '/screenshots',
  referenceBaseDirectory: process.cwd() + '/screenshots',
  diffBaseDirectory: process.cwd() + '/screenshots'
}

// Webdriver.io config overwrites.
// See the sharpeye.conf.js file in the root of the sharpeye module
exports.config = {

  // Define, which browser you want to use
  // See: https://github.com/SeleniumHQ/selenium/wiki/DesiredCapabilities
  capabilities: [
    {
      browserName: 'firefox'
    },
    {
      browserName: 'chrome'
    }
  ]
};

sharpeye.tasks.js:

For taking a full-page screenshot of a URL, just specify the path as string. e.g.: /my/path

To click/fill in some elements and take a screenshot afterwards, you can specify an object, with following properties:

  • name: The name of the actions package. Will be used for the screenshot filename
  • path: The URL path to start from
  • element: (optional) The element, from which a screenshot should be taken
  • viewport: (optional) Whether the viewport should be captured, instead of the whole page
  • noScreenshot: (optional) Set to true, to prevent taking a screenshot. Might be used e.g. for logins
  • actions: An array of objects, which specify, where to click and for what to wait for

The action objects have following properties:

  • $: The selector for the DOM element, on which should be clicked, or which should be selected. Also works for options in select lists.
  • wait: (optinal) The element, which should be waited for, after clicking
  • fill: (optional) A string, which should be filled into the selected element
  • waitBefore: (optional) time in milliseconds, to be waited, before clicking
  • offset: (optional) an offset in y direction, to be scrolled (useful, when elements are hidden behind floating elements)

The actions array can also contain an object, which switches the context to another frame. This object can have following properties:

  • switchToFrame: ID of the (i)frame, to switch to, or null, to switch back to the default frame
  • wait: After switching, element to wait for, before continuing
module.exports = [
  '/admin/content',
  { name: 'name of the click path',
    path: '/node/add/article',
    [element: 'selector for DOM-element from which the screenshot should be made'],
    [viewport: true // makes screenshot of the viewport, instead of the whole page],
    [noScreenshot: true // Makes no screenshot at all]
    actions: [
      { $: 'DOM selector', wait: 'DOM selector to wait until visible', [waitBefore: 'optional time in milliseconds, which should pass, before clicking']},
      { $: 'DOM selector', fill: 'My value to be filled into the DOM element' },
      { switchToFrame: 'ID of frame', wait: 'DOM selector to wait until visible inside frame' },
      { switchToFrame: null } // switch to default context
  ]},
]

Different types of selectors can be used: http://webdriver.io/guide/usage/selectors.html