Grails and Selenium: how to integrate the two? - selenium

I'm looking to automate the testing of the UI part of my Grails project using Selenium. A number of options seem to exist:
Grails Selenium plugin: doesn't appear to support programmatic test definitions?
Grails Selenium-RC plugin: links on the plugin page are broken, the only Github repo I can find appears to be the Ruby version...
Geb (and the Grails plugin), which hasn't made a 1.0 final release yet.
Can anyone recommend one of these tools in particular, or suggest a better way? Does any decent documentation exist describing how to test Grails applications with Selenium?

We have been using Geb + Geb Grails plugin (Selenium wrapper) in several projects for more then two years.
The release number might be < 1.0, but in stability (bugs & API) it can be considered + 1.0 quality IMHO.

Related

QUERY: Using Karate DSL with javascript based UI automation framework

I want to know, if we can use karate with JS based UI automation framework. And if yes, what are the requisite to follow. Do we require maven in that case?
We have well matured UI automation Selenium based framework. We want to know, if we can integrate Karate DSL without using maven.
You might if you use the CLI (command line interface) provided by the stand-alone JAR / executable. Please read the documentation here: https://github.com/intuit/karate/tree/master/karate-netty#standalone-jar
Which means if you can call an OS command from node / JS - you can use Karate. But there are no guarantees - and you can assume the answer to your question is NO.
That said - we plan to have our own competitor to Selenium - but it will take a little more time: https://github.com/intuit/karate/tree/master/karate-core

How do I setup Cucumber with Grails 3.2.4 for Testing with Grails?

I've been trying to do BDD testing with Grails 3.2.4 and I've had difficulty integrating Cucumber(https://cucumber.io/) with Grails 3.2. If it can be done then how do I setup cucumber for testing?
I've tried setting up with gradle cucumber but it doesn't seem to be working properly and there isn't much of a guide to getting it setup. See https://github.com/samueltbrown/gradle-cucumber-plugin for gradle cucumber and https://github.com/hauner/grails-cucumber for Grails cucumber which is not compatible with Grails 3.2.
As far as I can understand you are able to use Java libraries. Looking in the docs tells me that it is possible to use JUnit for unit testing.
This leads me to think that you should be able to use the Java Skeleton provided by the Cucumber team.
My approach would be to clone it and get it to run. It should run out of the box. Then include it in your test suite for your project.
I've got cucumber to work with just a dummy test class (not a Grails domain class), but when I try to test a real domain class to make sure the attribute constraints are adhered to, it doesn't work. The class is not seen as a domain class and I'm told GORM has not been initialized. I'll be one step closer to getting Cucumber to work with Grails 3 once I find out how to initialize GORM in the Cucumber step defintions.

Create a old Play 2.3.1 framework (current is 2.4.3)

Problem
I'm trying to create a Play 2.3.1 framework, because the lack of info on how to get started with 2.4.3. So much has changed apparently that the tutorials on youtube is useless and I can't get it to work.
Question
How do I do this?
I have tried to go to https://www.playframework.com/download#older-versions but all versions yield the same link to https://downloads.typesafe.com/typesafe-activator/1.3.6/typesafe-activator-1.3.6-minimal.zip
which installs the newest playframework 2.4.3.
Please say that someone knows how to do this?
Also, why should I bother using 2.4.3 > 2.3.1 if I'm only creating a simple mobile app w/database? Security reasons or just "easier"?
Same question for IntelliJ 14 > IntelliJ 13 ?
https://www.playframework.com/download#older-versions is the link you need.
When you're new to Play! it can be quite confusing so I think a bit of terminology is needed.
SBT - Scala build tool. This is a build tool that is baked into every Play! project but totally independent of Play! framework, ie. many Scala projects use this to manage their builds without ever using Play! It's just the Scala equivilient of a Maven, Gradle or Ant. Nothing special.
Activator - This is Play!'s commandline, like a build-tool++. It's commandline tool with a superset of the SBT commands clean compile etc etc, with Play! specific ones like 'new', 'run'. It actually just amounts to not much more than a script (.sh/.bat) which bootstraps SBT and some extra goodness for running play commands. In earlier versions like 1.x this command was named play. Version 2.x was a practically a re-write so you can ignore all related advice.
Play - the playframework itself is just a regular jar (and all its dependencies). It is declared in the project/plugins.sbt
So the reason all the download links point to activator-1.3.6 is because that is just the version of the commandline tool. This will default to latest: 2.4.x.
When you perform an activator new you get a choice of templates. If you REALLY REALLY want to use 2.3.x you could choose this template when prompted hello-play-2_3-scala.
But I don't suggest you do that because:
The documentation for 2.4.x is comprehensive and there are walkthrough guides, it won't take any longer than a youtube video.
There are bug fixes and new features in 2.4.x
2.4.x introduced dependency injection which means it will be harder to upgrade once you'ved developed everything in 2.3x.
Apart from dependency injection most stuff works the same in 2.4.x
Intellij:
Use 14. Play support is improving all the time. If you can use the Early Access Program and the latest version of the Scala plugin.
Don't run 'activator idea' - this is deprecated. File -> open project from Intellij should be enough.

Difference between selenium-support and selenium-java jars

I'm confused about the use of the selenium-support jar file.
There is another achieve available called selenium-java.jar, which is selenium java binding.
Where I can use selenium-support jar?
If you are using Maven generally you want to have your project dependant only on selenium-java. selenium-support is one of the dependencies of that. Maven will resolve these dependencies for you.
If you are just using a plain project, then linking to selenium-standalone will contain all these in one package.
Additional information can be found in the official documentation.
Selenium Support:
Selenium is a set of different software tools each with a different approach to supporting browser automation. These tools are highly flexible, allowing many options for locating and manipulating elements within a browser, and one of its key features is the support for automating multiple browser platforms. This package contains .NET support utilites and classes that users may find useful in using Selenium WebDriver. These support classes are mainly intended to spark ideas of what is possible with Selenium WebDriver, and may not be entirely appropriate for production use.
Selenium Java Jars:
Selenium Standalone Server - is a java jar file which is used for starting selenium server which is as word say server, proxy to selenium grid for browsers you want to automate

playframework seleniums intellij idea intelli sense support

I'm writing selenium tests in playframework 1.2.4 using IntelliJ idea (it has some support of playframework now). Is it possible to use some syntax help for selenium tests, which is actually located in html files?
For example there is a tests (in mytest.test.html file)
#{selenium 'software detail renders with back-link on board'}
openAndWait('/detail/1')
assertVisible('//div[#id="util-panel"]//a[#id="back-link"]')
#{/selenium}
Of course I can use intelli-j templates/sniplets. But I would prefer syntax support.
There is a special plugin for IntelliJ IDEA that helps with Selenium tests: https://blog.jetbrains.com/idea/2020/03/intellij-idea-2020-1-selenium-support/
It provides XPath/CSS highlighting and completion for the most used Selenium APIs, including Geb, Selenide and ScalaTest.