Skip to content

Commit

Permalink
fix: add missing param to fix download_videos method (#262)
Browse files Browse the repository at this point in the history
* fix: add missing param to fix download_videos method

* fix: add doc about baseline folder
  • Loading branch information
rgonalo committed Jan 27, 2022
1 parent 6dba3c3 commit 2c08028
Show file tree
Hide file tree
Showing 3 changed files with 48 additions and 14 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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
- New param [RANDOM_PHONE_NUMBER] in *replace_param* method to generate random phone number

v2.2.1
Expand Down
58 changes: 45 additions & 13 deletions docs/visual_testing.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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:
Expand All @@ -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.
Expand Down
3 changes: 2 additions & 1 deletion toolium/driver_wrappers_pool.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit 2c08028

Please sign in to comment.