diff --git a/CHANGELOG.rst b/CHANGELOG.rst index 8ed859a1..65bdba0e 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -6,6 +6,7 @@ v2.2.2 *Release date: In development* +- Add missing param in download_videos method to fix error downloading videos from a remote server - Add map_param function to dataset module - New param [RANDOM_PHONE_NUMBER] in *replace_param* method to generate random phone number diff --git a/docs/visual_testing.rst b/docs/visual_testing.rst index e044ac1b..b148f6d0 100644 --- a/docs/visual_testing.rst +++ b/docs/visual_testing.rst @@ -93,7 +93,45 @@ or How to configure it? -------------------- -Toolium properties related to Visual Testing are stored in properties.cfg :: +Baseline folder +~~~~~~~~~~~~~~~ + +The baseline folder must contain the images that will be used as reference in visual testing asserts. Besides, when +configuring `save: true`, the screenshots will be saved there. + +The baseline folder by default is `output/visualtests/baseline`, but it can be changed through a system property, as +can be seen in the following example: + +.. code:: console + + $ export TOOLIUM_VISUAL_BASELINE_DIRECTORY=resources/baseline + +When using behave, it can also be configured in `before_all` method: + +.. code:: python + + from toolium.behave.environment import before_all as toolium_before_all + + def before_all(context): + context.config_files = ConfigFiles() + context.config_files.set_visual_baseline_directory('resources/baseline') + toolium_before_all(context) + +When using nose, it can also be configured in `setUp` method: + +.. code:: python + + from toolium import test_cases + + class SeleniumTestCase(test_cases.SeleniumTestCase): + def setUp(self): + self.config_files.set_visual_baseline_directory('resources/baseline') + super(SeleniumTestCase, self).setUp() + +Visual Testing properties +~~~~~~~~~~~~~~~~~~~~~~~~~ + +Toolium properties related to Visual Testing are stored in properties.cfg as :: [VisualTests] enabled: true @@ -103,28 +141,23 @@ Toolium properties related to Visual Testing are stored in properties.cfg :: baseline_name: {Driver_type} engine: pil -enabled -~~~~~~~ +**enabled** | *true*: visual testing is enabled, screenshots are captured and compared | *false*: visual testing is disabled, no screenshots are captured -fail -~~~~ +**fail** | *true*: if a visual assertion fails, the test fails | *false*: although a visual assertion fails, the test passes -save -~~~~ +**save** | *true*: baseline images will be overwritten with new screenshots | *false*: screenshots will be compared with already saved baseline images -complete_report -~~~~~~~~~~~~~~~ +**complete_report** | *true*: html report will contain failed and passed visual assertions | *false*: html report will only contain failed visual assertions -baseline_name -~~~~~~~~~~~~~ +**baseline_name** | It contains the name of the images base to compare current execution screenshots with, and it might depends on the browser, the mobile device or resolution used in the execution. | The easiest way of generating a custom name per environment is to use the values of other configuration properties. To access a property value use the following format: {SectionName_optionName}. | Some examples of baseline_name values are: @@ -136,8 +169,7 @@ baseline_name - *{Version}*: baseline_name will take the value of version capability, although it is not configured - *{RemoteNode}*: baseline_name will take the value of the remote node name -engine -~~~~~~ +**engine** | 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. diff --git a/toolium/driver_wrappers_pool.py b/toolium/driver_wrappers_pool.py index 0fc0ffe6..f28199b5 100644 --- a/toolium/driver_wrappers_pool.py +++ b/toolium/driver_wrappers_pool.py @@ -190,7 +190,8 @@ def download_videos(cls, name, test_passed=True, maintain_default=False): # Download video if necessary (error case or enabled video) if (not test_passed or driver_wrapper.config.getboolean_optional('Server', 'video_enabled', False)) \ and driver_wrapper.remote_node_video_enabled: - driver_wrapper.utils.download_remote_video(video_name.format(name, driver_index)) + driver_wrapper.utils.download_remote_video(driver_wrapper.server_type, + video_name.format(name, driver_index)) except Exception as exc: # Capture exceptions to avoid errors in teardown method due to session timeouts driver_wrapper.logger.warning('Error downloading videos: %s' % exc)