mirror of
https://github.com/TryGhost/Ghost.git
synced 2025-01-13 22:41:32 -05:00
parent
fdd7354e6f
commit
50d4f02388
3 changed files with 11 additions and 12 deletions
|
@ -347,23 +347,23 @@ CasperTest = (function () {
|
|||
});
|
||||
|
||||
// Wrapper around `casper.test.begin`
|
||||
function begin(testName, expect, suite, doNotAutoLogin) {
|
||||
function begin(testName, expect, suite, doNotAutoLogin, doNotRunSetup) {
|
||||
_beforeDoneHandler = _noop;
|
||||
|
||||
var runTest = function (test) {
|
||||
test.filename = testName.toLowerCase().replace(/ /g, '-').concat('.png');
|
||||
|
||||
casper.start('about:blank').viewport(1280, 1024);
|
||||
// Only call register once for the lifetime of CasperTest
|
||||
if (!_isUserRegistered && !doNotRunSetup) {
|
||||
CasperTest.Routines.signout.run();
|
||||
CasperTest.Routines.setup.run();
|
||||
CasperTest.Routines.signout.run();
|
||||
|
||||
_isUserRegistered = true;
|
||||
}
|
||||
|
||||
if (!doNotAutoLogin) {
|
||||
// Only call register once for the lifetime of CasperTest
|
||||
if (!_isUserRegistered) {
|
||||
CasperTest.Routines.signout.run();
|
||||
CasperTest.Routines.setup.run();
|
||||
|
||||
_isUserRegistered = true;
|
||||
}
|
||||
|
||||
/* Ensure we're logged out at the start of every test or we may get
|
||||
unexpected failures. */
|
||||
CasperTest.Routines.signout.run();
|
||||
|
|
|
@ -22,7 +22,6 @@ CasperTest.begin('Ghost admin will load login page', 4, function suite(test) {
|
|||
}, true);
|
||||
|
||||
// Note, this test applies to a global redirect, which sends us to the standard admin.
|
||||
// Once Ember becomes the standard admin, this test should still pass.
|
||||
CasperTest.begin('Redirects login to signin', 2, function suite(test) {
|
||||
CasperTest.Routines.signout.run(test);
|
||||
casper.start(url + 'ghost/login/', function testRedirect(response) {
|
||||
|
|
|
@ -64,7 +64,7 @@ CasperTest.begin('Ghost setup fails properly', 10, function suite(test) {
|
|||
}, function onTimeout() {
|
||||
test.assert(false, 'No error notification after invite.');
|
||||
});
|
||||
}, true);
|
||||
}, true, true);
|
||||
|
||||
CasperTest.begin('Authenticated user is redirected', 6, function suite(test) {
|
||||
casper.thenOpenAndWaitForPageLoad('signin', function testTitleAndUrl() {
|
||||
|
@ -91,4 +91,4 @@ CasperTest.begin('Authenticated user is redirected', 6, function suite(test) {
|
|||
}, function onTimeOut() {
|
||||
test.fail('Failed to redirect');
|
||||
});
|
||||
}, true);
|
||||
}, true, true);
|
||||
|
|
Loading…
Reference in a new issue