All Projects → nut-tree → Nut.js

nut-tree / Nut.js

Licence: apache-2.0
Native UI testing / controlling with node

Programming Languages

typescript
32286 projects

Projects that are alternatives of or similar to Nut.js

Tlsfuzzer
SSL and TLS protocol test suite and fuzzer
Stars: ✭ 335 (+8.41%)
Mutual labels:  automation, testing-tools, test-automation
mbt-bundle
A core library for Sicope Model, a Model-Based Testing tool for web application.
Stars: ✭ 19 (-93.85%)
Mutual labels:  test-automation, testing-tools
service-ui
UI service for Report Portal
Stars: ✭ 47 (-84.79%)
Mutual labels:  test-automation, testing-tools
page-walker
Chrome DevTools automation for desktop and mobile devices
Stars: ✭ 18 (-94.17%)
Mutual labels:  test-automation, testing-tools
vm-automation
VirtualBox automation using Python
Stars: ✭ 1 (-99.68%)
Mutual labels:  test-automation, testing-tools
karate-runner
VSCode Extension for Karate
Stars: ✭ 23 (-92.56%)
Mutual labels:  test-automation, testing-tools
vim-testbed
Docker image for testing Vim plugins
Stars: ✭ 40 (-87.06%)
Mutual labels:  test-automation, testing-tools
extensiveautomation-server
Extensive Automation server
Stars: ✭ 19 (-93.85%)
Mutual labels:  test-automation, testing-tools
page-modeller
⚙️ Browser DevTools extension for modelling web pages for automation.
Stars: ✭ 66 (-78.64%)
Mutual labels:  test-automation, testing-tools
request-baskets
HTTP requests collector to test webhooks, notifications, REST clients and more ...
Stars: ✭ 149 (-51.78%)
Mutual labels:  test-automation, testing-tools
Openrunner
Computest Openrunner: Benchmark and functional testing for frontend-heavy web applications
Stars: ✭ 16 (-94.82%)
Mutual labels:  test-automation, testing-tools
rfswarm
Robot Framework Swarm
Stars: ✭ 68 (-77.99%)
Mutual labels:  test-automation, testing-tools
software-testing-resource-pack
Various files useful for manual testing and test automation etc.
Stars: ✭ 38 (-87.7%)
Mutual labels:  test-automation, testing-tools
Wasmite
Now WebAssembly has proper testing, unit-testing and debugging 🤗
Stars: ✭ 20 (-93.53%)
Mutual labels:  test-automation, testing-tools
IO-TESTER
A functional test framework
Stars: ✭ 32 (-89.64%)
Mutual labels:  test-automation, testing-tools
educhain
an instructional purpose blockchain.
Stars: ✭ 21 (-93.2%)
Mutual labels:  test-automation, testing-tools
jdbdt
JDBDT: Java Database Delta Testing
Stars: ✭ 12 (-96.12%)
Mutual labels:  test-automation, testing-tools
AutoMeter-API
AutoMeter-API是一款针对分布式服务,微服务API功能和性能一体的自动化测试平台,一站式解决应用,服务,API,环境管理,用例,条件,测试场景,计划,测试报告,功能/性能测试兼容支持的一体化工作平台
Stars: ✭ 105 (-66.02%)
Mutual labels:  test-automation, testing-tools
Telegraf-Test
Telegraf Test - Simple Test ToolKit of Telegram Bots
Stars: ✭ 22 (-92.88%)
Mutual labels:  test-automation, testing-tools
servirtium-java
Service Virtualized HTTP - to help service test automation stay fast and consistent
Stars: ✭ 16 (-94.82%)
Mutual labels:  test-automation, testing-tools

nut.js (Native UI Toolkit)

GitHub Actions
Master Create tagged release
Develop Create snapshot release

Supported node versions SonarCloud badge SonarCloud Coverage

Downloads per month

Native UI testing / automation with node.js


Built with opencv4nodejs

About

logo

nut.js is a cross-platform native UI automation / 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.

Examples

nut-tree/trailmix contains a set of ready to use examples which demo the usage ot nut.js.

Discussion

In nut-tree/rfc documents regarding larger design / implementation changes in nut.js are up for discussion.

Community

Feel free to join our Discord community

