VRFS-1668 fixing tests related to notification changes

This commit is contained in:
Brian Smith 2014-05-14 01:16:33 -04:00
parent 2302c89154
commit 212ef168c9
14 changed files with 176 additions and 29 deletions

View File

@ -224,7 +224,7 @@
def scheduled_session_rsvp(email, msg)
end
def scheduled_session_approved(email, msg)
def scheduled_session_rsvp_approved(email, msg)
end
def scheduled_session_rsvp_cancelled(email, msg)

View File

@ -142,7 +142,8 @@
{ title: "Confirmation Email Sent",
text: "A confirmation email should arrive shortly at " + email + ". Please click the confirmation link in it to confirm your email change."
},
{ no_cancel: true });
null, // notify method will add buttons
true);
}
function postUpdateEmailFailure(xhr, textStatus, errorMessage) {
@ -193,7 +194,8 @@
{ title: "Password Changed",
text: "You have changed your password successfully."
},
{ no_cancel: true });
null,
true);
}
function postUpdatePasswordFailure(xhr, textStatus, errorMessage) {

View File

@ -364,7 +364,8 @@
{ title: "Profile Changed",
text: "You have updated your profile successfully."
},
{ no_cancel: true });
null,
true);
}
function postUpdateProfileFailure(xhr, textStatus, errorMessage) {

View File

@ -370,7 +370,8 @@
{ title: "Upload an Avatar First",
text: "To update your avatar, first you must upload an image using the UPLOAD button"
},
{ no_cancel: true });
null,
true);
}
}
@ -387,7 +388,8 @@
{ title: "Avatar Changed",
text: "You have updated your avatar successfully."
},
{ no_cancel: true });
null,
true);
}
function onSelectRelease(event) {

View File

@ -369,7 +369,8 @@
{ title: "Upload a Band Photo First",
text: "To update your band photo, first you must upload an image using the UPLOAD button"
},
{ no_cancel: true });
null,
true);
}
}
@ -382,7 +383,8 @@
{ title: "Band Photo Changed",
text: "You have updated your band photo successfully."
},
{ no_cancel: true });
null,
true);
}
function onSelectRelease(event) {

View File

@ -784,9 +784,14 @@
cancelButton
];
this.notify = function (message, buttons) {
this.notify = function (message, buttons, noCancel) {
if (!buttons) {
buttons = defaultButtons;
if (noCancel) {
buttons = okButton;
}
else {
buttons = defaultButtons;
}
}
// this allows clients to just specify the important action button without having to repeat the cancel descripton everywhere

View File

@ -165,7 +165,18 @@
registerJoinRequestRejected();
registerMusicianSessionJoin();
registerBandSessionJoin();
// scheduled sessions
registerScheduledSessionInvitation();
registerScheduledSessionRsvp();
registerScheduledSessionRsvpApproved();
registerScheduledSessionRsvpCancelled();
registerScheduledSessionRsvpCancelledOrg();
registerScheduledSessionCancelled();
registerScheduledSessionRescheduled();
registerScheduledSessionReminder();
registerScheduledSessionComment();
// recording notifications
registerMusicianRecordingSaved();
@ -741,6 +752,7 @@
});
}
function registerScheduledSessionInvitation() {
context.JK.JamServer.registerMessageCallback(context.JK.MessageType.SCHEDULED_SESSION_INVITATION, function(header, payload) {
logger.debug("Handling SCHEDULED_SESSION_INVITATION msg " + JSON.stringify(payload));
@ -755,6 +767,121 @@
});
}
function registerScheduledSessionRsvp() {
context.JK.JamServer.registerMessageCallback(context.JK.MessageType.SCHEDULED_SESSION_RSVP, function(header, payload) {
logger.debug("Handling SCHEDULED_SESSION_RSVP msg " + JSON.stringify(payload));
handleNotification(payload, header.type);
app.notify({
"title": "Session Invitation",
"text": payload.msg,
"icon_url": context.JK.resolveAvatarUrl(payload.photo_url)
});
});
}
function registerScheduledSessionRsvpApproved() {
context.JK.JamServer.registerMessageCallback(context.JK.MessageType.SCHEDULED_SESSION_RSVP_APPROVED, function(header, payload) {
logger.debug("Handling SCHEDULED_SESSION_RSVP_APPROVED msg " + JSON.stringify(payload));
handleNotification(payload, header.type);
app.notify({
"title": "Session Invitation",
"text": payload.msg,
"icon_url": context.JK.resolveAvatarUrl(payload.photo_url)
});
});
}
function registerScheduledSessionRsvpCancelled() {
context.JK.JamServer.registerMessageCallback(context.JK.MessageType.SCHEDULED_SESSION_RSVP_CANCELLED, function(header, payload) {
logger.debug("Handling SCHEDULED_SESSION_RSVP_CANCELLED msg " + JSON.stringify(payload));
handleNotification(payload, header.type);
app.notify({
"title": "Session Invitation",
"text": payload.msg,
"icon_url": context.JK.resolveAvatarUrl(payload.photo_url)
});
});
}
function registerScheduledSessionRsvpCancelledOrg() {
context.JK.JamServer.registerMessageCallback(context.JK.MessageType.SCHEDULED_SESSION_RSVP_CANCELLED_ORG, function(header, payload) {
logger.debug("Handling SCHEDULED_SESSION_RSVP_CANCELLED_ORG msg " + JSON.stringify(payload));
handleNotification(payload, header.type);
app.notify({
"title": "Session Invitation",
"text": payload.msg,
"icon_url": context.JK.resolveAvatarUrl(payload.photo_url)
});
});
}
function registerScheduledSessionCancelled() {
context.JK.JamServer.registerMessageCallback(context.JK.MessageType.SCHEDULED_SESSION_CANCELLED, function(header, payload) {
logger.debug("Handling SCHEDULED_SESSION_CANCELLED msg " + JSON.stringify(payload));
handleNotification(payload, header.type);
app.notify({
"title": "Session Invitation",
"text": payload.msg,
"icon_url": context.JK.resolveAvatarUrl(payload.photo_url)
});
});
}
function registerScheduledSessionRescheduled() {
context.JK.JamServer.registerMessageCallback(context.JK.MessageType.SCHEDULED_SESSION_RESCHEDULED, function(header, payload) {
logger.debug("Handling SCHEDULED_SESSION_RESCHEDULED msg " + JSON.stringify(payload));
handleNotification(payload, header.type);
app.notify({
"title": "Session Invitation",
"text": payload.msg,
"icon_url": context.JK.resolveAvatarUrl(payload.photo_url)
});
});
}
function registerScheduledSessionReminder() {
context.JK.JamServer.registerMessageCallback(context.JK.MessageType.SCHEDULED_SESSION_REMINDER, function(header, payload) {
logger.debug("Handling SCHEDULED_SESSION_REMINDER msg " + JSON.stringify(payload));
handleNotification(payload, header.type);
app.notify({
"title": "Session Invitation",
"text": payload.msg,
"icon_url": context.JK.resolveAvatarUrl(payload.photo_url)
});
});
}
function registerScheduledSessionComment() {
context.JK.JamServer.registerMessageCallback(context.JK.MessageType.SCHEDULED_SESSION_COMMENT, function(header, payload) {
logger.debug("Handling SCHEDULED_SESSION_COMMENT msg " + JSON.stringify(payload));
handleNotification(payload, header.type);
app.notify({
"title": "Session Invitation",
"text": payload.msg,
"icon_url": context.JK.resolveAvatarUrl(payload.photo_url)
});
});
}
function registerMusicianRecordingSaved() {
context.JK.JamServer.registerMessageCallback(context.JK.MessageType.MUSICIAN_RECORDING_SAVED, function(header, payload) {
logger.debug("Handling MUSICIAN_RECORDING_SAVED msg " + JSON.stringify(payload));

View File

@ -469,7 +469,8 @@
{ title: "Unable to Join Session",
text: "The session you attempted to join is over."
},
{ no_cancel: true });
null,
true);
}
else {
app.notifyServerError(xhr, 'Unable to Join Session');

View File

@ -219,7 +219,8 @@
{ title: "Unable to Join Session",
text: "There was an unexpected error while attempting to join the session."
},
{ no_cancel: true });
null,
true);
}
});
}

