VulpesOS/gaia/tv_apps/dashboard/test/marionette/dashboard_test.js
OverSu b38dea0597 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.
2026-09-30 23:13:03 +02:00

123 lines
3.7 KiB
JavaScript
Executable file

'use strict';
var APP_URL = 'app://dashboard.gaiamobile.org';
var Keys = {
'up': '\ue013',
'right': '\ue014',
'down': '\ue015',
'left': '\ue012'
};
var assert = require('chai').assert;
// Skip because the dashboard is not needed app now.
// Should re-enable the test when we need it.
marionette.skip('Test Arrow Key Events', function() {
var opts = {
hostOptions: {
screen: {
width: 1920,
height: 1080
}
}
};
var client = marionette.client({
profile: opts,
// XXX: Set this to true once Accessibility is implemented in TV
desiredCapabilities: { raisesAccessibilityExceptions: false }
});
setup(function() {
// Launch test app
client.apps.launch(APP_URL);
client.apps.switchToApp(APP_URL);
});
test('Display and hide top widget after pressing up/down',
{ devices: ['tv'] }, function () {
var element = client.helper.waitForElement('body');
element.sendKeys(Keys.up);
assert.equal(element.scriptWith(function(elem) {
return elem.dataset.activeDirection;
}), 'up');
element.sendKeys(Keys.down);
assert.equal(element.scriptWith(function(elem) {
return elem.dataset.activeDirection;
}), '');
});
test('Display and hide right widget after pressing right/left',
{ devices: ['tv'] }, function () {
var element = client.helper.waitForElement('body');
element.sendKeys(Keys.right);
assert.equal(element.scriptWith(function(elem) {
return elem.dataset.activeDirection;
}), 'right');
element.sendKeys(Keys.left);
assert.equal(element.scriptWith(function(elem) {
return elem.dataset.activeDirection;
}), '');
});
test('Display and hide bottom widget after pressing down/up',
{ devices: ['tv'] }, function () {
var element = client.helper.waitForElement('body');
element.sendKeys(Keys.down);
assert.equal(element.scriptWith(function(elem) {
return elem.dataset.activeDirection;
}), 'down');
element.sendKeys(Keys.up);
assert.equal(element.scriptWith(function(elem) {
return elem.dataset.activeDirection;
}), '');
});
test('Display and hide left widget after pressing left/right',
{ devices: ['tv'] }, function () {
var element = client.helper.waitForElement('body');
element.sendKeys(Keys.left);
assert.equal(element.scriptWith(function(elem) {
return elem.dataset.activeDirection;
}), 'left');
element.sendKeys(Keys.right);
assert.equal(element.scriptWith(function(elem) {
return elem.dataset.activeDirection;
}), '');
});
test('Doesn\'t hide top widgets after pressing up when top widget is visible',
{ devices: ['tv'] }, function () {
var element = client.helper.waitForElement('body');
// test top widget
element.sendKeys(Keys.up);
assert.equal(element.scriptWith(function(elem) {
return elem.dataset.activeDirection;
}), 'up');
element.sendKeys(Keys.up);
assert.equal(element.scriptWith(function(elem) {
return elem.dataset.activeDirection;
}), 'up');
});
test('Doesn\'t hide top widgets after pressing right or left ' +
'when top widget is visible', { devices: ['tv'] }, function () {
var element = client.helper.waitForElement('body');
// test top widget
element.sendKeys(Keys.up);
assert.equal(element.scriptWith(function(elem) {
return elem.dataset.activeDirection;
}), 'up');
element.sendKeys(Keys.right);
assert.equal(element.scriptWith(function(elem) {
return elem.dataset.activeDirection;
}), 'up');
element.sendKeys(Keys.left);
assert.equal(element.scriptWith(function(elem) {
return elem.dataset.activeDirection;
}), 'up');
});
});