Wallogit.com
2017 © Pedro Peláez
Visual regression tests integrated in Codeception
Visual regression tests integrated in Codeception., (*1)
This module can be used to compare the current representation of a website element with an expected. It was written on the shoulders of codeception and integrates in a very easy way., (*3)
Example, (*4)
, (*5)
VisualCeption uses a combination of the "make a screenshot" feature in webdriver, imagick and jquery to compare visual elements on a website. This comparison is done in five steps:, (*6)
VisualCeption needs the following components to run:, (*7)
Add the module to _bootstrap.php., (*8)
include_once "/path/to/module/VisualCeption.php";
include_once "/path/to/module/ImageDeviationException.php";, (*9)
To use the VisualCeption module you have to configure it., (*10)
Example Configuration, (*11)
modules:
enabled:
- WebDriver:
url: http://localhost.com
browser: firefox
- VisualCeption:
referenceImageDir: /home/codeception/referenceImages/ # Path to the reference folder (optional, standard is
# <datadir>/VisualCeption/)
maximumDeviation: 5 # deviation in percent
saveCurrentImageIfFailure: true # if true, VisualCeption saves the current
VisualCeption is really easy to use. There are only two methods that will be added to $I seeVisualChanges and dontSeeVisualChanges., (*12)
$I->seeVisualChanges( "uniqueIdentifier1", "elementId1" );
$I->dontSeeVisualChanges( "uniqueIdentifier2", "elementId2" );
$I->dontSeeVisualChanges( "uniqueIdentifier3", "elementId3" [, array("excludeElement1", "excludeElement2")] );
Example Usage, (*13)
$I->seeVisualChanges( "subNavigation", "#subNav" );
$I->dontSeeVisualChanges("content", "div.content", array("#intro"));
If you need more information about the test run please use the command line debug option (-d)., (*14)
VisualCeption uses the WebDriver module for making the screenshots. As a consequence we are not able to take screenshots via google chrome as the chromedriver does not allow full page screenshots., (*15)