Page load hangs when calling to() in setup()

20 views
Skip to first unread message

Samuel Rossinovic

unread,
Sep 11, 2017, 2:00:55 AM9/11/17
to Geb User Mailing List
The webpage I'm testing has an index page, which is the first page the user lands-on, after signing in.

I wish to set Index as an initial page for multiple test methods, so that: 
  1. tests can refer to that initial page
  2. tests don't have to explicitly navigate to that page at the start of the test.

So, I tried pulling this impl to a base class:

class MyPage extends Page {//...}
class Index extends MyPage {//...}

class MySpec extends GebReportingSpec {

 
@Shared
 
Index index

   
def setupSpec() {
        to
LoginPage
        login username
, password
   
}

   
def setup() {
        index
= at Index // begin each test method at Index
   
}
}

class FooSpec extends MySpec {
 
 
def test1() {
     
//assume we're at Index, pointed-to by index
     
// test..
 
}


 
def test1() {
     
//assume we're at Index, pointed-to by index
     
// test..
 
}
}


But...
* When MySpec.setup() calls 'at Index',on test1 is successful (as LoginPage.login() will land it on Index), but test2 fails, because test1 doesn't finish at Index.
* If I set MySpec.setup() to call 'to Index', test1 hangs until the test fails, only loading parts of the Index page (and thus failing Index's at() check).

When test1 & test2 call 'at Index'/'to Index' respectively, all's well.

How can I fix my Base spec?

Thanks!




Marcin Erdmann

unread,
Sep 11, 2017, 11:34:28 AM9/11/17
to geb-...@googlegroups.com
I do not understand why if you set MySpec.setup() to call 'to Index', test1 hangs until the test fails, only loading parts of the Index page. I would expect doing 'to Index' in setup() to resolve your issue. Can you please explain why only part of your index page is loaded in that case?

--
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/d0eb5726-7171-41b4-860d-549ba8356202%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Samuel Rossinovic

unread,
Sep 11, 2017, 8:16:56 PM9/11/17
to Geb User Mailing List
I may have worked around the problem.
When I modify MySpec to:
class MySpec extends GebReportingSpec {
 
@Shared
 
Index index

   
def setupSpec() {
        to
LoginPage
        login username
,
password
        at
Index // make sure Index is fully-loaded before continuing
   
}


   
def setup() {
   
if (!isAt(Index))
        index
= to Index // begin each test method at Index
   
}
}

test runs smoothly. 

Seems the page hangs when the client delivers a request (the one from setup()), before the the login() result page finishes loading.

Sorry for the noise,
Reply all
Reply to author
Forward
0 new messages