-
Notifications
You must be signed in to change notification settings - Fork 74
Description
Sometimes, in the course of Robotic events, a page object method needs to return None
. We currently require that all keywords return either self
, an instance of another page class, or, at least, some value other than None
. This is so that page object authors are consciously deciding whether their keyword switches to a new page. This causes a problem, though, when the actual return value of a getter needs to be None
, which is sometimes the case. This exception often gets in the way of debugging other problems in a test, forcing knowledge of this requirement on test authors.
After discussion with @hellmanj, we decided that this is likely more common than the problem we are trying to prevent: namely, you use a keyword that should take you to a new page, but the page object author forgot to return that page, and so you get the old page's version of the keyword instead of the new one. (This only happens if two pages define the same keyword that does slightly different things. Otherwise, you'll just get a message saying the keyword you tried to use couldn't be found.)
Therefore, we should take out the code (https://github.com/ncbi/robotframework-pageobjects/blob/master/robotpageobjects/page.py#L53, https://github.com/ncbi/robotframework-pageobjects/blob/master/robotpageobjects/page.py#L294) that requires returning a page object.
@hellmanj also suggests augmenting the exception that tells you that a keyword couldn't be found, with something reminding you that you need to return a page object from each keyword that takes you to a new page.