Publish Vulpes Preview 15 sources for desktop, Android and Tundra
Share Gaia assets and adapters, keep private profiles and development documents local, and update both public READMEs.
This commit is contained in:
parent
93e3a48004
commit
b38dea0597
25901 changed files with 9982925 additions and 369 deletions
83
gaia/apps/settings/test/marionette/app/keyboard_app.js
Executable file
83
gaia/apps/settings/test/marionette/app/keyboard_app.js
Executable file
|
|
@ -0,0 +1,83 @@
|
|||
'use strict';
|
||||
|
||||
var Base = require('./base');
|
||||
|
||||
/**
|
||||
* Abstraction around keyboard app
|
||||
* @constructor
|
||||
* @param {Marionette.Client} client for operations.
|
||||
*/
|
||||
function KeyboardApp(client) {
|
||||
Base.call(this, client, null, KeyboardApp.Selectors);
|
||||
}
|
||||
|
||||
module.exports = KeyboardApp;
|
||||
|
||||
KeyboardApp.Selectors = {
|
||||
'settingsHeader': '#general-header',
|
||||
'vibrationCheckbox': '#cb-vibration'
|
||||
};
|
||||
|
||||
KeyboardApp.SETTINGS_LAUNCH_PATH = 'app://keyboard.gaiamobile.org/' +
|
||||
'settings.html';
|
||||
|
||||
KeyboardApp.prototype = {
|
||||
__proto__: Base.prototype,
|
||||
|
||||
get vibrationFromMozSettings() {
|
||||
return this.client.settings.get('keyboard.vibration');
|
||||
},
|
||||
|
||||
switchToSettings: function() {
|
||||
this.client.switchToFrame();
|
||||
var settingsFrame = this.client.findElement(
|
||||
'iframe[src*="' + KeyboardApp.SETTINGS_LAUNCH_PATH + '"]');
|
||||
|
||||
/**
|
||||
* XXX: Workaround to wait for the frame is ready after switching to the
|
||||
* keyboard app's settings page. We should use
|
||||
* this.client.apps.switchToApp(KeyboardApp.SETTINGS_LAUNCH_PATH)
|
||||
* instead of the logic below after Bug 1027994 is fixed.
|
||||
*
|
||||
* Add swithToApp waiting logic here, see Bug 1003788 for a similar
|
||||
* technique we implemented in marionette-apps plugin.
|
||||
*/
|
||||
|
||||
// Wait for the iframe is rendered.
|
||||
this.client.waitFor(function() {
|
||||
var frameClass = settingsFrame.scriptWith(function(el) {
|
||||
return el.parentNode.getAttribute('class');
|
||||
});
|
||||
|
||||
if (frameClass !== null) {
|
||||
return frameClass.indexOf('render') !== -1;
|
||||
} else {
|
||||
return true;
|
||||
}
|
||||
});
|
||||
|
||||
// Wait for the iframe is displayed on screen.
|
||||
this.client.waitFor(function() {
|
||||
var transitionState = settingsFrame.scriptWith(function(el) {
|
||||
return el.parentNode.getAttribute('transition-state');
|
||||
});
|
||||
|
||||
if (transitionState !== null) {
|
||||
return transitionState === 'opened';
|
||||
} else {
|
||||
return settingsFrame.displayed();
|
||||
}
|
||||
});
|
||||
|
||||
this.client.switchToFrame(settingsFrame);
|
||||
},
|
||||
|
||||
clickVibrationOption: function() {
|
||||
this.waitForElement('vibrationCheckbox').click();
|
||||
},
|
||||
|
||||
goBackToSettingsApp: function() {
|
||||
var header = this.waitForElement('settingsHeader');
|
||||
header.tap(25, 25);
|
||||
}
|
||||
};
|
||||
Loading…
Reference in a new issue