My test:
it(\'should allow login\', function() {
browser.get(\'index.html\');
$(\'#username\').sendKeys(\'administrator\');
$(\'#password\').sendKeys(\'pa
The safest approach I would take is depicted in the following code snippet:
it('should return true when element is present', function () {
var logout;
logout = $('#logout');
browser.driver.isElementPresent(logout).then(function (isPresent) {
isPresent = (isPresent) ? true : browser.wait(function () {
return browser.driver.isElementPresent(logout );
}, 15000); //timeout after 15s
expect(isPresent).toBeTruthy();
});
});
Above code starts of with a promise to check if an element exists, and if true then assign it true, otherwise wait and keep pooling for the next 15sec to see if element is present, and in both cases we expect it to be true.