Skip to content

Commit

Permalink
Merge pull request #45 from Telefonica/feature/magick
Browse files Browse the repository at this point in the history
Feature/magick
  • Loading branch information
rgonalo authored Nov 18, 2016
2 parents 199ed1f + 032ee28 commit d7e86f8
Show file tree
Hide file tree
Showing 6 changed files with 21 additions and 8 deletions.
3 changes: 2 additions & 1 deletion CHANGELOG.rst
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,14 @@ Toolium Changelog
v1.1.3
------

*In development*
*Release date: 2016-11-18*

- Video download works in Selenium Grid 3
- New config property 'binary' in [Firefox] section to configure the firefox binary path
- Allow to configure visual baseline directory in ConfigFiles class (default: output/visualtests/baseline)
- Delete IE and Edge cookies after tests
- Fix wait_until_element_visible and wait_until_element_not_visible methods when the page element has a parent element
- Add *imagemagick* as visual engine to have better diff images

v1.1.2
------
Expand Down
3 changes: 1 addition & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@ REQ = requirements.txt

TESTREQ = requirements_dev.txt

UNIT_TEST_ARGS=--nocapture --with-xunit --xunit-file=$(ROOT)/dist/nosetest.xml
COVERAGE_ARGS=--with-coverage --cover-erase --cover-package=$(APP) \
--cover-branches --cover-xml \
--cover-xml-file=$(ROOT)/dist/coverage.xml
Expand Down Expand Up @@ -100,7 +99,7 @@ $(VENV): $(REQ) $(TESTREQ)
$@/$(BIN)/pip install --upgrade -r $(TESTREQ); \

unittest: init venv
$(VENV)/$(BIN)/nosetests $(UNIT_TEST_ARGS)
$(PYTHON_EXE) setup.py test

coverage: init venv
$(VENV)/$(BIN)/nosetests $(COVERAGE_ARGS) $(UNIT_TEST_ARGS)
Expand Down
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
1.1.2
1.1.3
9 changes: 8 additions & 1 deletion docs/visual_testing.rst
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,14 @@ baseline_name

engine
~~~~~~
| Needle can compare images using different libraries (or engines) underneath. Currently, it supports Pillow and PerceptualDiff.
| Needle can compare images using different libraries (or engines) underneath. Currently, it supports Pillow, PerceptualDiff and ImageMagick.
- *pil*: uses Pillow to compare images. It's the default option and it's installed as a Toolium dependency.
- *perceptualdiff*: uses `PerceptualDiff <http://pdiff.sourceforge.net>`_ to compare images. It is a faster library and besides generates a diff image, highlighting the differences between the baseline image and the new screenshot. It requires to be installed separately and depends on your host.
- *imagemagick*: uses `ImageMagick <http://www.imagemagick.org>`_ to compare images. It also generates a diff image, highlighting the differences in a more visual way than perceptualdiff. It requires to be installed separately and depends on your host.

To use *imagemagick*, the master version of needle must be installed:

.. code-block:: console
pip install git+https://github.com/bfirsh/needle.git@master#egg=needle
1 change: 1 addition & 0 deletions toolium/test/test_visual_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,7 @@ def test_engine_perceptual(driver_wrapper):
assert isinstance(visual.engine, PerceptualEngine)


# Disabled until needle 0.4 is released
# def test_engine_magick(driver_wrapper):
# driver_wrapper.config.set('VisualTests', 'engine', 'imagemagick')
# visual = VisualTest(driver_wrapper)
Expand Down
11 changes: 8 additions & 3 deletions toolium/visual_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,9 @@

try:
from needle.engines.perceptualdiff_engine import Engine as PerceptualEngine
# from needle.engines.imagemagick_engine import Engine as MagickEngine
from needle.engines.pil_engine import Engine as PilEngine
from PIL import Image
from needle.engines.imagemagick_engine import Engine as MagickEngine
except ImportError:
pass

Expand Down Expand Up @@ -77,8 +77,13 @@ def __init__(self, driver_wrapper=None, force=False):
engine_type = self.driver_wrapper.config.get_optional('VisualTests', 'engine', 'pil')
if engine_type == 'perceptualdiff':
self.engine = PerceptualEngine()
# elif engine_type == 'imagemagick':
# self.engine = MagickEngine()
elif engine_type == 'imagemagick':
if 'MagickEngine' not in globals():
self.logger.warn("Engine '{}' not found, using pil instead. It should be installed "
"the master version of needle, not the 0.3.".format(engine_type))
self.engine = PilEngine()
else:
self.engine = MagickEngine()
elif engine_type == 'pil':
self.engine = PilEngine()
else:
Expand Down

0 comments on commit d7e86f8

Please sign in to comment.