开发者

Weak failure trace when using page object pattern with spock and geb

When using spock+geb you can assert that you are on expected page by assertion e.g.:

assert title == 'Sign In'

and you get a nice failure trace if assertion fails:

Condition not satisfied:

title == 'Sign In'
|     |
Login false
      5 differences (28% similarity)
      (Lo)g(i--)n
      (Si)g(n I)n

But if I try to use page object pattern e.g.:

开发者_如何学C
class LoginPage extends GebPage {
    static at = { title == 'Sign In' }
}

Trace is not very helping what's going wrong:

Condition not satisfied:

at(LoginPage)
|
false

Is there any way how to use page object pattern and get more descriptive failure trace ?


According to geb mailing list responses the current workaround is:

static at = { assert title == 'Sign In'; true }

Thanks to David & Luke.


Offhand, I'm not sure if I have an answer to your question. I believe I had a similar question at some point, but other issues became more important after time (such as the fact that WebDriver is a POS). You won't find Stackoverflow to be much use when it comes to new & emerging libraries, such as Geb.

Your best bet is to post a message on Geb's mailing list instead. You can find it here.

Luke Daley, the creator of Geb, usually responds to messages on a daily basis & is extremely helpful. The mailing list is quite useful, even though the number of members is small at this point.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