mirror of
https://github.com/TryGhost/Ghost.git
synced 2024-12-15 11:34:24 +03:00
962accfec7
issue #2989 - Adds lodash for bind and isNumber - looking for a better solution for this - Still needs the editor and flow tests porting - Some of the tests are commented out awaiting further implementations
39 lines
1.5 KiB
JavaScript
39 lines
1.5 KiB
JavaScript
// # Signout Test
|
|
// Test that signout works correctly
|
|
|
|
/*globals casper, __utils__, url, testPost, falseUser, email */
|
|
CasperTest.emberBegin("Ghost signout works correctly", 4, function suite(test) {
|
|
CasperTest.Routines.register.run(test);
|
|
CasperTest.Routines.logout.run(test);
|
|
CasperTest.Routines.login.run(test);
|
|
|
|
casper.thenOpenAndWaitForPageLoad('root', function then() {
|
|
test.assertTitle("Ghost Admin", "Ghost admin has no title");
|
|
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');
|
|
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');
|
|
|
|
casper.waitForSelector('.notification-success', function onSuccess() {
|
|
test.assert(true, 'Got success notification');
|
|
}, function onTimeout() {
|
|
test.assert(false, 'No success notification :(');
|
|
});
|
|
}, true); |