问题
The example:
Page Class
Page TestPage extends Page{
static at = {blah blah....}
static content = {
someVar {$(By.id("someId"))}
}
}
Script:
class Test extends GebReportingSpec{
def "some Feature Methods"(){
when:
def page1 = at TestPage
page1.someVar.click() //In intellij "someVar" shows as unrecognized
}
}
According to what I have read and researched, in the example above, someVar
should autocomplete and be recognized, but it is not. the code still runs and works correctly but someVar
still comes up as unrecognized by the autocompiler in Intellij.
The only way I can have the variable be recognized is by creating a getter method for someVar
When I see the answer to this question: Geb authoring support within Intellij-IDEA?
I assume that what I am attempting to do should work but it does not. is there a way to have the static content autocomplete without creating getter methods?
Edit: Also wanted to add that in my case I am getting the page objects from a jar file. Both the binaries and the sources jars are downloaded and recognized.
来源:https://stackoverflow.com/questions/50688315/how-to-have-geb-static-content-recognized-form-test-script