diff --git a/apps/keyboard/test/marionette/email_keyboard_test.js b/apps/keyboard/test/marionette/email_keyboard_test.js new file mode 100644 index 000000000000..8be77b77432f --- /dev/null +++ b/apps/keyboard/test/marionette/email_keyboard_test.js @@ -0,0 +1,83 @@ +/* global suite */ + +'use strict'; + +var KeyboardTestApp = require('./lib/keyboard_test_app'), + Keyboard = require('./lib/keyboard'), + assert = require('assert'); + +marionette('Email keyboard input tests', function() { + var apps = {}; + var keyboardTestApp = null; + var keyboard = null; + var client = null; + + apps[KeyboardTestApp.ORIGIN] = __dirname + '/keyboardtestapp'; + + client = marionette.client({ + profile: { + apps: apps, + prefs: { + 'focusmanager.testmode': true + }, + settings: { + 'lockscreen.enabled': false, + 'ftu.manifestURL': null + } + } + }); + + setup(function() { + keyboard = new Keyboard(client); + keyboardTestApp = new KeyboardTestApp(client); + + keyboardTestApp.launch(); + }); + + suite(' tests', function() { + setup(function() { + keyboardTestApp.switchTo(); + keyboardTestApp.emailInput.tap(); + + keyboard.switchTo(); + }); + + test('should be email layout', function() { + var atSymbol = '@'; + var commaSymbol = ','; + + assert.equal(keyboard.isKeyPresent(atSymbol), true); + + assert.equal(keyboard.isKeyPresent(commaSymbol), false); + }); + + test('Type post@mydomain.com', function() { + keyboard.type('post'); + + keyboardTestApp.switchTo(); + keyboardTestApp.emailInput.tap(); + keyboard.switchTo(); + + keyboard.type('@'); + keyboard.type('mydomain.com'); + + keyboardTestApp.switchTo(); + + assert.equal( + keyboardTestApp.emailInput.getAttribute('value'), 'post@mydomain.com'); + }); + + test('Type post123@mydomain.com', function() { + keyboard.type('post123'); + keyboard.type('@'); + keyboard.type('mydomain.com'); + + keyboardTestApp.switchTo(); + + assert.equal( + keyboardTestApp.emailInput.getAttribute('value'), + 'post123@mydomain.com'); + }); + + }); +});