View File

@ -277,14 +277,19 @@
"title": "Message from " + payload.sender_name,
"text": payload.msg,
"icon_url": context.JK.resolveAvatarUrl(payload.photo_url)
}, {
"ok_text": "REPLY",
"ok_callback": respondTextInvitation,
"ok_callback_args": {
"sender_id": payload.sender_id,
"notification_id": payload.notification_id
}
});
}, [{
id: "btn-reply",
text: "REPLY",
"layout-action": "close",
href: "#",
css: "button-orange",
callback: respondTextInvitation,
callback_args: {
"sender_id": payload.sender_id,
"notification_id": payload.notification_id
}
}]
);
}
}

View File

@ -66,7 +66,8 @@
{ title: "Unable to Join Session",
text: "There was an unexpected error while attempting to join the session."
},
{ no_cancel: true });
null,
true);
}
});
}
@ -157,7 +158,8 @@
title: "Unable to Message From Here",
text: goto
},
{ no_cancel: true });
null,
true);
}
return false;

View File

@ -77,7 +77,7 @@ describe "Notification Highlighter", :js => true, :type => :feature, :capybara_f
before(:each) do
notification = Notification.send_text_message("text message", user2, user)
notification.errors.any?.should be_false
find('#notification #ok-button') # wait for notification to show, so that we know the sidebar had a chance to update
find('#notification #btn-reply') # wait for notification to show, so that we know the sidebar had a chance to update
end
it_behaves_like :notification_badge, highlighted: false, count:0
@ -88,7 +88,7 @@ describe "Notification Highlighter", :js => true, :type => :feature, :capybara_f
document_blur
notification = Notification.send_text_message("text message 2", user2, user)
notification.errors.any?.should be_false
find('#notification #ok-button')
find('#notification #btn-reply')
end
it_behaves_like :notification_badge, highlighted: true, count:1
@ -157,7 +157,7 @@ describe "Notification Highlighter", :js => true, :type => :feature, :capybara_f
badge = find("#{NOTIFICATION_PANEL} .badge", text: '1')
badge['class'].include?('highlighted').should == true
find('#notification #ok-button', text: 'ACCEPT').trigger(:click)
find('#notification #btn-reply', text: 'ACCEPT').trigger(:click)
badge = find("#{NOTIFICATION_PANEL} .badge", text: '0')
badge['class'].include?('highlighted').should == false

