|
7 jaren geleden | |
---|---|---|
.. | ||
module | 7 jaren geleden | |
test | 7 jaren geleden | |
.gitignore | 7 jaren geleden | |
.travis.yml | 7 jaren geleden | |
CHANGELOG.md | 7 jaren geleden | |
LICENCE | 7 jaren geleden | |
composer.json | 7 jaren geleden | |
readme.md | 7 jaren geleden |
Visual regression tests for Codeception.
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.
WARNING This module can reduce the execution speed of acceptance tests. Use it only for visual regression test suite and not for regular end to end testing.
Example
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:
VisualCeption needs the following components to run:
Make sure you have php-imagick extension installed. Run php -m
to see if imagick extension is enabled.
Then add VisualCeption to composer.json:
composer require "codeception/visualception:*" --dev
To use the VisualCeption module you have to configure it.
Example Configuration
modules:
enabled:
- WebDriver:
url: http://localhost.com
browser: firefox
- VisualCeption:
maximumDeviation: 5 # deviation in percent
saveCurrentImageIfFailure: true # if true, VisualCeption saves the current
tests/_output
. Default: 'debug/visual/'tests/_output/vcresult.html
. Default: falseVisualCeption is really easy to use. There are only two methods that will be added to $I seeVisualChanges
and dontSeeVisualChanges
.
$I->seeVisualChanges( "uniqueIdentifier1", "elementId1" );
$I->dontSeeVisualChanges( "uniqueIdentifier2", "elementId2" );
$I->dontSeeVisualChanges( "uniqueIdentifier3", "elementId3" [, array("excludeElement1", "excludeElement2")] );
Example Usage
$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).
Enable Reports in config and use nice HTML output to see all failed visual tests with thair image diffs on a page:
modules:
enabled:
- WebDriver:
url: http://localhost.com
browser: firefox
- VisualCeption:
report: true
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.