Ghost/core/test/functional/client/signout_test.js
Hannah Wolfe 962accfec7 Functional tests for Ember
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
2014-06-20 15:20:59 +01:00

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);