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

taiko-screencheck

v1.0.21

Published

simplify visual regression testing with screenshot capture and compare

Downloads

34

Readme

taiko screencheck

Node.js CI TypeDocs

Installation

npm install taiko-screencheck

Introduction

taiko-screencheck

taiko-screencheck is a taiko plugin that assists visual regression testing by tracking visual changes to websites and web apps. It introduces a global screencheck method that has the same call signature as the built-in screenshot method, except that it returns the result of comparing a screenshot to a reference screenshot.

By default taiko-screencheck will create an automatically numbered directory to store screenshots. It is recommended that test developers use the screenshotSetup method to override this behaviour to give complete control of taiko-screencheck output.

Taiko Methods

screencheck()

screencheck(screenshotOptions = {}) => { 
   result:string = "SAME" | "DIFFERENT" | "NO_BASE_IMAGE",
   data:Buffer, referenceData:Buffer = undefined, pixelCount:number 
}

This method takes and saves a screenshot and compares it to the reference screenshot in the detected or configured reference directory (see screencheckSetup#refRunId).

The value of the returned result property indicates whether or not the screenshots differ.

Taiko CLI example:

await openBrowser()
await goto("dcdc.io")
homepage = await screencheck()
assert.equal(homepage.result, "SAME")

screencheckSetup()

screencheckSetup(options = { 
   runId:string = <auto>, refRunId:string = <auto>, baseDir:string = <cwd>
}) => options

This method optionally configures screencheck to use custom directories for output and comparison.

FAQs

  1. My headless screen captures never match my headed screen captures of the same page.

    This may be happening because you have a high DPI display. Try setting your desktop as a 1:1 pixel ratio to your display device. Alternatively you may want to avoid headed mode for the creation of reference images.

    On Windows it may help to disable ClearType while running tests in headed modes.

  2. How do I use taiko-screencheck?

    With an initialised node project, run npm install taiko-screencheck and from thereonin taiko will automatically enable taiko-screencheck.

  3. Does taiko-screencheck work on the taiko CLI and in node?

    Yes. You can use the plugin in both node and taiko CLI.

  4. What happens when I don't configure using screencheckSetup?

    taiko-screencheck will create a directory per run, named 000n.auto where n is computed based on the current contents of the base directory. This is to say, the first time it runs the output will go to $pwd/0001.auto and the next time $pwd/0002.auto and so on.

    You can use screencheckSetup(options) to change this behaviour.

  5. Can I see the current configuration at runtime?

    Yes. Call screencheckSetup() without providing options and taiko-screencheck will return the current configuration.

  6. When I call openBrowser the viewport size is 1440 x 900. Why is this happening?

    taiko-screencheck overrides the built in openBrowser() command by adding a call to setViewPort() that matches the headless mode viewport. This feature mitigates the need to rewrite test scripts written in headed mode that later run in headless mode. If you don't want this behaviour, you can add a second boolean parameter to openBrowser(options, true) to force use of the original openBrowser command which will have a viewport "appropriate" for your desktop display.

Contributing

Clone the git repository and use the _test_harness subdirectory to test the plugin in the taiko environment. The repository includes a Visual Studio Code configuration for debugging in a taiko context.

git clone https://github.com/dcdc-io/taiko-screencheck
cd taiko-screencheck
npm install
npm run build
npm run test