How to setup Geb 2.0 in IntelliJ (run/debug configurations)? - selenium

I'm using Geb 2.0 (http://gebish.org/) and have downloaded the Gradle sample (https://github.com/geb/geb-example-gradle).
All works just fine on my machine with all browsers (Chrome, Firefox, ChromeHeadless).
I have imported the project in IntelliJ (latest Ultimate edition) and all normal code editing functions are working fine.
What fails is attempting to run a spec. I get an exception with the helpful hint of the path to the driver executable must be set by the webdriver.chrome.driver system property.
However, I can't figure out what to point it at. I've tried pointing at the selenium-chrome-driver-3.6.0.jar but that results in failure also.
I'm using -Dgeb.env=chrome and -Dwebdriver.chrome.driver=SOMERANDOMEPATHSHERE
Help?

The Gradle example Geb project is set up to generate the appropriately configured IntelliJ project capable fo running the specs from the IDE. Simply run ./gradlew idea and load the project by opening the geb-example-gradle.ipr file in IntelliJ instead of loading the project by importing it's Gradle build the way you do.

Related

Can't load the main class/runnable jar JavafX 8 project [duplicate]

i created a Javafx project using JDK 8 and when i tried to export it to a runnable .jar file, i got surprised that it doesn't run using CMD, and gives the following error :
"Javafx compenents are missing"
while it works perfectly during the compiling time(using the IDE) when i accessed the .jar files, i found it has just .class files (that i made), and the needed library files that haven't been exported (i made sure to select the "extract need library files extract required libraries into generated jar" option in Eclipse), is there a reason behind of this? and a way to solve it? thanks in advance
Ps: i tried this using Eclipse and Intellij IDE
I just wanna mention once again that I'm using JDK 8 where it has JavaFX library inside of it.
Did you try this?
There are detailed instructions on how to configure your IDE to run JavaFX with newer OpenJDKs (which do not come with JFX components in it).
It also explains how to create a new JavaFX Maven project from archetype, with all the necessary plugins to easily build your application while including the minimal Java components for it (using jlink).
This will ensure that anybody using your application will have those components.

How to build jar with javafx in openjdk12

I'm trying to build jar for javafx desktop application. Working in IntelijIdea, jdk 12,using javafx12, link javafx sdk, write VM-options in menu run-edit configuration. In IDE all working correctly, my app launches and works. But when I try to create artifact and then build it to jar all brokes. IDE tell, that fx:deploy isn't there. Then my app don't work even in IDE.
I got stuck here.
Can you, please, help, how to build this javafx to launch it without IDE?
p. s. Know, that in jdk8, where javafx still includes, it's easier, but is it really no other way to create independent from IDE javafx, than using jdk8?
Built GUI with swing, created artifact and then built it to jar.
There wasn't problems.
But I don't want swing...
actual error: "Error. Java FX Packager: Can't build artifact - fx:deploy is not available in this JDK.
Will be really greatfull for tricks or tips with that.

Setting chromedriver as the default for use in Geb tests inside IntelliJ

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.

Inspecting code on a non-java IntelliJ IDEA project

I'm using IntelliJ IDEA to build a non-java project, it is just a PHP + Javascript project, everything is working just fine but when I try to Inspect all the code in the project (Analyze -> Inspect Code) I get an error:
The JDK is not configured properly for this project. Inspection cannot proceed.
Am I doing something wrong? Do I have to configure an SDK even though the project is not java?
Note: The automatic code inspection for working files opened in the editor is working fine, the only problem is when I try to inspec all the code in the project.
Note 2: I cannot use PHPStorm neither Webstorm.
Thanks.
In my case, I didn't wanted to delete the module since I have a bunch of stuff configured (data sources, dictionaries, http requests) and a lot of code in the shelf (which I believe it's stored along the project/module). I found that you can skip the "delete your module" part and instead just update the module config:
Find the $module.iml file (in my case it's inside the .idea directory) and at the top there's was a line:
<module type="JAVA_MODULE" version="4">
which I changed to:
<module type="WEB_MODULE" version="4">
The issue was fixed and I haven't seen any side-effects but, just in case, you might want to backup the .idea directory.
I raised this over at https://youtrack.jetbrains.com/issue/IDEA-188017 - after some back and forth, the Jetbrains employee helped me figure out that I had a Java module in there.
If you are not using Java, please crate a module of a Static Web type. Now you have a module of a Java type, that is why the error is reported, so such behaviour is expected.
Delete your Java module.
Once you enter in the menu in the screenshot below, find the Static Web type and create your module like that.
Seems like adding a SDK the code analyzer works just fine, even though the project has no single java module.
Maybe it is a bug, so I will report it.
My project's .idea/<project>.iml file had an entry:
<orderEntry type="inheritedJdk" />
I quit Idea, removed the line above from the iml file, restarted Idea and the next Inspection ran without any issues.
I recently ran into this issue with my purely Python project.
After much frustation, I bumped into a rather bizarre solution:
When IntelliJ complained that JDK is not configured, in the following dialog box, I just selected JDK8 (instead of Python 3.7.2 path) and viola! its gone.
My environment was
IntelliJ IDEA 2018.3.4 (Community Edition)
Build #IC-183.5429.30, built on January 29, 2019
JRE: 1.8.0_152-release-1343-b26 x86_64
JVM: OpenJDK 64-Bit Server VM by JetBrains s.r.o
macOS 10.14.2

Intellij and Hybris Tests

Currently I'm doing the hybris 5 Developer Training Trails 5.7 - Part I - Core in Intellij and the Hybris Plugin for Intellij.
Now I'm at the point where I have to run a test class. When I'm doing it, it tells me that it's not finding a a class "de.hybris.platform.cuppy.jalo.Match".
When I'm running the same test in http://localhost:9001/test then everything works fine.
I guess I have to fix my classpath, but I don't know how. If I change the classpath of the module in "Run/Debug Configurations" to something else, then it's not working. If I change there the working directory from MODULES_DIR to the whole project path it's not working either. Now I have no ideas anymore.
Just install "Hybris Integration" plugin it will do everything automatically. You will be able to import Hybris projects just like maven or gradle based projects. That plugin provides Hybris integration into Intellij IDEA and another IDE based on it.
You can install it to your IDE directly from the repository by clicking on the "Browse Repositories" button in Settings/Plugins dialog.
You need to remove all your JAVA Build Path Problems. Then test cases should work.
In my case I had set the "power save mode" on IntelliJ. Removing it solved the problem for testing