2016-06-04 04:31:35 +02:00
|
|
|
var common = require('../casper_lib/common.js').common;
|
|
|
|
|
|
|
|
common.start_and_log_in();
|
|
|
|
casper.verbonse = true;
|
|
|
|
|
|
|
|
casper.waitForSelector('#new_message_content', function () {
|
|
|
|
casper.test.info('compose box visible');
|
|
|
|
casper.page.sendEvent('keypress', "c"); // brings up the compose box
|
|
|
|
});
|
|
|
|
|
|
|
|
casper.then(function () {
|
|
|
|
casper.fill('form[action^="/json/messages"]', {
|
|
|
|
stream: 'Verona',
|
|
|
|
subject: 'Test mention all'
|
|
|
|
});
|
|
|
|
});
|
2016-06-09 09:29:49 +02:00
|
|
|
common.select_item_via_typeahead('#new_message_content', '@all', 'all');
|
2016-06-04 04:31:35 +02:00
|
|
|
|
2016-11-17 21:27:19 +01:00
|
|
|
casper.waitForText("Are you sure you want to mention all", function () {
|
2016-06-04 04:31:35 +02:00
|
|
|
casper.test.info('Warning message appears when mentioning @all');
|
2016-11-17 21:27:19 +01:00
|
|
|
casper.test.assertSelectorHasText('.compose-all-everyone', 'Are you sure you want to mention all');
|
2016-06-04 04:31:35 +02:00
|
|
|
});
|
|
|
|
|
|
|
|
casper.then( function () {
|
2016-10-07 19:09:40 +02:00
|
|
|
common.turn_off_press_enter_to_send();
|
2016-06-04 04:31:35 +02:00
|
|
|
casper.test.info('Click Send Button');
|
|
|
|
casper.click('#compose-send-button');
|
|
|
|
});
|
|
|
|
casper.waitForText("Please remove @all", function () {
|
|
|
|
casper.test.info('Error message appears when attempting to send a message without acknowledging the @all mention warning');
|
|
|
|
casper.test.assertSelectorHasText('#error-msg', "Please remove @all / @everyone or acknowledge that you will be spamming everyone!");
|
|
|
|
});
|
|
|
|
|
|
|
|
casper.waitForSelector('.compose-all-everyone-confirm', function () {
|
|
|
|
casper.click('.compose-all-everyone-confirm');
|
|
|
|
}, function () {
|
|
|
|
casper.test.error('Could not click confirm button.');
|
|
|
|
});
|
|
|
|
|
|
|
|
casper.waitWhileVisible('.compose-all-everyone-confirm', function () {
|
|
|
|
casper.test.info('Check that error messages are gone.');
|
|
|
|
casper.test.assertNotVisible('.compose-all-everyone-msg');
|
2016-10-07 19:09:40 +02:00
|
|
|
casper.test.assertNotVisible('#send-status');
|
2016-06-04 04:31:35 +02:00
|
|
|
});
|
|
|
|
|
|
|
|
casper.then( function () {
|
|
|
|
casper.test.info('Click Send Button');
|
|
|
|
casper.click('#compose-send-button');
|
|
|
|
});
|
|
|
|
|
|
|
|
casper.then( function () {
|
|
|
|
common.expected_messages('zhome', ['Verona > Test mention all'],
|
|
|
|
["<p><span class=\"user-mention user-mention-me\" data-user-email=\"*\">@all</span> </p>"]
|
|
|
|
);
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
common.then_log_out();
|
|
|
|
|
|
|
|
casper.run(function () {
|
|
|
|
casper.test.done();
|
|
|
|
});
|