mirror of
https://github.com/TryGhost/Ghost.git
synced 2025-01-13 22:41:32 -05:00
725d4aac7d
No Issue - Move authentication related handlers to the Application route. - Switch Sign Out from a button to a link. Use the signout route to handle invalidating the session and redirecting instead of an action from a button. - Clear error messages on signin page when pressing log in button. - Errors are now always shown on sign in screen and a success notification is shown after sign out. - Update functional tests.
33 lines
1.2 KiB
JavaScript
33 lines
1.2 KiB
JavaScript
// # Signout Test
|
|
// Test that signout works correctly
|
|
|
|
/*globals CasperTest, casper */
|
|
CasperTest.begin('Ghost signout works correctly', 3, function suite(test) {
|
|
CasperTest.Routines.signout.run(test);
|
|
CasperTest.Routines.signin.run(test);
|
|
|
|
casper.thenOpenAndWaitForPageLoad('root', function then() {
|
|
test.assertTitle('Ghost Admin', 'Ghost admin has no title');
|
|
test.assertUrlMatch(/ghost\/\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');
|
|
return window.getComputedStyle(menu).getPropertyValue('display') === 'block' &&
|
|
window.getComputedStyle(menu).getPropertyValue('opacity') === '1';
|
|
});
|
|
});
|
|
|
|
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');
|
|
|
|
}, true);
|