mirror of
https://github.com/TryGhost/Ghost.git
synced 2025-02-17 23:44:39 -05:00
Merge pull request #5559 from halfdan/fix/5536
Fix signin test (run setup properly)
This commit is contained in:
commit
ca6a381dc2
3 changed files with 11 additions and 12 deletions
|
@ -347,23 +347,23 @@ CasperTest = (function () {
|
||||||
});
|
});
|
||||||
|
|
||||||
// Wrapper around `casper.test.begin`
|
// Wrapper around `casper.test.begin`
|
||||||
function begin(testName, expect, suite, doNotAutoLogin) {
|
function begin(testName, expect, suite, doNotAutoLogin, doNotRunSetup) {
|
||||||
_beforeDoneHandler = _noop;
|
_beforeDoneHandler = _noop;
|
||||||
|
|
||||||
var runTest = function (test) {
|
var runTest = function (test) {
|
||||||
test.filename = testName.toLowerCase().replace(/ /g, '-').concat('.png');
|
test.filename = testName.toLowerCase().replace(/ /g, '-').concat('.png');
|
||||||
|
|
||||||
casper.start('about:blank').viewport(1280, 1024);
|
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) {
|
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
|
/* Ensure we're logged out at the start of every test or we may get
|
||||||
unexpected failures. */
|
unexpected failures. */
|
||||||
CasperTest.Routines.signout.run();
|
CasperTest.Routines.signout.run();
|
||||||
|
|
|
@ -22,7 +22,6 @@ CasperTest.begin('Ghost admin will load login page', 4, function suite(test) {
|
||||||
}, true);
|
}, true);
|
||||||
|
|
||||||
// Note, this test applies to a global redirect, which sends us to the standard admin.
|
// 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.begin('Redirects login to signin', 2, function suite(test) {
|
||||||
CasperTest.Routines.signout.run(test);
|
CasperTest.Routines.signout.run(test);
|
||||||
casper.start(url + 'ghost/login/', function testRedirect(response) {
|
casper.start(url + 'ghost/login/', function testRedirect(response) {
|
||||||
|
|
|
@ -64,7 +64,7 @@ CasperTest.begin('Ghost setup fails properly', 10, function suite(test) {
|
||||||
}, function onTimeout() {
|
}, function onTimeout() {
|
||||||
test.assert(false, 'No error notification after invite.');
|
test.assert(false, 'No error notification after invite.');
|
||||||
});
|
});
|
||||||
}, true);
|
}, true, true);
|
||||||
|
|
||||||
CasperTest.begin('Authenticated user is redirected', 6, function suite(test) {
|
CasperTest.begin('Authenticated user is redirected', 6, function suite(test) {
|
||||||
casper.thenOpenAndWaitForPageLoad('signin', function testTitleAndUrl() {
|
casper.thenOpenAndWaitForPageLoad('signin', function testTitleAndUrl() {
|
||||||
|
@ -91,4 +91,4 @@ CasperTest.begin('Authenticated user is redirected', 6, function suite(test) {
|
||||||
}, function onTimeOut() {
|
}, function onTimeOut() {
|
||||||
test.fail('Failed to redirect');
|
test.fail('Failed to redirect');
|
||||||
});
|
});
|
||||||
}, true);
|
}, true, true);
|
||||||
|
|
Loading…
Add table
Reference in a new issue