VulpesOS/gaia/dev_apps/music-oga/test/marionette/lib/fakeactivitycaller.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.5 KiB
JavaScript
Executable file

/* global module */
'use strict';
function FakeActivityCaller(client, origin) {
this.client = client;
this.origin = origin || ('app://' + FakeActivityCaller.DEFAULT_ORIGIN);
}
module.exports = FakeActivityCaller;
FakeActivityCaller.DEFAULT_ORIGIN = 'fakeactivity.gaiamobile.org';
FakeActivityCaller.Selector = Object.freeze({
openButton: '#open',
pickButton: '#pick',
actionMenu: 'form[data-z-index-level="action-menu"]'
});
FakeActivityCaller.prototype = {
client: null,
get openButton() {
return this.client.helper.waitForElement(
FakeActivityCaller.Selector.openButton);
},
get pickButton() {
return this.client.helper.waitForElement(
FakeActivityCaller.Selector.pickButton);
},
get actionMenu() {
return this.client.helper.waitForElement(
FakeActivityCaller.Selector.actionMenu);
},
launch: function() {
this.client.switchToFrame();
this.client.apps.launch(this.origin);
this.client.apps.switchToApp(this.origin);
},
close: function() {
this.client.apps.close(this.origin);
},
tapOpenButton: function() {
this.openButton.tap();
},
tapPickButton: function() {
this.pickButton.tap();
},
selectMusicApp: function() {
this.client.switchToFrame();
var list = this.actionMenu.findElements('button');
for (var i = 0; i < list.length; i++) {
if (list[i].text() === 'Music OGA') {
this.client.helper.waitForElement(list[i]);
list[i].tap();
return;
}
}
}
};