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.
This commit is contained in:
parent
93e3a48004
commit
b38dea0597
25901 changed files with 9982925 additions and 369 deletions
90
gaia/apps/communications/dialer/test/marionette/lib/dialer.js
Executable file
90
gaia/apps/communications/dialer/test/marionette/lib/dialer.js
Executable file
|
|
@ -0,0 +1,90 @@
|
|||
'use strict';
|
||||
|
||||
/* global module */
|
||||
var KeypadView = require('./views/keypad/views.js');
|
||||
var TabsView = require('./views/tabs/view.js');
|
||||
|
||||
/**
|
||||
* 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 = {
|
||||
profile: {
|
||||
settings: {
|
||||
'devtools.overlay': true,
|
||||
'hud.reflows': true
|
||||
},
|
||||
prefs: {
|
||||
'devtools.debugger.forbid-certified-apps': false
|
||||
}
|
||||
},
|
||||
desiredCapabilities: {
|
||||
'raisesAccessibilityExceptions': 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',
|
||||
|
||||
contactsTabItem: '#option-contacts',
|
||||
callLogTabItem: '#option-recents',
|
||||
callLogTabs: '#call-log-filter',
|
||||
callLogEditForm: '#edit-mode',
|
||||
|
||||
addToExistingContactMenuItem: 'button[data-l10n-id="addToExistingContact"]'
|
||||
};
|
||||
|
||||
Dialer.prototype = {
|
||||
/**
|
||||
* Launches dialer app and focuses on frame.
|
||||
*/
|
||||
launch: function() {
|
||||
this.client.apps.launch(Dialer.URL, 'dialer');
|
||||
this.switchTo();
|
||||
this.client.helper.waitForElement('body');
|
||||
},
|
||||
|
||||
relaunch: function() {
|
||||
this.client.apps.close(Dialer.URL, 'dialer');
|
||||
this.launch();
|
||||
},
|
||||
|
||||
switchTo: function() {
|
||||
this.client.switchToFrame();
|
||||
// switchToApp already waits for the app to be displayed
|
||||
this.client.apps.switchToApp(Dialer.URL, 'dialer');
|
||||
},
|
||||
|
||||
get phoneNumber() {
|
||||
return this.client.helper.waitForElement(Dialer.Selectors.phoneNumber)
|
||||
.getAttribute('value');
|
||||
},
|
||||
|
||||
get keypadView() {
|
||||
return new KeypadView(this.client);
|
||||
},
|
||||
|
||||
get tabs() {
|
||||
return new TabsView(this.client);
|
||||
}
|
||||
};
|
||||
|
||||
module.exports = Dialer;
|
||||
|
|
@ -0,0 +1,18 @@
|
|||
'use strict';
|
||||
|
||||
/* global module */
|
||||
var SELECTORS = Object.freeze({
|
||||
addNewContact: 'button[data-l10n-id="createNewContact"]',
|
||||
});
|
||||
|
||||
function ActivitiesAccessor(client) {
|
||||
this.client = client;
|
||||
}
|
||||
|
||||
ActivitiesAccessor.prototype = {
|
||||
get addNewContactMenuItem() {
|
||||
return this.client.helper.waitForElement(SELECTORS.addNewContact);
|
||||
}
|
||||
};
|
||||
|
||||
module.exports = ActivitiesAccessor;
|
||||
|
|
@ -0,0 +1,25 @@
|
|||
'use strict';
|
||||
/* global module */
|
||||
|
||||
var ActivitiesAccessor = require('./accessors');
|
||||
|
||||
function ActivitiesView(client) {
|
||||
this.client = client;
|
||||
this.accessors = new ActivitiesAccessor(client);
|
||||
}
|
||||
|
||||
ActivitiesView.prototype = {
|
||||
pickCreateNew: function() {
|
||||
this.client.waitFor(function() {
|
||||
return this.accessors.addNewContactMenuItem.enabled();
|
||||
}.bind(this));
|
||||
var button = this.accessors.addNewContactMenuItem;
|
||||
button.tap();
|
||||
|
||||
var contacts = this.client.loader.getAppClass('contacts');
|
||||
contacts.switchToCreateNewContactActivity();
|
||||
return contacts;
|
||||
}
|
||||
};
|
||||
|
||||
module.exports = ActivitiesView;
|
||||
|
|
@ -0,0 +1,77 @@
|
|||
'use strict';
|
||||
|
||||
var SELECTORS = Object.freeze({
|
||||
editButton: '#call-log-icon-edit',
|
||||
callLogTabs: '#call-log-filter',
|
||||
callLogItem: '.log-item',
|
||||
callLogNoResults: '#no-result-message',
|
||||
editHeader: '#edit-mode-header',
|
||||
selectAllButton: '#select-all-threads',
|
||||
deleteButton: '#delete-button',
|
||||
confirmDeleteButton: '#confirmation-message [data-l10n-id="delete"]'
|
||||
});
|
||||
|
||||
function CallLogAccessors(client) {
|
||||
this.client = client;
|
||||
}
|
||||
|
||||
CallLogAccessors.prototype = {
|
||||
get callLogFilter() {
|
||||
return this.client.helper.waitForElement(SELECTORS.callLogTabs);
|
||||
},
|
||||
|
||||
get callLogNoResults() {
|
||||
return this.client.helper.waitForElement(SELECTORS.callLogNoResults);
|
||||
},
|
||||
|
||||
get logEntries() {
|
||||
return this.client.findElements(SELECTORS.callLogItem);
|
||||
},
|
||||
|
||||
get editButton() {
|
||||
return this.client.helper.waitForElement(SELECTORS.editButton);
|
||||
},
|
||||
|
||||
get editHeader() {
|
||||
return new EditHeaderAccessors(this.client, SELECTORS.editHeader);
|
||||
},
|
||||
|
||||
get selectAllButton() {
|
||||
return this.client.helper.waitForElement(SELECTORS.selectAllButton);
|
||||
},
|
||||
|
||||
get deleteButton() {
|
||||
return this.client.helper.waitForElement(SELECTORS.deleteButton);
|
||||
},
|
||||
|
||||
get dialogConfirmButton() {
|
||||
return this.client.helper.waitForElement(SELECTORS.confirmDeleteButton);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
var HEADER_SELECTORS = Object.freeze({
|
||||
title: 'h1',
|
||||
});
|
||||
|
||||
function EditHeaderAccessors(client, rootSelector) {
|
||||
this.client = client;
|
||||
this.rootSelector = rootSelector;
|
||||
}
|
||||
|
||||
EditHeaderAccessors.prototype = {
|
||||
get root() {
|
||||
return this.client.helper.waitForElement(this.rootSelector);
|
||||
},
|
||||
|
||||
get title() {
|
||||
return this.root.findElement(HEADER_SELECTORS.title);
|
||||
},
|
||||
|
||||
get closeButton() {
|
||||
return this.root;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
module.exports = CallLogAccessors;
|
||||
70
gaia/apps/communications/dialer/test/marionette/lib/views/call_log/view.js
Executable file
70
gaia/apps/communications/dialer/test/marionette/lib/views/call_log/view.js
Executable file
|
|
@ -0,0 +1,70 @@
|
|||
'use strict';
|
||||
|
||||
var CallLogAccessors = require('./accessors');
|
||||
|
||||
|
||||
|
||||
function CallLogView(client, expectedNumberOfItems) {
|
||||
this.client = client;
|
||||
this.accessors = new CallLogAccessors(client);
|
||||
|
||||
this.accessors.callLogFilter;
|
||||
|
||||
if (expectedNumberOfItems === 0) {
|
||||
this.accessors.callLogNoResults;
|
||||
} else {
|
||||
var self = this;
|
||||
this.client.waitFor(function() {
|
||||
return self.accessors.logEntries.length === expectedNumberOfItems;
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
CallLogView.prototype = {
|
||||
enterEditMode: function() {
|
||||
var filter = this.accessors.callLogFilter;
|
||||
this.accessors.editButton.tap();
|
||||
this.client.helper.waitForElementToDisappear(filter);
|
||||
|
||||
var self = this;
|
||||
this.client.waitFor(function() {
|
||||
return self.accessors.editHeader.title.getAttribute('data-l10n-id') ===
|
||||
'edit';
|
||||
});
|
||||
},
|
||||
|
||||
exitEditMode: function() {
|
||||
var editHeader = this.accessors.editHeader.root;
|
||||
// TODO: Use a GaiaHeader view, once bug 1241813 lands
|
||||
this.accessors.editHeader.closeButton.tap(10,10);
|
||||
this.accessors.callLogFilter;
|
||||
this.client.helper.waitForElementToDisappear(editHeader);
|
||||
},
|
||||
|
||||
deleteEntries: function(indexesToDelete) {
|
||||
var logEntries = this.accessors.logEntries;
|
||||
var entriesToDelete = logEntries.filter(function(_, index) {
|
||||
return indexesToDelete.indexOf(index) > -1;
|
||||
});
|
||||
|
||||
entriesToDelete.forEach(function(entry) {
|
||||
entry.tap();
|
||||
});
|
||||
|
||||
this._performDelete();
|
||||
},
|
||||
|
||||
deleteAllEntries: function() {
|
||||
this.accessors.selectAllButton.tap();
|
||||
this._performDelete();
|
||||
},
|
||||
|
||||
_performDelete: function() {
|
||||
var editHeader = this.accessors.editHeader.root;
|
||||
this.accessors.deleteButton.tap();
|
||||
this.accessors.dialogConfirmButton.tap();
|
||||
this.client.helper.waitForElementToDisappear(editHeader);
|
||||
}
|
||||
};
|
||||
|
||||
module.exports = CallLogView;
|
||||
|
|
@ -0,0 +1,23 @@
|
|||
'use strict';
|
||||
/* global module */
|
||||
|
||||
var SELECTORS = Object.freeze({
|
||||
goToCallLog: '#option-recents',
|
||||
goToContactList: '#option-contacts'
|
||||
});
|
||||
|
||||
function DialerOptionsAccessor(client) {
|
||||
this.client = client;
|
||||
}
|
||||
|
||||
DialerOptionsAccessor.prototype = {
|
||||
get callLogButton() {
|
||||
return this.client.helper.waitForElement(SELECTORS.goToCallLog);
|
||||
},
|
||||
|
||||
get contactListButton() {
|
||||
return this.client.helper.waitForElement(SELECTORS.goToContactList);
|
||||
}
|
||||
};
|
||||
|
||||
module.exports = DialerOptionsAccessor;
|
||||
|
|
@ -0,0 +1,28 @@
|
|||
'use strict';
|
||||
/* global module */
|
||||
var DialerOptionsAccessor = require('./tabAccessors');
|
||||
|
||||
function DialerOptionsView(client) {
|
||||
this.client = client;
|
||||
this.accessors = new DialerOptionsAccessor(client);
|
||||
}
|
||||
|
||||
DialerOptionsView.prototype = {
|
||||
goToCallLog: function() {
|
||||
var callLogTab = this.accessors.callLogButton;
|
||||
callLogTab.tap();
|
||||
|
||||
var CallLogView = require('../call_log/views.js');
|
||||
return new CallLogView(this.client);
|
||||
},
|
||||
|
||||
goToContactList: function() {
|
||||
var contactListTab = this.accessors.contactListButton;
|
||||
contactListTab.tap();
|
||||
|
||||
var contacts = this.client.loader.getAppClass('contacts');
|
||||
return contacts;
|
||||
}
|
||||
};
|
||||
|
||||
module.exports = DialerOptionsView;
|
||||
|
|
@ -0,0 +1,27 @@
|
|||
'use strict';
|
||||
/* global module */
|
||||
var SELECTORS = Object.freeze({
|
||||
keypadCallBarAddContact: '#keypad-callbar-add-contact',
|
||||
});
|
||||
|
||||
function KeypadAccessor(client) {
|
||||
this.client = client;
|
||||
}
|
||||
|
||||
KeypadAccessor.prototype = {
|
||||
get addContactButton() {
|
||||
return this.client.helper.waitForElement(SELECTORS.keypadCallBarAddContact);
|
||||
},
|
||||
|
||||
key: function(keyNumber) {
|
||||
return this.client.helper.waitForElement(
|
||||
this.getKeypadKeySelector(keyNumber)
|
||||
);
|
||||
},
|
||||
|
||||
getKeypadKeySelector: function(key) {
|
||||
return '.keypad-key[data-value="' + key +'"]';
|
||||
}
|
||||
};
|
||||
|
||||
module.exports = KeypadAccessor;
|
||||
36
gaia/apps/communications/dialer/test/marionette/lib/views/keypad/views.js
Executable file
36
gaia/apps/communications/dialer/test/marionette/lib/views/keypad/views.js
Executable file
|
|
@ -0,0 +1,36 @@
|
|||
'use strict';
|
||||
/* global module */
|
||||
var KeypadAccessor = require('./accessors');
|
||||
|
||||
function KeypadView(client) {
|
||||
this.client = client;
|
||||
this.accessors = new KeypadAccessor(client);
|
||||
}
|
||||
|
||||
KeypadView.prototype = {
|
||||
typePhoneNumber: function(number) {
|
||||
var i;
|
||||
var typeNumberArray = String(number).split('');
|
||||
|
||||
for (i in typeNumberArray){
|
||||
if (i === '+') {
|
||||
var zero_key = this.key(0);
|
||||
this.actions.longPress(zero_key, 1).perform();
|
||||
} else {
|
||||
i = parseInt(typeNumberArray[i]);
|
||||
this.accessors.key(i).tap();
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
addToContacts: function() {
|
||||
var addToContactsButton = this.accessors.addContactButton;
|
||||
addToContactsButton.tap();
|
||||
|
||||
var ActivitiesView = require('../activities/views.js');
|
||||
var activitiesView = new ActivitiesView(this.client);
|
||||
return activitiesView;
|
||||
}
|
||||
};
|
||||
|
||||
module.exports = KeypadView;
|
||||
22
gaia/apps/communications/dialer/test/marionette/lib/views/tabs/accessors.js
Executable file
22
gaia/apps/communications/dialer/test/marionette/lib/views/tabs/accessors.js
Executable file
|
|
@ -0,0 +1,22 @@
|
|||
'use strict';
|
||||
|
||||
var SELECTORS = Object.freeze({
|
||||
callLogTabItem: '#option-recents',
|
||||
contactsTabItem: '#option-contacts'
|
||||
});
|
||||
|
||||
function TabsAccessors(client) {
|
||||
this.client = client;
|
||||
}
|
||||
|
||||
TabsAccessors.prototype = {
|
||||
get callLogButton() {
|
||||
return this.client.helper.waitForElement(SELECTORS.callLogTabItem);
|
||||
},
|
||||
|
||||
get contactListButton() {
|
||||
return this.client.helper.waitForElement(SELECTORS.contactsTabItem);
|
||||
}
|
||||
};
|
||||
|
||||
module.exports = TabsAccessors;
|
||||
25
gaia/apps/communications/dialer/test/marionette/lib/views/tabs/view.js
Executable file
25
gaia/apps/communications/dialer/test/marionette/lib/views/tabs/view.js
Executable file
|
|
@ -0,0 +1,25 @@
|
|||
'use strict';
|
||||
|
||||
var TabsAccessors = require('./accessors');
|
||||
var CallLogView = require('../call_log/view.js');
|
||||
|
||||
function TabsView(client) {
|
||||
this.client = client;
|
||||
this.accessors = new TabsAccessors(client);
|
||||
}
|
||||
|
||||
TabsView.prototype = {
|
||||
goToCallLog: function(expectedNumberOfItems) {
|
||||
expectedNumberOfItems = expectedNumberOfItems || 0;
|
||||
this.accessors.callLogButton.tap();
|
||||
return new CallLogView(this.client, expectedNumberOfItems);
|
||||
},
|
||||
|
||||
goToContactList: function() {
|
||||
this.accessors.contactListButton.tap();
|
||||
var contacts = this.client.loader.getAppClass('contacts');
|
||||
return contacts;
|
||||
},
|
||||
};
|
||||
|
||||
module.exports = TabsView;
|
||||
Loading…
Reference in a new issue