From bc49251e9a3e6179709496544d16f4a66c21b09e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rub=C3=A9n=20Gonz=C3=A1lez=20Alonso?= Date: Thu, 17 Nov 2016 19:20:47 +0100 Subject: [PATCH 1/2] Add imagemagick as visual engine --- CHANGELOG.rst | 1 + Makefile | 3 +-- docs/visual_testing.rst | 9 ++++++++- toolium/test/test_visual_test.py | 1 + toolium/visual_test.py | 11 ++++++++--- 5 files changed, 19 insertions(+), 6 deletions(-) diff --git a/CHANGELOG.rst b/CHANGELOG.rst index d35b4ee4..88afff28 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -11,6 +11,7 @@ v1.1.3 - 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 ------ diff --git a/Makefile b/Makefile index c932d39a..0b8003d1 100644 --- a/Makefile +++ b/Makefile @@ -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 @@ -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) diff --git a/docs/visual_testing.rst b/docs/visual_testing.rst index 0ed372ef..a907df7e 100644 --- a/docs/visual_testing.rst +++ b/docs/visual_testing.rst @@ -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 `_ 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 `_ 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 diff --git a/toolium/test/test_visual_test.py b/toolium/test/test_visual_test.py index deadf8d7..4fa6fae0 100644 --- a/toolium/test/test_visual_test.py +++ b/toolium/test/test_visual_test.py @@ -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) diff --git a/toolium/visual_test.py b/toolium/visual_test.py index d899574c..77198143 100644 --- a/toolium/visual_test.py +++ b/toolium/visual_test.py @@ -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 @@ -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: From 032ee28052ab7ded112d84250bb6a83c8cac2abf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rub=C3=A9n=20Gonz=C3=A1lez=20Alonso?= Date: Thu, 17 Nov 2016 19:26:03 +0100 Subject: [PATCH 2/2] Release Toolium 1.1.3 --- CHANGELOG.rst | 2 +- VERSION | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.rst b/CHANGELOG.rst index 88afff28..c18b710a 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -4,7 +4,7 @@ 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 diff --git a/VERSION b/VERSION index 45a1b3f4..781dcb07 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -1.1.2 +1.1.3