Skip to content

Commit

Permalink
Move keyboard tests to it's own file.
Browse files Browse the repository at this point in the history
  • Loading branch information
octalmage committed Feb 25, 2018
1 parent 98eb2ca commit 37e3165
Show file tree
Hide file tree
Showing 4 changed files with 38 additions and 98 deletions.
82 changes: 0 additions & 82 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 0 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,6 @@
"devDependencies": {
"jasmine": "^3.0.0",
"prebuild": "v6.1.0",
"tape": "^3.5.0",
"targetpractice": "0.0.7"
}
}
38 changes: 38 additions & 0 deletions test/integration/keyboard.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
/* jshint esversion: 6 */
var robot = require('../..');
var targetpractice = require('targetpractice/index.js');
var os = require('os');

robot.setMouseDelay(100);

let target, elements;

describe('Integration/Keyboard', () => {
beforeEach(done => {
target = targetpractice.start();
target.once('elements', message => {
elements = message;
done();
});
});

afterEach(() => {
targetpractice.stop();
target = null;
});

it('types', done => {
const stringToType = 'hello world';
// Currently Target Practice waits for the "user" to finish typing before sending the event.
target.once('type', element => {
expect(element.id).toEqual('input_1');
expect(element.text).toEqual(stringToType);
done();
});

const input_1 = elements.input_1;
robot.moveMouse(input_1.x, input_1.y);
robot.mouseClick();
robot.typeString(stringToType);
});
});
15 changes: 0 additions & 15 deletions test/integration/mouse.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,21 +37,6 @@ describe('Integration/Mouse', () => {
robot.mouseClick();
});

it('types', done => {
const stringToType = 'hello world';
// Currently Target Practice waits for the "user" to finish typing before sending the event.
target.once('type', element => {
expect(element.id).toEqual('input_1');
expect(element.text).toEqual(stringToType);
done();
});

const input_1 = elements.input_1;
robot.moveMouse(input_1.x, input_1.y);
robot.mouseClick();
robot.typeString(stringToType);
});

it('scrolls', done => {
target.once('scroll', element => {
/**
Expand Down

0 comments on commit 37e3165

Please sign in to comment.