2014-06-16 16:44:09 -05:00
|
|
|
// # Signout Test
|
|
|
|
// Test that signout works correctly
|
|
|
|
|
2014-06-24 06:17:40 -05:00
|
|
|
/*globals CasperTest, casper */
|
2014-06-26 08:06:38 -05:00
|
|
|
CasperTest.begin('Ghost signout works correctly', 4, function suite(test) {
|
|
|
|
CasperTest.Routines.setup.run(test);
|
|
|
|
CasperTest.Routines.signout.run(test);
|
|
|
|
CasperTest.Routines.signin.run(test);
|
2014-06-16 16:44:09 -05:00
|
|
|
|
|
|
|
casper.thenOpenAndWaitForPageLoad('root', function then() {
|
2014-06-24 06:17:40 -05:00
|
|
|
test.assertTitle('Ghost Admin', 'Ghost admin has no title');
|
2014-06-16 16:44:09 -05:00
|
|
|
test.assertUrlMatch(/ghost\/ember\/\d+\/$/, 'Landed on the correct URL without signing in');
|
|
|
|
});
|
|
|
|
|
|
|
|
casper.thenClick('#usermenu a').waitFor(function checkOpaque() {
|
|
|
|
return this.evaluate(function () {
|
|
|
|
var menu = document.querySelector('#usermenu .overlay.open');
|
2014-06-24 06:17:40 -05:00
|
|
|
return window.getComputedStyle(menu).getPropertyValue('display') === 'block' &&
|
|
|
|
window.getComputedStyle(menu).getPropertyValue('opacity') === '1';
|
2014-06-16 16:44:09 -05:00
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
casper.captureScreenshot('user-menu-open.png');
|
|
|
|
|
|
|
|
casper.waitForSelector('.usermenu-signout a');
|
|
|
|
casper.thenClick('.usermenu-signout a');
|
|
|
|
|
|
|
|
casper.waitForSelector('#login').then(function assertSuccess() {
|
|
|
|
test.assert(true, 'Got login screen');
|
|
|
|
});
|
|
|
|
|
|
|
|
casper.captureScreenshot('user-menu-logout-clicked.png');
|
|
|
|
|
|
|
|
casper.waitForSelector('.notification-success', function onSuccess() {
|
|
|
|
test.assert(true, 'Got success notification');
|
|
|
|
}, function onTimeout() {
|
|
|
|
test.assert(false, 'No success notification :(');
|
|
|
|
});
|
|
|
|
}, true);
|