nierika
v1.1.0
Published
wip - nothing here yet
Downloads
3
Readme
nierika
Visual testing library, heavily inspired by Sikuli / SikiliX
Installation
npm install --save nierika
Api
At the moment only VNC is supported as screen driver. You start by constructing screen
object:
const nierika = require('nierika')
const opts = {
host: '127.0.0.1',
port: 5911,
password: 'my-new-password',
encodings: [rfb.encodings.raw, rfb.encodings.pseudoCursor] // optional
};
const screen = nierika.createScreen(opts)
Screen
object
const template = await screen.createTemplateFromFile(path)
- create template using image file file from disk. Returns Template
const match = await screen.waitVisible(template, timeout)
- wait until template is visible on screen.
const match = await screen.waitVanish(template, timeout)
- wait until template is NOT visible on screen.
await screen.mouseMove(x, y)
- move mouse to x, y
await screen.mouseMove(template)
- wait until template is visible and move mouse to match position
await screen.mouseLeftClick()
await screen.mouseLeftDoubleClick()
await screen.mouseWheeDown()
await screen.mouseWheelUp()
await screen.keyboardTypeText(string)
- type text
await screen.keyboardKeyUp(string|number)
, await screen.keyboardKeyDown(string|number)
- if argument is number, send numerical keysym. If it's a string, use it as a name to lookup keysym using keysym module.
Template
object
template.similar(similarity)
- return new template with similarity set to similarity
template.width()
, template.height()
TODO
- OCR with tesseract.js
- SikuliIDE-like test authoring app based on electron
- filters to allow running same test cases under 'color blind' / 'low contract vision' / 'shaky mouse' modes
- tools to automatically extract and save templates and convert to test scripts from running nightmare or cypress
- option to match templates using ORB descriptors
- performance: use image pyramids
- save and replay tests together with screen recording
- automatically create tests from VNC session recording
Thanks
@glenngillen for running 'New Year resolution to finish a project' meetup where I finnally put pieces of code together as first version of this lib