Wait preset and environments - change of default wait timeout ignored?

842 views
Skip to first unread message

monika.januszek

unread,
Mar 24, 2016, 10:48:29 AM3/24/16
to Geb User Mailing List
Hi, I am developing a set of automated tests that are meant to run in server environment.
To enable both running with a headless browser on the CI and 'normal' browser for debugging purposes, we have come up with following GebConfig.groovy structure:

environments {

  //prepare phantomJS config

  // ......snip

  // it is our default


  driver = {

  def phantomJsDriver = new PhantomJSDriver(phantomCaps)

  phantomJsDriver.manage().window().size = new Dimension(1680, 1050)

  phantomJsDriver

  }

  waiting {

    timeout = 10

  }

  'htmlunit' {

  //<snip>configure htmlunit

  driver = {htmlUnitDriver}

  }

  'firefox' {

  //<snip>configure firefox

  driver={new FirefoxDriver(ffCaps)}

  }

  'chrome' {

  //<snip>configure chrome

  driver ={ new ChromeDriver(chromeCaps)}

  }

  'slowServer' {

  waiting {

  timeout = 30

  }

 }

}


Now, if I explicitly set 'slowServer' as an environment, using the -Dgeb.env parameter, timeout is changed to 30 seconds as expected.

However, the now-supposedly-default timeout of 10 seconds is not observed and pages time out after 5 seconds.

This happens regardless of selected browser and I don't seem to be able to properly configure it.


What am I doing wrong?

Marcin Erdmann

unread,
Mar 28, 2016, 1:45:14 PM3/28/16
to Geb User Mailing List
Hi Monika,

Can you please explain what you mean by "However, the now-supposedly-default timeout of 10 seconds is not observed and pages time out after 5 seconds." in more detail? I'm not sure what you mean by "now-supposedly-default timeout of 10 seconds" as the default timeout in Geb is 5 seconds not 10 seconds. What do you mean by "pages time out"? I don't see any page at checking waiting configuration (http://www.gebish.org/manual/current/#at-check-waiting) in your Geb config so I don't know what you mean by pages timing out...

So, please explain in detail what you do, what you're expecting to happen and what is happening.

Cheers,
Marcin

--
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/be531e31-bb92-4362-bf8f-b6162731198b%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Monika Morawiecka

unread,
Mar 29, 2016, 6:50:51 AM3/29/16
to Geb User Mailing List
Hi,

I simply wanted to override default timeout value.

But I figured it out, instead of placing timeout configuration in environments block, I moved it out like this:

(...)
waiting { timeout = 10 }

environments{
defaultDriver={...}
'htmlunit' {...}
'firefox' {...}
'slow' {waiting { timeout = 30 }}

Now the timeout value is as expected.

As for atCheckWaiting: I am not setting it due to more complex at checks necessary, but I do use waitFor{} within at block.
As I understood, whole at checker is wrapped with atCheckWaiting, and some of the pages are loaded dynamically, so I need to verify presence of several items to confirm page is properly loaded.
Unless I'm wrong and all statements in at block get their own waitFor?

Marcin Erdmann

unread,
Mar 29, 2016, 2:48:25 PM3/29/16
to Geb User Mailing List
On Tue, Mar 29, 2016 at 11:50 AM, Monika Morawiecka <monika.m...@gmail.com> wrote:
Hi,

I simply wanted to override default timeout value.

But I figured it out, instead of placing timeout configuration in environments block, I moved it out like this:

(...)
waiting { timeout = 10 }

environments{
defaultDriver={...}
'htmlunit' {...}
'firefox' {...}
'slow' {waiting { timeout = 30 }}

Now the timeout value is as expected.

Right, I missed the fact that you had your default waiting block inside of the environments block in the snippet you included in your first email. Indeed, the defaults should live at the top level of the config script and should not be nested in the environments block.
 

As for atCheckWaiting: I am not setting it due to more complex at checks necessary, but I do use waitFor{} within at block.
As I understood, whole at checker is wrapped with atCheckWaiting, and some of the pages are loaded dynamically, so I need to verify presence of several items to confirm page is properly loaded.
Unless I'm wrong and all statements in at block get their own waitFor?

I did not suggest that you should use atCheckWaiting, I was just confused about what didn't work for you after reading your email, sorry. And yes, if you use atCheckWaiting then the whole at checker will be wrapped with a waitFor() call. 
Reply all
Reply to author
Forward
0 new messages