MDL-42625 behat: Make behat pacient

* When looking for texts inside the page or inside
  other containers we should wait until the elements
  are visible.
* Same when expanding tree nodes
* Normalizing loops to spin() function using
  behat_base::TIMEOUT and behat_base::EXTENDED_TIMEOUT,
  leaving TIMEOUT for DOM load processes and
  EXTENDED_TIMEOUT for long processes that involves JS
  too.