Files
zulip/frontend_tests/casper_tests/08-edit.js
Steve Howell d604814347 casper: Improve logic to confirm message sends.
We now use `wait_for_message_fully_processed`
to check that messages are fully rendered.

Before this, we had loopholes where messages
sent outside the view were effectively ignored.
Now we explicitly ignore the check for the
one place we do that.

The more important behavior is for messages
that get sent to the current view.

Before this change, the older version of this
function declared victory as soon as we put the
server version of a locally echoed message into
the current message list's data.

This fixes flaky behavior with 07-stars in
particular, since we need the star icon
on our last message to be there before
we click on it.

Because this function is more robust now, we
can remove some redundant checks in 08-edit.js.
2020-03-26 14:54:02 -04:00

89 lines
2.4 KiB
JavaScript

var common = require('../casper_lib/common.js');
casper.options.verbose = true;
casper.options.logLevel = "debug";
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.then(function () {
casper.waitUntilVisible(".message_edit_content");
});
}
// Send and edit a stream message
common.then_send_message('stream', {
stream: 'Verona',
subject: 'edits',
content: 'test editing',
});
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.waitWhileVisible("textarea.message_edit_content", function () {
casper.test.assertSelectorHasText(".last_message .message_content", "test edited");
});
common.then_send_message('stream', {
stream: 'Verona',
subject: 'edits',
content: '/me test editing one line with me',
});
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.waitWhileVisible("textarea.message_edit_content", function () {
casper.test.assertSelectorHasText(".last_message .sender-status", "test edited one line with me");
});
common.then_send_message('private', {
recipient: "cordelia@zulip.com",
content: "test editing pm",
});
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.then(function () {
casper.waitWhileVisible("textarea.message_edit_content", function () {
casper.test.assertSelectorHasText(".last_message .message_content", "test edited pm");
});
});
casper.run(function () {
casper.test.done();
});