Hi Brian, The error you're seeing is very interesting - it means that the elements that are reported on are removed from DOM between the comparison fails and the values of elements of the comparison are being printed. If they were removed before the comparison happened then you would get a StaleElementReferenceException instead of the exception being part of the comparison failure message. That's quite an edge case, but I've seen similar things in the past.
Anyway, the action that you are executing just before the assertion you shared happens has to trigger asynchronous removal of some DOM elements that are evaluated in that assertion. What is happening before this statement is being executed? Are you using some js framework intended for building single page apps like Angular, Ember or React? If that is the case then you will have to add an waitFor() call which will enable you to wait for the page state to stabilise before moving on with performing your assertion. Marcin On Wed, Aug 10, 2016 at 10:53 AM, Brian Westrich <[email protected]> wrote: > Hello Geb users! > > I'm really enjoying using Geb for testing, and especially appreciate the > informative error messages that Geb/Spock gives when tests fail. > > Today we came across a possible exception to this rule. We found that if a > date comparison fails, the actual date value is not displayed, instead we > get a StaleElementReference exception as shown below..... > > labRequest[0].dateField == requestDate > | | | | | > | | | | 2016-03-02T00:00 > | | | false > | | geb.content.SimplePageContent@a4f7aef (renderer threw > StaleElementReferenceException) > | gov.bhnrc.modules.LabAnalysisRequestRow@2d4bfa3f (renderer > threw StaleElementReferenceException) > java.util.ArrayList@7fc57d59 (renderer threw GroovyRuntimeException) > > We define the date field in the Page Object as follows: > > dateField { $("div span input[name=dateSent]") } > > > and then do the comparison as follows: > > def requestDate = '2016-03-02T00:00' > > ... > > labRequest[0].dateField == requestDate > > > If the values of the two dates match, the test passes, but if they differ > then the above exception occurs. > > I did a brief search through the recent mailing list archives, but didn't > see anything mentioned similar to this. > > Has anyone else run across this? > > -- Brian > > > -- > 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/99732e0a-fda7-43dd-8523-be93e37d73f5%40googlegroups.com > <https://groups.google.com/d/msgid/geb-user/99732e0a-fda7-43dd-8523-be93e37d73f5%40googlegroups.com?utm_medium=email&utm_source=footer> > . > For more options, visit https://groups.google.com/d/optout. > -- 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/CA%2B52dQTVHj4aJsZfxzAxkOH%3Dkucgrb_EXVh7Y9Ej1Lxv_0Cczw%40mail.gmail.com. For more options, visit https://groups.google.com/d/optout.
