2020-07-15 01:29:15 +02:00
|
|
|
var common = require("../casper_lib/common.js");
|
2017-05-14 21:14:26 +02:00
|
|
|
|
|
|
|
common.start_and_log_in();
|
|
|
|
|
|
|
|
var last_message_id;
|
|
|
|
var msgs_qty;
|
|
|
|
|
|
|
|
casper.then(function () {
|
|
|
|
casper.waitUntilVisible("#zhome");
|
|
|
|
});
|
|
|
|
|
|
|
|
casper.then(function () {
|
|
|
|
msgs_qty = this.evaluate(function () {
|
2020-07-15 01:29:15 +02:00
|
|
|
return $("#zhome .message_row").length;
|
2017-05-14 21:14:26 +02:00
|
|
|
});
|
|
|
|
last_message_id = this.evaluate(function () {
|
2020-07-15 01:29:15 +02:00
|
|
|
var msg = $("#zhome .message_row").last();
|
|
|
|
msg.find(".info").click();
|
|
|
|
$(".delete_message").click();
|
|
|
|
return msg.attr("id");
|
2017-05-14 21:14:26 +02:00
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
casper.then(function () {
|
|
|
|
casper.waitUntilVisible("#delete_message_modal", function () {
|
2020-07-15 01:29:15 +02:00
|
|
|
casper.click("#do_delete_message_button");
|
2017-05-14 21:14:26 +02:00
|
|
|
});
|
|
|
|
});
|
2019-01-24 20:51:10 +01:00
|
|
|
casper.then(function () {
|
|
|
|
casper.test.assertVisible("#do_delete_message_spinner .loading_indicator_spinner");
|
|
|
|
casper.test.assertNotVisible("#do_delete_message_button");
|
|
|
|
});
|
2017-05-14 21:14:26 +02:00
|
|
|
|
|
|
|
casper.then(function () {
|
2017-05-31 07:07:49 +02:00
|
|
|
casper.waitFor(function check_length() {
|
|
|
|
return casper.evaluate(function (expected_length) {
|
2020-07-15 01:29:15 +02:00
|
|
|
return $("#zhome .message_row").length === expected_length;
|
2017-05-31 07:07:49 +02:00
|
|
|
}, msgs_qty - 1);
|
2017-05-14 21:14:26 +02:00
|
|
|
});
|
|
|
|
});
|
|
|
|
|
2017-05-31 07:07:49 +02:00
|
|
|
casper.then(function () {
|
|
|
|
casper.test.assertDoesntExist(last_message_id);
|
2019-01-24 20:51:10 +01:00
|
|
|
casper.test.assertNotVisible("#do_delete_message_spinner .loading_indicator_spinner");
|
2017-05-31 07:07:49 +02:00
|
|
|
});
|
|
|
|
|
2017-05-14 21:14:26 +02:00
|
|
|
casper.run(function () {
|
|
|
|
casper.test.done();
|
|
|
|
});
|