Problem Verifying that an element does Not exist using the page object model

270 views
Skip to first unread message

Paul Sukow

unread,
Aug 11, 2016, 4:59:55 PM8/11/16
to Geb User Mailing List
Hi,

I'm working on a test for a scheduling part of our app in which I do the following steps:
1. Create a shift
2. Verify that the shift was created.
3. Delete the shift
4. Verify that the shift was deleted.

I am using the page object pattern and I have a selector in my page for the shift like:
newShift { $('.newShiftClass') }

I am able to verify when a new shift is created in my test by:
newShift != null

When I try to verify that the shift was deleted by:
newShift == null
An geb.error.RequiredPageContentNotPresent exception is thrown and the test fails.

I can, however, use the selector in my test like:
$('.newShiftClass') == null
And the test will pass and no exceptions will be thrown.


It seems to me that this might be a bug in Geb, but I'm not sure. Does anyone have any advice?

Brian Kotek

unread,
Aug 11, 2016, 7:26:32 PM8/11/16
to Geb User Mailing List
It's not a bug. You need to set required: false for the content item, because Geb defaults it to required: true. http://www.gebish.org/manual/current/#code-required-code

--
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+unsubscribe@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/54a451e1-cf93-408f-9700-007774b15f84%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply all
Reply to author
Forward
0 new messages