Merge pull request #4994 from imurchie/isaac-android-keyevent

Add tests for sending simple key events to Android
This commit is contained in:
Jonathan Lipps 2015-04-23 15:40:50 -07:00
Родитель ee1b9face9 1815100bf6
Коммит 2062bfa727
1 изменённых файлов: 40 добавлений и 1 удалений

Просмотреть файл

@ -3,7 +3,8 @@
var env = require('../../helpers/env')
, setup = require("./setup-base")
, _ = require('underscore')
, getAppPath = require('../../helpers/app').getAppPath;
, getAppPath = require('../../helpers/app').getAppPath
, status = require('../../../lib/server/status');
var desired = {
@ -87,6 +88,32 @@ module.exports = function () {
var testText = 'Super-test.';
runTextEditTest(testText, done);
});
describe('pressing device key', function () {
it('should be able to send keyevents', function (done) {
driver
.waitForElementByClassName('android.widget.EditText')
.elementById('com.android.launcher:id/search_button')
.should.be.rejectedWith(status.codes.NoSuchElement.code)
.pressDeviceKey(3)
.waitForElementById('com.android.launcher:id/search_button')
.elementByClassName('android.widget.EditText')
.should.be.rejectedWith(status.codes.NoSuchElement.code)
.nodeify(done);
});
// skip selendroid because selendroid implements keyevent with an adb
// call, and we are unable to send metastate that way
it('should be able to send combination keyevents @skip-selendroid-all', function (done) {
driver
.waitForElementByClassName('android.widget.EditText')
.clear()
.pressDeviceKey(29, 193)
.elementByClassName('android.widget.EditText')
.text().should.become('A')
.nodeify(done);
});
});
});
describe('editing unicode text field', function () {
@ -178,6 +205,18 @@ module.exports = function () {
});
describe('pressing device key with unicode keyboard', function () {
it('should be able to send keyevents', function (done) {
driver
.waitForElementByClassName('android.widget.EditText')
.elementById('com.android.launcher:id/search_button')
.should.be.rejectedWith(status.codes.NoSuchElement.code)
.pressDeviceKey(3)
.waitForElementById('com.android.launcher:id/search_button')
.elementByClassName('android.widget.EditText')
.should.be.rejectedWith(status.codes.NoSuchElement.code)
.nodeify(done);
});
// skip selendroid because selendroid implements keyevent with an adb
// call, and we are unable to send metastate that way
it('should be able to send combination keyevents @skip-selendroid-all', function (done) {