Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
expected behavior of Browser.at(Page) (quoting the docs):
Browser.at(Page)
If implicit assertions are enabled (which they are by default). This method will only ever return a page instance or throw an AssertionError
void method calls in an at-checker do not get ast transformed, i.e. no assert(...): https://github.com/geb/geb/blob/v1.0/module/geb-implicit-assertions/src/main/groovy/geb/transform/implicitassertions/ImplicitAssertionsTransformationVisitor.groovy#L255
void
now, if a static at-checker has a void method call as last BinaryExpression, that is cast to boolean, returning false (the void method call does not get ast transformed): https://github.com/geb/geb/blob/v1.0/module/geb-core/src/main/groovy/geb/Page.groovy#L228
BinaryExpression
boolean
false
that false is mapped to null and returned by Browser.doAt(Page): https://github.com/geb/geb/blob/v1.0/module/geb-core/src/main/groovy/geb/Browser.groovy#L459
Browser.doAt(Page)
so we get no AssertionError, no Exception, just null. current Browser.page does not change.
AssertionError
Exception
null
Browser.page
n.b. possible workaround is a simple true as last statement in the static at-checker.
true
The text was updated successfully, but these errors were encountered:
Thanks for such detailed explanation of what the problem is, @zyro23. It is a bit of an edge case but it indeed does what the docs say it wouldn't do so it's clearly a bug and needs fixing.
Sorry, something went wrong.
geb/geb@5f04ffc
erdi
No branches or pull requests
expected behavior of
Browser.at(Page)
(quoting the docs):void
method calls in an at-checker do not get ast transformed, i.e. no assert(...):https://github.com/geb/geb/blob/v1.0/module/geb-implicit-assertions/src/main/groovy/geb/transform/implicitassertions/ImplicitAssertionsTransformationVisitor.groovy#L255
now, if a static at-checker has a
void
method call as lastBinaryExpression
, that is cast toboolean
, returningfalse
(the void method call does not get ast transformed):https://github.com/geb/geb/blob/v1.0/module/geb-core/src/main/groovy/geb/Page.groovy#L228
that
false
is mapped to null and returned byBrowser.doAt(Page)
:https://github.com/geb/geb/blob/v1.0/module/geb-core/src/main/groovy/geb/Browser.groovy#L459
so we get no
AssertionError
, noException
, justnull
. currentBrowser.page
does not change.n.b. possible workaround is a simple
true
as last statement in the static at-checker.The text was updated successfully, but these errors were encountered: