Hi all,

I'm wondering how other people deal with the following scenario / what the 
best way for it is in Geb. 
Perhaps there exists some functionality already that I don't know of, 
perhaps more people run into this issue and we can add some functionality 
to geb.

tldr: how do you optimally deal with* !element_x.displayed* cases. 
> Especially when you prefer a wait:true for every action other than 
> !displayed on that element/content


Sample scenario
- I have a button
- For some tests I want to click that button, in general, it's nice to 
define 'wait: true' so that it waits for that button to appear before 
pressing it.
(because I won't want to describe everything in my POM or because the 
button is dynamically loaded)
- For some tests, I want to make sure that button is not displayed

Problem: 
- I don't want to wait the full default timeout duration to assess that the 
button in fact, did not show up. But I also don't want to put an arbitrary 
'2 seconds' on it either, it's also too slow and maybe on some CI tooling 
it can actually take those 2 seconds to load causing tests that randomly 
succeed or fail
- I want to make the tests as fast as possible. To do this, generally, I 
wait for some other element that should be displayed at the same time as 
the element in question, then I usually do: !*element_x.displayed *with 
wait time 0.
But: I don't want to define that (geb) content twice, once with wait: true, 
once with wait: false (or wait: 2)


Possible solutions I've thought of:
- Would be nice to be able to manually specify a specific wait time inside 
the tests when using a geb module's content. 
So f.e.: for that element, when declaring it in its geb module's content, 
the (default) wait time is set to true. But when calling that content from 
inside the test, I can set a specific wait time of 0

- Instead of 'wait: true', I could f.e. mention an other piece of content 
as an element to wait for (instead of a time duration). I can do this when 
I know that an element is loaded at the same time as that other piece of 
content.

Example: Let's say I have button1 and button2, they're both dynamically 
loaded at the same time but button 2 should only display when the user 
.f.e. has admin rights, then I can link button2's 'waiting time' to button1.
When I do f.e. in my test:  *!button2.displayed* it can automatically wait 
for button1 to appear, then it can verify whether button2 is displayed as 
well, and, if not, automatically throw an exception

-- 
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/a219b54d-6feb-449f-b75a-ae07e5b7f7fa%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to