Testing dynamically added content with Geb

471 views
Skip to first unread message

Antony Jones

unread,
Sep 26, 2015, 9:19:49 AM9/26/15
to Geb User Mailing List
Hi All,

Just thought I'd post another gist in my series of testing Asynchronous front-ends with Geb, as the last gist was far more popular than I had imagined.

The following Gist is an example of how to make assertions on content which is added to the page AFTER your initial page render. For instance an angular-bootstrap modal - it doesn't exist on the page until you trigger it, yet I have a reference to it (with required: false) in my page model. The problem is that once you fire the modal and start asserting, Geb has already decided that it doesn't exist.

Luckily, there is a way to get Geb to refresh its cache of the page once the triggering button has clicked, using the (to:) DSL functionality.

See the gist here:


Cheers,
Antony

Kito Mann

unread,
Sep 28, 2015, 11:05:38 AM9/28/15
to geb-...@googlegroups.com
Nice, Antony!

Did you ever try this?

modal(wait: true, cache: false) { $('.my-modal').module(ModalDialogModule) }

___

Kito D. Mann | @kito99 | Author, JSF in Action
Virtua, Inc. | http://www.virtua.com | JSF/Java EE training and consulting
http://www.JSFCentral.com | @jsfcentral
+1 203-998-0403

* Listen to the Enterprise Java Newscast: http://enterprisejavanews.com
* JSFCentral Interviews Podcast: http://www.jsfcentral.com/resources/jsfcentralpodcasts/
* Sign up for the JSFCentral Newsletter: http://oi.vresp.com/?fid=ac048d0e17

--
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 geb-user+u...@googlegroups.com.
To post to this group, send email to geb-...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/geb-user/e5a8374b-c7a4-4a3d-99dd-0d99ca440bcd%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Marcin Erdmann

unread,
Sep 28, 2015, 1:27:15 PM9/28/15
to geb-...@googlegroups.com
Kito, cache: false is the default, no meed to specify it explicitly. 

I met with Antony today and explained a flaw in his gist. He promised to post an update here so that everybody can benefit. I will only say that you're on the right track with using waiting on the module here, Kito.

Nicolai Negru

unread,
Jun 29, 2016, 4:12:54 AM6/29/16
to Geb User Mailing List
It looks like the updates have not been published.
Marcin, could you share your thoughts / recommended approach on above?


On Monday, 28 September 2015 18:27:15 UTC+1, Marcin Erdmann wrote:
Kito, cache: false is the default, no meed to specify it explicitly. 

I met with Antony today and explained a flaw in his gist. He promised to post an update here so that everybody can benefit. I will only say that you're on the right track with using waiting on the module here, Kito....
Reply all
Reply to author
Forward
0 new messages