1 new commit in galaxy-central: https://bitbucket.org/galaxy/galaxy-central/commits/3cdd4aae8403/ Changeset: 3cdd4aae8403 User: carlfeberhard Date: 2014-01-08 19:34:43 Summary: Functional browser tests: update/fix login tests Affected #: 2 files diff -r 725010d022f3dae2400fab9d009b3d65af70f440 -r 3cdd4aae8403e76df8e0ac1efa621ad9b8889039 test/casperjs/login-tests.js --- a/test/casperjs/login-tests.js +++ b/test/casperjs/login-tests.js @@ -39,7 +39,7 @@ password = spaceghost.fixtureData.testUser.password; } -var userEmailSelector = '//a[contains(text(),"Logged in as")]/span["id=#user-email"]'; +var userEmailSelector = '//a[contains(text(),"Logged in as")]'; // =================================================================== TESTS // register a user (again...) @@ -53,9 +53,11 @@ this.test.comment( 'logging out: ' + email ); spaceghost.user.logout(); }); -spaceghost.then( function(){ - this.test.assertSelectorDoesntHaveText( xpath( userEmailSelector ), /\w/ ); - this.test.assert( spaceghost.user.loggedInAs() === '', 'loggedInAs() is empty string' ); +spaceghost.thenOpen( spaceghost.baseUrl, function(){ + spaceghost.waitForMasthead( function() { + this.test.assertDoesntExist( xpath( userEmailSelector ) ); + this.test.assert( spaceghost.user.loggedInAs() === '', 'loggedInAs() is empty string' ); + }); }); // log them back in - check for email in logged in text diff -r 725010d022f3dae2400fab9d009b3d65af70f440 -r 3cdd4aae8403e76df8e0ac1efa621ad9b8889039 test/casperjs/modules/user.js --- a/test/casperjs/modules/user.js +++ b/test/casperjs/modules/user.js @@ -81,7 +81,6 @@ spaceghost.thenOpen( spaceghost.baseUrl, function(){ spaceghost.waitForMasthead( function() { - spaceghost.clickLabel( spaceghost.data.labels.masthead.menus.user ); spaceghost.clickLabel( spaceghost.data.labels.masthead.userMenu.login ); spaceghost.withMainPanel( function mainBeforeLogin(){ @@ -162,7 +161,7 @@ try { var emailSelector = xpath( spaceghost.data.selectors.masthead.userMenu.userEmail_xpath ), loggedInInfo = spaceghost.elementInfoOrNull( emailSelector ); - if( loggedInInfo ){ + if( loggedInInfo !== null ){ userEmail = loggedInInfo.text.replace( 'Logged in as ', '' ); } } catch( err ){ @@ -177,13 +176,13 @@ */ User.prototype.logout = function logout(){ var spaceghost = this.spaceghost; - if( !this.loggedInAs() ){ return spaceghost; } spaceghost.thenOpen( spaceghost.baseUrl, function(){ this.info( 'user logging out' ); - //TODO: handle already logged out spaceghost.waitForMasthead( function _logout() { - spaceghost.clickLabel( spaceghost.data.labels.masthead.menus.user ); - spaceghost.clickLabel( spaceghost.data.labels.masthead.userMenu.logout ); + if( spaceghost.user.loggedInAs() ){ + spaceghost.clickLabel( spaceghost.data.labels.masthead.menus.user ); + spaceghost.clickLabel( spaceghost.data.labels.masthead.userMenu.logout ); + } }); }); return spaceghost; Repository URL: https://bitbucket.org/galaxy/galaxy-central/ -- This is a commit notification from bitbucket.org. You are receiving this because you have the service enabled, addressing the recipient of this email.