Hello, we are upgrading our project from Grails 5....
# questions
g
Hello, we are upgrading our project from Grails 5.2.5 to 6.2.3, getting this error while running functional tests, did anyone faced this issue? any solutions?
Copy code
Execution failed for task ':citss-web:compileFunctionalTestGroovy'.
> Unrecoverable compilation error: startup failed:
  General error during instruction selection: java.lang.NoClassDefFoundError: org.openqa.selenium.interactions.HasInputDevices
  
  java.lang.RuntimeException: java.lang.NoClassDefFoundError: org.openqa.selenium.interactions.HasInputDevices
j
I'd start with selenium dependency versions. Here is a fresh build.gradle from https://start.grails.org/
buildscript {
repositories {
maven { url "<https://repo.grails.org/grails/core>" }
mavenCentral()
}
dependencies { // Not Published to Gradle Plugin Portal
classpath "org.grails:grails-gradle-plugin:6.2.4"
classpath "org.grails.plugins:hibernate5:8.1.0"
}
}
plugins {
id "groovy"
id "com.github.erdi.webdriver-binaries" version "3.2"
id "war"
id "idea"
id "com.bertramlabs.asset-pipeline" version "4.5.1"
id "application"
id "eclipse"
}
// Not Published to Gradle Plugin Portal
apply plugin: "org.grails.grails-web"
apply plugin: "org.grails.grails-gsp"
group = "com.example"
repositories {
mavenCentral()
maven { url "<https://repo.grails.org/grails/core/>" }
}
configurations {
all {
resolutionStrategy.eachDependency { DependencyResolveDetails details->
if (details.requested.group == 'org.seleniumhq.selenium') {
details.useVersion('4.19.1')
}
}
}
}
dependencies {
profile "org.grails.profiles:web"
implementation "org.grails:grails-core"
implementation "org.grails:grails-logging"
implementation "org.grails:grails-plugin-databinding"
implementation "org.grails:grails-plugin-i18n"
implementation "org.grails:grails-plugin-interceptors"
implementation "org.grails:grails-plugin-rest"
implementation "org.grails:grails-plugin-services"
implementation "org.grails:grails-plugin-url-mappings"
implementation "org.grails:grails-web-boot"
implementation "org.grails.plugins:gsp"
implementation "org.grails.plugins:hibernate5"
implementation "org.grails.plugins:scaffolding"
implementation "org.springframework.boot:spring-boot-autoconfigure"
implementation "org.springframework.boot:spring-boot-starter"
implementation "org.springframework.boot:spring-boot-starter-actuator"
implementation "org.springframework.boot:spring-boot-starter-logging"
implementation "org.springframework.boot:spring-boot-starter-tomcat"
implementation "org.springframework.boot:spring-boot-starter-validation"
compileOnly "io.micronaut:micronaut-inject-groovy"
console "org.grails:grails-console"
runtimeOnly "com.bertramlabs.plugins:asset-pipeline-grails:4.5.1"
runtimeOnly "com.h2database:h2"
runtimeOnly "org.apache.tomcat:tomcat-jdbc"
runtimeOnly "org.fusesource.jansi:jansi:1.18"
testImplementation "io.micronaut:micronaut-inject-groovy"
testImplementation "org.grails:grails-gorm-testing-support"
testImplementation "org.grails:grails-web-testing-support"
testImplementation "org.grails.plugins:geb"
testImplementation "org.seleniumhq.selenium:selenium-api:4.19.1"
testImplementation "org.seleniumhq.selenium:selenium-remote-driver:4.19.1"
testImplementation "org.seleniumhq.selenium:selenium-support:4.19.1"
testImplementation "org.spockframework:spock-core"
testRuntimeOnly "org.seleniumhq.selenium:selenium-chrome-driver:4.19.1"
testRuntimeOnly "org.seleniumhq.selenium:selenium-firefox-driver:4.19.1"
testRuntimeOnly "org.seleniumhq.selenium:selenium-safari-driver:4.19.1"
}
application {
mainClass = "com.example.Application"
}
java {
sourceCompatibility = JavaVersion.toVersion("11")
}
tasks.withType(Test) {
useJUnitPlatform()
systemProperty "geb.env", System.getProperty('geb.env')
systemProperty "geb.build.reportsDir", reporting.file("geb/integrationTest")
systemProperty 'webdriver.chrome.driver', "${System.getenv('CHROMEWEBDRIVER')}/chromedriver"
systemProperty 'webdriver.gecko.driver', "${System.getenv('GECKOWEBDRIVER')}/geckodriver"
}
webdriverBinaries {
chromedriver '122.0.6260.0'
geckodriver '0.33.0'
edgedriver '110.0.1587.57'
}
assets {
minifyJs = true
minifyCss = true
skipNonDigests = true
}
g
I already tried with this and still getting the issue
but thank you for your input
j
You could try: https://github.com/healenium/healenium-web/issues/278 For Grails 7 we are using testcontainers for selenium in Geb. That has been backported to Grails 6. That is a bit bigger of a lift than finding that class and either fixing the dependency or package/classname. https://github.com/apache/grails-geb/tree/4.1.x?tab=readme-ov-file#examples
g
Great, let me try that, thank you
Hi again, the functional tests are also running along with integration tests, what should I do to make them not run? This is causing only after upgrade to 6.2.3