tests: Rename casper helpers for clarity

send_message -> then_send_message
send_many -> then_send_many
wait_and_send -> then_wait_and_send

Hopefully this makes it clearer that they should not be called inside of steps.

(imported from commit 4fcc971817b25056100311ba55303da2c5527f0f)
This commit is contained in:
Zev Benjamin 2014-03-07 14:59:30 -05:00 committed by Steve Howell
parent 0ccb794007
commit 39f632134d
6 changed files with 14 additions and 14 deletions

View File

@ -99,7 +99,7 @@ exports.check_form = function (form_selector, expected, test_name) {
}
};
exports.send_message = function (type, params) {
exports.then_send_message = function (type, params) {
casper.waitForSelector('#new_message_content', function () {
if(type === "stream") {
casper.page.sendEvent('keypress', "c");
@ -121,9 +121,9 @@ exports.send_message = function (type, params) {
};
// Wait for any previous send to finish, then send a message.
exports.wait_and_send = function (type, params) {
exports.then_wait_and_send = function (type, params) {
casper.waitForSelector('#compose-send-button:enabled');
exports.send_message(type, params);
exports.then_send_message(type, params);
};
// Get message headings (recipient rows) and bodies out of the DOM.
@ -166,9 +166,9 @@ exports.keypress = function (code) {
};
// Send a whole list of messages using wait_and_send.
exports.send_many = function (msgs) {
exports.then_send_many = function (msgs) {
msgs.forEach(function (msg) {
exports.wait_and_send(
exports.then_wait_and_send(
(msg.stream !== undefined) ? 'stream' : 'private',
msg);
});

View File

@ -36,7 +36,7 @@ casper.then(function () {
// Send some messages.
common.send_many([
common.then_send_many([
{ stream: 'Verona', subject: 'frontend test',
content: 'test message A' },
@ -73,7 +73,7 @@ common.wait_for_receive(function () {
casper.test.info('Sending more messages');
});
common.send_many([
common.then_send_many([
{ stream: 'Verona', subject: 'frontend test',
content: 'test message D' },

View File

@ -10,7 +10,7 @@ casper.then(function () {
casper.test.info('Sending messages');
});
common.send_many([
common.then_send_many([
{ stream: 'Verona', subject: 'frontend test',
content: 'test message A' },

View File

@ -3,12 +3,12 @@ var common = require('../common.js').common;
common.start_and_log_in();
// Send a message to try replying to
common.send_message('stream', {
common.then_send_message('stream', {
stream: 'Verona',
subject: 'Reply test',
content: "We reply to this message"
});
common.send_message('private', {
common.then_send_message('private', {
recipient: "cordelia@zulip.com",
content: "And reply to this message"
});
@ -94,7 +94,7 @@ casper.then(function () {
common.keypress(27); // escape to dismiss compose box
});
casper.waitWhileVisible('.message_comp');
common.send_many([
common.then_send_many([
{ recipient: recipients.join(','),
content: 'A huddle to check spaces' }]);

View File

@ -18,7 +18,7 @@ casper.then(function () {
casper.test.info("Sending test message");
});
common.send_message('stream', {
common.then_send_message('stream', {
stream: 'Verona',
subject: 'stars',
content: 'test star'

View File

@ -16,7 +16,7 @@ function then_edit_last_message() {
// Send and edit a stream message
common.send_message('stream', {
common.then_send_message('stream', {
stream: 'Verona',
subject: 'edits',
content: 'test editing'
@ -39,7 +39,7 @@ casper.waitForSelector(".message_edit_notice", function () {
casper.test.assertSelectorHasText(".last_message .message_content", "test edited");
});
common.send_message('private', {
common.then_send_message('private', {
recipient: "cordelia@zulip.com",
content: "test editing pm"
});