Skip to content

Instantly share code, notes, and snippets.

@evan-007
Created September 11, 2014 16:29
Show Gist options
  • Save evan-007/c9e78a02434874c88761 to your computer and use it in GitHub Desktop.
Save evan-007/c9e78a02434874c88761 to your computer and use it in GitHub Desktop.
protractor scoping
var helper = require('../helpers/signinHelper')
describe('Adding friends', function(){
beforeEach(function(){
helper.login();
})
afterEach(function(){
browser.manage().deleteAllCookies();
});
//better way to make this available in all `it` blocks?
var saveThisUsername;
it('users can make friend requests', function(){
//do some stuff
//set saveThisUserName to use it later
saveThisUsername = firstUser;
//expect some stuff
})
it('added users appear on pending friends list', function(){
//do stuff
//use saveThisUsername from previous spec in `expect`
allPending = element.all(by.repeater('friend in friends'))
allPending.last().then(function(elem){
elem.findElement(by.binding('friend.username')).then(function(nameElem){
expect(nameElem.getText()).toBe(saveThisUsername)
})
})
})
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment