Handle modal dialogue which will block all tests in the cms

updated as an afterScenario event
This commit is contained in:
Jeffrey Guo 2014-09-22 13:46:44 +12:00
parent 6e13a68762
commit 54eaa63845

View File

@ -222,6 +222,27 @@ JS;
} }
} }
/**
* Close modal dialog if test scenario fails on CMS page
*
* @AfterScenario
*/
public function closeModalDialog(ScenarioEvent $event) {
// Only for failed tests on CMS page
if (4 === $event->getResult()) {
$cmsElement = $this->getSession()->getPage()->find('css', '.cms');
if($cmsElement) {
try {
// Navigate away triggered by reloading the page
$this->getSession()->reload();
$this->getSession()->getDriver()->getWebDriverSession()->accept_alert();
} catch(\WebDriver\Exception $e) {
// no-op, alert might not be present
}
}
}
}
/** /**
* Delete any created files and folders from assets directory * Delete any created files and folders from assets directory
* *