VulpesOS/gaia/apps/system/test/marionette/sim_dialog_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

75 lines
1.9 KiB
JavaScript
Executable file

'use strict';
marionette('Sim Dialog:', function() {
var assert = require('assert');
var pinInput = 'input[name=simpin]';
var submitBtn = '#simpin-dialog button[type=submit]';
var client = marionette.client({
profile: {
prefs: {
'focusmanager.testmode': true
}
}
});
setup(function() {
});
function loadScripts(scripts) {
if (!scripts.length) {
return;
}
var path = scripts.pop();
var script = document.createElement('script');
script.type = 'text/javascript';
script.src = path;
script.async = false;
script.addEventListener('load', function() {
loadScripts(scripts);
});
document.body.appendChild(script);
}
test.skip('Input is shown with error', function() {
client.executeScript(loadScripts, [[
'../../../../shared/unit/mocks/mock_simslot.js',
'../../../../shared/unit/mocks/mock_simslot_manager.js'
]]);
client.executeScript(function(path) {
var win = window.wrappedJSObject;
var slot = new win.MockSIMSlot(null, 0);
win.MockSIMSlotManager.mInstances = [slot];
win.SIMSlotManager = win.MockSIMSlotManager;
slot.simCard.cardState = 'pinRequired';
win.SimPinDialog.init();
win.SimPinDialog.show(slot);
win.SimPinDialog.handleError('pin', 1);
});
client.findElement(pinInput).tap();
// Wait for keyboard to show up
client.waitFor(function() {
var keyboard = client.findElement('#keyboards');
return keyboard.displayed() &&
!keyboard.getAttribute('data-transition-in');
});
var inputSize = client.findElement(pinInput).size();
var inputLocation = client.findElement(pinInput).location();
var buttonLocation = client.findElement(submitBtn).location();
assert.ok(inputLocation.y + inputSize.height < buttonLocation.y,
'The bottom of the input is above the buttons');
});
});