2019-10-25 09:45:13 +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 () {
|
|
|
|
return $('#zhome .message_row').length;
|
|
|
|
});
|
|
|
|
last_message_id = this.evaluate(function () {
|
2019-06-06 06:04:16 +02:00
|
|
|
var msg = $('#zhome .message_row').last();
|
2017-05-14 21:14:26 +02:00
|
|
|
msg.find('.info').click();
|
|
|
|
$('.delete_message').click();
|
|
|
|
return msg.attr('id');
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
casper.then(function () {
|
|
|
|
casper.waitUntilVisible("#delete_message_modal", function () {
|
|
|
|
casper.click('#do_delete_message_button');
|
|
|
|
});
|
|
|
|
});
|
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) {
|
|
|
|
return $('#zhome .message_row').length === expected_length;
|
|
|
|
}, 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();
|
|
|
|
});
|