2014-06-17 01:44:09 +04:00
|
|
|
// # App Test
|
|
|
|
// Tests that the general layout & functionality of global admin components is correct
|
|
|
|
|
2014-09-03 19:42:55 +04:00
|
|
|
/*globals CasperTest, casper, newUser */
|
2014-06-17 01:44:09 +04:00
|
|
|
|
2015-03-07 23:35:45 +03:00
|
|
|
CasperTest.begin('Admin navigation bar is correct', 45, function suite(test) {
|
2014-06-17 01:44:09 +04:00
|
|
|
casper.thenOpenAndWaitForPageLoad('root', function testTitleAndUrl() {
|
2014-11-25 23:56:08 +03:00
|
|
|
test.assertTitle('Content - Test Blog', 'Ghost admin has incorrect title');
|
2014-07-01 03:26:08 +04:00
|
|
|
test.assertUrlMatch(/ghost\/\d+\/$/, 'Landed on the correct URL');
|
2014-06-17 01:44:09 +04:00
|
|
|
});
|
|
|
|
|
|
|
|
casper.then(function testNavItems() {
|
2015-05-19 16:21:39 +03:00
|
|
|
var logoHref = this.getElementAttribute('.gh-nav-footer-sitelink', 'href'),
|
|
|
|
contentHref = this.getElementAttribute('.gh-nav-main-content', 'href'),
|
|
|
|
editorHref = this.getElementAttribute('.gh-nav-main-editor', 'href'),
|
|
|
|
settingsGeneralHref = this.getElementAttribute('.gh-nav-settings-general', 'href');
|
2014-06-17 01:44:09 +04:00
|
|
|
|
|
|
|
// Logo
|
2015-05-19 16:21:39 +03:00
|
|
|
test.assertExists('.gh-nav-footer-sitelink', 'Ghost logo home page link exists');
|
2015-05-20 23:09:31 +03:00
|
|
|
test.assertEquals(logoHref, 'http://127.0.0.1:2369/', 'Ghost logo link href is correct');
|
2014-06-17 01:44:09 +04:00
|
|
|
|
|
|
|
// Content
|
2015-05-19 16:21:39 +03:00
|
|
|
test.assertExists('.gh-nav-main-content', 'Content nav item exists');
|
|
|
|
test.assertSelectorHasText('.gh-nav-main-content', 'Content', 'Content nav item has correct text');
|
2014-07-01 03:26:08 +04:00
|
|
|
test.assertEquals(contentHref, '/ghost/', 'Content href is correct');
|
2015-05-19 16:21:39 +03:00
|
|
|
test.assertExists('.gh-nav-main-content.active', 'Content nav item is not marked active');
|
2014-06-17 01:44:09 +04:00
|
|
|
|
|
|
|
// Editor
|
2015-05-19 16:21:39 +03:00
|
|
|
test.assertExists('.gh-nav-main-editor', 'Editor nav item exists');
|
|
|
|
test.assertSelectorHasText('.gh-nav-main-editor', 'New Post', 'Editor nav item has correct text');
|
2014-07-01 03:26:08 +04:00
|
|
|
test.assertEquals(editorHref, '/ghost/editor/', 'Editor href is correct');
|
2015-05-19 16:21:39 +03:00
|
|
|
test.assertDoesntExist('.gh-nav-main-editor.active', 'Editor nav item is not marked active');
|
2014-06-17 01:44:09 +04:00
|
|
|
|
|
|
|
// Settings
|
2015-05-19 16:21:39 +03:00
|
|
|
test.assertExists('.gh-nav-settings-general', 'Settings nav item exists');
|
|
|
|
test.assertSelectorHasText('.gh-nav-settings-general', 'General', 'Settings nav item has correct text');
|
|
|
|
test.assertEquals(settingsGeneralHref, '/ghost/settings/general/', 'Settings href is correct');
|
|
|
|
test.assertDoesntExist('.gh-nav-settings-general.active', 'Settings nav item is marked active');
|
2014-06-17 01:44:09 +04:00
|
|
|
});
|
|
|
|
|
2015-03-07 23:35:45 +03:00
|
|
|
casper.then(function testHelpMenuNotVisible() {
|
2015-05-19 16:21:39 +03:00
|
|
|
test.assertExists('.gh-help-button', 'Help menu nav item exists');
|
|
|
|
test.assertNotExists('.gh-help-button .dropdown.open', 'Help menu should not be visible');
|
2015-03-07 23:35:45 +03:00
|
|
|
});
|
|
|
|
|
2015-05-19 16:21:39 +03:00
|
|
|
casper.thenClick('.gh-help-button');
|
|
|
|
casper.waitForSelector('.dropdown', function then() {
|
2015-03-07 23:35:45 +03:00
|
|
|
var supportHref = this.getElementAttribute('.help-menu-support', 'href'),
|
|
|
|
tweetHref = this.getElementAttribute('.help-menu-tweet', 'href'),
|
|
|
|
howtoHref = this.getElementAttribute('.help-menu-how-to', 'href'),
|
|
|
|
wishlistHref = this.getElementAttribute('.help-menu-wishlist', 'href');
|
|
|
|
|
2015-05-19 16:21:39 +03:00
|
|
|
test.assertVisible('.dropdown-menu', 'Help menu should be visible');
|
2015-03-07 23:35:45 +03:00
|
|
|
|
|
|
|
test.assertExists('.help-menu-support', 'Support menu item exists');
|
|
|
|
test.assertSelectorHasText('.help-menu-support', 'Support Center', 'Support menu item has correct text');
|
|
|
|
test.assertEquals(supportHref, 'http://support.ghost.org/', 'Support href is correct');
|
|
|
|
|
|
|
|
test.assertExists('.help-menu-tweet', 'Tweet menu item exists');
|
|
|
|
test.assertSelectorHasText('.help-menu-tweet', 'Tweet @TryGhost!', 'Tweet menu item has correct text');
|
|
|
|
test.assertEquals(tweetHref, 'https://twitter.com/intent/tweet?text=%40TryGhost+Hi%21+Can+you+help+me+with+&related=TryGhost', 'Tweet href is correct');
|
|
|
|
|
|
|
|
test.assertExists('.help-menu-how-to', 'How-to menu item exists');
|
|
|
|
test.assertSelectorHasText('.help-menu-how-to', 'How to Use Ghost', 'How-to menu item has correct text');
|
|
|
|
test.assertEquals(howtoHref, 'http://support.ghost.org/how-to-use-ghost/', 'How-to href is correct');
|
|
|
|
|
|
|
|
test.assertExists('.help-menu-wishlist', 'Wishlist menu item exists');
|
|
|
|
test.assertSelectorHasText('.help-menu-wishlist', 'Wishlist', 'Wishlist menu item has correct text');
|
|
|
|
test.assertEquals(wishlistHref, 'http://ideas.ghost.org/', 'Wishlist href is correct');
|
|
|
|
|
|
|
|
test.assertExists('.help-menu-markdown', 'Markdown menu item exists');
|
|
|
|
test.assertSelectorHasText('.help-menu-markdown', 'Markdown Help', 'Markdown menu item has correct text');
|
|
|
|
|
|
|
|
casper.thenClick('.help-menu-markdown');
|
|
|
|
|
|
|
|
casper.waitUntilVisible('.modal-container', function onSuccess() {
|
|
|
|
test.assertSelectorHasText(
|
|
|
|
'.modal-content .modal-header',
|
|
|
|
'Markdown Help',
|
|
|
|
'delete modal has correct text');
|
|
|
|
|
|
|
|
test.assertExists('.modal-content .close');
|
|
|
|
});
|
|
|
|
|
|
|
|
casper.thenClick('.modal-content .close');
|
|
|
|
|
|
|
|
casper.waitWhileVisible('.modal-container', function onSuccess() {
|
|
|
|
test.assert(true, 'clicking close should remove the markdown help modal');
|
|
|
|
});
|
2015-05-19 16:21:39 +03:00
|
|
|
}, casper.failOnTimeout(test, 'WaitForSelector .gh-help-menu .ember-view.open failed'));
|
2015-03-07 23:35:45 +03:00
|
|
|
|
2014-06-17 01:44:09 +04:00
|
|
|
casper.then(function testUserMenuNotVisible() {
|
2015-05-19 16:21:39 +03:00
|
|
|
test.assertExists('.gh-nav-menu .gh-nav-menu-details-user', 'User menu nav item exists');
|
|
|
|
test.assertNotExists('.gh-nav-menu-details-user .user-menu-profile', 'User menu should not be visible');
|
2014-06-17 01:44:09 +04:00
|
|
|
});
|
|
|
|
|
2015-05-19 16:21:39 +03:00
|
|
|
casper.thenClick('.gh-nav-menu');
|
|
|
|
casper.waitForSelector('.dropdown', function then() {
|
2014-08-17 23:23:00 +04:00
|
|
|
var profileHref = this.getElementAttribute('.user-menu-profile', 'href'),
|
|
|
|
signoutHref = this.getElementAttribute('.user-menu-signout', 'href');
|
2014-06-17 01:44:09 +04:00
|
|
|
|
2015-05-19 16:21:39 +03:00
|
|
|
test.assertVisible('.dropdown-item.user-menu-profile', 'User menu should be visible');
|
2014-06-17 01:44:09 +04:00
|
|
|
|
2015-05-19 16:21:39 +03:00
|
|
|
test.assertExists('.dropdown-item.user-menu-profile', 'Profile menu item exists');
|
|
|
|
test.assertSelectorHasText('.dropdown-item.user-menu-profile', 'Your Profile',
|
2014-06-17 01:44:09 +04:00
|
|
|
'Profile menu item has correct text');
|
2014-07-02 07:44:39 +04:00
|
|
|
test.assertEquals(profileHref, '/ghost/settings/users/' + newUser.slug + '/', 'Profile href is correct');
|
2014-06-17 01:44:09 +04:00
|
|
|
|
2014-08-17 23:23:00 +04:00
|
|
|
test.assertExists('.user-menu-signout', 'Sign Out menu item exists');
|
|
|
|
test.assertSelectorHasText('.user-menu-signout', 'Sign Out', 'Signout menu item has correct text');
|
2014-07-30 00:49:26 +04:00
|
|
|
test.assertEquals(signoutHref, '/ghost/signout/', 'Sign Out href is correct');
|
2014-08-17 23:23:00 +04:00
|
|
|
}, casper.failOnTimeout(test, 'WaitForSelector .user-menu .dropdown failed'));
|
2014-06-17 01:44:09 +04:00
|
|
|
});
|
2014-06-28 07:50:31 +04:00
|
|
|
|
|
|
|
CasperTest.begin('Can transition to the editor and back', 6, function suite(test) {
|
|
|
|
casper.thenOpenAndWaitForPageLoad('root', function testTitleAndUrl() {
|
2014-11-25 23:56:08 +03:00
|
|
|
test.assertTitle('Content - Test Blog', 'Ghost admin has incorrect title');
|
2014-07-01 03:26:08 +04:00
|
|
|
test.assertUrlMatch(/ghost\/\d+\/$/, 'Landed on the correct URL');
|
2014-06-28 07:50:31 +04:00
|
|
|
});
|
|
|
|
|
|
|
|
casper.thenTransitionAndWaitForScreenLoad('editor', function testTransitionToEditor() {
|
2014-10-18 00:57:10 +04:00
|
|
|
test.assertUrlMatch(/ghost\/editor\//, 'Landed on the correct URL');
|
2014-06-28 07:50:31 +04:00
|
|
|
test.assertExists('.entry-markdown', 'Ghost editor is present');
|
|
|
|
test.assertExists('.entry-preview', 'Ghost preview is present');
|
|
|
|
});
|
|
|
|
|
|
|
|
casper.thenTransitionAndWaitForScreenLoad('content', function testTransitionToContent() {
|
2014-07-01 03:26:08 +04:00
|
|
|
test.assertUrlMatch(/ghost\/\d+\/$/, 'Landed on the correct URL');
|
2014-06-28 07:50:31 +04:00
|
|
|
});
|
|
|
|
});
|