Skip to content
This repository has been archived by the owner on Nov 3, 2021. It is now read-only.

Commit

Permalink
Merge pull request #33411 from raylin/1219674-test-email-keyboard-gij
Browse files Browse the repository at this point in the history
1219674 test email keyboard gij
  • Loading branch information
raylin committed Nov 30, 2015
2 parents ddceb5a + 751fe05 commit 5e1b383
Showing 1 changed file with 83 additions and 0 deletions.
83 changes: 83 additions & 0 deletions apps/keyboard/test/marionette/email_keyboard_test.js
Original file line number Diff line number Diff line change
@@ -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('<input type="email"> 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');
});

});
});

0 comments on commit 5e1b383

Please sign in to comment.