This repository has been archived by the owner on Nov 3, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2.3k
/
dialer.js
77 lines (66 loc) · 1.82 KB
/
dialer.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
/**
* Abstraction around dialer app.
* @constructor
* @param {Marionette.Client} client for operations.
*/
function Dialer(client) {
this.client = client;
}
/**
* @type String Origin of dialer app
*/
Dialer.URL = 'app://communications.gaiamobile.org';
Dialer.config = {
settings: {
'ftu.manifestURL': null,
'lockscreen.enabled': false,
'devtools.overlay': true,
'hud.reflows': true
},
prefs: {
'dom.w3c_touch_events.enabled': 1,
'devtools.debugger.forbid-certified-apps': false
}
};
Dialer.Selectors = {
phoneNumber: '#phone-number-view',
keypadView: '#keyboard-view',
del: '#keypad-delete',
zero: '.keypad-key[data-value="0"]',
one: '.keypad-key[data-value="1"]',
two: '.keypad-key[data-value="2"]',
three: '.keypad-key[data-value="3"]',
keypadCallBarAddContact: '#keypad-callbar-add-contact',
callLogTabItem: '#option-recents',
callLogEditButton: '#call-log-icon-edit',
callLogTabs: '#call-log-filter',
callLogNoResultsContainer: '#no-result-container',
callLogItem: '.log-item',
callLogEditForm: '#edit-mode',
contactsTabItem: '#option-contacts',
contactsIframe: '#iframe-contacts',
addToExistintContactMenuItem: '#add-to-existing-contact-menuitem'
};
/**
* @private
* @param {Marionette.Client} client for selector.
* @param {String} name of selector [its a key in Dialer.Selectors].
*/
function findElement(client, name) {
return client.findElement(Dialer.Selectors[name]);
}
Dialer.prototype = {
/**
* Launches dialer app and focuses on frame.
*/
launch: function() {
this.client.apps.launch(Dialer.URL, 'dialer');
this.client.apps.switchToApp(Dialer.URL, 'dialer');
this.client.helper.waitForElement('body');
},
relaunch: function() {
this.client.apps.close(Dialer.URL, 'dialer');
this.launch();
}
};
module.exports = Dialer;