Skip to content

Raise a custom exception with visual diff assertion failures #1577

@mdmintz

Description

@mdmintz

Raise a custom exception with visual diff assertion failures

For visual testing, instead of raising a general Exception when a visual difference failure is detected, SeleniumBase should raise a custom VisualException to differentiate that failure apart from others. The failure output of the completed update should look something like this:

E           seleniumbase.common.exceptions.VisualException: 
E           AssertionError:
E           First differing element 39:
E           ['div', [['class', ['section', 'hidden-section', 'image-section']]]]
E           ['div', [['class', ['section', 'image-section']]]]
E           
E           -  ['div', [['class', ['section', 'hidden-section', 'image-section']]]],
E           ?                                ------------------
E           +  ['div', [['class', ['section', 'image-section']]]],
E           *
E           *** Exception: <Level 3> Visual Diff Failure:
E           * HTML tag attribute values don't match the baseline!

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions