diff --git a/core/client/templates/settings/general.hbs b/core/client/templates/settings/general.hbs index 37de9f57f2..776046f640 100644 --- a/core/client/templates/settings/general.hbs +++ b/core/client/templates/settings/general.hbs @@ -18,7 +18,7 @@
Describe what your blog is about {{gh-count-characters description}} diff --git a/core/test/functional/base.js b/core/test/functional/base.js index 23a23938e0..7e907a9ffb 100644 --- a/core/test/functional/base.js +++ b/core/test/functional/base.js @@ -150,8 +150,10 @@ casper.failOnTimeout = function (test, message) { // With Ember in place, we don't want to submit forms, rather press the green button which always has a class of // 'button-save'. This method handles that smoothly. casper.fillAndSave = function (selector, data) { - casper.fill(selector, data, false); - casper.thenClick(selector + ' .button-save'); + casper.then(function doFill() { + casper.fill(selector, data, false); + casper.thenClick('.button-save'); + }); }; // ## Debugging diff --git a/core/test/functional/client/app_test.js b/core/test/functional/client/app_test.js index fcb91c7abf..c8afe6d14c 100644 --- a/core/test/functional/client/app_test.js +++ b/core/test/functional/client/app_test.js @@ -1,7 +1,7 @@ // # App Test // Tests that the general layout & functionality of global admin components is correct -/*globals casper, __utils__, url, testPost, newUser */ +/*globals CasperTest, casper */ CasperTest.emberBegin('Admin navigation bar is correct', 28, function suite(test) { casper.thenOpenAndWaitForPageLoad('root', function testTitleAndUrl() { diff --git a/core/test/functional/client/content_test.js b/core/test/functional/client/content_test.js index 6a85c96553..eaffc389b2 100644 --- a/core/test/functional/client/content_test.js +++ b/core/test/functional/client/content_test.js @@ -1,29 +1,40 @@ // # Content Test // Test the content screen, uses the editor to create dummy content -/*globals casper, __utils__, url, testPost, newUser */ +/*globals CasperTest, casper, testPost, newUser */ -CasperTest.emberBegin("Content screen is correct", 17, function suite(test) { +CasperTest.emberBegin('Content screen is correct', 17, function suite(test) { // First, create a sample post for testing (this should probably be a routine) CasperTest.Routines.createTestPost.run(false); // Begin test casper.thenOpenAndWaitForPageLoad('content', function testTitleAndUrl() { - test.assertTitle("Ghost Admin", "Ghost admin has no title"); - test.assertUrlMatch(/ghost\/ember\/\d+\/$/, "Landed on the correct URL"); + test.assertTitle('Ghost Admin', 'Ghost admin has no title'); + test.assertUrlMatch(/ghost\/ember\/\d+\/$/, 'Landed on the correct URL'); }); casper.then(function testViews() { - test.assertExists(".content-view-container", "Content main view is present"); - test.assertExists(".content-list-content", "Content list view is present"); + test.assertExists('.content-view-container', 'Content main view is present'); + test.assertExists('.content-list-content', 'Content list view is present'); test.assertExists('.content-list .floatingheader a.button.button-add', 'add new post button exists'); - test.assertEquals(this.getElementAttribute('.content-list .floatingheader a.button.button-add', 'href'), '/ghost/ember/editor/', 'add new post href is correct'); - test.assertExists(".content-list-content li .entry-title", "Content list view has at least one item"); - test.assertSelectorHasText(".content-list-content li:first-of-type h3", testPost.title, "title is present and has content"); - test.assertSelectorHasText(".content-list-content li:first-of-type .entry-meta .status .draft", 'Draft', "status is present has content"); - test.assertExists(".content-preview", "Content preview is present"); - test.assertSelectorHasText('.content-preview header .status', 'Written', 'preview header contains "Written" when post is a draft'); - test.assertSelectorHasText('.content-preview header .author', newUser.name, 'preview header contains author name'); + test.assertEquals( + this.getElementAttribute('.content-list .floatingheader a.button.button-add', 'href'), + '/ghost/ember/editor/', 'add new post href is correct' + ); + test.assertExists('.content-list-content li .entry-title', 'Content list view has at least one item'); + test.assertSelectorHasText( + '.content-list-content li:first-of-type h3', testPost.title, 'title is present and has content' + ); + test.assertSelectorHasText( + '.content-list-content li:first-of-type .entry-meta .status .draft', 'Draft', 'correct status is present' + ); + test.assertExists('.content-preview', 'Content preview is present'); + test.assertSelectorHasText( + '.content-preview header .status', 'Written', 'preview header contains "Written" when post is a draft' + ); + test.assertSelectorHasText( + '.content-preview header .author', newUser.name, 'preview header contains author name' + ); }); casper.then(function testEditPostButton() { @@ -50,7 +61,7 @@ CasperTest.emberBegin("Content screen is correct", 17, function suite(test) { // test.assertDoesntExist('.content-list-content li:nth-of-type(2) .active', 'second item is not active'); // // // Ember adds script tags into the list so we need to use nth-of-type -// }).thenClick(".content-list-content li:nth-of-type(2) a", function then() { +// }).thenClick('.content-list-content li:nth-of-type(2) a', function then() { // test.assertDoesntExist('.content-list-content li:first-of-type .active', 'first item is not active'); // test.assertExists('.content-list-content li:nth-of-type(2) .active', 'second item is active'); // }); @@ -62,7 +73,7 @@ CasperTest.emberBegin('Content list shows correct post status', 7, function test // Begin test casper.thenOpenAndWaitForPageLoad('content', function testTitleAndUrl() { test.assertTitle('Ghost Admin', 'Ghost admin has no title'); - test.assertUrlMatch(/ghost\/ember\/\d+\/$/, "Landed on the correct URL"); + test.assertUrlMatch(/ghost\/ember\/\d+\/$/, 'Landed on the correct URL'); }); // Select first non-draft, non-static post. Should be second in the list at this stage of testing. @@ -76,8 +87,12 @@ CasperTest.emberBegin('Content list shows correct post status', 7, function test // Test for 'Published' in header casper.then(function testHeader() { - test.assertSelectorHasText('.content-preview header .status', 'Published', 'preview header contains "Published" when post is published'); - test.assertSelectorHasText('.content-preview header .author', newUser.name, 'preview header contains author name'); + test.assertSelectorHasText( + '.content-preview header .status', 'Published', 'preview header contains "Published" when post is published' + ); + test.assertSelectorHasText( + '.content-preview header .author', newUser.name, 'preview header contains author name' + ); }); // Change post to static page @@ -103,7 +118,7 @@ CasperTest.emberBegin('Delete post modal', 7, function testDeleteModal(test) { // Begin test casper.thenOpenAndWaitForPageLoad('content', function testTitleAndUrl() { test.assertTitle('Ghost Admin', 'Ghost admin has no title'); - test.assertUrlMatch(/ghost\/ember\/\d+\/$/, "Landed on the correct URL"); + test.assertUrlMatch(/ghost\/ember\/\d+\/$/, 'Landed on the correct URL'); }); // Open post settings menu @@ -120,8 +135,8 @@ CasperTest.emberBegin('Delete post modal', 7, function testDeleteModal(test) { casper.thenClick('.js-button-reject'); - casper.waitWhileVisible("#modal-container", function onSuccess() { - test.assert(true, "clicking cancel should close the delete post modal"); + casper.waitWhileVisible('#modal-container', function onSuccess() { + test.assert(true, 'clicking cancel should close the delete post modal'); }); // Test delete @@ -149,18 +164,18 @@ CasperTest.emberBegin('Delete post modal', 7, function testDeleteModal(test) { // // casper.thenOpenAndWaitForPageLoad('content', function testTitleAndUrl() { // test.assertTitle('Ghost Admin', 'Ghost admin has no title'); -// test.assertUrlMatch(/ghost\/ember\/\d+\/$/, "Landed on the correct URL"); +// test.assertUrlMatch(/ghost\/ember\/\d+\/$/, 'Landed on the correct URL'); // }); //}); -CasperTest.emberBegin("Posts can be marked as featured", 10, function suite(test) { +CasperTest.emberBegin('Posts can be marked as featured', 10, function suite(test) { // Create a sample post CasperTest.Routines.createTestPost.run(false); // Begin test casper.thenOpenAndWaitForPageLoad('content', function testTitleAndUrl() { - test.assertTitle("Ghost Admin", "Ghost admin has no title"); - test.assertUrlMatch(/ghost\/ember\/\d+\/$/, "Landed on the correct URL"); + test.assertTitle('Ghost Admin', 'Ghost admin has no title'); + test.assertUrlMatch(/ghost\/ember\/\d+\/$/, 'Landed on the correct URL'); }); // Mark as featured @@ -209,7 +224,7 @@ CasperTest.emberBegin('Post url can be changed', 7, function suite(test) { // Begin test casper.thenOpenAndWaitForPageLoad('content', function testTitleAndUrl() { test.assertTitle('Ghost Admin', 'Ghost admin has no title'); - test.assertUrlMatch(/ghost\/ember\/\d+\/$/, "Landed on the correct URL"); + test.assertUrlMatch(/ghost\/ember\/\d+\/$/, 'Landed on the correct URL'); }); casper.thenClick('a.post-settings'); @@ -224,7 +239,7 @@ CasperTest.emberBegin('Post url can be changed', 7, function suite(test) { '#url': 'new-url' }, false); - this.click('a.post-settings') + this.click('a.post-settings'); }); casper.waitForSelector('.notification-success', function waitForSuccess() { @@ -248,7 +263,7 @@ CasperTest.emberBegin('Post published date can be changed', 7, function suite(te // Begin test casper.thenOpenAndWaitForPageLoad('content', function testTitleAndUrl() { test.assertTitle('Ghost Admin', 'Ghost admin has no title'); - test.assertUrlMatch(/ghost\/ember\/\d+\/$/, "Landed on the correct URL"); + test.assertUrlMatch(/ghost\/ember\/\d+\/$/, 'Landed on the correct URL'); }); casper.thenClick('a.post-settings'); @@ -263,7 +278,7 @@ CasperTest.emberBegin('Post published date can be changed', 7, function suite(te '.post-setting-date': '22 May 14 @ 23:39' }, false); - this.click('a.post-settings') + this.click('a.post-settings'); }); casper.waitForSelector('.notification-success', function waitForSuccess() { @@ -287,7 +302,7 @@ CasperTest.emberBegin('Post can be changed to static page', 7, function suite(te // Begin test casper.thenOpenAndWaitForPageLoad('content', function testTitleAndUrl() { test.assertTitle('Ghost Admin', 'Ghost admin has no title'); - test.assertUrlMatch(/ghost\/ember\/\d+\/$/, "Landed on the correct URL"); + test.assertUrlMatch(/ghost\/ember\/\d+\/$/, 'Landed on the correct URL'); }); casper.thenClick('.content-preview a.post-settings'); diff --git a/core/test/functional/client/editor_test.js b/core/test/functional/client/editor_test.js index 57fb2c19e4..4b594455da 100644 --- a/core/test/functional/client/editor_test.js +++ b/core/test/functional/client/editor_test.js @@ -1,7 +1,7 @@ // # Editor Test // Test the editor screen works as expected -/*globals casper, __utils__, url, testPost */ +/*globals CasperTest, casper, testPost, $ */ CasperTest.emberBegin('Ghost editor functions correctly', 19, function suite(test) { casper.thenOpenAndWaitForPageLoad('editor', function testTitleAndUrl() { test.assertTitle('Ghost Admin', 'Ghost admin has no title'); @@ -130,7 +130,9 @@ CasperTest.emberBegin('Markdown in editor works', 4, function suite(test) { return document.querySelector('.CodeMirror-wrap textarea').value; }, '![sometext]()', 'Editor value is correct'); - test.assertSelectorHasText('.entry-preview .rendered-markdown', 'Add image of sometext', 'Editor value is correct'); + test.assertSelectorHasText( + '.entry-preview .rendered-markdown', 'Add image of sometext', 'Alt value is correct' + ); }, function onTimeout() { test.assert('false', 'markdown did not re-render'); }); @@ -159,9 +161,9 @@ CasperTest.emberBegin('Image Uploads', 17, function suite(test) { casper.thenClick('.entry-preview .image-uploader a.image-url'); casper.waitForSelector('.image-uploader-url', function onSuccess() { - test.assertExists('.image-uploader-url .url.js-upload-url', 'Image URL uploader exists') - test.assertExists('.image-uploader-url .button-save.js-button-accept', 'Image URL accept button exists') - test.assertExists('.image-uploader-url .image-upload', 'Back to normal image upload style button exists') + test.assertExists('.image-uploader-url .url.js-upload-url', 'Image URL uploader exists'); + test.assertExists('.image-uploader-url .button-save.js-button-accept', 'Image URL accept button exists'); + test.assertExists('.image-uploader-url .image-upload', 'Back to normal image upload style button exists'); }); // Test image source location @@ -208,7 +210,7 @@ CasperTest.emberBegin('Image Uploads', 17, function suite(test) { }); casper.waitForSelector('.entry-preview .js-drop-zone.pre-image-uploader', function onSuccess() { - var imageJQuerySelector = '.entry-preview img.js-upload-target[src="' + imageURL + '"]' + var imageJQuerySelector = '.entry-preview img.js-upload-target[src="' + imageURL + '"]'; test.assertExists(imageJQuerySelector, 'Uploaded image tag properly links to inputted image URL'); }); }); @@ -253,14 +255,16 @@ CasperTest.emberBegin('Post settings menu', 30, function suite(test) { test.assertExists('.post-settings-menu input#url', 'url field exists'); test.assertExists('.post-settings-menu input.post-setting-date', 'publication date field exists'); test.assertExists('.post-settings-menu input.post-setting-static-page', 'static page checkbox field exists'); - test.assertExists('.post-settings-menu a.delete', 'delete post button exists') + test.assertExists('.post-settings-menu a.delete', 'delete post button exists'); }); casper.thenClick('#publish-bar a.post-settings'); casper.waitUntilVisible('#publish-bar .post-settings-menu', function onSuccess() { test.assert(true, 'popup menu should be visible after clicking post-settings icon'); - test.assertNotVisible('.post-settings-menu a.delete', 'delete post btn shouldn\'t be visible on unsaved drafts'); + test.assertNotVisible( + '.post-settings-menu a.delete', 'delete post button shouldn\'t be visible on unsaved drafts' + ); }); casper.thenClick('#publish-bar a.post-settings'); @@ -303,7 +307,7 @@ CasperTest.emberBegin('Post settings menu', 30, function suite(test) { '#url': 'new-url-editor' }, false); - this.click('#publish-bar a.post-settings') + this.click('#publish-bar a.post-settings'); }); casper.waitForSelector('.notification-success', function waitForSuccess() { @@ -331,7 +335,7 @@ CasperTest.emberBegin('Post settings menu', 30, function suite(test) { '.post-setting-date': '10 May 14 @ 00:17' }, false); - this.click('#publish-bar a.post-settings') + this.click('#publish-bar a.post-settings'); }); casper.waitForSelector('.notification-success', function waitForSuccess() { diff --git a/core/test/functional/client/settings_test.js b/core/test/functional/client/settings_test.js index f241fbf9bd..ede21442a5 100644 --- a/core/test/functional/client/settings_test.js +++ b/core/test/functional/client/settings_test.js @@ -1,7 +1,7 @@ // # Settings Test // Test the various tabs on the settings page -/*globals casper, CasperTest, url */ +/*globals CasperTest, casper */ // These classes relate to elements which only appear when a given tab is loaded. // These are used to check that a switch to a tab is complete, or that we are on the right tab. @@ -67,16 +67,16 @@ CasperTest.emberBegin('General settings pane is correct', 8, function suite(test casper.click('.js-modal-logo'); }); - casper.waitForSelector('#modal-container .modal-content .js-drop-zone .description', assertImageUploaderModalThenClose, - casper.failOnTimeout(test, 'No upload logo modal container appeared')); + casper.waitForSelector('#modal-container .modal-content .js-drop-zone .description', + assertImageUploaderModalThenClose, casper.failOnTimeout(test, 'No upload logo modal container appeared')); // Test Blog Cover Upload Button casper.waitForSelector('.js-modal-cover', function () { casper.click('.js-modal-cover'); }); - casper.waitForSelector('#modal-container .modal-content .js-drop-zone .description', assertImageUploaderModalThenClose, - casper.failOnTimeout(test, 'No upload cover modal container appeared')); + casper.waitForSelector('#modal-container .modal-content .js-drop-zone .description', + assertImageUploaderModalThenClose, casper.failOnTimeout(test, 'No upload cover modal container appeared')); function handleSettingsRequest(requestData) { // make sure we only get requests from the user pane @@ -110,14 +110,14 @@ CasperTest.emberBegin('General settings pane is correct', 8, function suite(test }); //// ## General settings validations tests -//CasperTest.emberBegin('General settings validation is correct', 3, function suite(test) { +//CasperTest.emberBegin('General settings validation is correct', 7, function suite(test) { // casper.thenOpenAndWaitForPageLoad('settings.general', function testTitleAndUrl() { // test.assertTitle('Ghost Admin', 'Ghost admin has no title'); -// test.assertUrlMatch(/ghost\/settings\/general\/$/, 'Ghost doesn\'t require login this time'); +// test.assertUrlMatch(/ghost\/ember\/settings\/general\/$/, 'Landed on the correct URL'); // }); // // // Ensure general blog title field length validation -// this.fillAndSave('form#settings-general', { +// casper.fillAndSave('form#settings-general', { // 'general[title]': new Array(152).join('a') // }); // @@ -125,21 +125,21 @@ CasperTest.emberBegin('General settings pane is correct', 8, function suite(test // test.assertSelectorHasText('.notification-error', 'too long'); // }, casper.failOnTimeout(test, 'Blog title length error did not appear'), 2000); // -// this.thenClick('.js-bb-notification .close'); +// casper.thenClick('.js-bb-notification .close'); // // // Ensure general blog description field length validation -// this.fillAndSave('form#settings-general', { -// '#blog-description': new Array(202).join('a') +// casper.fillAndSave('form#settings-general', { +// 'general[description]': new Array(202).join('a') // }); // // casper.waitForSelectorTextChange('.notification-error', function onSuccess() { // test.assertSelectorHasText('.notification-error', 'too long'); // }, casper.failOnTimeout(test, 'Blog description length error did not appear')); // -// this.thenClick('.js-bb-notification .close'); +// casper.thenClick('.js-bb-notification .close'); // // // Ensure postsPerPage number field form validation -// this.fillAndSave('form#settings-general', { +// casper.fillAndSave('form#settings-general', { // 'general[postsPerPage]': 'notaninteger' // }); // @@ -147,20 +147,21 @@ CasperTest.emberBegin('General settings pane is correct', 8, function suite(test // test.assertSelectorHasText('.notification-error', 'use a number'); // }, casper.failOnTimeout(test, 'postsPerPage error did not appear'), 2000); // -// this.thenClick('.js-bb-notification .close'); +// casper.thenClick('.js-bb-notification .close'); // // // Ensure postsPerPage max of 1000 -// this.fillAndSave('form#settings-general', { +// casper.fillAndSave('form#settings-general', { // 'general[postsPerPage]': '1001' // }); +// // casper.waitForSelectorTextChange('.notification-error', function onSuccess() { // test.assertSelectorHasText('.notification-error', 'use a number less than 1000'); // }, casper.failOnTimeout(test, 'postsPerPage max error did not appear', 2000)); // -// this.thenClick('.js-bb-notification .close'); +// casper.thenClick('.js-bb-notification .close'); // // // Ensure postsPerPage min of 0 -// this.fillAndSave('form#settings-general', { +// casper.fillAndSave('form#settings-general', { // 'general[postsPerPage]': '-1' // }); // diff --git a/core/test/functional/client/signin_test.js b/core/test/functional/client/signin_test.js index 1e6edd594c..ec2d48e7b4 100644 --- a/core/test/functional/client/signin_test.js +++ b/core/test/functional/client/signin_test.js @@ -1,22 +1,16 @@ // # Signin Test // Test that signin works, including testing our spam prevention mechanisms -/*globals casper, __utils__, url, newUser, user, falseUser */ - -//CasperTest.emberBegin('Ensure Session is Killed', 1, function suite(test) { -// casper.thenOpenAndWaitForPageLoad('signout', function ensureSignedOut() { -// test.assertUrlMatch(/ghost\/ember\/sign/, 'We got redirected to signin or signup page'); -// }); -//}, true); +/*globals CasperTest, casper, url, newUser, user, falseUser */ CasperTest.emberBegin('Ensure a User is Registered', 3, function suite(test) { casper.thenOpenAndWaitForPageLoad('signup', function checkUrl() { test.assertUrlMatch(/ghost\/ember\/signup\/$/, 'Landed on the correct URL'); }); - casper.waitForOpaque(".signup-box", + casper.waitForOpaque('.signup-box', function then() { - this.fillAndSave("#signup", newUser); + this.fillAndSave('#signup', newUser); }, function onTimeout() { test.fail('Sign up form didn\'t fade in.'); @@ -39,9 +33,9 @@ CasperTest.emberBegin('Ensure a User is Registered', 3, function suite(test) { }); }, true); -CasperTest.emberBegin("Ghost admin will load login page", 3, function suite(test) { +CasperTest.emberBegin('Ghost admin will load login page', 3, function suite(test) { casper.thenOpenAndWaitForPageLoad('signin', function testTitleAndUrl() { - test.assertTitle("Ghost Admin", "Ghost admin has no title"); + test.assertTitle('Ghost Admin', 'Ghost admin has no title'); test.assertUrlMatch(/ghost\/ember\/signin\/$/, 'We should be presented with the signin page.'); casper.then(function testLink() { @@ -64,15 +58,15 @@ CasperTest.emberBegin('Redirects login to signin', 2, function suite(test) { }); }, true); -CasperTest.emberBegin("Can't spam it", 4, function suite(test) { +CasperTest.emberBegin('Can\'t spam it', 4, function suite(test) { casper.thenOpenAndWaitForPageLoad('signin', function testTitle() { - test.assertTitle("Ghost Admin", "Ghost admin has no title"); + test.assertTitle('Ghost Admin', 'Ghost admin has no title'); test.assertUrlMatch(/ghost\/ember\/signin\/$/, 'Landed on the correct URL'); }); - casper.waitForOpaque(".login-box", + casper.waitForOpaque('.login-box', function then() { - this.fillAndSave("#login", falseUser); + this.fillAndSave('#login', falseUser); }, function onTimeout() { test.fail('Sign in form didn\'t fade in.'); @@ -82,7 +76,7 @@ CasperTest.emberBegin("Can't spam it", 4, function suite(test) { casper.captureScreenshot('login_spam_test.png'); casper.waitForText('attempts remaining!', function then() { - this.fillAndSave("#login", falseUser); + this.fillAndSave('#login', falseUser); }); casper.captureScreenshot('login_spam_test2.png'); @@ -100,22 +94,22 @@ CasperTest.emberBegin("Can't spam it", 4, function suite(test) { }, true); -CasperTest.emberBegin("Login limit is in place", 4, function suite(test) { +CasperTest.emberBegin('Login limit is in place', 4, function suite(test) { casper.thenOpenAndWaitForPageLoad('signin', function testTitleAndUrl() { - test.assertTitle("Ghost Admin", "Ghost admin has no title"); + test.assertTitle('Ghost Admin', 'Ghost admin has no title'); test.assertUrlMatch(/ghost\/ember\/signin\/$/, 'Landed on the correct URL'); }); - casper.waitForOpaque(".login-box", + casper.waitForOpaque('.login-box', function then() { - this.fillAndSave("#login", falseUser); + this.fillAndSave('#login', falseUser); }, function onTimeout() { test.fail('Sign in form didn\'t fade in.'); }); casper.wait(2100, function doneWait() { - this.fillAndSave("#login", falseUser); + this.fillAndSave('#login', falseUser); }); casper.waitForText('remaining', function onSuccess() { @@ -129,48 +123,47 @@ CasperTest.emberBegin("Login limit is in place", 4, function suite(test) { casper.wait(2000); }, true); -CasperTest.emberBegin("Can login to Ghost", 5, function suite(test) { +CasperTest.emberBegin('Can login to Ghost', 5, function suite(test) { casper.thenOpenAndWaitForPageLoad('signin', function testTitleAndUrl() { - test.assertTitle("Ghost Admin", "Ghost admin has no title"); + test.assertTitle('Ghost Admin', 'Ghost admin has no title'); test.assertUrlMatch(/ghost\/ember\/signin\/$/, 'Landed on the correct URL'); }); - casper.waitForOpaque(".login-box", function then() { - this.fillAndSave("#login", user); + casper.waitForOpaque('.login-box', function then() { + this.fillAndSave('#login', user); }); casper.wait(2000); casper.waitForResource(/posts/, function testForDashboard() { test.assertUrlMatch(/ghost\/ember\/\d+\/$/, 'Landed on the correct URL'); - test.assertExists("#global-header", "Global admin header is present"); - test.assertExists(".manage", "We're now on content"); + test.assertExists('#global-header', 'Global admin header is present'); + test.assertExists('.manage', 'We\'re now on content'); }, function onTimeOut() { test.fail('Failed to signin'); }); }, true); -// Uncomment when signin / email validation has been readded to the frontend -//CasperTest.emberBegin('Ensure email field form validation', 3, function suite(test) { -// casper.thenOpenAndWaitForPageLoad('signin', function testTitleAndUrl() { -// test.assertTitle("Ghost Admin", "Ghost admin has no title"); -// test.assertUrlMatch(/ghost\/ember\/signin\/$/, 'Landed on the correct URL'); -// }); -// -// casper.waitForOpaque(".js-login-box", -// function then() { -// this.fillAndSave("form.login-form", { -// 'email': 'notanemail' -// }); -// }, -// function onTimeout() { -// test.fail('Login form didn\'t fade in.'); -// }); -// -// casper.waitForSelectorTextChange('.notification-error', function onSuccess() { -// test.assertSelectorHasText('.notification-error', 'Invalid Email'); -// }, function onTimeout() { -// test.fail('Email validation error did not appear'); -// }, 2000); -// -//}, true); +CasperTest.emberBegin('Ensure email field form validation', 3, function suite(test) { + casper.thenOpenAndWaitForPageLoad('signin', function testTitleAndUrl() { + test.assertTitle('Ghost Admin', 'Ghost admin has no title'); + test.assertUrlMatch(/ghost\/ember\/signin\/$/, 'Landed on the correct URL'); + }); + + casper.waitForOpaque('.js-login-box', + function then() { + this.fillAndSave('form.login-form', { + 'email': 'notanemail' + }); + }, + function onTimeout() { + test.fail('Login form didn\'t fade in.'); + }); + + casper.waitForSelectorTextChange('.notification-error', function onSuccess() { + test.assertSelectorHasText('.notification-error', 'Invalid Email'); + }, function onTimeout() { + test.fail('Email validation error did not appear'); + }, 2000); + +}, true); diff --git a/core/test/functional/client/signout_test.js b/core/test/functional/client/signout_test.js index 7a5f1b9271..c36ef812f3 100644 --- a/core/test/functional/client/signout_test.js +++ b/core/test/functional/client/signout_test.js @@ -1,22 +1,22 @@ // # Signout Test // Test that signout works correctly -/*globals casper, __utils__, url, testPost, falseUser, email */ -CasperTest.emberBegin("Ghost signout works correctly", 4, function suite(test) { +/*globals CasperTest, casper */ +CasperTest.emberBegin('Ghost signout works correctly', 4, function suite(test) { CasperTest.Routines.register.run(test); CasperTest.Routines.logout.run(test); CasperTest.Routines.login.run(test); casper.thenOpenAndWaitForPageLoad('root', function then() { - test.assertTitle("Ghost Admin", "Ghost admin has no title"); + test.assertTitle('Ghost Admin', 'Ghost admin has no title'); test.assertUrlMatch(/ghost\/ember\/\d+\/$/, 'Landed on the correct URL without signing in'); }); casper.thenClick('#usermenu a').waitFor(function checkOpaque() { return this.evaluate(function () { var menu = document.querySelector('#usermenu .overlay.open'); - return window.getComputedStyle(menu).getPropertyValue('display') === "block" - && window.getComputedStyle(menu).getPropertyValue('opacity') === "1"; + return window.getComputedStyle(menu).getPropertyValue('display') === 'block' && + window.getComputedStyle(menu).getPropertyValue('opacity') === '1'; }); }); diff --git a/core/test/functional/client/signup_test.js b/core/test/functional/client/signup_test.js index 9e3f10868f..8bf63f06ab 100644 --- a/core/test/functional/client/signup_test.js +++ b/core/test/functional/client/signup_test.js @@ -1,13 +1,15 @@ // # Signup Test // Test that signup works correctly -CasperTest.emberBegin("Ghost signup fails properly", 5, function suite(test) { +/*global CasperTest, casper, email */ + +CasperTest.emberBegin('Ghost signup fails properly', 5, function suite(test) { casper.thenOpenAndWaitForPageLoad('signup', function then() { test.assertUrlMatch(/ghost\/ember\/signup\/$/, 'Landed on the correct URL'); }); casper.then(function signupWithShortPassword() { - casper.fillAndSave("#signup", {email: email, password: 'test'}); + casper.fillAndSave('#signup', {email: email, password: 'test'}); }); // should now throw a short password error @@ -19,7 +21,7 @@ CasperTest.emberBegin("Ghost signup fails properly", 5, function suite(test) { }); casper.then(function signupWithLongPassword() { - casper.fillAndSave("#signup", {email: email, password: 'testing1234'}); + casper.fillAndSave('#signup', {email: email, password: 'testing1234'}); }); // should now throw a 1 user only error