Skip to content

Repository files navigation

NUT (Native UI Toolkit) Build Status

Native UI testing / controlling with node.js


Built with Robot Built with opencv4nodejs

About

logo

This is a WIP implementation for a cross-platform native UI testing tool. It allows for native UI interactions via keyboard and / or mouse, but additionally gives you the possibility to navigate the screen based on image matching.

Sample

The following snippet shows a valid NUT example (on macOS)

"use strict";

const native = require("native-ui-toolkit");

const square = async (control) => {
    await control.mouse.move(control.movement.right(500));
    await control.mouse.move(control.movement.down(500));
    await control.mouse.move(control.movement.left(500));
    await control.mouse.move(control.movement.up(500));
};

const openSpotlight = async (control) => {
    await control.keyboard.pressKey(native.Key.LeftSuper);
    await control.keyboard.pressKey(native.Key.Space);
    await control.keyboard.releaseKey(native.Key.Space);
    await control.keyboard.releaseKey(native.Key.LeftSuper);
}

describe("Basic test", () => {
    it("Should run a simple test", async () => {
        const config = new native.Config();
        const control = new native.Controller(config);

        await square(control);
        await openSpotlight(control);
        await control.keyboard.type("calculator");
        await control.keyboard.type(native.Key.Return);
    });
});

Examples

The nuts contains a set of ready to use examples which demo the usage ot NUT.

Modules

This list gives an overview on currently implemented and planned functionality. It's work in progress and will undergo constant modification.

Assertions

  • isVisible
  • isNotVisible

Clipboard

  • Copy to clipboard
  • Paste from clipboard

Keyboard

  • Support for standard US keyboard layout
  • Support for German keyboard layout

Mouse

  • Support for basic mouse movement
  • Configurable movement speed

Process

  • Spawn a new process
  • Retrieve the region of a process window
  • Close a spawned process

Screen

  • findOnScreen
  • waitFor
  • Hooks to trigger actions based on images

About

Native UI testing / controlling with node

Topics

Resources

Contributing

Stars

2.9k stars

Watchers

23 watching

Forks

Releases

Sponsor this project

Packages

Used by

Contributors

Languages