0
Fork 0
mirror of https://github.com/TryGhost/Ghost.git synced 2025-02-10 23:36:14 -05:00

Merge pull request #4579 from PaulAdamDavis/about-tests

About Page Tests
This commit is contained in:
Hannah Wolfe 2014-12-05 17:03:17 +00:00
commit aca7577b60
3 changed files with 45 additions and 1 deletions

View file

@ -23,7 +23,7 @@
<dt>Environment:</dt>
<dd class="about-environment-detail">{{environment}}</dd>
<dt>Database:</dt>
<dd class="about-environment-detail">{{database}}</dd>
<dd class="about-environment-detail about-environment-database">{{database}}</dd>
<dt>Mail:</dt>
<dd class="about-environment-detail">{{#if mail}}{{mail}}{{else}}Native{{/if}}</dd>
</dl>

View file

@ -84,6 +84,10 @@ screens = {
url: 'ghost/settings/general',
selector: '.settings-nav-general.active'
},
'settings.about': {
url: 'ghost/settings/about',
selector: '.settings-nav-about.active'
},
'settings.users': {
url: 'ghost/settings/users',
linkSelector: '.settings-nav-users a',

View file

@ -0,0 +1,40 @@
// # About Test
// Test the various parts of the About page
/*globals CasperTest, casper */
CasperTest.begin('About screen is correct', 10, function suite(test) {
casper.thenOpenAndWaitForPageLoad('settings.about', function testTitleAndUrl() {
test.assertTitle('Settings - About - Test Blog', 'Ghost admin has incorrect title');
test.assertUrlMatch(/ghost\/settings\/about\/$/, 'Landed on the correct URL');
});
casper.then(function testVersionNumber() {
var versionNumber = casper.getHTML('.about-ghost-intro .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');
test.assertMatch(databaseTypeText, /sqlite3|mysql|pg/gi, 'Database is an allowed type');
});
casper.then(function testContributors() {
var firstContribImageSrc = casper.getElementAttribute('.top-contributors li:nth-child(1) a img', 'src');
test.assertElementCount('.top-contributors li', 20, '20 contributors are shown');
// Check first contributor image tag is on the page
test.assertExist('.top-contributors li: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');
// Check first contributor links to GitHub
test.assertExists('.top-contributors li: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');
});
});