2015-10-14 00:21:23 +02:00
|
|
|
var common = require('../casper_lib/common.js').common;
|
2013-08-20 18:20:10 +02:00
|
|
|
|
|
|
|
common.start_and_log_in();
|
|
|
|
|
|
|
|
function then_edit_last_message() {
|
|
|
|
casper.then(function () {
|
|
|
|
casper.evaluate(function () {
|
|
|
|
var msg = $('#zhome .message_row:last');
|
|
|
|
msg.find('.info').click();
|
|
|
|
$('.popover_edit_message').click();
|
|
|
|
});
|
|
|
|
});
|
|
|
|
casper.waitForSelector(".message_edit_content");
|
|
|
|
}
|
|
|
|
|
2014-03-07 23:06:05 +01:00
|
|
|
function wait_for_message_actually_sent() {
|
|
|
|
casper.waitFor(function () {
|
|
|
|
return casper.evaluate(function () {
|
|
|
|
return current_msg_list.last().local_id === undefined;
|
|
|
|
});
|
|
|
|
});
|
|
|
|
}
|
2013-08-20 18:20:10 +02:00
|
|
|
|
|
|
|
// Send and edit a stream message
|
|
|
|
|
2014-03-07 20:59:30 +01:00
|
|
|
common.then_send_message('stream', {
|
2013-08-20 18:20:10 +02:00
|
|
|
stream: 'Verona',
|
|
|
|
subject: 'edits',
|
|
|
|
content: 'test editing'
|
|
|
|
});
|
|
|
|
|
|
|
|
casper.waitForText("test editing");
|
2014-03-07 23:06:05 +01:00
|
|
|
wait_for_message_actually_sent();
|
2013-08-20 18:20:10 +02:00
|
|
|
|
|
|
|
then_edit_last_message();
|
|
|
|
|
|
|
|
casper.then(function () {
|
|
|
|
casper.evaluate(function () {
|
|
|
|
var msg = $('#zhome .message_row:last');
|
|
|
|
msg.find('.message_edit_topic').val("edited");
|
|
|
|
msg.find('.message_edit_content').val("test edited");
|
|
|
|
msg.find('.message_edit_save').click();
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
casper.waitForSelector(".message_edit_notice", function () {
|
|
|
|
casper.test.assertSelectorHasText(".last_message .message_content", "test edited");
|
|
|
|
});
|
|
|
|
|
2016-05-31 14:24:58 +02:00
|
|
|
common.then_send_message('stream', {
|
|
|
|
stream: 'Verona',
|
|
|
|
subject: 'edits',
|
|
|
|
content: '/me test editing one line with me'
|
|
|
|
});
|
|
|
|
|
|
|
|
casper.waitForText("test editing one line with me");
|
|
|
|
wait_for_message_actually_sent();
|
|
|
|
|
|
|
|
then_edit_last_message();
|
|
|
|
|
|
|
|
casper.then(function () {
|
|
|
|
casper.evaluate(function () {
|
|
|
|
var msg = $('#zhome .message_row:last');
|
|
|
|
msg.find('.message_edit_topic').val("edited");
|
|
|
|
msg.find('.message_edit_content').val("/me test edited one line with me");
|
|
|
|
msg.find('.message_edit_save').click();
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
casper.waitForSelector(".message_edit_notice", function () {
|
|
|
|
casper.test.assertSelectorHasText(".last_message .sender-status", "test edited one line with me");
|
|
|
|
});
|
|
|
|
|
2014-03-07 20:59:30 +01:00
|
|
|
common.then_send_message('private', {
|
2013-08-20 18:20:10 +02:00
|
|
|
recipient: "cordelia@zulip.com",
|
|
|
|
content: "test editing pm"
|
|
|
|
});
|
|
|
|
|
|
|
|
casper.waitForText("test editing pm");
|
2014-03-07 23:06:05 +01:00
|
|
|
wait_for_message_actually_sent();
|
2013-08-20 18:20:10 +02:00
|
|
|
then_edit_last_message();
|
|
|
|
|
|
|
|
casper.then(function () {
|
|
|
|
casper.evaluate(function () {
|
|
|
|
var msg = $('#zhome .message_row:last');
|
|
|
|
msg.find('.message_edit_content').val("test edited pm");
|
|
|
|
msg.find('.message_edit_save').click();
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
casper.waitForSelector(".private-message .message_edit_notice", function () {
|
|
|
|
casper.test.assertSelectorHasText(".last_message .message_content", "test edited pm");
|
|
|
|
});
|
|
|
|
|
|
|
|
casper.run(function () {
|
|
|
|
casper.test.done();
|
|
|
|
});
|