Skip to content

Commit c0f3383

Browse files
Nils LangnerNils Langner
Nils Langner
authored and
Nils Langner
committed
fixed test
1 parent a581d71 commit c0f3383

File tree

4 files changed

+11
-13
lines changed

4 files changed

+11
-13
lines changed

module/ImageDeviationException.php

-6
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,4 @@
11
<?php
2-
/**
3-
* Created by PhpStorm.
4-
* User: langn
5-
* Date: 14.10.14
6-
* Time: 13:25
7-
*/
82

93
namespace Codeception\Module;
104

module/VisualCeption.php

+8
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,10 @@ public function seeVisualChanges($identifier, $elementID = null, $excludeElement
7575
$deviationResult = $this->getDeviation($identifier, $elementID, $excludeElements);
7676

7777
if (!is_null($deviationResult["deviationImage"])) {
78+
79+
// used for assertion counter in codeception / phpunit
80+
$this->assertTrue(true);
81+
7882
if ($deviationResult["deviation"] <= $this->maximumDeviation) {
7983
$compareScreenshotPath = $this->getDeviationScreenshotPath($identifier);
8084
$deviationResult["deviationImage"]->writeImage($compareScreenshotPath);
@@ -107,6 +111,10 @@ public function dontSeeVisualChanges($identifier, $elementID = null, $excludeEle
107111
$deviationResult = $this->getDeviation($identifier, $elementID, $excludeElements);
108112

109113
if (!is_null($deviationResult["deviationImage"])) {
114+
115+
// used for assertion counter in codeception / phpunit
116+
$this->assertTrue(true);
117+
110118
if ($deviationResult["deviation"] > $this->maximumDeviation) {
111119
$compareScreenshotPath = $this->getDeviationScreenshotPath($identifier);
112120
$deviationResult["deviationImage"]->writeImage($compareScreenshotPath);

test/integration/tests/acceptance.suite.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -24,4 +24,4 @@ modules:
2424
webStorageEnabled: true
2525
VisualCeption:
2626
maximumDeviation: 0
27-
saveCurrentImageIfFailure: true
27+
saveCurrentImageIfFailure: true

test/integration/tests/acceptance/WriteCurrentImageCest.php

+2-6
Original file line numberDiff line numberDiff line change
@@ -27,13 +27,9 @@ public function writeCurrentImageFile(WebGuy $I, $scenario)
2727
{
2828
$currentImagePath = $exception->getCurrentImage();
2929

30-
if (is_file( $currentImagePath )) {
31-
return true;
30+
if (!is_file( $exception->getCurrentImage() )) {
31+
throw new \PHPUnit_Framework_ExpectationFailedException("The screenshot was not saved successfully.");
3232
}
33-
34-
// @TODO: complete the test, if current.* image is written
35-
$scenario->incomplete();
36-
throw $exception;
3733
}
3834
}
3935
}

0 commit comments

Comments
 (0)