From 055652e16dbe575d5f68eb9c430cf72302e65879 Mon Sep 17 00:00:00 2001 From: Waseem Daher Date: Tue, 8 Jan 2013 11:34:04 -0500 Subject: [PATCH] A few more subscription-related tests. (imported from commit 4d2b47d124bdf0e483363fb7852061bd690d0064) --- zephyr/tests/frontend/tests.js | 24 +++++++++++++++++++++--- 1 file changed, 21 insertions(+), 3 deletions(-) diff --git a/zephyr/tests/frontend/tests.js b/zephyr/tests/frontend/tests.js index 3c108098c3..91a36d4af4 100644 --- a/zephyr/tests/frontend/tests.js +++ b/zephyr/tests/frontend/tests.js @@ -289,14 +289,32 @@ casper.then(function() { casper.test.assertTextExists('Denmark', 'Initial subscriptions loaded'); }); casper.then(function() { - casper.fill('form#add_new_subscription', {streams: 'waseemio'}); + casper.fill('form#add_new_subscription', {streams: 'Waseemio'}); casper.click('form#add_new_subscription input.btn.btn-primary'); }); casper.then(function() { - casper.waitForText('waseemio'); + casper.waitForText('Waseemio'); // TODO: Make this more robust. // I tried to do it with assertSelectorHasText, but it wasn't quite working. - casper.test.assertTextExists('Successfully added subscription to waseemio', 'Subscribing to a stream'); + casper.test.assertTextExists('Successfully added subscription to Waseemio', 'Subscribing to a stream'); +}); + +casper.then(function() { + casper.fill('form#add_new_subscription', {streams: 'WASeemio'}); + casper.click('form#add_new_subscription input.btn.btn-primary'); +}); +casper.then(function() { + casper.waitForText('Already subscribed'); + casper.test.assertTextExists('Already subscribed', "Can't subscribe twice to a stream"); +}); + +casper.then(function() { + casper.fill('form#add_new_subscription', {streams: ' '}); + casper.click('form#add_new_subscription input.btn.btn-primary'); +}); +casper.then(function() { + casper.waitForText('Error adding subscription'); + casper.test.assertTextExists('Error adding subscription', "Can't subscribe to an empty stream name"); }); // Settings page tests