grails - '$'的页面组件模板 'ApplicationSummaryPage'的定义无效,参数必须是Closure或Map and Closure

标签 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

最佳答案

问题是我不会传递 ds 的索引。更正的版本如下

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

在Geb邮件列表上得到了答复。在此为他人发布。

关于grails - '$'的页面组件模板 'ApplicationSummaryPage'的定义无效,参数必须是Closure或Map and Closure,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10131540/

相关文章:

grails - Grails Fullcalendar时区问题

intellij-idea - 如何配置IntelliJ以使用JUnit 4运行测试?

grails - 升级到 grails 2.3.1 后应用程序引导出错

grails - 从groovy中的子表中删除记录

http - 将服务请求重定向到另一台服务器

grails - 当我单击带有Geb的超链接时,页面转换没有发生

groovy - 这个 Groovy 结构是做什么的,语法是如何工作的?

grails - 如何使创建的JSON对象成为Groovy对象,以便我通过dot(.)运算符访问属性

grails - Grails 3-检查命令对象值是否全部为空

java - Java 类的 Groovy Spock 测试 - 如何模拟 Clob