Clean up files from assets/ after each scenario

This commit is contained in:
Ingo Schommer 2013-10-23 20:55:17 +02:00
parent 1cd15f5429
commit 32c7cea104

View File

@ -7,6 +7,7 @@ use Behat\Behat\Context\ClosuredContextInterface,
Behat\Behat\Context\BehatContext, Behat\Behat\Context\BehatContext,
Behat\Behat\Context\Step, Behat\Behat\Context\Step,
Behat\Behat\Event\StepEvent, Behat\Behat\Event\StepEvent,
Behat\Behat\Event\ScenarioEvent,
Behat\Behat\Exception\PendingException; Behat\Behat\Exception\PendingException;
use Behat\Mink\Driver\Selenium2Driver; use Behat\Mink\Driver\Selenium2Driver;
use Behat\Gherkin\Node\PyStringNode, use Behat\Gherkin\Node\PyStringNode,
@ -196,6 +197,18 @@ JS;
} }
} }
/**
* Delete any created files and folders from assets directory
*
* @AfterScenario @assets
*/
public function cleanAssetsAfterScenario(ScenarioEvent $event)
{
foreach(\File::get() as $file) {
$file->delete();
}
}
public function takeScreenshot(StepEvent $event) { public function takeScreenshot(StepEvent $event) {
$driver = $this->getSession()->getDriver(); $driver = $this->getSession()->getDriver();
// quit silently when unsupported // quit silently when unsupported