1

Test:

  1. Send keys to a text box --> use sendKeys

  2. Verify that no error message is seen --> use EC.invisibility or not of isDisplayed

We have a bug in our system and displays the error message, though input text is right. However above test succeeds because Angular took few additional microseconds to display error message, but in the meantime protractor already verified no error message.

To get away from it, I added browser.sleep between steps 1 and 2, but that is not a good way. Is there a better approach for it?

suresh
  • 254
  • 5
  • 9
  • See [this question](https://stackoverflow.com/questions/45584840/what-is-the-difference-between-browser-sleep-and-browser-wait-methods) for an explanation of an alternative to `browser.sleep()` – brae Aug 28 '18 at 18:06
  • If there's an response returned by api endpoint, you can use library like `request` and verify the response. https://www.npmjs.com/package/request – Kacper Aug 28 '18 at 18:22
  • @Kacper - this is mostly front end logic. Also our backend is mostly mocked. In our tests we just make sure front end works well given an api response. – suresh Aug 28 '18 at 20:31
  • @brae - well, using browser.wait() is not an alternative. Initially there is no error message, after I put something in text box - "error message" is not seen immediately. So, browser.wait() for invisibility is good and marks test as successful. However, there is bug and the error message shows up after about a second. – suresh Aug 28 '18 at 20:32
  • So maybe you should check visibility (using ExpectedConditions and wait) of an error and if it occurs throw an error and fail the test? – Kacper Aug 29 '18 at 06:49

0 Answers0