Created
September 11, 2014 16:29
-
-
Save evan-007/c9e78a02434874c88761 to your computer and use it in GitHub Desktop.
protractor scoping
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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