Skip to content

Instantly share code, notes, and snippets.

@benheymink
Last active August 29, 2015 14:13
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save benheymink/eaa09f5c83e36e196e11 to your computer and use it in GitHub Desktop.
Save benheymink/eaa09f5c83e36e196e11 to your computer and use it in GitHub Desktop.
Fixed test spec
it('Should display the right number of elements on the page', function(){
// myExpectedObjects is an array of items i'm expecting to be
// drawn on the page
var allPromises = myExpectedObjects.map(function(myObject){
return element(by.id(myObject.id)).isPresent();
});
// Wait until all locators have been executed
protractor.promise.all(allPromises).then(function(presentValues){
for(var i = 0; i < presentValues.length; i++){
if(!presentValues[i]){
console.log('Whoops, looks like ' + myExpectedObjects[i].name + ' isn\'t on the page!!');
}
expect(presentValues[i]).toBeTruthy();
}
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment