title: Check if image is valid and loaded with Protractor
body: <p>I am writing tests using Protractor (with Cucumber.js, Chai and Chai As Promised, though I think these details don't matter). I would like to write a test that checks whether an image element is valid and loaded - i.e. that it has a <code>src</code> attribute and has not errored out while loading.</p>
  
  <p>There are some <a href="https://stackoverflow.com/q/1977871/1709587">nice-looking answers</a> elsewhere to the question of how to check if an image is loaded from within a browser, via the DOM API. But how can I cleanly perform this check using Protractor's API?</p>
  
  <p>I expect my test will look something like:</p>
  
  <pre><code>this.Then(/^I should see the "([^"]*)" image$/, function (imageId, callback) {
      expect(
          element(by.id(imageId))
      ).to.eventually.satisfy(isImageOk).notify(callback);
  });
  </code></pre>
  
  <p>but I don't know how to implement the <code>isImageOk</code> function via the Protractor API.</p>