页面组件模板'$'的'ApplicationSummaryPage'的定义无效,params必须是Closure,或Map和Closure

时间:2012-04-12 20:46:07

标签: grails groovy spock geb

下面是我的Geb页面,规格和错误。我不确定问题出在哪里和什么地方。当我从ApplicationSummaryPage中移除下面的内容时,我没有收到此错误。

ds(wait: true)
{ module DatasourceInformationRow, $("table.ic-table-creditReportProduct table tr", it) }
class ApplicationSummaryPage extends Page
{
    static url = "application-summary/application-summary.jsf"

    static at =
    { assert title == "Application Summary" }

    static content =
    {
        menu
        { module MenuModule }

        userPanel
        {module UserPanelModule }

        ds(wait: true)
        { module DatasourceInformationRow, $("table.ic-table-creditReportProduct table tr", it) }

        applicationSummaryForm
        { $("#applicationSummary_form") }

        workItemDiv
        {$("div", id: "consumerWorkItems:workItemPanel")}

        workItemsSection
        {workItemDiv.find (".ui-panel-title").text()}

        resubmitLink
        {$("a",id: "loginForm")}

        overrideDecisionLink
        {$("a",id: "loginForm")}

        addNoteLink
        {$("a",id: "loginForm")}
    }
}

规格

类SearchSpec扩展了BaseUiSpec {     def setup()     {         登录(“经理”)     }

def "cccc"()
{
    when: "I search"
    to SearchPage
    at SearchPage

    applicationid.value "10002000000010000"
    searchButton.click()
    at SearchPage

    waitFor
    { searchResultsData }

    println "------------"+ searchResults(0).ApplicationId.text()

    searchResults(0).ApplicationId.click(ApplicationSummaryPage)
    Thread.sleep 5000
    at ApplicationSummaryPage
    println "-----???"+ ds
}

}

错误

geb.waiting.WaitTimeoutException: condition did not pass in 15.0 seconds (failed with exception)
    at geb.waiting.Wait.waitFor(Wait.groovy:126)
    at geb.content.PageContentTemplate.create(PageContentTemplate.groovy:117)
    at geb.content.PageContentTemplate.get(PageContentTemplate.groovy:98)
    at geb.content.NavigableSupport.getContent(NavigableSupport.groovy:43)
    at geb.content.NavigableSupport.propertyMissing(NavigableSupport.groovy:127)
    at geb.Browser.propertyMissing(Browser.groovy:175)
    at geb.spock.GebSpec.propertyMissing(GebSpec.groovy:55)
    at test.SearchSpec.cccc(SearchSpec.groovy:33)
Caused by: geb.error.InvalidPageContent: Definition of page component template '$' of 'ApplicationSummaryPage' is invalid, params must be either a Closure, or Map and Closure (args were: [class java.lang.String, null])
    at geb.content.PageContentTemplateBuilder.throwBadInvocationError(PageContentTemplateBuilder.groovy:69)
    at geb.content.PageContentTemplateBuilder.methodMissing(PageContentTemplateBuilder.groovy:51)
    at groovy.lang.GroovyObjectSupport.invokeMethod(GroovyObjectSupport.java:44)
    at com.equifax.ic.testing.framework.ui.pages.applicationmanagement.ApplicationSummaryPage._clinit__closure2_closure5(ApplicationSummaryPage.groovy:24)
    at com.equifax.ic.testing.framework.ui.pages.applicationmanagement.ApplicationSummaryPage._clinit__closure2_closure5(ApplicationSummaryPage.groovy)
    at geb.content.PageContentTemplate.invokeFactory(PageContentTemplate.groovy:134)
    at geb.content.PageContentTemplate.create_closure1(PageContentTemplate.groovy:103)
    at geb.content.PageContentTemplate.create_closure1(PageContentTemplate.groovy)
    at geb.waiting.Wait.waitFor(Wait.groovy:115)
    ... 7 more

1 个答案:

答案 0 :(得分:0)

问题是我没有通过 ds 的索引。更正后的版本低于

println "-----???"+ ds(0)

在Geb邮件列表上得到了回复。在这里发布给其他人。