Skip to content

Commit 37e3165

Browse files
committed
Move keyboard tests to it's own file.
1 parent 98eb2ca commit 37e3165

File tree

4 files changed

+38
-98
lines changed

4 files changed

+38
-98
lines changed

package-lock.json

-82
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

-1
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,6 @@
4545
"devDependencies": {
4646
"jasmine": "^3.0.0",
4747
"prebuild": "v6.1.0",
48-
"tape": "^3.5.0",
4948
"targetpractice": "0.0.7"
5049
}
5150
}

test/integration/keyboard.js

+38
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
/* jshint esversion: 6 */
2+
var robot = require('../..');
3+
var targetpractice = require('targetpractice/index.js');
4+
var os = require('os');
5+
6+
robot.setMouseDelay(100);
7+
8+
let target, elements;
9+
10+
describe('Integration/Keyboard', () => {
11+
beforeEach(done => {
12+
target = targetpractice.start();
13+
target.once('elements', message => {
14+
elements = message;
15+
done();
16+
});
17+
});
18+
19+
afterEach(() => {
20+
targetpractice.stop();
21+
target = null;
22+
});
23+
24+
it('types', done => {
25+
const stringToType = 'hello world';
26+
// Currently Target Practice waits for the "user" to finish typing before sending the event.
27+
target.once('type', element => {
28+
expect(element.id).toEqual('input_1');
29+
expect(element.text).toEqual(stringToType);
30+
done();
31+
});
32+
33+
const input_1 = elements.input_1;
34+
robot.moveMouse(input_1.x, input_1.y);
35+
robot.mouseClick();
36+
robot.typeString(stringToType);
37+
});
38+
});

test/integration/mouse.js

-15
Original file line numberDiff line numberDiff line change
@@ -37,21 +37,6 @@ describe('Integration/Mouse', () => {
3737
robot.mouseClick();
3838
});
3939

40-
it('types', done => {
41-
const stringToType = 'hello world';
42-
// Currently Target Practice waits for the "user" to finish typing before sending the event.
43-
target.once('type', element => {
44-
expect(element.id).toEqual('input_1');
45-
expect(element.text).toEqual(stringToType);
46-
done();
47-
});
48-
49-
const input_1 = elements.input_1;
50-
robot.moveMouse(input_1.x, input_1.y);
51-
robot.mouseClick();
52-
robot.typeString(stringToType);
53-
});
54-
5540
it('scrolls', done => {
5641
target.once('scroll', element => {
5742
/**

0 commit comments

Comments
 (0)