Skip to content

Commit 0906aaa

Browse files
committed
Updated readme, added logo
1 parent 426695e commit 0906aaa

3 files changed

Lines changed: 20 additions & 11 deletions

File tree

‎.gfx/nut.png‎

81.1 KB
Loading

‎.npmignore‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,4 +4,5 @@ tslint.json
44
.travis.yml
55
.vscode
66
.idea
7-
.github
7+
.github
8+
/.gfx

‎README.md‎

Lines changed: 18 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,10 @@ Native UI testing / controlling with node.js
1313

1414
# About
1515

16+
<p align="centet">
17+
<img src=".gfx/nut.png" alt="logo" width="200"/>
18+
</p>
19+
1620
This is a WIP implementation for a cross-platform native UI testing tool.
1721
It allows for native UI interactions via keyboard and / or mouse,
1822
but additionally gives you the possibility to navigate the screen based on image matching.
@@ -26,28 +30,32 @@ The following snippet shows a valid NUT example (on macOS)
2630

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

29-
const square = async (controller) => {
30-
await controller.mouse.move(controller.movement.right(500));
31-
await controller.mouse.move(controller.movement.down(500));
32-
await controller.mouse.move(controller.movement.left(500));
33-
await controller.mouse.move(controller.movement.up(500));
33+
const square = async (control) => {
34+
await control.mouse.move(control.movement.right(500));
35+
await control.mouse.move(control.movement.down(500));
36+
await control.mouse.move(control.movement.left(500));
37+
await control.mouse.move(control.movement.up(500));
3438
};
3539

40+
const openSpotlight = async (control) => {
41+
await control.keyboard.pressKey(native.Key.LeftSuper);
42+
await control.keyboard.pressKey(native.Key.Space);
43+
await control.keyboard.releaseKey(native.Key.Space);
44+
await control.keyboard.releaseKey(native.Key.LeftSuper);
45+
}
46+
3647
describe("Basic test", () => {
3748
it("Should run a simple test", async () => {
3849
const config = new native.Config();
3950
const control = new native.Controller(config);
4051

4152
await square(control);
42-
43-
await control.keyboard.pressKey(native.Key.LeftSuper);
44-
await control.keyboard.pressKey(native.Key.Space);
45-
await control.keyboard.releaseKey(native.Key.Space);
46-
await control.keyboard.releaseKey(native.Key.LeftSuper);
53+
await openSpotlight(control);
4754
await control.keyboard.type("calculator");
4855
await control.keyboard.type(native.Key.Return);
4956
});
5057
});
58+
5159
```
5260

5361
# Examples

0 commit comments

Comments
 (0)