Skip to content

Commit

Permalink
fix: ignore not found excluded elements in visual tests
Browse files Browse the repository at this point in the history
  • Loading branch information
rgonalo committed Mar 21, 2024
1 parent b92cb7c commit 3c850d7
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.rst
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ v3.1.4

- Add `ignore_empty` optional parameter to POEditor configuration to ignore empty translations
- Fix on swipe method. Duration from None to 0.
- Ignore not found excluded elements in visual tests

v3.1.3
------
Expand Down
8 changes: 6 additions & 2 deletions toolium/visual_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -105,9 +105,13 @@ def assert_screenshot(self, element, filename, file_suffix=None, threshold=0, ex
exclude_web_elements = []
for exclude_element in exclude_elements:
try:
exclude_web_elements.append(self.utils.get_web_element(exclude_element))
exclude_web_element = self.utils.get_web_element(exclude_element)
if exclude_web_element:
exclude_web_elements.append(exclude_web_element)
else:
self.logger.warning('Element to be excluded not found')
except NoSuchElementException as e:
self.logger.warning("Element to be excluded not found: %s", str(e))
self.logger.warning('Element to be excluded not found: {str(e)}')

baseline_path = os.path.join(self.baseline_directory, '{}.png'.format(filename))
filename_with_suffix = '{0}__{1}'.format(filename, file_suffix) if file_suffix else filename
Expand Down

0 comments on commit 3c850d7

Please sign in to comment.