diff --git a/backend/build.gradle b/backend/build.gradle index 3b6f64ddc..63170b7fa 100644 --- a/backend/build.gradle +++ b/backend/build.gradle @@ -6,6 +6,7 @@ plugins { id 'net.researchgate.release' version '2.6.0' id 'io.franzbecker.gradle-lombok' version '1.13' id 'com.palantir.docker' version '0.20.1' + id 'com.palantir.docker-run' version '0.20.1' } apply plugin: 'io.spring.dependency-management' @@ -20,11 +21,28 @@ repositories { url 'https://build.shibboleth.net/nexus/content/groups/public' artifactUrls = ['https://build.shibboleth.net/nexus/content/repositories/thirdparty-snapshots'] } + mavenLocal() } configurations.all { resolutionStrategy { force 'org.cryptacular:cryptacular:1.1.3' + + eachDependency { details -> + if (details.requested.group == 'org.seleniumhq.selenium' && details.requested.name != 'htmlunit-driver') { + details.useVersion '3.141.59' + } + } + } +} + +configurations { + integrationTestCompile { + extendsFrom testCompile + + } + integrationTestRuntime { + extendsFrom testRuntime } } @@ -70,8 +88,9 @@ springBoot { } lombok { - version = "1.16.20" - sha256 = "c5178b18caaa1a15e17b99ba5e4023d2de2ebc18b58cde0f5a04ca4b31c10e6d" + version = "1.18.4" + //TODO: get new sha256 + sha256 = "" } dependencies { @@ -139,6 +158,9 @@ dependencies { //JSON schema validator compile 'org.sharegov:mjson:1.4.1' + + integrationTestCompile 'com.saucelabs:sebuilder-interpreter:1.0.6' + integrationTestCompile 'jp.vmi:selenese-runner-java:3.19.2' // CSV file support compile 'com.opencsv:opencsv:4.4' @@ -155,6 +177,27 @@ sourceSets { srcDirs = [] } } + integrationTest { + groovy { + srcDirs = ['src/integration/groovy'] + compileClasspath += main.output + test.output + runtimeClasspath += main.output + test.output + } + resources { + srcDir 'src/integration/resources' + } + } +} + +task integrationTest(type: Test) { + group = 'verification' + description = 'Run various integration tests' + dependsOn 'dockerRun', 'runChecker' + finalizedBy 'dockerStop' + testClassesDirs = sourceSets.integrationTest.output.classesDirs + classpath = sourceSets.integrationTest.runtimeClasspath + systemProperties = System.properties + systemProperties['user.dir'] = workingDir } task generateSources { @@ -248,4 +291,26 @@ docker { files tasks.bootJar.outputs files 'src/main/docker-files/loader.properties' buildArgs(['JAR_FILE': "shibui-${version}.jar"]) +} + +tasks.dockerRun.dependsOn tasks.docker +dockerRun { + name 'shibuiint' + image 'unicon/shibui' + ports '10101:8080' + daemonize true + command '--spring.profiles.include=no-auth,very-dangerous' + clean true +} + +task runChecker << { + def ready = false + while (!ready) { + try { + ready = 'http://localhost:10101'.toURL().text.length() > 0 + } catch (IOException e) { + println 'cannot reach site' + sleep 5000 + } + } } \ No newline at end of file diff --git a/backend/src/integration/groovy/com/sebuilder/interpreter/webdriverfactory/Firefox.java b/backend/src/integration/groovy/com/sebuilder/interpreter/webdriverfactory/Firefox.java new file mode 100644 index 000000000..a7ddb5217 --- /dev/null +++ b/backend/src/integration/groovy/com/sebuilder/interpreter/webdriverfactory/Firefox.java @@ -0,0 +1,53 @@ +/* + * Copyright 2012 Sauce Labs + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.sebuilder.interpreter.webdriverfactory; + +import java.io.File; +import java.util.HashMap; +import org.openqa.selenium.firefox.FirefoxBinary; +import org.openqa.selenium.firefox.FirefoxDriver; +import org.openqa.selenium.firefox.FirefoxOptions; +import org.openqa.selenium.firefox.FirefoxProfile; +import org.openqa.selenium.remote.DesiredCapabilities; +import org.openqa.selenium.remote.RemoteWebDriver; + +public class Firefox implements WebDriverFactory { + /** + * @param config Key/value pairs treated as required capabilities, with the exception of: + *