mirror of
https://github.com/silverstripe/silverstripe-behat-extension
synced 2024-10-22 17:05:32 +02:00
Clean up files from assets/ after each scenario
This commit is contained in:
parent
1cd15f5429
commit
32c7cea104
@ -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
|
||||||
|
Loading…
Reference in New Issue
Block a user