2016-06-04 04:31:35 +02:00
|
|
|
var common = require('../casper_lib/common.js').common;
|
|
|
|
|
|
|
|
common.start_and_log_in();
|
|
|
|
|
2017-11-17 00:50:14 +01:00
|
|
|
casper.waitUntilVisible('#zhome', function () {
|
2016-06-04 04:31:35 +02:00
|
|
|
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"]', {
|
2018-11-13 17:16:02 +01:00
|
|
|
stream_message_recipient_stream: 'Verona',
|
|
|
|
stream_message_recipient_topic: 'Test mention all',
|
2016-06-04 04:31:35 +02:00
|
|
|
});
|
|
|
|
});
|
2018-01-24 17:18:07 +01:00
|
|
|
common.select_item_via_typeahead('#compose-textarea', '@**all**', 'all');
|
2016-06-04 04:31:35 +02:00
|
|
|
|
2016-11-09 19:34:07 +01:00
|
|
|
casper.then(function () {
|
2016-10-07 19:09:40 +02:00
|
|
|
common.turn_off_press_enter_to_send();
|
2016-11-09 19:34:07 +01:00
|
|
|
casper.test.info("Checking for all everyone warning");
|
|
|
|
var stream_size = this.evaluate(function () {
|
|
|
|
return stream_data.get_sub('Verona').subscribers.num_items();
|
|
|
|
});
|
|
|
|
casper.test.info(stream_size);
|
|
|
|
var threshold = this.evaluate(function () {
|
|
|
|
compose.all_everyone_warn_threshold = 5;
|
|
|
|
return compose.all_everyone_warn_threshold;
|
|
|
|
});
|
|
|
|
casper.test.assertTrue(stream_size > threshold);
|
2016-06-04 04:31:35 +02:00
|
|
|
casper.test.info('Click Send Button');
|
|
|
|
casper.click('#compose-send-button');
|
|
|
|
});
|
|
|
|
|
2016-11-09 19:34:07 +01:00
|
|
|
casper.then(function () {
|
2017-06-07 10:16:55 +02:00
|
|
|
casper.waitForSelectorText(".compose-all-everyone-msg", "Are you sure you want to mention all", function () {
|
2018-01-24 17:18:07 +01:00
|
|
|
casper.test.info('Warning message appears when mentioning @**all**');
|
2016-11-09 19:34:07 +01:00
|
|
|
casper.test.assertSelectorHasText('.compose-all-everyone-msg', 'Are you sure you want to mention all');
|
|
|
|
casper.click('.compose-all-everyone-confirm');
|
|
|
|
});
|
2016-06-04 04:31:35 +02:00
|
|
|
|
2016-11-09 19:34:07 +01:00
|
|
|
casper.waitWhileVisible('.compose-all-everyone-confirm', function () {
|
|
|
|
casper.test.info('Check that error messages are gone.');
|
|
|
|
casper.test.assertNotVisible('.compose-all-everyone-msg');
|
2017-11-26 19:58:36 +01:00
|
|
|
casper.test.assertNotVisible('#compose-send-status');
|
2016-11-09 19:34:07 +01:00
|
|
|
});
|
2016-06-04 04:31:35 +02:00
|
|
|
});
|
|
|
|
|
2016-11-09 19:34:07 +01:00
|
|
|
casper.then(function () {
|
2016-06-04 04:31:35 +02:00
|
|
|
common.expected_messages('zhome', ['Verona > Test mention all'],
|
2018-05-07 01:42:17 +02:00
|
|
|
["<p><span class=\"user-mention user-mention-me\" " +
|
|
|
|
"data-user-id=\"*\">@all</span></p>"]);
|
2016-06-04 04:31:35 +02:00
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
common.then_log_out();
|
|
|
|
|
|
|
|
casper.run(function () {
|
|
|
|
casper.test.done();
|
|
|
|
});
|