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
74
gaia/apps/sms/test/marionette/lib/views/inbox/accessors.js
Executable file
74
gaia/apps/sms/test/marionette/lib/views/inbox/accessors.js
Executable file
|
|
@ -0,0 +1,74 @@
|
|||
'use strict';
|
||||
|
||||
/* global module */
|
||||
|
||||
var SELECTORS = Object.freeze({
|
||||
main: '.panel-InboxView',
|
||||
conversation: '.threadlist-item',
|
||||
smsConversation: '.threadlist-item[data-last-message-type="sms"]',
|
||||
mmsConversation: '.threadlist-item[data-last-message-type="mms"]',
|
||||
conversationTitle: '.threadlist-item-title',
|
||||
navigateToComposerHeaderButton: '#threads-composer-link'
|
||||
});
|
||||
|
||||
function InboxAccessor(client) {
|
||||
this.client = client;
|
||||
}
|
||||
|
||||
InboxAccessor.prototype = {
|
||||
get firstConversation() {
|
||||
return this.client.helper.waitForElement(SELECTORS.conversation);
|
||||
},
|
||||
|
||||
get smsConversation() {
|
||||
return this.client.helper.waitForElement(SELECTORS.smsConversation);
|
||||
},
|
||||
|
||||
get mmsConversation() {
|
||||
return this.client.helper.waitForElement(SELECTORS.mmsConversation);
|
||||
},
|
||||
|
||||
get conversations() {
|
||||
return this.client.findElements(SELECTORS.conversation);
|
||||
},
|
||||
|
||||
get createNewMessageButton() {
|
||||
return this.client.helper.waitForElement(
|
||||
SELECTORS.navigateToComposerHeaderButton
|
||||
);
|
||||
},
|
||||
|
||||
findConversation: function(id) {
|
||||
return this.client.findElement('#thread-' + id);
|
||||
},
|
||||
|
||||
hasConversation: function(id) {
|
||||
try {
|
||||
return !!this.client.scope({ searchTimeout: 100 }).findElement(
|
||||
'#thread-' + id
|
||||
);
|
||||
} catch(e) {
|
||||
return false;
|
||||
}
|
||||
},
|
||||
|
||||
getConversationTitle: function(conversation) {
|
||||
return conversation.findElement(SELECTORS.conversationTitle);
|
||||
},
|
||||
|
||||
waitToAppear: function() {
|
||||
return this.client.helper.waitForElement(SELECTORS.main);
|
||||
},
|
||||
|
||||
// Temporary solution to keep the current tests running.
|
||||
// TODO: bug 1167103
|
||||
navigateToComposer: function() {
|
||||
this.createNewMessageButton.tap();
|
||||
},
|
||||
|
||||
doubleTapOnFirstConversation: function() {
|
||||
this.client.loader.getActions().doubleTap(this.firstConversation).perform();
|
||||
}
|
||||
};
|
||||
|
||||
module.exports = InboxAccessor;
|
||||
76
gaia/apps/sms/test/marionette/lib/views/inbox/view.js
Executable file
76
gaia/apps/sms/test/marionette/lib/views/inbox/view.js
Executable file
|
|
@ -0,0 +1,76 @@
|
|||
'use strict';
|
||||
|
||||
/* global module */
|
||||
|
||||
var InboxAccessor = require('./accessors');
|
||||
|
||||
function InboxView(client) {
|
||||
this.client = client;
|
||||
this.accessors = new InboxAccessor(client);
|
||||
}
|
||||
|
||||
InboxView.prototype = {
|
||||
get conversations() {
|
||||
return this.accessors.conversations.reduce(function(list, conversation) {
|
||||
// It's workaround for the case when conversation node reference is stale,
|
||||
// so when we try to access MarionetteElement from the node that's not
|
||||
// attached to the dom we'll get an exception.
|
||||
try {
|
||||
var bodyText = conversation.findElement('.body-text');
|
||||
list.push({
|
||||
id: +conversation.getAttribute('data-thread-id'),
|
||||
lastMessageType: conversation.getAttribute('data-last-message-type'),
|
||||
title: this.accessors.getConversationTitle(conversation).text(),
|
||||
bodyText: bodyText.displayed() ? bodyText.text() : '',
|
||||
isDraft: !!conversation.getAttribute('data-draft-id'),
|
||||
hasDraft: conversation.getAttribute('class').indexOf('draft') !== -1
|
||||
});
|
||||
} catch(e) {
|
||||
console.error('Conversation node is not available', e);
|
||||
}
|
||||
|
||||
return list;
|
||||
}.bind(this), []);
|
||||
},
|
||||
|
||||
goToConversation: function(conversationId) {
|
||||
var conversation = this.accessors.findConversation(conversationId);
|
||||
|
||||
// We should retrieve all required info from the conversation node before we
|
||||
// tap on it, as in split view mode tap triggers document to change and
|
||||
// the node will be discarded.
|
||||
var isConversationLessDraft = !!conversation.getAttribute('data-draft-id');
|
||||
|
||||
conversation.tap();
|
||||
|
||||
return isConversationLessDraft ?
|
||||
this._createNewMessageView() :
|
||||
this._createConversationView();
|
||||
},
|
||||
|
||||
hasConversation: function(conversationId) {
|
||||
return this.accessors.hasConversation(conversationId);
|
||||
},
|
||||
|
||||
createNewMessage: function() {
|
||||
this.accessors.createNewMessageButton.tap();
|
||||
|
||||
return this._createNewMessageView();
|
||||
},
|
||||
|
||||
_createNewMessageView: function() {
|
||||
var NewMessageView = require('../new-message/view');
|
||||
var newMessageView = new NewMessageView(this.client);
|
||||
newMessageView.accessors.waitToAppear();
|
||||
return newMessageView;
|
||||
},
|
||||
|
||||
_createConversationView: function() {
|
||||
var ConversationView = require('../conversation/view');
|
||||
var conversationView = new ConversationView(this.client);
|
||||
conversationView.accessors.waitToAppear();
|
||||
return conversationView;
|
||||
}
|
||||
};
|
||||
|
||||
module.exports = InboxView;
|
||||
Loading…
Reference in a new issue