commit/galaxy-central: carlfeberhard: QA: add login info to api-history-permission-tests (unable to repro failure shown on buildbot), use API to check loggedInAs
1 new commit in galaxy-central: https://bitbucket.org/galaxy/galaxy-central/commits/ffaadbe7fbc2/ Changeset: ffaadbe7fbc2 User: carlfeberhard Date: 2014-04-18 16:59:35 Summary: QA: add login info to api-history-permission-tests (unable to repro failure shown on buildbot), use API to check loggedInAs Affected #: 2 files diff -r 47860aa3f96d9d1276e08f0590506d5cf1c15fc7 -r ffaadbe7fbc29efe93b712e8ae158af28d09f4be test/casperjs/api-history-permission-tests.js --- a/test/casperjs/api-history-permission-tests.js +++ b/test/casperjs/api-history-permission-tests.js @@ -30,6 +30,7 @@ //// ------------------------------------------------------------------------------------------- create 3 histories spaceghost.user.loginOrRegisterUser( email, password ); spaceghost.thenOpen( spaceghost.baseUrl ).then( function(){ + this.test.comment( '(logged in as ' + this.user.loggedInAs() + ')' ); // create three histories: make the 2nd importable (via the API), and the third published this.test.comment( 'importable, slug, and published should all be returned by show and initially off' ); @@ -216,6 +217,7 @@ spaceghost.user.loginOrRegisterUser( email2, password2 ); spaceghost.thenOpen( spaceghost.baseUrl ).then( function(){ + this.test.comment( '(logged in as ' + this.user.loggedInAs() + ')' ); testInaccessible.call( spaceghost, inaccessibleHistory, inaccessibleHdas ); testAccessible.call( spaceghost, accessibleHistory, accessibleHdas ); testAccessible.call( spaceghost, publishedHistory, publishedHdas ); @@ -226,6 +228,7 @@ //// ------------------------------------------------------------------------------------------- user1 revoke perms spaceghost.user.loginOrRegisterUser( email, password ); spaceghost.thenOpen( spaceghost.baseUrl ).then( function(){ + this.test.comment( '(logged in as ' + this.user.loggedInAs() + ')' ); this.test.comment( 'revoking perms should prevent access' ); this.api.histories.update( accessibleHistory.id, { importable : false @@ -250,6 +253,7 @@ //// ------------------------------------------------------------------------------------------- user2 retry perms spaceghost.user.loginOrRegisterUser( email2, password2 ); spaceghost.thenOpen( spaceghost.baseUrl ).then( function(){ + this.test.comment( '(logged in as ' + this.user.loggedInAs() + ')' ); testInaccessible.call( spaceghost, accessibleHistory, accessibleHdas ); testInaccessible.call( spaceghost, publishedHistory, publishedHdas ); }); diff -r 47860aa3f96d9d1276e08f0590506d5cf1c15fc7 -r ffaadbe7fbc29efe93b712e8ae158af28d09f4be test/casperjs/modules/user.js --- a/test/casperjs/modules/user.js +++ b/test/casperjs/modules/user.js @@ -163,19 +163,24 @@ * @returns {String} email of currently logged in user or '' if no one logged in */ User.prototype.loggedInAs = function loggedInAs(){ - return this.spaceghost.jumpToTop( function(){ - var userEmail = ''; - try { - var emailSelector = xpath( this.data.selectors.masthead.userMenu.userEmail_xpath ), - loggedInInfo = this.elementInfoOrNull( emailSelector ); - if( loggedInInfo !== null ){ - userEmail = loggedInInfo.text.replace( 'Logged in as ', '' ); - } - } catch( err ){ - this.warn( err ); - } - return userEmail; - }); + var currUser = this.spaceghost.api.users.show( 'current' ); + //this.spaceghost.debug( this.spaceghost.jsonStr( currUser ) ); + return currUser.email; +//TODO: due to late rendering of masthead this is no longer reliable - need a wait for in the main page + //return this.spaceghost.jumpToTop( function(){ + // var userEmail = ''; + // try { + // var emailSelector = xpath( this.data.selectors.masthead.userMenu.userEmail_xpath ), + // loggedInInfo = this.elementInfoOrNull( emailSelector ); + // this.debug( '\n\n' + this.jsonStr( loggedInInfo ) + '\n' ); + // if( loggedInInfo !== null ){ + // userEmail = loggedInInfo.text.replace( 'Logged in as ', '' ); + // } + // } catch( err ){ + // this.warn( err ); + // } + // return userEmail; + //}); }; /** Log out the current user 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.
participants (1)
-
commits-noreply@bitbucket.org