How can I set IntelliJ to recognize chromedriver as the default test browser to use for my automated Geb tests?
I have two IntelliJ projects, one that is configured and running properly hitting the targets I want, and one that has outdated code that I'm trying to bring back to life.
In the good project, when working with Geb tests, I'm able to reference the instance of Browser without actually defining it.. I.E., I can say
go('google.com')
and it works. In the project I'm trying to update, I have to define an instance of browser, and then append browser to all of my commands. Example:
browser.go('google.com')
It seems that if I don't call browser.go, it defaults to some type of phantomJs or headless (maybe htmlUnit?) browser to run the tests.
I don't see anything in the pom.xml file that would indicate to do this in EITHER of the projects, and in the good project there is no driver defined inside of the GebConfig.groovy, so I'm a little confused on where this could be set.
You configure the default browser in your GebConfig.groovy
. From there you can reference the system property geb.env
which could be set from Maven or Gradle. I usually build all my Geb projects with Maven, using this variable to set the default (which could still be overridden via command line). When importing the Maven project into IntelliJ IDEA, the IDE will respect the Maven setting.
For basic introduction about geb.env
see the Geb manual.
In your pom.xml look for something like <geb.env>phantomjs</geb.env>
and change it as needed.