VulpesOS/gaia/apps/system/test/marionette/lib/dialog.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

68 lines
1.7 KiB
JavaScript
Executable file

'use strict';
function Dialog(client) {
this.client = client.scope({
searchTimeout: 20000
});
}
module.exports = Dialog;
Dialog.Selector = {
visibleDialog: '.generic-dialog.visible',
okButton: '.generic-dialog.visible .affirmative',
messageContainer: '.generic-dialog.visible .inner',
promptInput: '.generic-dialog.visible .modal-dialog-prompt-input',
menu: '.generic-dialog.visible menu',
title: '.generic-dialog.visible .inner h3'
};
Dialog.prototype = {
client: null,
system: null,
alert: function(message) {
this.client.executeScript(function(message) {
return window.setTimeout(function() {
window.wrappedJSObject.alert(message);
});
}, [message]);
},
confirm: function(message) {
this.client.executeScript(function(message) {
return window.setTimeout(function() {
window.wrappedJSObject.confirm(message);
});
}, [message]);
},
prompt: function(message) {
this.client.executeScript(function(message) {
return window.setTimeout(function() {
window.wrappedJSObject.prompt(message);
});
}, [message]);
},
get current() {
return this.client.helper.waitForElement(Dialog.Selector.visibleDialog);
},
get okButton() {
return this.client.helper.waitForElement(Dialog.Selector.okButton);
},
get menu() {
return this.client.findElement(Dialog.Selector.menu);
},
get title() {
return this.client.helper.waitForElement(Dialog.Selector.title);
},
get messageContainer() {
return this.client.findElement(Dialog.Selector.messageContainer);
},
get promptInput() {
return this.client.findElement(Dialog.Selector.promptInput);
}
};