How to test for CiviCRM status messages in selenium?
So one possibility is to use Selenium2TestCase as your base class for you test...

I've been using Selenium Standalone Server 3.3 (looks like 3.4 just released)
http://www.seleniumhq.org/download/

So its a little different that SeleniumTestCase, because Selenium 2 uses the WebDriver, and support for firefox may require you install the third party gecko drivers, there's a chrome driver there too that works really well.

So I have a test class that extends Selenium2TestCase , and added this helper function:

/**
   * Utility function to wait for an element to be displayed
   *
   * @param $elementCssPath
   * @param $timeout
   * @return \PHPUnit_Extensions_Selenium2TestCase_Element
   * @throws Exception
   */
  public function findElementWaitUntilDisplay($elementCssPath, $timeout){
    $this-&gt;waitUntil(function() use($elementCssPath){
      if ($element = $this-&gt;byCssSelector($elementCssPath)) {
        if($element-&gt;displayed()) {
          return true;
        }
        else {
          return null;
        }
      }
      return null;
    }, $timeout);
    try{
      $element = $this-&gt;byCssSelector($elementCssPath);
      return $element;
    }
    catch(Exception $e){
      throw $e;
    }
  }


So then you may have a test use it like so:

testStatusMessageDisplayed() {
  $status_message_element = $this-&gt;findElementWaitUntilDisplay('whatever-your-css-selector-is', 5000); //wait 5s for status message to appear
  $this-&gt;assertEquals('expected text', $status_message_element-&gt;text());
}


This helper function has been coming in handy, whether I am waiting for a page to load, or an ajax request, or some javascript rewrite the dom.