mirror of
https://github.com/TryGhost/Ghost.git
synced 2025-03-11 02:12:21 -05:00
Fix-up remaining functional tests
No Issue - signup, signin and setup tests - fixup other files for code styles
This commit is contained in:
parent
ce6420818a
commit
2e5caeb9c1
13 changed files with 119 additions and 95 deletions
|
@ -8,7 +8,7 @@ var NotificationsComponent = Ember.Component.extend({
|
|||
notification.get('status') : notification.status;
|
||||
|
||||
return displayStatus === 'passive';
|
||||
}),
|
||||
})
|
||||
});
|
||||
|
||||
export default NotificationsComponent;
|
||||
|
|
|
@ -9,7 +9,7 @@
|
|||
{{/gh-dropdown-button}}
|
||||
{{#gh-dropdown tagName="div" classNames="dropdown" name="user-menu" closeOnClick="true"}}
|
||||
<ul class="dropdown-menu dropdown-triangle-top js-user-menu-dropdown-menu" role="menu" style="right:-50%;left:auto;margin-right:40px">
|
||||
<li role="presentation">{{#link-to "settings.about" classNames="dropdown-item js-nav-item" role="menuitem" tabindex="-1"}}<i class="icon-gh"></i> About Ghost{{/link-to}}</li>
|
||||
<li role="presentation">{{#link-to "settings.about" classNames="gh-nav-menu-about dropdown-item js-nav-item" role="menuitem" tabindex="-1"}}<i class="icon-gh"></i> About Ghost{{/link-to}}</li>
|
||||
<li class="divider"></li>
|
||||
<li role="presentation">{{#link-to "settings.users.user" session.user.slug classNames="dropdown-item user-menu-profile js-nav-item" role="menuitem" tabindex="-1"}}<i class="icon-user"></i> Your Profile{{/link-to}}</li>
|
||||
<li class="divider"></li>
|
||||
|
@ -26,7 +26,7 @@
|
|||
<li>{{#link-to "editor.new" classNames="gh-nav-main-editor"}}<i class="icon-pen"></i>New Post{{/link-to}}</li>
|
||||
<li>{{#link-to "posts" classNames="gh-nav-main-content"}}<i class="icon-content"></i>Content{{/link-to}}</li>
|
||||
{{!<li><a href="#"><i class="icon-user"></i>My Posts</a></li>}}
|
||||
<li>{{#link-to "settings.users" classnames="gh-nav-main-settings-users"}}<i class="icon-team"></i>Team{{/link-to}}</li>
|
||||
<li>{{#link-to "settings.users" classNames="gh-nav-main-users"}}<i class="icon-team"></i>Team{{/link-to}}</li>
|
||||
{{!<li><a href="#"><i class="icon-idea"></i>Ideas</a></li>}}
|
||||
</ul>
|
||||
<ul class="gh-nav-list gh-nav-settings">
|
||||
|
|
|
@ -8,9 +8,9 @@
|
|||
|
||||
<section class="gh-env-details">
|
||||
<ul class="gh-env-list">
|
||||
<li><strong>Version</strong> {{model.version}}</li>
|
||||
<li class="gh-env-list-version"><strong>Version</strong> {{model.version}}</li>
|
||||
<li><strong>Environment</strong> {{model.environment}}</li>
|
||||
<li><strong>Database</strong> {{model.database}}</li>
|
||||
<li class="gh-env-list-database-type"><strong>Database</strong> {{model.database}}</li>
|
||||
<li><strong>Mail</strong> {{#if model.mail}}{{model.mail}}{{else}}Native{{/if}}</li>
|
||||
</ul>
|
||||
<div class="gh-env-help">
|
||||
|
|
|
@ -38,14 +38,13 @@ var ApplicationView = Ember.View.extend({
|
|||
});
|
||||
|
||||
// #### Open and close the nav on hover
|
||||
$('.gh-nav').mouseenter(function() {
|
||||
$('.gh-nav').mouseenter(function () {
|
||||
$('.gh-nav').addClass('open');
|
||||
});
|
||||
$('.gh-main').mouseenter(function() {
|
||||
$('.gh-main').mouseenter(function () {
|
||||
$('.gh-nav').removeClass('open');
|
||||
});
|
||||
|
||||
|
||||
mobileQuery.addListener(this.get('closeGlobalMobileNavOnDesktop'));
|
||||
},
|
||||
|
||||
|
|
|
@ -80,23 +80,19 @@ screens = {
|
|||
linkSelector: 'a.post-edit',
|
||||
selector: '.entry-markdown-content .markdown-editor'
|
||||
},
|
||||
settings: {
|
||||
url: 'ghost/settings/',
|
||||
linkSelector: '.gh-nav-settings-general',
|
||||
selector: '.gh-nav-settings-general.active'
|
||||
},
|
||||
'settings.general': {
|
||||
url: 'ghost/settings/general',
|
||||
selector: '.gh-nav-settings-general.active'
|
||||
},
|
||||
'settings.about': {
|
||||
url: 'ghost/settings/about',
|
||||
selector: '.settings-nav-about.active'
|
||||
linkSelector: '.gh-nav-menu-about',
|
||||
selector: '.gh-about-header'
|
||||
},
|
||||
'settings.users': {
|
||||
url: 'ghost/settings/users',
|
||||
linkSelector: '.gh-nav-main-settings-users',
|
||||
selector: '.settings-nav-users.active'
|
||||
linkSelector: '.gh-nav-main-users',
|
||||
selector: '.gh-nav-main-users.active'
|
||||
},
|
||||
'settings.users.user': {
|
||||
url: 'ghost/settings/users/test',
|
||||
|
@ -112,6 +108,7 @@ screens = {
|
|||
// signin with authenticated user redirects to posts
|
||||
selector: '.gh-nav-main-content.active'
|
||||
},
|
||||
|
||||
signout: {
|
||||
url: 'ghost/signout/',
|
||||
linkSelector: '.user-menu-signout',
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
|
||||
/*globals CasperTest, casper, newUser */
|
||||
|
||||
CasperTest.begin('Admin navigation bar is correct', 45, function suite(test) {
|
||||
CasperTest.begin('Admin navigation bar is correct', 65, function suite(test) {
|
||||
casper.thenOpenAndWaitForPageLoad('root', function testTitleAndUrl() {
|
||||
test.assertTitle('Content - Test Blog', 'Ghost admin has incorrect title');
|
||||
test.assertUrlMatch(/ghost\/\d+\/$/, 'Landed on the correct URL');
|
||||
|
@ -13,10 +13,15 @@ CasperTest.begin('Admin navigation bar is correct', 45, function suite(test) {
|
|||
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');
|
||||
usersHref = this.getElementAttribute('.gh-nav-main-users', 'href'),
|
||||
settingsGeneralHref = this.getElementAttribute('.gh-nav-settings-general', 'href'),
|
||||
settingsNavigationHref = this.getElementAttribute('.gh-nav-settings-navigation', 'href'),
|
||||
settingsTagsHref = this.getElementAttribute('.gh-nav-settings-tags', 'href'),
|
||||
settingsCodeInjectionHref = this.getElementAttribute('.gh-nav-settings-code-injection', 'href'),
|
||||
settingsLabsHref = this.getElementAttribute('.gh-nav-settings-labs', 'href');
|
||||
|
||||
// Logo
|
||||
test.assertExists('.gh-nav-footer-sitelink', 'Ghost logo home page link exists');
|
||||
test.assertExists('.gh-nav-footer-sitelink', 'Ghost home page link exists in nav footer');
|
||||
test.assertEquals(logoHref, 'http://127.0.0.1:2369/', 'Ghost logo link href is correct');
|
||||
|
||||
// Content
|
||||
|
@ -31,11 +36,41 @@ CasperTest.begin('Admin navigation bar is correct', 45, function suite(test) {
|
|||
test.assertEquals(editorHref, '/ghost/editor/', 'Editor href is correct');
|
||||
test.assertDoesntExist('.gh-nav-main-editor.active', 'Editor nav item is not marked active');
|
||||
|
||||
// Settings
|
||||
test.assertExists('.gh-nav-settings-general', 'Settings nav item exists');
|
||||
// Users
|
||||
test.assertExists('.gh-nav-main-users', 'Users nav item exists');
|
||||
test.assertSelectorHasText('.gh-nav-main-users', 'Team', 'Users nav item has correct text');
|
||||
test.assertEquals(usersHref, '/ghost/settings/users/', 'Users href is correct');
|
||||
test.assertDoesntExist('.gh-nav-main-users.active', 'Users nav item is not marked active');
|
||||
|
||||
// Settings - General
|
||||
test.assertExists('.gh-nav-settings-general', 'Settings - General nav 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');
|
||||
|
||||
// Settings - Navigation
|
||||
test.assertExists('.gh-nav-settings-navigation', 'Settings - Navigation nav item exists');
|
||||
test.assertSelectorHasText('.gh-nav-settings-navigation', 'Navigation', 'Settings nav item has correct text');
|
||||
test.assertEquals(settingsNavigationHref, '/ghost/settings/navigation/', 'Settings Navigation href is correct');
|
||||
test.assertDoesntExist('.gh-nav-settings-navigation.active', 'Settings - Navigation nav item is marked active');
|
||||
|
||||
// Settings - Tags
|
||||
test.assertExists('.gh-nav-settings-tags', 'Settings - Tags nav item exists');
|
||||
test.assertSelectorHasText('.gh-nav-settings-tags', 'Tags', 'Settings nav item has correct text');
|
||||
test.assertEquals(settingsTagsHref, '/ghost/settings/tags/', 'Settings Navigation href is correct');
|
||||
test.assertDoesntExist('.gh-nav-settings-tags.active', 'Settings - Navigation nav item is marked active');
|
||||
|
||||
// Settings - Code Injection
|
||||
test.assertExists('.gh-nav-settings-code-injection', 'Settings - Code Injection nav item exists');
|
||||
test.assertSelectorHasText('.gh-nav-settings-code-injection', 'Code Injection', 'Settings nav item has correct text');
|
||||
test.assertEquals(settingsCodeInjectionHref, '/ghost/settings/code-injection/', 'Settings Navigation href is correct');
|
||||
test.assertDoesntExist('.gh-nav-settings-code-injection.active', 'Settings - Code Injection nav item is marked active');
|
||||
|
||||
// Settings - Labs
|
||||
test.assertExists('.gh-nav-settings-labs', 'Settings - Labs nav item exists');
|
||||
test.assertSelectorHasText('.gh-nav-settings-labs', 'Labs', 'Settings nav item has correct text');
|
||||
test.assertEquals(settingsLabsHref, '/ghost/settings/labs/', 'Settings Labs href is correct');
|
||||
test.assertDoesntExist('.gh-nav-settings-labs.active', 'Settings - Labs nav item is marked active');
|
||||
});
|
||||
|
||||
casper.then(function testHelpMenuNotVisible() {
|
||||
|
@ -110,6 +145,8 @@ CasperTest.begin('Admin navigation bar is correct', 45, function suite(test) {
|
|||
test.assertSelectorHasText('.user-menu-signout', 'Sign Out', 'Signout menu item has correct text');
|
||||
test.assertEquals(signoutHref, '/ghost/signout/', 'Sign Out href is correct');
|
||||
}, casper.failOnTimeout(test, 'WaitForSelector .user-menu .dropdown failed'));
|
||||
|
||||
// TODO Add tests to check each pane gets active class appropriately
|
||||
});
|
||||
|
||||
CasperTest.begin('Can transition to the editor and back', 6, function suite(test) {
|
||||
|
|
|
@ -42,7 +42,7 @@ CasperTest.begin('Ghost editor functions correctly', 16, function suite(test) {
|
|||
casper.sendKeys('#entry-title', testPost.title, {reset: true});
|
||||
casper.writeContentToEditor(testPost.html);
|
||||
|
||||
// TODO: Expand markdown tests to cover more markdown, and keyboard shortcuts
|
||||
// TODO: Expand markdown tests to cover more markdown, and keyboard shortcuts
|
||||
casper.waitForSelectorTextChange('.entry-preview .rendered-markdown', function onSuccess() {
|
||||
test.assertSelectorHasText(
|
||||
'.entry-preview .rendered-markdown',
|
||||
|
@ -56,7 +56,6 @@ CasperTest.begin('Ghost editor functions correctly', 16, function suite(test) {
|
|||
}, casper.failOnTimeout(test, 'markdown did not re-render'));
|
||||
});
|
||||
|
||||
|
||||
casper.thenClick('.js-publish-button');
|
||||
|
||||
casper.waitForSelector('.notification-success', function onSuccess() {
|
||||
|
@ -228,16 +227,16 @@ CasperTest.begin('Image Uploads', 23, function suite(test) {
|
|||
test.assertUrlMatch(/ghost\/editor\/\d+\/$/, 'got an id on our URL');
|
||||
}, casper.failOnTimeout(test, 'Post was not successfully created'));
|
||||
|
||||
|
||||
casper.thenTransitionAndWaitForScreenLoad('content', function canTransition() {
|
||||
test.assert(true, 'Can transition to content screen');
|
||||
test.assertUrlMatch(/ghost\/\d+\/$/, 'content transitions to correct url');
|
||||
});
|
||||
|
||||
////// Edit the draft post we just created
|
||||
//casper.thenClick('a.post-edit');
|
||||
// TODO fix this test
|
||||
// Edit the draft post we just created
|
||||
// casper.thenClick('a.post-edit');
|
||||
//
|
||||
//casper.waitForScreenLoad('editor.editing', function () {
|
||||
// casper.waitForScreenLoad('editor.editing', function () {
|
||||
// casper.writeContentToEditor('abcdefghijklmnopqrstuvwxyz');
|
||||
// casper.waitForSelectorTextChange('.entry-preview .rendered-markdown', function onSuccess() {
|
||||
// test.assertSelectorHasText(
|
||||
|
@ -247,10 +246,7 @@ CasperTest.begin('Image Uploads', 23, function suite(test) {
|
|||
// );
|
||||
// }, casper.failOnTimeout(test, 'markdown did not re-render'));
|
||||
//
|
||||
//}, casper.failOnTimeout(test, 'Editor did not load'));
|
||||
|
||||
|
||||
|
||||
// }, casper.failOnTimeout(test, 'Editor did not load'));
|
||||
});
|
||||
|
||||
CasperTest.begin('Tag editor', 7, function suite(test) {
|
||||
|
|
|
@ -27,7 +27,7 @@ CasperTest.begin('Post settings menu', 10, function suite(test) {
|
|||
casper.waitForSelector('.notification-success', function waitForSuccess() {
|
||||
test.assert(true, 'got success notification');
|
||||
test.assertSelectorHasText('.notification-success', 'Saved.');
|
||||
casper.click('.notification-success .close');
|
||||
casper.click('.gh-notification-close');
|
||||
}, function onTimeout() {
|
||||
test.assert(false, 'No success notification');
|
||||
});
|
||||
|
|
|
@ -10,29 +10,29 @@ CasperTest.begin('About screen is correct', 9, function suite(test) {
|
|||
});
|
||||
|
||||
casper.then(function testVersionNumber() {
|
||||
var versionNumber = casper.getHTML('.about-ghost-intro .version');
|
||||
var versionNumber = casper.getHTML('.gh-env-list-version');
|
||||
test.assertMatch(versionNumber, /\d+\.\d+\.\d+/, 'Version is a number'); // Tests for a pattern like 0.0.0 to v11111.3334534.2342453-beta
|
||||
});
|
||||
|
||||
casper.then(function testDatabaseType() {
|
||||
var databaseTypeText = casper.getHTML('.about-environment-database');
|
||||
var databaseTypeText = casper.getHTML('.gh-env-list-database-type');
|
||||
test.assertMatch(databaseTypeText, /sqlite3|mysql|pg/gi, 'Database is an allowed type');
|
||||
});
|
||||
|
||||
casper.waitForSelector('.top-contributors li', function testContributors() {
|
||||
var firstContribImageSrc = casper.getElementAttribute('.top-contributors li:nth-child(1) a img', 'src');
|
||||
casper.waitForSelector('.gh-contributors article', function testContributors() {
|
||||
var firstContribImageSrc = casper.getElementAttribute('.gh-contributors article:nth-child(1) a img', 'src');
|
||||
|
||||
// Check first contributor image tag is on the page
|
||||
test.assertExist('.top-contributors li:nth-child(1) img', 'First contributor image is in place');
|
||||
test.assertExist('.gh-contributors article:nth-child(1) img', 'First contributor image is in place');
|
||||
|
||||
// Check first contributor image resource exists & alt tag isnt empty
|
||||
test.assertResourceExists(firstContribImageSrc, 'First contributor image file exists');
|
||||
test.assertDoesntExist('.top-contributors li:nth-child(1) a img[alt=""]', 'First contributor image alt is not empty');
|
||||
test.assertDoesntExist('.gh-contributors article:nth-child(1) a img[alt=""]', 'First contributor image alt is not empty');
|
||||
|
||||
// Check first contributor links to GitHub
|
||||
test.assertExists('.top-contributors li:nth-child(1) a[href*="github.com"]', 'First contributor link to GitHub');
|
||||
test.assertExists('.gh-contributors article:nth-child(1) a[href*="github.com"]', 'First contributor link to GitHub');
|
||||
|
||||
// Check first contributor links to GitHub
|
||||
test.assertDoesntExist('.top-contributors li:nth-child(1) a[title=""]', 'First contributor title is not empty');
|
||||
test.assertDoesntExist('.gh-contributors article:nth-child(1) a[title=""]', 'First contributor title is not empty');
|
||||
});
|
||||
});
|
||||
|
|
|
@ -5,48 +5,43 @@
|
|||
|
||||
// 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.
|
||||
var generalTabDetector = '.settings-content form#settings-general',
|
||||
usersTabDetector = '.settings-content .settings-users';
|
||||
var generalTabDetector = '.gh-nav-settings-general.active',
|
||||
usersTabDetector = '.gh-nav-main-users';
|
||||
|
||||
CasperTest.begin('Settings screen is correct', 15, function suite(test) {
|
||||
casper.thenOpenAndWaitForPageLoad('settings', function testTitleAndUrl() {
|
||||
CasperTest.begin('Settings screen is correct', 9, function suite(test) {
|
||||
casper.thenOpenAndWaitForPageLoad('settings.general', function testTitleAndUrl() {
|
||||
test.assertTitle('Settings - General - Test Blog', 'Ghost admin has incorrect title');
|
||||
test.assertUrlMatch(/ghost\/settings\/general\/$/, 'Landed on the correct URL');
|
||||
});
|
||||
|
||||
casper.then(function testViews() {
|
||||
test.assertExists('.settings', 'Settings main view is present');
|
||||
test.assertExists('.settings-nav', 'Settings menu is present');
|
||||
test.assertExists('.settings-nav-general a', 'General link is present');
|
||||
test.assertExists('.settings-nav-users a', 'Users link is present');
|
||||
test.assertNotExists('.settings-menu-apps a', 'Apps link is present');
|
||||
test.assertExists('.settings', 'Settings main view is present');
|
||||
test.assertExists('.settings-content', 'Settings content view is present');
|
||||
test.assertExists('.js-settings-content', 'Settings content view is present');
|
||||
test.assertExists(generalTabDetector, 'Form is present');
|
||||
test.assertSelectorHasText('.page-title', 'General', 'Title is "General"');
|
||||
test.assertSelectorHasText('.view-title', 'General', 'Title is "General"');
|
||||
});
|
||||
|
||||
// TODO move users tests to a new file and make sure settings nav tests are refactored into app_test.js
|
||||
|
||||
casper.then(function testSwitchingTabs() {
|
||||
casper.thenClick('.settings-nav-users a');
|
||||
casper.thenClick('.gh-nav-main-users');
|
||||
casper.waitForSelector(usersTabDetector, function then() {
|
||||
// assert that the right menu item is active
|
||||
test.assertExists('.settings-nav-users.active a', 'Users link is active');
|
||||
test.assertDoesntExist('.settings-nav-general.active a', 'General link is not active');
|
||||
test.assertExists('.gh-nav-main-users.active', 'Users link is active');
|
||||
test.assertDoesntExist('.gh-nav-settings-general.active', 'General link is not active');
|
||||
}, casper.failOnTimeout(test, 'waitForSelector `usersTabDetector` timed out'));
|
||||
|
||||
casper.thenClick('.settings-nav-general a');
|
||||
casper.thenClick('.gh-nav-settings-general');
|
||||
casper.waitForSelector(generalTabDetector, function then() {
|
||||
// assert that the right menu item is active
|
||||
test.assertExists('.settings-nav-general.active a', 'General link is active');
|
||||
test.assertDoesntExist('.settings-nav-users.active a', 'User link is not active');
|
||||
test.assertExists('.gh-nav-settings-general.active', 'General link is active');
|
||||
test.assertDoesntExist('.gh-nav-main-users.active', 'User link is not active');
|
||||
}, casper.failOnTimeout(test, 'waitForSelector `generalTabDetector` timed out'));
|
||||
});
|
||||
});
|
||||
|
||||
// ## General settings tests
|
||||
CasperTest.begin('General settings pane is correct', 8, function suite(test) {
|
||||
CasperTest.begin('General settings pane is correct', 7, function suite(test) {
|
||||
casper.thenOpenAndWaitForPageLoad('settings.general', function testTitleAndUrl() {
|
||||
test.assertTitle('Settings - General - Test Blog', 'Ghost admin has incorrect title');
|
||||
test.assertUrlMatch(/ghost\/settings\/general\/$/, 'Landed on the correct URL');
|
||||
});
|
||||
|
||||
|
@ -91,7 +86,7 @@ CasperTest.begin('General settings pane is correct', 8, function suite(test) {
|
|||
casper.waitForSelector('header .btn-blue').then(function () {
|
||||
casper.thenClick('header .btn-blue').waitFor(function successNotification() {
|
||||
return this.evaluate(function () {
|
||||
return document.querySelectorAll('.js-bb-notification section').length > 0;
|
||||
return document.querySelectorAll('.gh-notification').length > 0;
|
||||
});
|
||||
}, function doneWaiting() {
|
||||
test.pass('Waited for notification');
|
||||
|
@ -136,11 +131,14 @@ CasperTest.begin('General settings validation is correct', 6, function suite(tes
|
|||
|
||||
casper.thenClick('.gh-notification-close');
|
||||
|
||||
// TODO move these to ember tests, note: async issues - field will be often be null without a casper.wait
|
||||
// Check postsPerPage autocorrect
|
||||
casper.fillAndSave('form#settings-general', {
|
||||
'general[postsPerPage]': 'notaninteger'
|
||||
});
|
||||
|
||||
casper.wait(2000);
|
||||
|
||||
casper.then(function checkSlugInputValue() {
|
||||
test.assertField('general[postsPerPage]', '5');
|
||||
});
|
||||
|
@ -149,11 +147,13 @@ CasperTest.begin('General settings validation is correct', 6, function suite(tes
|
|||
'general[postsPerPage]': '1001'
|
||||
});
|
||||
|
||||
casper.wait(2000);
|
||||
|
||||
casper.then(function checkSlugInputValue() {
|
||||
test.assertField('general[postsPerPage]', '5');
|
||||
});
|
||||
});
|
||||
|
||||
//
|
||||
CasperTest.begin('Users screen is correct', 9, function suite(test) {
|
||||
casper.thenOpenAndWaitForPageLoad('settings.general');
|
||||
casper.thenTransitionAndWaitForScreenLoad('settings.users', function canTransition() {
|
||||
|
@ -166,9 +166,9 @@ CasperTest.begin('Users screen is correct', 9, function suite(test) {
|
|||
test.assertSelectorHasText('.settings-users .user-list-item .name', 'Test User');
|
||||
test.assertExists('.settings-users .user-list-item .role-label.owner', 'First user has owner role displayed');
|
||||
|
||||
test.assertExists('.page-actions .btn-green', 'Add user button is on page.');
|
||||
test.assertExists('.view-actions .btn-green', 'Add user button is on page.');
|
||||
});
|
||||
casper.thenClick('.page-actions .btn-green');
|
||||
casper.thenClick('.view-actions .btn-green');
|
||||
casper.waitForOpaque('.invite-new-user .modal-content', function then() {
|
||||
test.assertEval(function testOwnerRoleNotAnOption() {
|
||||
var options = document.querySelectorAll('.invite-new-user select#new-user-role option'),
|
||||
|
@ -223,7 +223,7 @@ CasperTest.begin('Can save settings', 7, function suite(test) {
|
|||
casper.thenClick('.btn-blue');
|
||||
casper.waitFor(function successNotification() {
|
||||
return this.evaluate(function () {
|
||||
return document.querySelectorAll('.js-bb-notification section').length > 0;
|
||||
return document.querySelectorAll('.gh-notification').length > 0;
|
||||
});
|
||||
}, function doneWaiting() {
|
||||
test.pass('Waited for notification');
|
||||
|
@ -237,11 +237,11 @@ CasperTest.begin('Can save settings', 7, function suite(test) {
|
|||
test.assert(true, 'Got success notification');
|
||||
}, casper.failOnTimeout(test, 'No success notification :('));
|
||||
|
||||
casper.thenClick('.settings-nav-general a').then(function testTransitionToGeneral() {
|
||||
casper.thenClick('.gh-nav-settings-general').then(function testTransitionToGeneral() {
|
||||
casper.waitForSelector(generalTabDetector, function then() {
|
||||
casper.on('resource.requested', handleSettingsRequest);
|
||||
test.assertEval(function testGeneralIsActive() {
|
||||
return document.querySelector('.settings-nav-general').classList.contains('active');
|
||||
return document.querySelector('.gh-nav-settings-general').classList.contains('active');
|
||||
}, 'general tab is marked active');
|
||||
},
|
||||
casper.failOnTimeout(test, 'waitForSelector `usersTabDetector` timed out'));
|
||||
|
@ -249,7 +249,7 @@ CasperTest.begin('Can save settings', 7, function suite(test) {
|
|||
|
||||
casper.thenClick('.btn-blue').waitFor(function successNotification() {
|
||||
return this.evaluate(function () {
|
||||
return document.querySelectorAll('.js-bb-notification section').length > 0;
|
||||
return document.querySelectorAll('.gh-notification').length > 0;
|
||||
});
|
||||
}, function doneWaiting() {
|
||||
test.pass('Waited for notification');
|
||||
|
@ -365,7 +365,7 @@ CasperTest.begin('User settings screen validates email', 6, function suite(test)
|
|||
}, false);
|
||||
});
|
||||
|
||||
casper.thenClick('.page-actions .btn-blue');
|
||||
casper.thenClick('.view-actions .btn-blue');
|
||||
|
||||
casper.waitForResource(/users/);
|
||||
|
||||
|
@ -413,7 +413,7 @@ CasperTest.begin('Ensure user bio field length validation', 3, function suite(te
|
|||
});
|
||||
});
|
||||
|
||||
casper.thenClick('.page-actions .btn-blue');
|
||||
casper.thenClick('.view-actions .btn-blue');
|
||||
|
||||
casper.waitForSelectorTextChange('.notification-error', function onSuccess() {
|
||||
test.assertSelectorHasText('.notification-error', 'is too long');
|
||||
|
@ -432,7 +432,7 @@ CasperTest.begin('Ensure user url field validation', 3, function suite(test) {
|
|||
});
|
||||
});
|
||||
|
||||
casper.thenClick('.page-actions .btn-blue');
|
||||
casper.thenClick('.view-actions .btn-blue');
|
||||
|
||||
casper.waitForSelectorTextChange('.notification-error', function onSuccess() {
|
||||
test.assertSelectorHasText('.notification-error', 'not a valid url');
|
||||
|
@ -451,7 +451,7 @@ CasperTest.begin('Ensure user location field length validation', 3, function sui
|
|||
});
|
||||
});
|
||||
|
||||
casper.thenClick('.page-actions .btn-blue');
|
||||
casper.thenClick('.view-actions .btn-blue');
|
||||
|
||||
casper.waitForSelectorTextChange('.notification-error', function onSuccess() {
|
||||
test.assertSelectorHasText('.notification-error', 'is too long');
|
||||
|
|
|
@ -16,7 +16,7 @@ CasperTest.begin('Ghost admin will load login page', 4, function suite(test) {
|
|||
|
||||
casper.echoConcise('Text' + text);
|
||||
test.assertExists('.forgotten-link');
|
||||
test.assertEqual(text, 'Forgotten password?');
|
||||
test.assertEqual(text, 'Forgot?');
|
||||
});
|
||||
});
|
||||
}, true);
|
||||
|
@ -59,7 +59,7 @@ CasperTest.begin('Login limit is in place', 4, function suite(test) {
|
|||
});
|
||||
}, true);
|
||||
|
||||
CasperTest.begin('Can login to Ghost', 5, function suite(test) {
|
||||
CasperTest.begin('Can login to Ghost', 4, function suite(test) {
|
||||
CasperTest.Routines.signout.run(test);
|
||||
|
||||
casper.thenOpenAndWaitForPageLoad('signin', function testTitleAndUrl() {
|
||||
|
@ -75,14 +75,13 @@ CasperTest.begin('Can login to Ghost', 5, function suite(test) {
|
|||
|
||||
casper.waitForResource(/posts/, function testForDashboard() {
|
||||
test.assertUrlMatch(/ghost\/\d+\/$/, 'Landed on the correct URL');
|
||||
test.assertExists('.global-nav', 'Global admin header is present');
|
||||
test.assertExists('.manage', 'We\'re now on content');
|
||||
test.assertExists('.gh-nav-main-content.active', 'Now we are on Content');
|
||||
}, function onTimeOut() {
|
||||
test.fail('Failed to signin');
|
||||
});
|
||||
}, true);
|
||||
|
||||
CasperTest.begin('Authenticated user is redirected', 8, function suite(test) {
|
||||
CasperTest.begin('Authenticated user is redirected', 6, function suite(test) {
|
||||
CasperTest.Routines.signout.run(test);
|
||||
|
||||
casper.thenOpenAndWaitForPageLoad('signin', function testTitleAndUrl() {
|
||||
|
@ -90,7 +89,8 @@ CasperTest.begin('Authenticated user is redirected', 8, function suite(test) {
|
|||
test.assertUrlMatch(/ghost\/signin\/$/, 'Landed on the correct URL');
|
||||
});
|
||||
|
||||
casper.waitForOpaque('.gh-signin', function then() {
|
||||
casper.waitForOpaque('' +
|
||||
'.gh-signin', function then() {
|
||||
this.fillAndSave('#login', user);
|
||||
});
|
||||
|
||||
|
@ -98,16 +98,14 @@ CasperTest.begin('Authenticated user is redirected', 8, function suite(test) {
|
|||
|
||||
casper.waitForResource(/posts/, function testForDashboard() {
|
||||
test.assertUrlMatch(/ghost\/\d+\/$/, 'Landed on the correct URL');
|
||||
test.assertExists('.global-nav', 'Global admin header is present');
|
||||
test.assertExists('.manage', 'We\'re now on content');
|
||||
test.assertExists('.gh-nav-main-content.active', 'Now we are on Content');
|
||||
}, function onTimeOut() {
|
||||
test.fail('Failed to signin');
|
||||
});
|
||||
|
||||
casper.thenOpenAndWaitForPageLoad('signin-authenticated', function testTitleAndUrl() {
|
||||
test.assertUrlMatch(/ghost\/\d+\/$/, 'Landed on the correct URL');
|
||||
test.assertExists('.global-nav', 'Global admin header is present');
|
||||
test.assertExists('.manage', 'We\'re now on content');
|
||||
test.assertExists('.gh-nav-main-content.active', 'Now we are on Content');
|
||||
}, function onTimeOut() {
|
||||
test.fail('Failed to redirect');
|
||||
});
|
||||
|
@ -121,9 +119,9 @@ CasperTest.begin('Ensure email field form validation', 3, function suite(test) {
|
|||
test.assertUrlMatch(/ghost\/signin\/$/, 'Landed on the correct URL');
|
||||
});
|
||||
|
||||
casper.waitForOpaque('.js-login-box',
|
||||
casper.waitForOpaque('.gh-signin',
|
||||
function then() {
|
||||
this.fillAndSave('form.login-form', {
|
||||
this.fillAndSave('form.gh-signin', {
|
||||
identification: 'notanemail'
|
||||
});
|
||||
},
|
||||
|
|
|
@ -11,9 +11,9 @@ CasperTest.begin('Ghost signout works correctly', 3, function suite(test) {
|
|||
test.assertUrlMatch(/ghost\/\d+\/$/, 'Landed on the correct URL without signing in');
|
||||
});
|
||||
|
||||
casper.thenClick('.user-menu .nav-label').waitFor(function checkOpaque() {
|
||||
casper.thenClick('.gh-nav-menu').waitFor(function checkOpaque() {
|
||||
return this.evaluate(function () {
|
||||
var menu = document.querySelector('.user-menu .dropdown.open');
|
||||
var menu = document.querySelector('.gh-nav-menu.open');
|
||||
return window.getComputedStyle(menu).getPropertyValue('display') === 'block' &&
|
||||
window.getComputedStyle(menu).getPropertyValue('opacity') === '1';
|
||||
});
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
|
||||
/*global CasperTest, casper, email, user, password */
|
||||
|
||||
CasperTest.begin('Ghost setup fails properly', 6, function suite(test) {
|
||||
CasperTest.begin('Ghost setup fails properly', 5, function suite(test) {
|
||||
casper.thenOpenAndWaitForPageLoad('setup', function then() {
|
||||
test.assertUrlMatch(/ghost\/setup\/$/, 'Landed on the correct URL');
|
||||
});
|
||||
|
@ -29,20 +29,19 @@ CasperTest.begin('Ghost setup fails properly', 6, function suite(test) {
|
|||
|
||||
casper.waitForResource(/\d+/, function testForDashboard() {
|
||||
test.assertUrlMatch(/ghost\/\d+\/$/, 'Landed on the correct URL');
|
||||
test.assertExists('.global-nav', 'Global admin header is present');
|
||||
test.assertExists('.manage', 'We\'re now on content');
|
||||
test.assertExists('.gh-nav-main-content.active', 'Now we are on Content');
|
||||
}, function onTimeOut() {
|
||||
test.fail('Failed to signin');
|
||||
}, 20000);
|
||||
}, true);
|
||||
|
||||
CasperTest.begin('Authenticated user is redirected', 8, function suite(test) {
|
||||
CasperTest.begin('Authenticated user is redirected', 6, function suite(test) {
|
||||
casper.thenOpenAndWaitForPageLoad('signin', function testTitleAndUrl() {
|
||||
test.assertTitle('Sign In - ghost', 'Ghost admin has incorrect title');
|
||||
test.assertUrlMatch(/ghost\/signin\/$/, 'Landed on the correct URL');
|
||||
});
|
||||
|
||||
casper.waitForOpaque('.login-box', function then() {
|
||||
casper.waitForOpaque('.gh-signin', function then() {
|
||||
this.fillAndSave('#login', user);
|
||||
});
|
||||
|
||||
|
@ -50,16 +49,14 @@ CasperTest.begin('Authenticated user is redirected', 8, function suite(test) {
|
|||
|
||||
casper.waitForResource(/\d+/, function testForDashboard() {
|
||||
test.assertUrlMatch(/ghost\/\d+\/$/, 'Landed on the correct URL');
|
||||
test.assertExists('.global-nav', 'Global admin header is present');
|
||||
test.assertExists('.manage', 'We\'re now on content');
|
||||
test.assertExists('.gh-nav-main-content.active', 'Now we are on Content');
|
||||
}, function onTimeOut() {
|
||||
test.fail('Failed to signin');
|
||||
});
|
||||
|
||||
casper.thenOpenAndWaitForPageLoad('setup-authenticated', function testTitleAndUrl() {
|
||||
test.assertUrlMatch(/ghost\/\d+\/$/, 'Landed on the correct URL');
|
||||
test.assertExists('.global-nav', 'Global admin header is present');
|
||||
test.assertExists('.manage', 'We\'re now on content');
|
||||
test.assertExists('.gh-nav-main-content.active', 'Now we are on Content');
|
||||
}, function onTimeOut() {
|
||||
test.fail('Failed to redirect');
|
||||
});
|
||||
|
|
Loading…
Add table
Reference in a new issue