Brian,
You are right that the expected value is listed in the debug output.
What's curious is that, when the comparison (between actual and
expected values) fails, I only see the expected value if I use a
waitFor() as suggested by Marcin. If I don't use waitFor(), I instead
get a StaleElementReferenceException and the expected value isn't
shown (though, as noted previously, if the comparison succeeds, the
waitFor isn't needed for the test to pass).
Another curiousity: If I pass in a smaller value for the timeout (say
1 second), geb still shows the expected value on failure, but I don't
have to wait the default duration of 30 seconds. Instead, Geb shows
the expected value after only 1 second of waiting:
waitFor(1) {
labRequest[0].dateField == requestDate
}
Output:
condition did not pass in 1.0 seconds (failed with exception)
geb.waiting.WaitTimeoutException: ......
...
Caused by: Assertion failed:
labRequest[0].dateField == requestDate
| | | | |
| | | | 2016-03-02T00:00
| | | false
| | dateField - SimplePageContent (owner: labRequest -
LabAnalysisRequestRow (owner: ProjectDetailPage, args: [], value:
null), args: [], value: 2016-02-03T00:00)
| labRequest - LabAnalysisRequestRow (owner:
ProjectDetailPage, args: [], value: null)
[labRequest - LabAnalysisRequestRow (owner: ProjectDetailPage, args:
[], value: null)]
So it looks like, in this case, some waiting period is needed before
geb is able to fully report test error information, but not for geb to
process a successful comparison.
Incidentally, I thought this behavior might only be occurring for date
fields, but have verified it occurs for other types of fields as well
(e.g. string).
Brian W.
On Thu, Aug 18, 2016 at 1:41 PM, Brian Kotek <[email protected]> wrote:
> Isn't the answer right there in the debug output? The value of dateField is
> "2016-02-03T00:00" but the value of requestDate is "2016-03-02T00:00". They
> aren't equal, so the assertion failure is correct.
>
--
You received this message because you are subscribed to the Google Groups "Geb
User Mailing List" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/geb-user/CAMvxi929qMA-5ERFoOXH4BTiHU7eQe_wQJPJc0aEEhDYzbZz8A%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.