Great work, I really appreciate it!
I've been using the tool for the past 2 months and I'm very satisfied.
I've added a couple of extra features / small fixes and I want to make them public, maybe there are others that might find them useful.
Changes:
Feature files can now be filtered based on content
My story: I've created a @smoke tag and used it only for some scenarios. There were files which contained no such tag, therefore on execution an error would have been thrown (that no scenario was found). Now the list of .feature files displays only the files containing @smoke tag. This is just an example, you can use any text as filter.
behatYmlFile: specify behat.yml file other than default (--config)
profile: specify a profile parameter for behat command line (--profile)
tags: specify a tag parameter for behat command line (--tags)
fileFilter: specify a filter for feature files (explained above)
Example of usage:
$app->createProject('INT: [Smoke - Chrome]', '/var/www/bros')
->setBehatYmlFile('behat_Chrome.yml')
// behat --profile int
->setProfile('int')
->setTags('@smoke')
// filter .feature files that contain @smoke tag
// (otherwise behat raises error that no scenario was found)
->setFileFilter('@smoke');
Insert screenshots into output window
My story: after each step, if an error occurs I capture a screenshot of the browser and I print a message with the path:
/**
* Capture screenshot after a step has failed (valid only for webdriver)
*
* @AfterStep
* @param AfterStepScope $scope
*/
public function afterStep(AfterStepScope $scope)
{
if (99 === $scope->getTestResult()->getResultCode())
{
$this->takeScreenshot();
}
}
/**
* Capture screenshot of the browser opened by Selenium
*/
private function takeScreenshot()
{
$driver = $this->getSession()->getDriver();
if ($driver instanceof Selenium2Driver)
{
$fileName = date('Y-m-d_H-i-s') . '_' . uniqid() . '.png';
$filePath = getcwd() . DIRECTORY_SEPARATOR . 'screenshots';
// create folder if not already existing
if (!file_exists($filePath))
{
mkdir($filePath, 0777, true);
}
$this->saveScreenshot($fileName, $filePath);
print('Screenshot at: ' . $filePath . DIRECTORY_SEPARATOR . $fileName);
}
}
Now the text displayed in the output window is parsed and if such messages are found, they are replaced with the actual images so they can be seen directly
(tested on Windows and Mac OS X)
Hello,
Great work, I really appreciate it! I've been using the tool for the past 2 months and I'm very satisfied. I've added a couple of extra features / small fixes and I want to make them public, maybe there are others that might find them useful.
Changes:
Feature files can now be filtered based on content
My story: I've created a @smoke tag and used it only for some scenarios. There were files which contained no such tag, therefore on execution an error would have been thrown (that no scenario was found). Now the list of .feature files displays only the files containing @smoke tag. This is just an example, you can use any text as filter.
Example of usage:
Added new project properties (optional):
Example of usage:
Insert screenshots into output window
My story: after each step, if an error occurs I capture a screenshot of the browser and I print a message with the path:
Now the text displayed in the output window is parsed and if such messages are found, they are replaced with the actual images so they can be seen directly (tested on Windows and Mac OS X)
Fixes: