intellij-idea - Intellij-IDEA 中的 Geb 创作支持吗?

标签 intellij-idea geb

Geb 文档表示 IDEA 通过 Groovy 插件 ( http://www.gebish.org/manual/current/ide-and-typing.html#intellij_idea_support ) 支持 Geb。特别是,它说“ IntelliJ IDEA(自版本 12 起)特别支持编写 Geb 代码。这是内置于 Groovy 支持中的;不需要额外的安装。”但是,我在 IDEA 13.x 或 14 中没有看到这一点。一切正常并运行,但我没有得到任何代码完成或在我的页面中定义的任何内容 DSL 定义的提示。此外,我的内容DSL 引用显示带有“下划线”格式,用于指示未知/动态/仅限运行时的 Groovy 元素。由于 Geb 文档明确表示它应该提供此功能,所以我试图弄清楚我是否遗漏了某些内容?

最佳答案

您只能在页面定义/类内或当 IntelliJ 知道页面类型时获得内容定义提示。如果您不跟踪页面类型,将不会有内容定义提示,因为 IntelliJ 无法确定当前页面类型是什么,并且无法提供自动完成功能。

class MyPage extends Page {
    static content {
        links { $("a") }
        fistLink { links.first() } //Intellij will understand what links are here
    }

    int getLinksCount() {
        links.size() // IntelliJ will understand what links are here
    }
}

class MySpec extends GebSpec {
    ...
    to(MyPage)
    myPage.links // Intellij will not understand/autocomplete links here
    ...
    def myPage = to(MyPage)
    myPage.links // Intellij will understand/autocomplete links here
    ...
}

此外,据我所知,这仅适用于终极版,而不适用于社区版。

关于intellij-idea - Intellij-IDEA 中的 Geb 创作支持吗?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30220591/

相关文章:

grails - Windows 7 命令提示符使用 geb 和 spock 运行 grails 功能测试

java - geb geckodriver 无法正常工作(启动多个浏览器窗口)

intellij-idea - Intellij/Websphere 运行配置显示 "address localhost:8880 is already in use"

java - Intellij 提示 must either be declared abstract or implement abstract method '$init$()' in 'Plugin'

intellij-idea - 如何从 IntelliJ IDEA 中获取 "Reformat code"函数?

grails - 带有Geb的Grails 3在 “angular-moment”上失败

automated-tests - GEB - 查找并计算文本中具有特定单词的所有元素

unit-testing - 使用 Spock,如何通过 grails 命令行运行特定功能?

python-3.x - IntelliJ Pycharm插件: move a variable into a class

intellij-idea - 无法阅读文本文件的 Intellij Idea 问题