“to SearchPage”从“then”块调用

时间:2012-04-05 19:47:27

标签: java grails groovy spock geb

为什么下面的Geb测试失败并出现以下错误。我不能在then块中调用to SearchPage吗?

Condition not satisfied:

to SearchPage
|
null

    at test.LogoutSpec.Verify that the logout takes the user to login page(LogoutSpec.groovy:35)



def "Verify that the logout takes the user to login page"()
    {
        given: "I successfully logged in to the application"
        to LoginPage
        loginForm.with
        {
            loginClientCode = "testingclient"
            loginSystemCode = "testingsystem"
            loginUserId = "abc"
            loginPassword = "password1"
        }
        loginButton.click()

        at SearchPage
        section == "Search Applications"

        when: "I click Log Out link from user panel"
        userPanel.logOutLink.click()

        then: "I am redirected to the LoginPage"
        at LoginPage

        and: "My session is invalidated"
        //TODO how to verify this
        to SearchPage
    }

1 个答案:

答案 0 :(得分:0)

then块用于断言。如果这有帮助,您可以在当时添加另一个并将to SearchPage放在when块中。