Skip to content

Commit 3e110e3

Browse files
committed
Raise "VisualException" for visual diff assertion failures
1 parent c2f6b03 commit 3e110e3

File tree

2 files changed

+10
-4
lines changed

2 files changed

+10
-4
lines changed

seleniumbase/common/exceptions.py

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,25 +4,29 @@
44
OutOfScopeException => Used by BaseCase methods when setUp() is skipped.
55
TextNotVisibleException => Called when expected text fails to appear.
66
TimeLimitExceededException => Called when exceeding "--time-limit=SECONDS".
7+
VisualException => Called when there's a Visual Diff Assertion Failure.
78
"""
8-
from selenium.common.exceptions import WebDriverException
99

1010

1111
class NoSuchFileException(Exception):
1212
pass
1313

1414

15-
class NotUsingChromeException(WebDriverException):
15+
class NotUsingChromeException(Exception):
1616
pass
1717

1818

1919
class OutOfScopeException(Exception):
2020
pass
2121

2222

23-
class TextNotVisibleException(WebDriverException):
23+
class TextNotVisibleException(Exception):
2424
pass
2525

2626

2727
class TimeLimitExceededException(Exception):
2828
pass
29+
30+
31+
class VisualException(Exception):
32+
pass

seleniumbase/fixtures/base_case.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11330,7 +11330,9 @@ def __assert_eq(self, *args, **kwargs):
1133011330
elif line.strip().startswith("*"):
1133111331
minified_exception += line + "\n"
1133211332
if minified_exception:
11333-
raise Exception(minified_exception)
11333+
from seleniumbase.common.exceptions import VisualException
11334+
11335+
raise VisualException(minified_exception)
1133411336

1133511337
def __process_visual_baseline_logs(self):
1133611338
"""Save copies of baseline PNGs in "./latest_logs" during failures.

0 commit comments

Comments
 (0)