Skip to content

Add support to provide more information for UnexpectedPageException #596

@leonard84

Description

@leonard84

Currently we only get the class name of the unexpected page as information,e.g.:
geb.error.UnexpectedPageException: An unexpected page com.acme.errors.ErrorPage was encountered when trying to find page match (given potentials: [class com.acme.HomePage, class com.acme.LoginPage])

In some instance it would be helpful to have the option to include additional information here.
I propose adding a new interface UnexpectedPage that has the method String getUnexpectedPageMessage() (feel free to use a better name) which is called after the page matches the at-checker. The String would then be included in the UnexpectedPageException message. Alternatively geb.Page could be extended with this method and provide a default implementation that returns null/"".

I know that there is the PageEventListener, but I think that this use-case still has merits, especially since you can't modify the exception message.

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions