Last active
August 29, 2015 14:13
-
-
Save benheymink/eaa09f5c83e36e196e11 to your computer and use it in GitHub Desktop.
Fixed test spec
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
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