Skip to content

Instantly share code, notes, and snippets.

@generalredneck
Forked from anonymous/gist:3305293
Created August 9, 2012 15:56
Show Gist options
  • Save generalredneck/3305394 to your computer and use it in GitHub Desktop.
Save generalredneck/3305394 to your computer and use it in GitHub Desktop.
function waitForMail($subject) {
$lastExceptionMessage = '';
for ($second = 0; ; $second+=2) {
if ($second > 45) {
$this->fail(
"WaitFor timeout. \n"
. "Last exception message: \n" . $lastExceptionMessage
);
}
$this->clickAndWait('link=Search');
$this->type('css=input[name=what]', $users[$i]->email);
$this->select('css=select[name=where]', 'To');
$this->clickAndWait('css=input[type=submit][value=Search]');
try {
$this->assertElementPresent("xpath=(//a[contains(@title, '$subject')])[last()]");
return;
}
catch (Exception $e) {
$this->clickAndWait('link=INBOX');
$lastExceptionMessage = $e->getMessage();
}
sleep(2);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment