@@ -19,6 +19,12 @@ class VisualCeption extends \Codeception\Module
1919
2020 private $ referenceImageDir ;
2121
22+ /**
23+ * This var represents the directory where the taken images are stored
24+ * @var string
25+ */
26+ private $ currentImageDir ;
27+
2228 private $ maximumDeviation = 0 ;
2329
2430 private $ webDriver = null ;
@@ -209,6 +215,12 @@ private function init()
209215 $ this ->debug ("Creating directory: $ this ->referenceImageDir " );
210216 mkdir ($ this ->referenceImageDir , 0777 , true );
211217 }
218+
219+ if (array_key_exists ('currentImageDir ' , $ this ->config )) {
220+ $ this ->currentImageDir = $ this ->config ["currentImageDir " ];
221+ }else {
222+ $ this ->currentImageDir = \Codeception \Configuration::logDir () . 'debug/tmp/ ' ;
223+ }
212224 }
213225
214226 /**
@@ -273,7 +285,7 @@ private function getScreenshotName($identifier)
273285 */
274286 private function getScreenshotPath ($ identifier )
275287 {
276- $ debugDir = \ Codeception \Configuration:: logDir () . ' debug/tmp/ ' ;
288+ $ debugDir = $ this -> currentImageDir ;
277289 if (!is_dir ($ debugDir )) {
278290 $ created = mkdir ($ debugDir , 0777 , true );
279291 if ($ created ) {
@@ -306,7 +318,12 @@ private function getExpectedScreenshotPath($identifier)
306318 */
307319 private function createScreenshot ($ identifier , array $ coords , array $ excludeElements = array ())
308320 {
309- $ screenshotPath = \Codeception \Configuration::logDir () . 'debug/ ' . "fullscreenshot.tmp.png " ;
321+ $ screenShotDir = \Codeception \Configuration::logDir () . 'debug/ ' ;
322+
323+ if ( !is_dir ($ screenShotDir )) {
324+ mkdir ($ screenShotDir , 0777 , true );
325+ }
326+ $ screenshotPath = $ screenShotDir . 'fullscreenshot.tmp.png ' ;
310327 $ elementPath = $ this ->getScreenshotPath ($ identifier );
311328
312329 $ this ->hideElementsForScreenshot ($ excludeElements );
0 commit comments