2020-07-15 01:29:15 +02:00
|
|
|
var common = require("../casper_lib/common.js");
|
2013-08-20 18:20:10 +02:00
|
|
|
|
2019-04-22 20:13:23 +02:00
|
|
|
casper.options.verbose = true;
|
|
|
|
casper.options.logLevel = "debug";
|
|
|
|
|
2013-08-20 18:20:10 +02:00
|
|
|
common.start_and_log_in();
|
|
|
|
|
|
|
|
function then_edit_last_message() {
|
|
|
|
casper.then(function () {
|
|
|
|
casper.evaluate(function () {
|
2020-07-15 01:29:15 +02:00
|
|
|
var msg = $("#zhome .message_row").last();
|
2020-07-20 21:24:26 +02:00
|
|
|
msg.find(".info").trigger("click");
|
|
|
|
$(".popover_edit_message").trigger("click");
|
2013-08-20 18:20:10 +02:00
|
|
|
});
|
|
|
|
});
|
2017-02-10 07:58:24 +01:00
|
|
|
casper.then(function () {
|
|
|
|
casper.waitUntilVisible(".message_edit_content");
|
|
|
|
});
|
2013-08-20 18:20:10 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
// Send and edit a stream message
|
|
|
|
|
2020-07-15 01:29:15 +02:00
|
|
|
common.then_send_message("stream", {
|
|
|
|
stream: "Verona",
|
|
|
|
subject: "edits",
|
|
|
|
content: "test editing",
|
2013-08-20 18:20:10 +02:00
|
|
|
});
|
|
|
|
|
|
|
|
then_edit_last_message();
|
|
|
|
|
|
|
|
casper.then(function () {
|
|
|
|
casper.evaluate(function () {
|
2020-07-15 01:29:15 +02:00
|
|
|
var msg = $("#zhome .message_row").last();
|
|
|
|
msg.find(".message_edit_topic").val("edited");
|
|
|
|
msg.find(".message_edit_content").val("test edited");
|
2020-07-20 21:24:26 +02:00
|
|
|
msg.find(".message_edit_save").trigger("click");
|
2013-08-20 18:20:10 +02:00
|
|
|
});
|
|
|
|
});
|
|
|
|
|
2016-06-30 01:52:09 +02:00
|
|
|
casper.waitWhileVisible("textarea.message_edit_content", function () {
|
2013-08-20 18:20:10 +02:00
|
|
|
casper.test.assertSelectorHasText(".last_message .message_content", "test edited");
|
|
|
|
});
|
|
|
|
|
2020-07-15 01:29:15 +02:00
|
|
|
common.then_send_message("stream", {
|
|
|
|
stream: "Verona",
|
|
|
|
subject: "edits",
|
|
|
|
content: "/me test editing one line with me",
|
2016-05-31 14:24:58 +02:00
|
|
|
});
|
|
|
|
|
|
|
|
then_edit_last_message();
|
|
|
|
|
|
|
|
casper.then(function () {
|
|
|
|
casper.evaluate(function () {
|
2020-07-15 01:29:15 +02:00
|
|
|
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");
|
2020-07-20 21:24:26 +02:00
|
|
|
msg.find(".message_edit_save").trigger("click");
|
2016-05-31 14:24:58 +02:00
|
|
|
});
|
|
|
|
});
|
|
|
|
|
2016-06-30 01:52:09 +02:00
|
|
|
casper.waitWhileVisible("textarea.message_edit_content", function () {
|
2020-07-15 00:34:28 +02:00
|
|
|
casper.test.assertSelectorHasText(
|
|
|
|
".last_message .sender-status",
|
|
|
|
"test edited one line with me"
|
|
|
|
);
|
2016-05-31 14:24:58 +02:00
|
|
|
});
|
|
|
|
|
2020-07-15 01:29:15 +02:00
|
|
|
common.then_send_message("private", {
|
2013-08-20 18:20:10 +02:00
|
|
|
recipient: "cordelia@zulip.com",
|
2016-12-03 23:18:30 +01:00
|
|
|
content: "test editing pm",
|
2013-08-20 18:20:10 +02:00
|
|
|
});
|
|
|
|
|
|
|
|
then_edit_last_message();
|
|
|
|
|
|
|
|
casper.then(function () {
|
|
|
|
casper.evaluate(function () {
|
2020-07-15 01:29:15 +02:00
|
|
|
var msg = $("#zhome .message_row").last();
|
|
|
|
msg.find(".message_edit_content").val("test edited pm");
|
2020-07-20 21:24:26 +02:00
|
|
|
msg.find(".message_edit_save").trigger("click");
|
2013-08-20 18:20:10 +02:00
|
|
|
});
|
|
|
|
});
|
|
|
|
|
2016-11-23 05:06:34 +01:00
|
|
|
casper.then(function () {
|
|
|
|
casper.waitWhileVisible("textarea.message_edit_content", function () {
|
|
|
|
casper.test.assertSelectorHasText(".last_message .message_content", "test edited pm");
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
2013-08-20 18:20:10 +02:00
|
|
|
casper.run(function () {
|
|
|
|
casper.test.done();
|
|
|
|
});
|