From 3627d4844504adf4b4b79f193f66c9be6d3970d2 Mon Sep 17 00:00:00 2001 From: Sebastian Gierlinger Date: Mon, 25 Nov 2013 16:03:54 +0100 Subject: [PATCH] Fix failing casper tests no issue - spam test: changed waitForSelector to waitForText - feature test: changed waitForRessource to watiForSelector --- core/test/functional/admin/content_test.js | 12 +++++++----- core/test/functional/admin/login_test.js | 9 ++++----- 2 files changed, 11 insertions(+), 10 deletions(-) diff --git a/core/test/functional/admin/content_test.js b/core/test/functional/admin/content_test.js index 5edd70b0a9..b51139dc32 100644 --- a/core/test/functional/admin/content_test.js +++ b/core/test/functional/admin/content_test.js @@ -67,7 +67,7 @@ CasperTest.begin('Infinite scrolling', 1, function suite(test) { }); }); -CasperTest.begin("Posts can be marked as featured", 4, function suite(test) { +CasperTest.begin("Posts can be marked as featured", 6, function suite(test) { // Create a sample post casper.thenOpen(url + 'ghost/editor/', function testTitleAndUrl() { test.assertTitle('Ghost Admin', 'Ghost admin has no title'); @@ -80,8 +80,9 @@ CasperTest.begin("Posts can be marked as featured", 4, function suite(test) { casper.thenClick('.js-publish-button'); - casper.waitForResource(/posts/, function checkPostWasCreated() { - test.assertExists('.notification-success', 'got success notification'); + casper.waitForSelector('.notification-success', function () { + test.assert(true, 'got success notification'); + test.assertSelectorHasText('.notification-success', 'Your post has been saved as a draft.'); }); // Begin test @@ -99,7 +100,8 @@ CasperTest.begin("Posts can be marked as featured", 4, function suite(test) { this.click('.featured'); }); - casper.waitForResource(/posts/, function checkPostWasMarkedAsFeatured() { - test.assertExists('.notification-success', 'got success notification'); + casper.waitForSelector('.notification-success', function () { + test.assert(true, 'got success notification'); + test.assertSelectorHasText('.notification-success', 'Post successfully marked as featured.'); }); }); diff --git a/core/test/functional/admin/login_test.js b/core/test/functional/admin/login_test.js index a150da3880..0cd3c5860a 100644 --- a/core/test/functional/admin/login_test.js +++ b/core/test/functional/admin/login_test.js @@ -45,7 +45,7 @@ CasperTest.begin('Redirects login to signin', 2, function suite(test) { }); }, true); -CasperTest.begin("Can't spam it", 4, function suite(test) { +CasperTest.begin("Can't spam it", 3, function suite(test) { casper.thenOpen(url + "ghost/signin/", function testTitle() { test.assertTitle("Ghost Admin", "Ghost admin has no title"); }); @@ -62,17 +62,16 @@ CasperTest.begin("Can't spam it", 4, function suite(test) { this.fill("#login", falseUser, true); }); - casper.waitForSelector('.notification-error', function onSuccess() { - test.assert(true, 'Save without title results in error notification as expected'); + casper.waitForText('Slow down, there are way too many login attempts!', function onSuccess() { + test.assert(true, 'Spamming the login did result in an error notification'); test.assertSelectorDoesntHaveText('.notification-error', '[object Object]'); - test.assertSelectorHasText('.notification-error', 'Slow down, there are way too many login attempts!'); }, function onTimeout() { test.assert(false, 'Spamming the login did not result in an error notification'); }); // This test causes the spam notification // add a wait to ensure future tests don't get tripped up by this. - casper.wait(1000); + casper.wait(2000); }, true); CasperTest.begin("Can login to Ghost", 4, function suite(test) {