View File

@ -73,7 +73,7 @@ describe "Production site at #{www}", :test_www => true, :js => true, :type =>
expect(page).to have_xpath(
"//div[@class='friend-name' and @user-id='#{user2.id}']/span[@class='friend-status']",
:text => "Available" )
find('#notification #ok-button').trigger(:click)
find('#notification #btn-reply').trigger(:click)
find('h1', text: 'conversation with ' + user2.name)
find('.previous-message-text', text: test_message)
send_text_message(test_response, close_on_send: true)

View File

@ -68,7 +68,7 @@ describe "Text Message", :js => true, :type => :feature, :capybara_feature => tr
end
in_client(@user1) do
find('#notification #ok-button').trigger(:click)
find('#notification #btn-reply').trigger(:click)
find('h1', text: 'conversation with ' + @user2.name)
end
end
@ -101,7 +101,7 @@ describe "Text Message", :js => true, :type => :feature, :capybara_feature => tr
end
in_client(@user1) do
find('#notification #ok-button').trigger(:click)
find('#notification #btn-reply').trigger(:click)
find('h1', text: 'conversation with ' + @user2.name)
find('.previous-message-text', text: "Oh hai to user id #{@user1.id}")
send_text_message('hey there yourself')
@ -110,7 +110,6 @@ describe "Text Message", :js => true, :type => :feature, :capybara_feature => tr
in_client(@user2) do
find('.previous-message-text', text: "hey there yourself")
send_text_message('ok bye', close_on_send: true)
end
in_client(@user1) do