Modules

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

Clipboard

  • [x] Copy text to clipboard
  • [x] Paste text from clipboard

Keyboard

  • [x] Support for standard US keyboard layout
  • [x] Support for German special characters

Mouse

  • [x] Support for mouse movement
  • [x] Support for mouse scroll
  • [x] Configurable movement speed
  • [x] Mouse drag

Window

  • [x] List all windows
  • [x] Retrieve active window
  • [x] Retrieve window title
  • [x] Retrieve window size and position

Screen

  • [x] findOnScreen
  • [x] waitFor
  • [x] Hooks to trigger actions based on images
  • [x] Highlighting screen regions

Integration

  • [x] Jest
  • [x] Electron

Sample

The following snippet shows a valid nut.js example (on macOS)

"use strict";

const { keyboard, Key, mouse, left, right, up, down, screen } = require("@nut-tree/nut-js");

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

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

describe("Basic test", () => {
  it("Should run a simple test", async () => {
    await square();
    await openSpotlight();
    await keyboard.type("calculator");
    await keyboard.type(Key.Return);
  });
});

Installation

nut.js comes with a pre-built version of OpenCV for your respective target platform. In order to use these pre-compiled bindings, certain runtime conditions have to be met.

Prerequisites

This section lists runtime requirements for nut.js on the respective target platform. nut.js is built and tested against node 10 and later as well as Electron 4 and later, so in order to use nut.js please make sure to use one of these versions.

Windows

In order to install nut.js on Windows, please make sure to have the Microsoft Visual C++ Redistributable installed.

macOS

On macOS, Xcode command line tools are required. You can install them by running

xcode-select --install

Attention:

In case you're experiencing problems like your mouse not moving or your keyboard not typing, please make sure to give the process you're executing your tests with accessibility permissions.

If an application wants to use accessibility features, a permission pop-up should be shown. If not, you could try to manually add the application you're running the script from.

Settings -> Security & Privacy -> Privacy -> Accessibility -> Add...

Linux

Depending on your distribution, Linux setups may differ.

In general, nut.js requires

  • libXtst

Installation on *buntu distributions:

sudo apt-get install libxtst-dev

Setups on other distributions might differ.

Install nut.js

Running

npm i @nut-tree/nut-js

or

yarn add @nut-tree/nut-js

will install nut.js and its required dependencies.

Snapshot releases

nut.js also provides snapshot releases which allows to test upcoming features.

Running

npm i @nut-tree/[email protected]

or

yarn add @nut-tree/[email protected]

will install the most recent development release of nut.js.

Attention: While snapshot releases are great to work with upcoming features before a new stable release, it is still a snapshot release. Please bear in mind that things might change and / or break on snapshot releases, so it is not recommended using them in production.

Usage with Electron

nut.js in combination with Electron requires bindings built for use with Electron. nut.js does provide such bindings and e.g. electron-rebuild makes installation a breeze.

Besides installing nut.js via

npm i @nut-tree/nut-js

or

yarn add @nut-tree/nut-js

we also install electron-rebuild as a devDependency:

npm i -D electron-rebuild

or

yarn add -D electron-rebuild

Next, we add a rebuild script to our package.json:

{
    ...
    "scripts": {
        ...
        "start": "electron app.js",
        "rebuild": "electron-rebuild"
    },
    ...,
}

Now all we have to do is run npm run rebuild and electron-rebuild will fetch the appropriate bindings for our Electron version. Currently nut.js provides bindings for all ABI version to work with Electron v4.x up to 8.x

Manual build

As a fallback, nut.js is able to build all required dependencies by itself. To do so, some setup is required on the respective target platform.

Windows

In order to install nut.js on Windows, Windows Build Tools and Python 2 are required. You can either set them up manually, or install them via npm:

npm install --global windows-build-tools

or

yarn global add windows-build-tools

macOS

On macOS, Xcode command line tools are required. You can install them by running

xcode-select --install

Linux

Depending on your distribution, Linux setups may differ.

In general, nut.js requires

  • Python 2
  • g++
  • make
  • libXtst
  • libPng

Installation on *buntu distributions:

sudo apt-get install build-essential python libxtst-dev libpng++-dev

Setups on other distributions might differ.

For reference, please see:

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].