Skip to content

provide more accurate accounting of selenium failures #9

@MarcelWilson

Description

@MarcelWilson

While updating tests for the latest changes to my current project I realized the errors appearing in the log weren't adequate enough for me to realize why the test had failed.

By all accounts the way this logs it is easy to assume that the element in question is missing.

11:53:53  INFO Admin sees if the logo is clickable.
11:53:53  INFO     Admin inspects the logo.
11:53:53  INFO     ... hoping it's clickable
11:53:53  INFO         => False
11:53:53  INFO     ***ERROR***

AssertionError: 
Expected: the element is enabled/clickable
     but: was not even present

Technically speaking, it couldn't be found because the target was incorrect. The TargetingError raised in Element is simply caught and the log never reflects the reason why it is not present.

It would be nice to show the selenium exception that caused the test to fail:
no such element: Unable to locate element: {"method":"xpath","selector":"//li[@data-testid=side-nav-logo-expanded]"}

Something like:

AssertionError: 
Expected: the element is enabled/clickable
     but: Unable to locate element: {"method":"xpath","selector":"//li[@data-testid=side-nav-logo-expanded]"}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions