From aae1e42da8d119beea85c5a07fa5ae68be0fc16a Mon Sep 17 00:00:00 2001 From: shicong Date: Tue, 2 Apr 2019 09:07:55 -0700 Subject: [PATCH] Use Docker Java API to manage container for WebDriver Previously we had a few customized Gradle build task to manage the Docker container for provisioning browser and ChromeDriverService used by WebDriver tests. This CL changed to use a java library from testcontainers.org to achieve the same purpose. The main benefit of it is that we can expect to run the WebDriver tests from IDE going forward. Also, this CL refactored the structure of WebDriver related classes to have JUnit rule to manage the lifecycle of WebDriver instance, this is also compatible with the API from testcontainers library. ------------- Created by MOE: https://github.com/google/moe MOE_MIGRATED_REVID=241539861 --- gradle/core/build.gradle | 39 +-------- .../dependency-locks/testCompile.lockfile | 20 ++++- .../testCompileClasspath.lockfile | 20 ++++- .../dependency-locks/testRuntime.lockfile | 20 ++++- .../testRuntimeClasspath.lockfile | 20 ++++- gradle/dependencies.gradle | 1 + .../dependency-locks/testCompile.lockfile | 20 ++++- .../testCompileClasspath.lockfile | 20 ++++- .../dependency-locks/testRuntime.lockfile | 20 ++++- .../testRuntimeClasspath.lockfile | 20 ++++- .../dependency-locks/testCompile.lockfile | 20 ++++- .../testCompileClasspath.lockfile | 20 ++++- .../dependency-locks/testRuntime.lockfile | 20 ++++- .../testRuntimeClasspath.lockfile | 20 ++++- java/google/registry/util/NetworkUtils.java | 8 +- .../google/registry/util}/UrlChecker.java | 7 +- javatests/google/registry/server/BUILD | 1 - .../google/registry/server/TestServer.java | 1 + .../webdriver/DockerWebDriverRule.java | 84 +++++++++++++++++++ .../OteSetupConsoleScreenshotTest.java | 6 +- .../RegistrarConsoleScreenshotTest.java | 6 +- .../webdriver/RegistrarConsoleWebTest.java | 5 +- .../RegistrarCreateConsoleScreenshotTest.java | 6 +- .../registry/webdriver/RepeatableRunner.java | 10 ++- ...lusScreenDiffer.java => ScreenDiffer.java} | 11 +-- .../registry/webdriver/TestServerRule.java | 20 +++-- ...ava => WebDriverPlusScreenDifferRule.java} | 42 ++++++---- ...Differ.java => WebDriverScreenDiffer.java} | 36 ++------ .../registry/webdriver/WebDriverTestCase.java | 30 +++++++ 29 files changed, 376 insertions(+), 177 deletions(-) rename {javatests/google/registry/server => java/google/registry/util}/UrlChecker.java (91%) create mode 100644 javatests/google/registry/webdriver/DockerWebDriverRule.java rename javatests/google/registry/webdriver/{WebDriverPlusScreenDiffer.java => ScreenDiffer.java} (87%) rename javatests/google/registry/webdriver/{WebDriverRule.java => WebDriverPlusScreenDifferRule.java} (90%) rename javatests/google/registry/webdriver/{ChromeWebDriverPlusScreenDiffer.java => WebDriverScreenDiffer.java} (86%) create mode 100644 javatests/google/registry/webdriver/WebDriverTestCase.java diff --git a/gradle/core/build.gradle b/gradle/core/build.gradle index 389e53af5..8e9d2815d 100644 --- a/gradle/core/build.gradle +++ b/gradle/core/build.gradle @@ -11,10 +11,6 @@ def screenshotsForGoldensDir = "${project.buildDir}/screenshots_for_goldens" def newGoldensDir = "${project.buildDir}/new_golden_images" def goldensDir = "${javatestsDir}/google/registry/webdriver/goldens/chrome-linux" -def chromeWebdriverServicePort = 4444 -// Url to the Chrome Webdriver service used by class ChromeWebDriverPlusScreenDiffer -def chromeWebdriverServiceUrl = - "http://localhost:${chromeWebdriverServicePort}/wd/hub" // Tests that conflict with (mostly unidentified) members of the main test // suite. It is unclear if they are offenders (i.e., those that pollute global @@ -240,6 +236,7 @@ dependencies { testCompile deps['org.seleniumhq.selenium:selenium-java'] testCompile deps['org.seleniumhq.selenium:selenium-remote-driver'] maybeRuntime deps['org.slf4j:slf4j-api'] + testCompile deps['org.testcontainers:selenium'] maybeRuntime deps['org.tukaani:xz'] maybeRuntime deps['org.xerial.snappy:snappy-java'] compile deps['xerces:xmlParserAPIs'] @@ -584,30 +581,6 @@ task outcastTest(type: Test) { maxParallelForks 5 } -task dockerStopAtStart(type: Exec) { - ignoreExitValue true - commandLine 'docker', 'stop', 'chrome-plus-chromedriver' -} -task dockerStopAtEnd(type: Exec) { - ignoreExitValue true - commandLine 'docker', 'stop', 'chrome-plus-chromedriver' -} - -task dockerRun(type: Exec) { - dependsOn dockerStopAtStart - def runCommand = [] - runCommand << 'docker' - runCommand << 'run' << '--detach' - runCommand << '--name' << 'chrome-plus-chromedriver' - runCommand << '--publish' - runCommand << "${chromeWebdriverServicePort}:${chromeWebdriverServicePort}" - runCommand << '--volume' << '/dev/shm:/dev/shm' - runCommand << '--network' << 'host' - runCommand << '--rm' - runCommand << 'selenium/standalone-chrome:3.141.59-gold' - commandLine runCommand -} - task findGoldenImages(type: JavaExec) { classpath = sourceSets.test.runtimeClasspath main = 'google.registry.webdriver.GoldenImageFinder' @@ -623,7 +596,6 @@ task findGoldenImages(type: JavaExec) { } task generateGoldenImages(type: Test) { - dependsOn dockerRun // Common exclude pattern. See README in parent directory for explanation. exclude "**/*TestCase.*", "**/*TestSuite.*" include "**/webdriver/*" @@ -634,13 +606,12 @@ task generateGoldenImages(type: Test) { systemProperty 'test.screenshot.dir', screenshotsForGoldensDir systemProperty 'test.screenshot.runAllAttempts', 'true' systemProperty 'test.screenshot.maxAttempts', '5' - systemProperty 'webdriver.chromeDriverServiceUrl', chromeWebdriverServiceUrl doFirst { new File(screenshotsForGoldensDir).deleteDir() } } -generateGoldenImages.finalizedBy(dockerStopAtEnd, findGoldenImages) +generateGoldenImages.finalizedBy(findGoldenImages) test { // Common exclude pattern. See README in parent directory for explanation. @@ -648,8 +619,6 @@ test { exclude fragileTestPatterns exclude outcastTestPatterns - dependsOn dockerRun - // Run every test class in its own process. // Uncomment to unblock build while troubleshooting inexplicable test errors. // This setting makes the build take 35 minutes, without it it takes about 10. @@ -658,14 +627,10 @@ test { // Sets the maximum number of test executors that may exist at the same time. maxParallelForks 5 - systemProperty 'webdriver.chromeDriverServiceUrl', chromeWebdriverServiceUrl - doFirst { new File(screenshotsDir).deleteDir() } }.dependsOn(fragileTest, outcastTest) -test.finalizedBy(dockerStopAtEnd) - task nomulus(type: Jar) { manifest { diff --git a/gradle/core/gradle/dependency-locks/testCompile.lockfile b/gradle/core/gradle/dependency-locks/testCompile.lockfile index 5e569185b..db19e97a2 100644 --- a/gradle/core/gradle/dependency-locks/testCompile.lockfile +++ b/gradle/core/gradle/dependency-locks/testCompile.lockfile @@ -116,6 +116,8 @@ com.googlecode.java-diff-utils:diffutils:1.3.0 com.googlecode.json-simple:json-simple:1.1.1 com.ibm.icu:icu4j:57.1 com.jcraft:jsch:0.1.55 +com.kohlschutter.junixsocket:junixsocket-common:2.0.4 +com.kohlschutter.junixsocket:junixsocket-native-common:2.0.4 com.squareup.okhttp3:okhttp:3.11.0 com.squareup.okhttp:okhttp:2.5.0 com.squareup.okio:okio:1.14.0 @@ -155,7 +157,8 @@ io.opencensus:opencensus-contrib-grpc-util:0.17.0 io.opencensus:opencensus-contrib-http-util:0.18.0 it.unimi.dsi:fastutil:6.5.16 javax.activation:activation:1.1 -javax.annotation:javax.annotation-api:1.2 +javax.activation:javax.activation-api:1.2.0 +javax.annotation:javax.annotation-api:1.3.2 javax.annotation:jsr250-api:1.0 javax.inject:javax.inject:1 javax.jdo:jdo2-api:2.3-eb @@ -163,12 +166,14 @@ javax.mail:mail:1.4 javax.servlet:servlet-api:2.5 javax.transaction:transaction-api:1.1 javax.validation:validation-api:1.0.0.GA -javax.xml.bind:jaxb-api:2.3.0 +javax.xml.bind:jaxb-api:2.3.1 jline:jline:1.0 joda-time:joda-time:2.9.2 junit:junit:4.12 net.bytebuddy:byte-buddy-agent:1.9.7 net.bytebuddy:byte-buddy:1.9.7 +net.java.dev.jna:jna-platform:5.2.0 +net.java.dev.jna:jna:5.2.0 org.apache.avro:avro:1.8.2 org.apache.beam:beam-model-job-management:2.11.0 org.apache.beam:beam-model-pipeline:2.11.0 @@ -181,7 +186,7 @@ org.apache.beam:beam-sdks-java-extensions-protobuf:2.11.0 org.apache.beam:beam-sdks-java-io-google-cloud-platform:2.11.0 org.apache.beam:beam-vendor-grpc-1_13_1:0.2 org.apache.beam:beam-vendor-guava-20_0:0.1 -org.apache.commons:commons-compress:1.8.1 +org.apache.commons:commons-compress:1.18 org.apache.commons:commons-exec:1.3 org.apache.commons:commons-lang3:3.8.1 org.apache.commons:commons-text:1.6 @@ -206,6 +211,7 @@ org.easymock:easymock:3.0 org.hamcrest:hamcrest-all:1.3 org.hamcrest:hamcrest-core:1.3 org.hamcrest:hamcrest-library:1.3 +org.jetbrains:annotations:17.0.0 org.joda:joda-money:0.10.0 org.json:json:20160810 org.mockito:mockito-core:2.25.0 @@ -217,6 +223,10 @@ org.ow2.asm:asm-commons:6.0 org.ow2.asm:asm-tree:6.0 org.ow2.asm:asm-util:6.0 org.ow2.asm:asm:6.0 +org.rnorth.duct-tape:duct-tape:1.0.7 +org.rnorth.visible-assertions:visible-assertions:2.1.2 +org.rnorth:tcp-unix-socket-proxy:1.0.2 +org.scijava:native-lib-loader:2.0.2 org.seleniumhq.selenium:selenium-api:3.141.59 org.seleniumhq.selenium:selenium-chrome-driver:3.141.59 org.seleniumhq.selenium:selenium-edge-driver:3.141.59 @@ -227,7 +237,9 @@ org.seleniumhq.selenium:selenium-opera-driver:3.141.59 org.seleniumhq.selenium:selenium-remote-driver:3.141.59 org.seleniumhq.selenium:selenium-safari-driver:3.141.59 org.seleniumhq.selenium:selenium-support:3.141.59 -org.slf4j:slf4j-api:1.7.25 +org.slf4j:slf4j-api:1.7.26 +org.testcontainers:selenium:1.10.7 +org.testcontainers:testcontainers:1.10.7 org.threeten:threetenbp:1.3.3 org.tukaani:xz:1.8 org.w3c.css:sac:1.3 diff --git a/gradle/core/gradle/dependency-locks/testCompileClasspath.lockfile b/gradle/core/gradle/dependency-locks/testCompileClasspath.lockfile index 8a421d62d..45ea53b11 100644 --- a/gradle/core/gradle/dependency-locks/testCompileClasspath.lockfile +++ b/gradle/core/gradle/dependency-locks/testCompileClasspath.lockfile @@ -115,6 +115,8 @@ com.googlecode.java-diff-utils:diffutils:1.3.0 com.googlecode.json-simple:json-simple:1.1.1 com.ibm.icu:icu4j:57.1 com.jcraft:jsch:0.1.55 +com.kohlschutter.junixsocket:junixsocket-common:2.0.4 +com.kohlschutter.junixsocket:junixsocket-native-common:2.0.4 com.squareup.okhttp3:okhttp:3.11.0 com.squareup.okhttp:okhttp:2.5.0 com.squareup.okio:okio:1.14.0 @@ -153,7 +155,8 @@ io.opencensus:opencensus-contrib-grpc-util:0.17.0 io.opencensus:opencensus-contrib-http-util:0.18.0 it.unimi.dsi:fastutil:6.5.16 javax.activation:activation:1.1 -javax.annotation:javax.annotation-api:1.2 +javax.activation:javax.activation-api:1.2.0 +javax.annotation:javax.annotation-api:1.3.2 javax.annotation:jsr250-api:1.0 javax.inject:javax.inject:1 javax.jdo:jdo2-api:2.3-eb @@ -161,12 +164,14 @@ javax.mail:mail:1.4 javax.servlet:servlet-api:2.5 javax.transaction:transaction-api:1.1 javax.validation:validation-api:1.0.0.GA -javax.xml.bind:jaxb-api:2.3.0 +javax.xml.bind:jaxb-api:2.3.1 jline:jline:1.0 joda-time:joda-time:2.9.2 junit:junit:4.12 net.bytebuddy:byte-buddy-agent:1.9.7 net.bytebuddy:byte-buddy:1.9.7 +net.java.dev.jna:jna-platform:5.2.0 +net.java.dev.jna:jna:5.2.0 org.apache.avro:avro:1.8.2 org.apache.beam:beam-model-job-management:2.11.0 org.apache.beam:beam-model-pipeline:2.11.0 @@ -179,7 +184,7 @@ org.apache.beam:beam-sdks-java-extensions-protobuf:2.11.0 org.apache.beam:beam-sdks-java-io-google-cloud-platform:2.11.0 org.apache.beam:beam-vendor-grpc-1_13_1:0.2 org.apache.beam:beam-vendor-guava-20_0:0.1 -org.apache.commons:commons-compress:1.8.1 +org.apache.commons:commons-compress:1.18 org.apache.commons:commons-exec:1.3 org.apache.commons:commons-lang3:3.8.1 org.apache.commons:commons-text:1.6 @@ -204,6 +209,7 @@ org.easymock:easymock:3.0 org.hamcrest:hamcrest-all:1.3 org.hamcrest:hamcrest-core:1.3 org.hamcrest:hamcrest-library:1.3 +org.jetbrains:annotations:17.0.0 org.joda:joda-money:0.10.0 org.json:json:20160810 org.mockito:mockito-core:2.25.0 @@ -215,6 +221,10 @@ org.ow2.asm:asm-commons:6.0 org.ow2.asm:asm-tree:6.0 org.ow2.asm:asm-util:6.0 org.ow2.asm:asm:6.0 +org.rnorth.duct-tape:duct-tape:1.0.7 +org.rnorth.visible-assertions:visible-assertions:2.1.2 +org.rnorth:tcp-unix-socket-proxy:1.0.2 +org.scijava:native-lib-loader:2.0.2 org.seleniumhq.selenium:selenium-api:3.141.59 org.seleniumhq.selenium:selenium-chrome-driver:3.141.59 org.seleniumhq.selenium:selenium-edge-driver:3.141.59 @@ -225,7 +235,9 @@ org.seleniumhq.selenium:selenium-opera-driver:3.141.59 org.seleniumhq.selenium:selenium-remote-driver:3.141.59 org.seleniumhq.selenium:selenium-safari-driver:3.141.59 org.seleniumhq.selenium:selenium-support:3.141.59 -org.slf4j:slf4j-api:1.7.25 +org.slf4j:slf4j-api:1.7.26 +org.testcontainers:selenium:1.10.7 +org.testcontainers:testcontainers:1.10.7 org.threeten:threetenbp:1.3.3 org.tukaani:xz:1.8 org.w3c.css:sac:1.3 diff --git a/gradle/core/gradle/dependency-locks/testRuntime.lockfile b/gradle/core/gradle/dependency-locks/testRuntime.lockfile index 8e358f6cd..783a2abd1 100644 --- a/gradle/core/gradle/dependency-locks/testRuntime.lockfile +++ b/gradle/core/gradle/dependency-locks/testRuntime.lockfile @@ -116,6 +116,8 @@ com.googlecode.java-diff-utils:diffutils:1.3.0 com.googlecode.json-simple:json-simple:1.1.1 com.ibm.icu:icu4j:57.1 com.jcraft:jsch:0.1.55 +com.kohlschutter.junixsocket:junixsocket-common:2.0.4 +com.kohlschutter.junixsocket:junixsocket-native-common:2.0.4 com.squareup.okhttp3:okhttp:3.11.0 com.squareup.okhttp:okhttp:2.5.0 com.squareup.okio:okio:1.14.0 @@ -157,7 +159,8 @@ io.opencensus:opencensus-contrib-grpc-util:0.17.0 io.opencensus:opencensus-contrib-http-util:0.18.0 it.unimi.dsi:fastutil:6.5.16 javax.activation:activation:1.1 -javax.annotation:javax.annotation-api:1.2 +javax.activation:javax.activation-api:1.2.0 +javax.annotation:javax.annotation-api:1.3.2 javax.annotation:jsr250-api:1.0 javax.inject:javax.inject:1 javax.jdo:jdo2-api:2.3-eb @@ -165,12 +168,14 @@ javax.mail:mail:1.4 javax.servlet:servlet-api:2.5 javax.transaction:transaction-api:1.1 javax.validation:validation-api:1.0.0.GA -javax.xml.bind:jaxb-api:2.3.0 +javax.xml.bind:jaxb-api:2.3.1 jline:jline:1.0 joda-time:joda-time:2.9.2 junit:junit:4.12 net.bytebuddy:byte-buddy-agent:1.9.7 net.bytebuddy:byte-buddy:1.9.7 +net.java.dev.jna:jna-platform:5.2.0 +net.java.dev.jna:jna:5.2.0 org.apache.avro:avro:1.8.2 org.apache.beam:beam-model-job-management:2.11.0 org.apache.beam:beam-model-pipeline:2.11.0 @@ -183,7 +188,7 @@ org.apache.beam:beam-sdks-java-extensions-protobuf:2.11.0 org.apache.beam:beam-sdks-java-io-google-cloud-platform:2.11.0 org.apache.beam:beam-vendor-grpc-1_13_1:0.2 org.apache.beam:beam-vendor-guava-20_0:0.1 -org.apache.commons:commons-compress:1.8.1 +org.apache.commons:commons-compress:1.18 org.apache.commons:commons-exec:1.3 org.apache.commons:commons-lang3:3.8.1 org.apache.commons:commons-text:1.6 @@ -211,6 +216,7 @@ org.glassfish.jaxb:txw2:2.3.0 org.hamcrest:hamcrest-all:1.3 org.hamcrest:hamcrest-core:1.3 org.hamcrest:hamcrest-library:1.3 +org.jetbrains:annotations:17.0.0 org.joda:joda-money:0.10.0 org.json:json:20160810 org.jvnet.staxex:stax-ex:1.7.8 @@ -223,6 +229,10 @@ org.ow2.asm:asm-commons:6.0 org.ow2.asm:asm-tree:6.0 org.ow2.asm:asm-util:6.0 org.ow2.asm:asm:6.0 +org.rnorth.duct-tape:duct-tape:1.0.7 +org.rnorth.visible-assertions:visible-assertions:2.1.2 +org.rnorth:tcp-unix-socket-proxy:1.0.2 +org.scijava:native-lib-loader:2.0.2 org.seleniumhq.selenium:selenium-api:3.141.59 org.seleniumhq.selenium:selenium-chrome-driver:3.141.59 org.seleniumhq.selenium:selenium-edge-driver:3.141.59 @@ -233,7 +243,9 @@ org.seleniumhq.selenium:selenium-opera-driver:3.141.59 org.seleniumhq.selenium:selenium-remote-driver:3.141.59 org.seleniumhq.selenium:selenium-safari-driver:3.141.59 org.seleniumhq.selenium:selenium-support:3.141.59 -org.slf4j:slf4j-api:1.7.25 +org.slf4j:slf4j-api:1.7.26 +org.testcontainers:selenium:1.10.7 +org.testcontainers:testcontainers:1.10.7 org.threeten:threetenbp:1.3.3 org.tukaani:xz:1.8 org.w3c.css:sac:1.3 diff --git a/gradle/core/gradle/dependency-locks/testRuntimeClasspath.lockfile b/gradle/core/gradle/dependency-locks/testRuntimeClasspath.lockfile index 8e358f6cd..783a2abd1 100644 --- a/gradle/core/gradle/dependency-locks/testRuntimeClasspath.lockfile +++ b/gradle/core/gradle/dependency-locks/testRuntimeClasspath.lockfile @@ -116,6 +116,8 @@ com.googlecode.java-diff-utils:diffutils:1.3.0 com.googlecode.json-simple:json-simple:1.1.1 com.ibm.icu:icu4j:57.1 com.jcraft:jsch:0.1.55 +com.kohlschutter.junixsocket:junixsocket-common:2.0.4 +com.kohlschutter.junixsocket:junixsocket-native-common:2.0.4 com.squareup.okhttp3:okhttp:3.11.0 com.squareup.okhttp:okhttp:2.5.0 com.squareup.okio:okio:1.14.0 @@ -157,7 +159,8 @@ io.opencensus:opencensus-contrib-grpc-util:0.17.0 io.opencensus:opencensus-contrib-http-util:0.18.0 it.unimi.dsi:fastutil:6.5.16 javax.activation:activation:1.1 -javax.annotation:javax.annotation-api:1.2 +javax.activation:javax.activation-api:1.2.0 +javax.annotation:javax.annotation-api:1.3.2 javax.annotation:jsr250-api:1.0 javax.inject:javax.inject:1 javax.jdo:jdo2-api:2.3-eb @@ -165,12 +168,14 @@ javax.mail:mail:1.4 javax.servlet:servlet-api:2.5 javax.transaction:transaction-api:1.1 javax.validation:validation-api:1.0.0.GA -javax.xml.bind:jaxb-api:2.3.0 +javax.xml.bind:jaxb-api:2.3.1 jline:jline:1.0 joda-time:joda-time:2.9.2 junit:junit:4.12 net.bytebuddy:byte-buddy-agent:1.9.7 net.bytebuddy:byte-buddy:1.9.7 +net.java.dev.jna:jna-platform:5.2.0 +net.java.dev.jna:jna:5.2.0 org.apache.avro:avro:1.8.2 org.apache.beam:beam-model-job-management:2.11.0 org.apache.beam:beam-model-pipeline:2.11.0 @@ -183,7 +188,7 @@ org.apache.beam:beam-sdks-java-extensions-protobuf:2.11.0 org.apache.beam:beam-sdks-java-io-google-cloud-platform:2.11.0 org.apache.beam:beam-vendor-grpc-1_13_1:0.2 org.apache.beam:beam-vendor-guava-20_0:0.1 -org.apache.commons:commons-compress:1.8.1 +org.apache.commons:commons-compress:1.18 org.apache.commons:commons-exec:1.3 org.apache.commons:commons-lang3:3.8.1 org.apache.commons:commons-text:1.6 @@ -211,6 +216,7 @@ org.glassfish.jaxb:txw2:2.3.0 org.hamcrest:hamcrest-all:1.3 org.hamcrest:hamcrest-core:1.3 org.hamcrest:hamcrest-library:1.3 +org.jetbrains:annotations:17.0.0 org.joda:joda-money:0.10.0 org.json:json:20160810 org.jvnet.staxex:stax-ex:1.7.8 @@ -223,6 +229,10 @@ org.ow2.asm:asm-commons:6.0 org.ow2.asm:asm-tree:6.0 org.ow2.asm:asm-util:6.0 org.ow2.asm:asm:6.0 +org.rnorth.duct-tape:duct-tape:1.0.7 +org.rnorth.visible-assertions:visible-assertions:2.1.2 +org.rnorth:tcp-unix-socket-proxy:1.0.2 +org.scijava:native-lib-loader:2.0.2 org.seleniumhq.selenium:selenium-api:3.141.59 org.seleniumhq.selenium:selenium-chrome-driver:3.141.59 org.seleniumhq.selenium:selenium-edge-driver:3.141.59 @@ -233,7 +243,9 @@ org.seleniumhq.selenium:selenium-opera-driver:3.141.59 org.seleniumhq.selenium:selenium-remote-driver:3.141.59 org.seleniumhq.selenium:selenium-safari-driver:3.141.59 org.seleniumhq.selenium:selenium-support:3.141.59 -org.slf4j:slf4j-api:1.7.25 +org.slf4j:slf4j-api:1.7.26 +org.testcontainers:selenium:1.10.7 +org.testcontainers:testcontainers:1.10.7 org.threeten:threetenbp:1.3.3 org.tukaani:xz:1.8 org.w3c.css:sac:1.3 diff --git a/gradle/dependencies.gradle b/gradle/dependencies.gradle index a5e1d6e30..66e0eb6f4 100644 --- a/gradle/dependencies.gradle +++ b/gradle/dependencies.gradle @@ -142,6 +142,7 @@ ext { 'org.seleniumhq.selenium:selenium-java:3.141.59', 'org.seleniumhq.selenium:selenium-remote-driver:3.141.59', 'org.slf4j:slf4j-api:1.7.16', + 'org.testcontainers:selenium:1.10.7', 'org.tukaani:xz:1.8', 'org.xerial.snappy:snappy-java:1.1.4-M3', 'org.yaml:snakeyaml:1.17', diff --git a/gradle/proxy/gradle/dependency-locks/testCompile.lockfile b/gradle/proxy/gradle/dependency-locks/testCompile.lockfile index c1bc87208..b54d0cd3c 100644 --- a/gradle/proxy/gradle/dependency-locks/testCompile.lockfile +++ b/gradle/proxy/gradle/dependency-locks/testCompile.lockfile @@ -116,6 +116,8 @@ com.googlecode.java-diff-utils:diffutils:1.3.0 com.googlecode.json-simple:json-simple:1.1.1 com.ibm.icu:icu4j:57.1 com.jcraft:jsch:0.1.55 +com.kohlschutter.junixsocket:junixsocket-common:2.0.4 +com.kohlschutter.junixsocket:junixsocket-native-common:2.0.4 com.squareup.okhttp3:okhttp:3.11.0 com.squareup.okhttp:okhttp:2.5.0 com.squareup.okio:okio:1.14.0 @@ -157,7 +159,8 @@ io.opencensus:opencensus-contrib-grpc-util:0.17.0 io.opencensus:opencensus-contrib-http-util:0.18.0 it.unimi.dsi:fastutil:6.5.16 javax.activation:activation:1.1 -javax.annotation:javax.annotation-api:1.2 +javax.activation:javax.activation-api:1.2.0 +javax.annotation:javax.annotation-api:1.3.2 javax.annotation:jsr250-api:1.0 javax.inject:javax.inject:1 javax.jdo:jdo2-api:2.3-eb @@ -165,12 +168,14 @@ javax.mail:mail:1.4 javax.servlet:servlet-api:2.5 javax.transaction:transaction-api:1.1 javax.validation:validation-api:1.0.0.GA -javax.xml.bind:jaxb-api:2.3.0 +javax.xml.bind:jaxb-api:2.3.1 jline:jline:1.0 joda-time:joda-time:2.9.2 junit:junit:4.12 net.bytebuddy:byte-buddy-agent:1.9.7 net.bytebuddy:byte-buddy:1.9.7 +net.java.dev.jna:jna-platform:5.2.0 +net.java.dev.jna:jna:5.2.0 org.apache.avro:avro:1.8.2 org.apache.beam:beam-model-job-management:2.11.0 org.apache.beam:beam-model-pipeline:2.11.0 @@ -183,7 +188,7 @@ org.apache.beam:beam-sdks-java-extensions-protobuf:2.11.0 org.apache.beam:beam-sdks-java-io-google-cloud-platform:2.11.0 org.apache.beam:beam-vendor-grpc-1_13_1:0.2 org.apache.beam:beam-vendor-guava-20_0:0.1 -org.apache.commons:commons-compress:1.8.1 +org.apache.commons:commons-compress:1.18 org.apache.commons:commons-exec:1.3 org.apache.commons:commons-lang3:3.8.1 org.apache.commons:commons-text:1.6 @@ -211,6 +216,7 @@ org.glassfish.jaxb:txw2:2.3.0 org.hamcrest:hamcrest-all:1.3 org.hamcrest:hamcrest-core:1.3 org.hamcrest:hamcrest-library:1.3 +org.jetbrains:annotations:17.0.0 org.joda:joda-money:0.10.0 org.json:json:20160810 org.jvnet.staxex:stax-ex:1.7.8 @@ -223,6 +229,10 @@ org.ow2.asm:asm-commons:6.0 org.ow2.asm:asm-tree:6.0 org.ow2.asm:asm-util:6.0 org.ow2.asm:asm:6.0 +org.rnorth.duct-tape:duct-tape:1.0.7 +org.rnorth.visible-assertions:visible-assertions:2.1.2 +org.rnorth:tcp-unix-socket-proxy:1.0.2 +org.scijava:native-lib-loader:2.0.2 org.seleniumhq.selenium:selenium-api:3.141.59 org.seleniumhq.selenium:selenium-chrome-driver:3.141.59 org.seleniumhq.selenium:selenium-edge-driver:3.141.59 @@ -233,7 +243,9 @@ org.seleniumhq.selenium:selenium-opera-driver:3.141.59 org.seleniumhq.selenium:selenium-remote-driver:3.141.59 org.seleniumhq.selenium:selenium-safari-driver:3.141.59 org.seleniumhq.selenium:selenium-support:3.141.59 -org.slf4j:slf4j-api:1.7.25 +org.slf4j:slf4j-api:1.7.26 +org.testcontainers:selenium:1.10.7 +org.testcontainers:testcontainers:1.10.7 org.threeten:threetenbp:1.3.3 org.tukaani:xz:1.8 org.w3c.css:sac:1.3 diff --git a/gradle/proxy/gradle/dependency-locks/testCompileClasspath.lockfile b/gradle/proxy/gradle/dependency-locks/testCompileClasspath.lockfile index 899657881..85f516dea 100644 --- a/gradle/proxy/gradle/dependency-locks/testCompileClasspath.lockfile +++ b/gradle/proxy/gradle/dependency-locks/testCompileClasspath.lockfile @@ -116,6 +116,8 @@ com.googlecode.java-diff-utils:diffutils:1.3.0 com.googlecode.json-simple:json-simple:1.1.1 com.ibm.icu:icu4j:57.1 com.jcraft:jsch:0.1.55 +com.kohlschutter.junixsocket:junixsocket-common:2.0.4 +com.kohlschutter.junixsocket:junixsocket-native-common:2.0.4 com.squareup.okhttp3:okhttp:3.11.0 com.squareup.okhttp:okhttp:2.5.0 com.squareup.okio:okio:1.14.0 @@ -156,7 +158,8 @@ io.opencensus:opencensus-contrib-grpc-util:0.17.0 io.opencensus:opencensus-contrib-http-util:0.18.0 it.unimi.dsi:fastutil:6.5.16 javax.activation:activation:1.1 -javax.annotation:javax.annotation-api:1.2 +javax.activation:javax.activation-api:1.2.0 +javax.annotation:javax.annotation-api:1.3.2 javax.annotation:jsr250-api:1.0 javax.inject:javax.inject:1 javax.jdo:jdo2-api:2.3-eb @@ -164,12 +167,14 @@ javax.mail:mail:1.4 javax.servlet:servlet-api:2.5 javax.transaction:transaction-api:1.1 javax.validation:validation-api:1.0.0.GA -javax.xml.bind:jaxb-api:2.3.0 +javax.xml.bind:jaxb-api:2.3.1 jline:jline:1.0 joda-time:joda-time:2.9.2 junit:junit:4.12 net.bytebuddy:byte-buddy-agent:1.9.7 net.bytebuddy:byte-buddy:1.9.7 +net.java.dev.jna:jna-platform:5.2.0 +net.java.dev.jna:jna:5.2.0 org.apache.avro:avro:1.8.2 org.apache.beam:beam-model-job-management:2.11.0 org.apache.beam:beam-model-pipeline:2.11.0 @@ -182,7 +187,7 @@ org.apache.beam:beam-sdks-java-extensions-protobuf:2.11.0 org.apache.beam:beam-sdks-java-io-google-cloud-platform:2.11.0 org.apache.beam:beam-vendor-grpc-1_13_1:0.2 org.apache.beam:beam-vendor-guava-20_0:0.1 -org.apache.commons:commons-compress:1.8.1 +org.apache.commons:commons-compress:1.18 org.apache.commons:commons-exec:1.3 org.apache.commons:commons-lang3:3.8.1 org.apache.commons:commons-text:1.6 @@ -210,6 +215,7 @@ org.glassfish.jaxb:txw2:2.3.0 org.hamcrest:hamcrest-all:1.3 org.hamcrest:hamcrest-core:1.3 org.hamcrest:hamcrest-library:1.3 +org.jetbrains:annotations:17.0.0 org.joda:joda-money:0.10.0 org.json:json:20160810 org.jvnet.staxex:stax-ex:1.7.8 @@ -222,6 +228,10 @@ org.ow2.asm:asm-commons:6.0 org.ow2.asm:asm-tree:6.0 org.ow2.asm:asm-util:6.0 org.ow2.asm:asm:6.0 +org.rnorth.duct-tape:duct-tape:1.0.7 +org.rnorth.visible-assertions:visible-assertions:2.1.2 +org.rnorth:tcp-unix-socket-proxy:1.0.2 +org.scijava:native-lib-loader:2.0.2 org.seleniumhq.selenium:selenium-api:3.141.59 org.seleniumhq.selenium:selenium-chrome-driver:3.141.59 org.seleniumhq.selenium:selenium-edge-driver:3.141.59 @@ -232,7 +242,9 @@ org.seleniumhq.selenium:selenium-opera-driver:3.141.59 org.seleniumhq.selenium:selenium-remote-driver:3.141.59 org.seleniumhq.selenium:selenium-safari-driver:3.141.59 org.seleniumhq.selenium:selenium-support:3.141.59 -org.slf4j:slf4j-api:1.7.25 +org.slf4j:slf4j-api:1.7.26 +org.testcontainers:selenium:1.10.7 +org.testcontainers:testcontainers:1.10.7 org.threeten:threetenbp:1.3.3 org.tukaani:xz:1.8 org.w3c.css:sac:1.3 diff --git a/gradle/proxy/gradle/dependency-locks/testRuntime.lockfile b/gradle/proxy/gradle/dependency-locks/testRuntime.lockfile index 2c3af2190..8622178e9 100644 --- a/gradle/proxy/gradle/dependency-locks/testRuntime.lockfile +++ b/gradle/proxy/gradle/dependency-locks/testRuntime.lockfile @@ -116,6 +116,8 @@ com.googlecode.java-diff-utils:diffutils:1.3.0 com.googlecode.json-simple:json-simple:1.1.1 com.ibm.icu:icu4j:57.1 com.jcraft:jsch:0.1.55 +com.kohlschutter.junixsocket:junixsocket-common:2.0.4 +com.kohlschutter.junixsocket:junixsocket-native-common:2.0.4 com.squareup.okhttp3:okhttp:3.11.0 com.squareup.okhttp:okhttp:2.5.0 com.squareup.okio:okio:1.14.0 @@ -157,7 +159,8 @@ io.opencensus:opencensus-contrib-grpc-util:0.17.0 io.opencensus:opencensus-contrib-http-util:0.18.0 it.unimi.dsi:fastutil:6.5.16 javax.activation:activation:1.1 -javax.annotation:javax.annotation-api:1.2 +javax.activation:javax.activation-api:1.2.0 +javax.annotation:javax.annotation-api:1.3.2 javax.annotation:jsr250-api:1.0 javax.inject:javax.inject:1 javax.jdo:jdo2-api:2.3-eb @@ -165,12 +168,14 @@ javax.mail:mail:1.4 javax.servlet:servlet-api:2.5 javax.transaction:transaction-api:1.1 javax.validation:validation-api:1.0.0.GA -javax.xml.bind:jaxb-api:2.3.0 +javax.xml.bind:jaxb-api:2.3.1 jline:jline:1.0 joda-time:joda-time:2.9.2 junit:junit:4.12 net.bytebuddy:byte-buddy-agent:1.9.7 net.bytebuddy:byte-buddy:1.9.7 +net.java.dev.jna:jna-platform:5.2.0 +net.java.dev.jna:jna:5.2.0 org.apache.avro:avro:1.8.2 org.apache.beam:beam-model-job-management:2.11.0 org.apache.beam:beam-model-pipeline:2.11.0 @@ -183,7 +188,7 @@ org.apache.beam:beam-sdks-java-extensions-protobuf:2.11.0 org.apache.beam:beam-sdks-java-io-google-cloud-platform:2.11.0 org.apache.beam:beam-vendor-grpc-1_13_1:0.2 org.apache.beam:beam-vendor-guava-20_0:0.1 -org.apache.commons:commons-compress:1.8.1 +org.apache.commons:commons-compress:1.18 org.apache.commons:commons-exec:1.3 org.apache.commons:commons-lang3:3.8.1 org.apache.commons:commons-text:1.6 @@ -211,6 +216,7 @@ org.glassfish.jaxb:txw2:2.3.0 org.hamcrest:hamcrest-all:1.3 org.hamcrest:hamcrest-core:1.3 org.hamcrest:hamcrest-library:1.3 +org.jetbrains:annotations:17.0.0 org.joda:joda-money:0.10.0 org.json:json:20160810 org.jvnet.staxex:stax-ex:1.7.8 @@ -223,6 +229,10 @@ org.ow2.asm:asm-commons:6.0 org.ow2.asm:asm-tree:6.0 org.ow2.asm:asm-util:6.0 org.ow2.asm:asm:6.0 +org.rnorth.duct-tape:duct-tape:1.0.7 +org.rnorth.visible-assertions:visible-assertions:2.1.2 +org.rnorth:tcp-unix-socket-proxy:1.0.2 +org.scijava:native-lib-loader:2.0.2 org.seleniumhq.selenium:selenium-api:3.141.59 org.seleniumhq.selenium:selenium-chrome-driver:3.141.59 org.seleniumhq.selenium:selenium-edge-driver:3.141.59 @@ -233,7 +243,9 @@ org.seleniumhq.selenium:selenium-opera-driver:3.141.59 org.seleniumhq.selenium:selenium-remote-driver:3.141.59 org.seleniumhq.selenium:selenium-safari-driver:3.141.59 org.seleniumhq.selenium:selenium-support:3.141.59 -org.slf4j:slf4j-api:1.7.25 +org.slf4j:slf4j-api:1.7.26 +org.testcontainers:selenium:1.10.7 +org.testcontainers:testcontainers:1.10.7 org.threeten:threetenbp:1.3.3 org.tukaani:xz:1.8 org.w3c.css:sac:1.3 diff --git a/gradle/proxy/gradle/dependency-locks/testRuntimeClasspath.lockfile b/gradle/proxy/gradle/dependency-locks/testRuntimeClasspath.lockfile index 2c3af2190..8622178e9 100644 --- a/gradle/proxy/gradle/dependency-locks/testRuntimeClasspath.lockfile +++ b/gradle/proxy/gradle/dependency-locks/testRuntimeClasspath.lockfile @@ -116,6 +116,8 @@ com.googlecode.java-diff-utils:diffutils:1.3.0 com.googlecode.json-simple:json-simple:1.1.1 com.ibm.icu:icu4j:57.1 com.jcraft:jsch:0.1.55 +com.kohlschutter.junixsocket:junixsocket-common:2.0.4 +com.kohlschutter.junixsocket:junixsocket-native-common:2.0.4 com.squareup.okhttp3:okhttp:3.11.0 com.squareup.okhttp:okhttp:2.5.0 com.squareup.okio:okio:1.14.0 @@ -157,7 +159,8 @@ io.opencensus:opencensus-contrib-grpc-util:0.17.0 io.opencensus:opencensus-contrib-http-util:0.18.0 it.unimi.dsi:fastutil:6.5.16 javax.activation:activation:1.1 -javax.annotation:javax.annotation-api:1.2 +javax.activation:javax.activation-api:1.2.0 +javax.annotation:javax.annotation-api:1.3.2 javax.annotation:jsr250-api:1.0 javax.inject:javax.inject:1 javax.jdo:jdo2-api:2.3-eb @@ -165,12 +168,14 @@ javax.mail:mail:1.4 javax.servlet:servlet-api:2.5 javax.transaction:transaction-api:1.1 javax.validation:validation-api:1.0.0.GA -javax.xml.bind:jaxb-api:2.3.0 +javax.xml.bind:jaxb-api:2.3.1 jline:jline:1.0 joda-time:joda-time:2.9.2 junit:junit:4.12 net.bytebuddy:byte-buddy-agent:1.9.7 net.bytebuddy:byte-buddy:1.9.7 +net.java.dev.jna:jna-platform:5.2.0 +net.java.dev.jna:jna:5.2.0 org.apache.avro:avro:1.8.2 org.apache.beam:beam-model-job-management:2.11.0 org.apache.beam:beam-model-pipeline:2.11.0 @@ -183,7 +188,7 @@ org.apache.beam:beam-sdks-java-extensions-protobuf:2.11.0 org.apache.beam:beam-sdks-java-io-google-cloud-platform:2.11.0 org.apache.beam:beam-vendor-grpc-1_13_1:0.2 org.apache.beam:beam-vendor-guava-20_0:0.1 -org.apache.commons:commons-compress:1.8.1 +org.apache.commons:commons-compress:1.18 org.apache.commons:commons-exec:1.3 org.apache.commons:commons-lang3:3.8.1 org.apache.commons:commons-text:1.6 @@ -211,6 +216,7 @@ org.glassfish.jaxb:txw2:2.3.0 org.hamcrest:hamcrest-all:1.3 org.hamcrest:hamcrest-core:1.3 org.hamcrest:hamcrest-library:1.3 +org.jetbrains:annotations:17.0.0 org.joda:joda-money:0.10.0 org.json:json:20160810 org.jvnet.staxex:stax-ex:1.7.8 @@ -223,6 +229,10 @@ org.ow2.asm:asm-commons:6.0 org.ow2.asm:asm-tree:6.0 org.ow2.asm:asm-util:6.0 org.ow2.asm:asm:6.0 +org.rnorth.duct-tape:duct-tape:1.0.7 +org.rnorth.visible-assertions:visible-assertions:2.1.2 +org.rnorth:tcp-unix-socket-proxy:1.0.2 +org.scijava:native-lib-loader:2.0.2 org.seleniumhq.selenium:selenium-api:3.141.59 org.seleniumhq.selenium:selenium-chrome-driver:3.141.59 org.seleniumhq.selenium:selenium-edge-driver:3.141.59 @@ -233,7 +243,9 @@ org.seleniumhq.selenium:selenium-opera-driver:3.141.59 org.seleniumhq.selenium:selenium-remote-driver:3.141.59 org.seleniumhq.selenium:selenium-safari-driver:3.141.59 org.seleniumhq.selenium:selenium-support:3.141.59 -org.slf4j:slf4j-api:1.7.25 +org.slf4j:slf4j-api:1.7.26 +org.testcontainers:selenium:1.10.7 +org.testcontainers:testcontainers:1.10.7 org.threeten:threetenbp:1.3.3 org.tukaani:xz:1.8 org.w3c.css:sac:1.3 diff --git a/gradle/util/gradle/dependency-locks/testCompile.lockfile b/gradle/util/gradle/dependency-locks/testCompile.lockfile index 8e358f6cd..783a2abd1 100644 --- a/gradle/util/gradle/dependency-locks/testCompile.lockfile +++ b/gradle/util/gradle/dependency-locks/testCompile.lockfile @@ -116,6 +116,8 @@ com.googlecode.java-diff-utils:diffutils:1.3.0 com.googlecode.json-simple:json-simple:1.1.1 com.ibm.icu:icu4j:57.1 com.jcraft:jsch:0.1.55 +com.kohlschutter.junixsocket:junixsocket-common:2.0.4 +com.kohlschutter.junixsocket:junixsocket-native-common:2.0.4 com.squareup.okhttp3:okhttp:3.11.0 com.squareup.okhttp:okhttp:2.5.0 com.squareup.okio:okio:1.14.0 @@ -157,7 +159,8 @@ io.opencensus:opencensus-contrib-grpc-util:0.17.0 io.opencensus:opencensus-contrib-http-util:0.18.0 it.unimi.dsi:fastutil:6.5.16 javax.activation:activation:1.1 -javax.annotation:javax.annotation-api:1.2 +javax.activation:javax.activation-api:1.2.0 +javax.annotation:javax.annotation-api:1.3.2 javax.annotation:jsr250-api:1.0 javax.inject:javax.inject:1 javax.jdo:jdo2-api:2.3-eb @@ -165,12 +168,14 @@ javax.mail:mail:1.4 javax.servlet:servlet-api:2.5 javax.transaction:transaction-api:1.1 javax.validation:validation-api:1.0.0.GA -javax.xml.bind:jaxb-api:2.3.0 +javax.xml.bind:jaxb-api:2.3.1 jline:jline:1.0 joda-time:joda-time:2.9.2 junit:junit:4.12 net.bytebuddy:byte-buddy-agent:1.9.7 net.bytebuddy:byte-buddy:1.9.7 +net.java.dev.jna:jna-platform:5.2.0 +net.java.dev.jna:jna:5.2.0 org.apache.avro:avro:1.8.2 org.apache.beam:beam-model-job-management:2.11.0 org.apache.beam:beam-model-pipeline:2.11.0 @@ -183,7 +188,7 @@ org.apache.beam:beam-sdks-java-extensions-protobuf:2.11.0 org.apache.beam:beam-sdks-java-io-google-cloud-platform:2.11.0 org.apache.beam:beam-vendor-grpc-1_13_1:0.2 org.apache.beam:beam-vendor-guava-20_0:0.1 -org.apache.commons:commons-compress:1.8.1 +org.apache.commons:commons-compress:1.18 org.apache.commons:commons-exec:1.3 org.apache.commons:commons-lang3:3.8.1 org.apache.commons:commons-text:1.6 @@ -211,6 +216,7 @@ org.glassfish.jaxb:txw2:2.3.0 org.hamcrest:hamcrest-all:1.3 org.hamcrest:hamcrest-core:1.3 org.hamcrest:hamcrest-library:1.3 +org.jetbrains:annotations:17.0.0 org.joda:joda-money:0.10.0 org.json:json:20160810 org.jvnet.staxex:stax-ex:1.7.8 @@ -223,6 +229,10 @@ org.ow2.asm:asm-commons:6.0 org.ow2.asm:asm-tree:6.0 org.ow2.asm:asm-util:6.0 org.ow2.asm:asm:6.0 +org.rnorth.duct-tape:duct-tape:1.0.7 +org.rnorth.visible-assertions:visible-assertions:2.1.2 +org.rnorth:tcp-unix-socket-proxy:1.0.2 +org.scijava:native-lib-loader:2.0.2 org.seleniumhq.selenium:selenium-api:3.141.59 org.seleniumhq.selenium:selenium-chrome-driver:3.141.59 org.seleniumhq.selenium:selenium-edge-driver:3.141.59 @@ -233,7 +243,9 @@ org.seleniumhq.selenium:selenium-opera-driver:3.141.59 org.seleniumhq.selenium:selenium-remote-driver:3.141.59 org.seleniumhq.selenium:selenium-safari-driver:3.141.59 org.seleniumhq.selenium:selenium-support:3.141.59 -org.slf4j:slf4j-api:1.7.25 +org.slf4j:slf4j-api:1.7.26 +org.testcontainers:selenium:1.10.7 +org.testcontainers:testcontainers:1.10.7 org.threeten:threetenbp:1.3.3 org.tukaani:xz:1.8 org.w3c.css:sac:1.3 diff --git a/gradle/util/gradle/dependency-locks/testCompileClasspath.lockfile b/gradle/util/gradle/dependency-locks/testCompileClasspath.lockfile index 13c1b1369..c927960a5 100644 --- a/gradle/util/gradle/dependency-locks/testCompileClasspath.lockfile +++ b/gradle/util/gradle/dependency-locks/testCompileClasspath.lockfile @@ -116,6 +116,8 @@ com.googlecode.java-diff-utils:diffutils:1.3.0 com.googlecode.json-simple:json-simple:1.1.1 com.ibm.icu:icu4j:57.1 com.jcraft:jsch:0.1.55 +com.kohlschutter.junixsocket:junixsocket-common:2.0.4 +com.kohlschutter.junixsocket:junixsocket-native-common:2.0.4 com.squareup.okhttp3:okhttp:3.11.0 com.squareup.okhttp:okhttp:2.5.0 com.squareup.okio:okio:1.14.0 @@ -156,7 +158,8 @@ io.opencensus:opencensus-contrib-grpc-util:0.17.0 io.opencensus:opencensus-contrib-http-util:0.18.0 it.unimi.dsi:fastutil:6.5.16 javax.activation:activation:1.1 -javax.annotation:javax.annotation-api:1.2 +javax.activation:javax.activation-api:1.2.0 +javax.annotation:javax.annotation-api:1.3.2 javax.annotation:jsr250-api:1.0 javax.inject:javax.inject:1 javax.jdo:jdo2-api:2.3-eb @@ -164,12 +167,14 @@ javax.mail:mail:1.4 javax.servlet:servlet-api:2.5 javax.transaction:transaction-api:1.1 javax.validation:validation-api:1.0.0.GA -javax.xml.bind:jaxb-api:2.3.0 +javax.xml.bind:jaxb-api:2.3.1 jline:jline:1.0 joda-time:joda-time:2.9.2 junit:junit:4.12 net.bytebuddy:byte-buddy-agent:1.9.7 net.bytebuddy:byte-buddy:1.9.7 +net.java.dev.jna:jna-platform:5.2.0 +net.java.dev.jna:jna:5.2.0 org.apache.avro:avro:1.8.2 org.apache.beam:beam-model-job-management:2.11.0 org.apache.beam:beam-model-pipeline:2.11.0 @@ -182,7 +187,7 @@ org.apache.beam:beam-sdks-java-extensions-protobuf:2.11.0 org.apache.beam:beam-sdks-java-io-google-cloud-platform:2.11.0 org.apache.beam:beam-vendor-grpc-1_13_1:0.2 org.apache.beam:beam-vendor-guava-20_0:0.1 -org.apache.commons:commons-compress:1.8.1 +org.apache.commons:commons-compress:1.18 org.apache.commons:commons-exec:1.3 org.apache.commons:commons-lang3:3.8.1 org.apache.commons:commons-text:1.6 @@ -210,6 +215,7 @@ org.glassfish.jaxb:txw2:2.3.0 org.hamcrest:hamcrest-all:1.3 org.hamcrest:hamcrest-core:1.3 org.hamcrest:hamcrest-library:1.3 +org.jetbrains:annotations:17.0.0 org.joda:joda-money:0.10.0 org.json:json:20160810 org.jvnet.staxex:stax-ex:1.7.8 @@ -222,6 +228,10 @@ org.ow2.asm:asm-commons:6.0 org.ow2.asm:asm-tree:6.0 org.ow2.asm:asm-util:6.0 org.ow2.asm:asm:6.0 +org.rnorth.duct-tape:duct-tape:1.0.7 +org.rnorth.visible-assertions:visible-assertions:2.1.2 +org.rnorth:tcp-unix-socket-proxy:1.0.2 +org.scijava:native-lib-loader:2.0.2 org.seleniumhq.selenium:selenium-api:3.141.59 org.seleniumhq.selenium:selenium-chrome-driver:3.141.59 org.seleniumhq.selenium:selenium-edge-driver:3.141.59 @@ -232,7 +242,9 @@ org.seleniumhq.selenium:selenium-opera-driver:3.141.59 org.seleniumhq.selenium:selenium-remote-driver:3.141.59 org.seleniumhq.selenium:selenium-safari-driver:3.141.59 org.seleniumhq.selenium:selenium-support:3.141.59 -org.slf4j:slf4j-api:1.7.25 +org.slf4j:slf4j-api:1.7.26 +org.testcontainers:selenium:1.10.7 +org.testcontainers:testcontainers:1.10.7 org.threeten:threetenbp:1.3.3 org.tukaani:xz:1.8 org.w3c.css:sac:1.3 diff --git a/gradle/util/gradle/dependency-locks/testRuntime.lockfile b/gradle/util/gradle/dependency-locks/testRuntime.lockfile index 8e358f6cd..783a2abd1 100644 --- a/gradle/util/gradle/dependency-locks/testRuntime.lockfile +++ b/gradle/util/gradle/dependency-locks/testRuntime.lockfile @@ -116,6 +116,8 @@ com.googlecode.java-diff-utils:diffutils:1.3.0 com.googlecode.json-simple:json-simple:1.1.1 com.ibm.icu:icu4j:57.1 com.jcraft:jsch:0.1.55 +com.kohlschutter.junixsocket:junixsocket-common:2.0.4 +com.kohlschutter.junixsocket:junixsocket-native-common:2.0.4 com.squareup.okhttp3:okhttp:3.11.0 com.squareup.okhttp:okhttp:2.5.0 com.squareup.okio:okio:1.14.0 @@ -157,7 +159,8 @@ io.opencensus:opencensus-contrib-grpc-util:0.17.0 io.opencensus:opencensus-contrib-http-util:0.18.0 it.unimi.dsi:fastutil:6.5.16 javax.activation:activation:1.1 -javax.annotation:javax.annotation-api:1.2 +javax.activation:javax.activation-api:1.2.0 +javax.annotation:javax.annotation-api:1.3.2 javax.annotation:jsr250-api:1.0 javax.inject:javax.inject:1 javax.jdo:jdo2-api:2.3-eb @@ -165,12 +168,14 @@ javax.mail:mail:1.4 javax.servlet:servlet-api:2.5 javax.transaction:transaction-api:1.1 javax.validation:validation-api:1.0.0.GA -javax.xml.bind:jaxb-api:2.3.0 +javax.xml.bind:jaxb-api:2.3.1 jline:jline:1.0 joda-time:joda-time:2.9.2 junit:junit:4.12 net.bytebuddy:byte-buddy-agent:1.9.7 net.bytebuddy:byte-buddy:1.9.7 +net.java.dev.jna:jna-platform:5.2.0 +net.java.dev.jna:jna:5.2.0 org.apache.avro:avro:1.8.2 org.apache.beam:beam-model-job-management:2.11.0 org.apache.beam:beam-model-pipeline:2.11.0 @@ -183,7 +188,7 @@ org.apache.beam:beam-sdks-java-extensions-protobuf:2.11.0 org.apache.beam:beam-sdks-java-io-google-cloud-platform:2.11.0 org.apache.beam:beam-vendor-grpc-1_13_1:0.2 org.apache.beam:beam-vendor-guava-20_0:0.1 -org.apache.commons:commons-compress:1.8.1 +org.apache.commons:commons-compress:1.18 org.apache.commons:commons-exec:1.3 org.apache.commons:commons-lang3:3.8.1 org.apache.commons:commons-text:1.6 @@ -211,6 +216,7 @@ org.glassfish.jaxb:txw2:2.3.0 org.hamcrest:hamcrest-all:1.3 org.hamcrest:hamcrest-core:1.3 org.hamcrest:hamcrest-library:1.3 +org.jetbrains:annotations:17.0.0 org.joda:joda-money:0.10.0 org.json:json:20160810 org.jvnet.staxex:stax-ex:1.7.8 @@ -223,6 +229,10 @@ org.ow2.asm:asm-commons:6.0 org.ow2.asm:asm-tree:6.0 org.ow2.asm:asm-util:6.0 org.ow2.asm:asm:6.0 +org.rnorth.duct-tape:duct-tape:1.0.7 +org.rnorth.visible-assertions:visible-assertions:2.1.2 +org.rnorth:tcp-unix-socket-proxy:1.0.2 +org.scijava:native-lib-loader:2.0.2 org.seleniumhq.selenium:selenium-api:3.141.59 org.seleniumhq.selenium:selenium-chrome-driver:3.141.59 org.seleniumhq.selenium:selenium-edge-driver:3.141.59 @@ -233,7 +243,9 @@ org.seleniumhq.selenium:selenium-opera-driver:3.141.59 org.seleniumhq.selenium:selenium-remote-driver:3.141.59 org.seleniumhq.selenium:selenium-safari-driver:3.141.59 org.seleniumhq.selenium:selenium-support:3.141.59 -org.slf4j:slf4j-api:1.7.25 +org.slf4j:slf4j-api:1.7.26 +org.testcontainers:selenium:1.10.7 +org.testcontainers:testcontainers:1.10.7 org.threeten:threetenbp:1.3.3 org.tukaani:xz:1.8 org.w3c.css:sac:1.3 diff --git a/gradle/util/gradle/dependency-locks/testRuntimeClasspath.lockfile b/gradle/util/gradle/dependency-locks/testRuntimeClasspath.lockfile index 8e358f6cd..783a2abd1 100644 --- a/gradle/util/gradle/dependency-locks/testRuntimeClasspath.lockfile +++ b/gradle/util/gradle/dependency-locks/testRuntimeClasspath.lockfile @@ -116,6 +116,8 @@ com.googlecode.java-diff-utils:diffutils:1.3.0 com.googlecode.json-simple:json-simple:1.1.1 com.ibm.icu:icu4j:57.1 com.jcraft:jsch:0.1.55 +com.kohlschutter.junixsocket:junixsocket-common:2.0.4 +com.kohlschutter.junixsocket:junixsocket-native-common:2.0.4 com.squareup.okhttp3:okhttp:3.11.0 com.squareup.okhttp:okhttp:2.5.0 com.squareup.okio:okio:1.14.0 @@ -157,7 +159,8 @@ io.opencensus:opencensus-contrib-grpc-util:0.17.0 io.opencensus:opencensus-contrib-http-util:0.18.0 it.unimi.dsi:fastutil:6.5.16 javax.activation:activation:1.1 -javax.annotation:javax.annotation-api:1.2 +javax.activation:javax.activation-api:1.2.0 +javax.annotation:javax.annotation-api:1.3.2 javax.annotation:jsr250-api:1.0 javax.inject:javax.inject:1 javax.jdo:jdo2-api:2.3-eb @@ -165,12 +168,14 @@ javax.mail:mail:1.4 javax.servlet:servlet-api:2.5 javax.transaction:transaction-api:1.1 javax.validation:validation-api:1.0.0.GA -javax.xml.bind:jaxb-api:2.3.0 +javax.xml.bind:jaxb-api:2.3.1 jline:jline:1.0 joda-time:joda-time:2.9.2 junit:junit:4.12 net.bytebuddy:byte-buddy-agent:1.9.7 net.bytebuddy:byte-buddy:1.9.7 +net.java.dev.jna:jna-platform:5.2.0 +net.java.dev.jna:jna:5.2.0 org.apache.avro:avro:1.8.2 org.apache.beam:beam-model-job-management:2.11.0 org.apache.beam:beam-model-pipeline:2.11.0 @@ -183,7 +188,7 @@ org.apache.beam:beam-sdks-java-extensions-protobuf:2.11.0 org.apache.beam:beam-sdks-java-io-google-cloud-platform:2.11.0 org.apache.beam:beam-vendor-grpc-1_13_1:0.2 org.apache.beam:beam-vendor-guava-20_0:0.1 -org.apache.commons:commons-compress:1.8.1 +org.apache.commons:commons-compress:1.18 org.apache.commons:commons-exec:1.3 org.apache.commons:commons-lang3:3.8.1 org.apache.commons:commons-text:1.6 @@ -211,6 +216,7 @@ org.glassfish.jaxb:txw2:2.3.0 org.hamcrest:hamcrest-all:1.3 org.hamcrest:hamcrest-core:1.3 org.hamcrest:hamcrest-library:1.3 +org.jetbrains:annotations:17.0.0 org.joda:joda-money:0.10.0 org.json:json:20160810 org.jvnet.staxex:stax-ex:1.7.8 @@ -223,6 +229,10 @@ org.ow2.asm:asm-commons:6.0 org.ow2.asm:asm-tree:6.0 org.ow2.asm:asm-util:6.0 org.ow2.asm:asm:6.0 +org.rnorth.duct-tape:duct-tape:1.0.7 +org.rnorth.visible-assertions:visible-assertions:2.1.2 +org.rnorth:tcp-unix-socket-proxy:1.0.2 +org.scijava:native-lib-loader:2.0.2 org.seleniumhq.selenium:selenium-api:3.141.59 org.seleniumhq.selenium:selenium-chrome-driver:3.141.59 org.seleniumhq.selenium:selenium-edge-driver:3.141.59 @@ -233,7 +243,9 @@ org.seleniumhq.selenium:selenium-opera-driver:3.141.59 org.seleniumhq.selenium:selenium-remote-driver:3.141.59 org.seleniumhq.selenium:selenium-safari-driver:3.141.59 org.seleniumhq.selenium:selenium-support:3.141.59 -org.slf4j:slf4j-api:1.7.25 +org.slf4j:slf4j-api:1.7.26 +org.testcontainers:selenium:1.10.7 +org.testcontainers:testcontainers:1.10.7 org.threeten:threetenbp:1.3.3 org.tukaani:xz:1.8 org.w3c.css:sac:1.3 diff --git a/java/google/registry/util/NetworkUtils.java b/java/google/registry/util/NetworkUtils.java index 33e018fed..42ab53e17 100644 --- a/java/google/registry/util/NetworkUtils.java +++ b/java/google/registry/util/NetworkUtils.java @@ -82,16 +82,16 @@ public final class NetworkUtils { /** * Returns the externally-facing IPv4 network address of the local host. * - *

This function implements a workaround for an - * issue in - * {@link InetAddress#getLocalHost}. + *

This function implements a workaround for an issue in {@link + * InetAddress#getLocalHost}. * *

Note: This code was pilfered from {@link "com.google.net.base.LocalHost"} which was * never made open source. * * @throws UnknownHostException if the local host could not be resolved into an address */ - private static InetAddress getExternalAddressOfLocalSystem() throws UnknownHostException { + public static InetAddress getExternalAddressOfLocalSystem() throws UnknownHostException { InetAddress localhost = InetAddress.getLocalHost(); // If we have a loopback address, look for an address using the network cards. if (localhost.isLoopbackAddress()) { diff --git a/javatests/google/registry/server/UrlChecker.java b/java/google/registry/util/UrlChecker.java similarity index 91% rename from javatests/google/registry/server/UrlChecker.java rename to java/google/registry/util/UrlChecker.java index d6ff64824..dce1d99f5 100644 --- a/javatests/google/registry/server/UrlChecker.java +++ b/java/google/registry/util/UrlChecker.java @@ -12,7 +12,7 @@ // See the License for the specific language governing permissions and // limitations under the License. -package google.registry.server; +package google.registry.util; import static com.google.common.base.Throwables.throwIfUnchecked; import static java.util.concurrent.Executors.newCachedThreadPool; @@ -23,13 +23,14 @@ import java.net.HttpURLConnection; import java.net.URL; import java.util.concurrent.TimeUnit; -final class UrlChecker { +/** An utility to probe a given url until it becomes available. */ +public final class UrlChecker { private static final int READ_TIMEOUT_MS = 1000; private static final int CONNECT_TIMEOUT_MS = 500; /** Probes {@code url} until it becomes available. */ - static void waitUntilAvailable(final URL url, int timeoutMs) { + public static void waitUntilAvailable(final URL url, int timeoutMs) { try { Void unusedReturnValue = SimpleTimeLimiter.create(newCachedThreadPool()) .callWithTimeout( diff --git a/javatests/google/registry/server/BUILD b/javatests/google/registry/server/BUILD index 30a630d1a..094dadd1e 100644 --- a/javatests/google/registry/server/BUILD +++ b/javatests/google/registry/server/BUILD @@ -13,7 +13,6 @@ java_library( "ServletWrapperDelegatorServlet.java", "StaticResourceServlet.java", "TestServer.java", - "UrlChecker.java", ], visibility = ["//visibility:public"], deps = [ diff --git a/javatests/google/registry/server/TestServer.java b/javatests/google/registry/server/TestServer.java index 425ee5abe..21db930c0 100644 --- a/javatests/google/registry/server/TestServer.java +++ b/javatests/google/registry/server/TestServer.java @@ -24,6 +24,7 @@ import com.google.common.collect.ImmutableList; import com.google.common.collect.ImmutableMap; import com.google.common.net.HostAndPort; import com.google.common.util.concurrent.SimpleTimeLimiter; +import google.registry.util.UrlChecker; import java.net.MalformedURLException; import java.net.URL; import java.nio.file.Path; diff --git a/javatests/google/registry/webdriver/DockerWebDriverRule.java b/javatests/google/registry/webdriver/DockerWebDriverRule.java new file mode 100644 index 000000000..73400f044 --- /dev/null +++ b/javatests/google/registry/webdriver/DockerWebDriverRule.java @@ -0,0 +1,84 @@ +// Copyright 2019 The Nomulus Authors. All Rights Reserved. +// +// 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 google.registry.webdriver; + +import static com.google.common.base.Preconditions.checkNotNull; + +import google.registry.util.UrlChecker; +import java.net.MalformedURLException; +import java.net.URL; +import java.time.Duration; +import java.time.temporal.ChronoUnit; +import org.junit.rules.ExternalResource; +import org.openqa.selenium.WebDriver; +import org.openqa.selenium.chrome.ChromeOptions; +import org.openqa.selenium.remote.RemoteWebDriver; +import org.testcontainers.containers.BindMode; +import org.testcontainers.containers.GenericContainer; +import org.testcontainers.containers.wait.strategy.Wait; + +/** JUnit rule for managing Docker container used by WebDriver tests. */ +class DockerWebDriverRule extends ExternalResource { + + // This port number is defined in this Dockerfile: + // https://github.com/SeleniumHQ/docker-selenium/blob/master/StandaloneChrome/Dockerfile#L21 + private static final int CHROME_DRIVER_SERVICE_PORT = 4444; + private static final URL WEB_DRIVER_URL = getWebDriverUrl(); + private WebDriver webDriver; + + private static URL getWebDriverUrl() { + GenericContainer container = + new GenericContainer("selenium/standalone-chrome") + .withFileSystemBind("/dev/shm", "/dev/shm", BindMode.READ_WRITE) + .withExposedPorts(CHROME_DRIVER_SERVICE_PORT) + .waitingFor(Wait.forHttp("/").withStartupTimeout(Duration.of(20, ChronoUnit.SECONDS))); + container.start(); + URL url; + try { + url = + new URL( + String.format( + "http://localhost:%d/wd/hub", + container.getMappedPort(CHROME_DRIVER_SERVICE_PORT))); + } catch (MalformedURLException e) { + throw new IllegalArgumentException(e); + } + UrlChecker.waitUntilAvailable(url, 20000); + return url; + } + + @Override + protected void before() { + ChromeOptions chromeOptions = new ChromeOptions().setHeadless(true); + webDriver = new RemoteWebDriver(WEB_DRIVER_URL, chromeOptions); + } + + @Override + protected void after() { + try { + webDriver.quit(); + } finally { + webDriver = null; + } + } + + /** + * Returns {@link WebDriver} instance connected to the {@link + * org.openqa.selenium.chrome.ChromeDriverService} running in the container. + */ + public WebDriver getWebDriver() { + return checkNotNull(webDriver); + } +} diff --git a/javatests/google/registry/webdriver/OteSetupConsoleScreenshotTest.java b/javatests/google/registry/webdriver/OteSetupConsoleScreenshotTest.java index 17cd0b09d..ea63969f2 100644 --- a/javatests/google/registry/webdriver/OteSetupConsoleScreenshotTest.java +++ b/javatests/google/registry/webdriver/OteSetupConsoleScreenshotTest.java @@ -21,7 +21,6 @@ import com.googlecode.objectify.ObjectifyFilter; import google.registry.model.ofy.OfyFilter; import google.registry.module.frontend.FrontendServlet; import google.registry.server.RegistryTestServer; -import google.registry.webdriver.RepeatableRunner.AttemptNumber; import org.junit.Rule; import org.junit.Test; import org.junit.runner.RunWith; @@ -29,7 +28,7 @@ import org.openqa.selenium.By; /** Registrar Console Screenshot Differ tests. */ @RunWith(RepeatableRunner.class) -public class OteSetupConsoleScreenshotTest { +public class OteSetupConsoleScreenshotTest extends WebDriverTestCase { @Rule public final TestServerRule server = @@ -41,9 +40,6 @@ public class OteSetupConsoleScreenshotTest { .setEmail("Marla.Singer@google.com") .build(); - private final AttemptNumber attemptNumber = new AttemptNumber(); - @Rule public final WebDriverRule driver = new WebDriverRule(attemptNumber); - @Test public void get_owner_fails() throws Throwable { driver.get(server.getUrl("/registrar-ote-setup")); diff --git a/javatests/google/registry/webdriver/RegistrarConsoleScreenshotTest.java b/javatests/google/registry/webdriver/RegistrarConsoleScreenshotTest.java index 21291eb47..7e97e3fbb 100644 --- a/javatests/google/registry/webdriver/RegistrarConsoleScreenshotTest.java +++ b/javatests/google/registry/webdriver/RegistrarConsoleScreenshotTest.java @@ -27,7 +27,6 @@ import google.registry.model.registrar.Registrar.State; import google.registry.module.frontend.FrontendServlet; import google.registry.server.RegistryTestServer; import google.registry.testing.CertificateSamples; -import google.registry.webdriver.RepeatableRunner.AttemptNumber; import org.junit.Rule; import org.junit.Test; import org.junit.runner.RunWith; @@ -36,7 +35,7 @@ import org.openqa.selenium.Dimension; /** Registrar Console Screenshot Differ tests. */ @RunWith(RepeatableRunner.class) -public class RegistrarConsoleScreenshotTest { +public class RegistrarConsoleScreenshotTest extends WebDriverTestCase { @Rule public final TestServerRule server = @@ -51,9 +50,6 @@ public class RegistrarConsoleScreenshotTest { .setEmail("Marla.Singer@google.com") .build(); - private final AttemptNumber attemptNumber = new AttemptNumber(); - @Rule public final WebDriverRule driver = new WebDriverRule(attemptNumber); - @Test public void index_owner() throws Throwable { driver.get(server.getUrl("/registrar")); diff --git a/javatests/google/registry/webdriver/RegistrarConsoleWebTest.java b/javatests/google/registry/webdriver/RegistrarConsoleWebTest.java index 218a1108b..66e1b4036 100644 --- a/javatests/google/registry/webdriver/RegistrarConsoleWebTest.java +++ b/javatests/google/registry/webdriver/RegistrarConsoleWebTest.java @@ -29,7 +29,6 @@ import google.registry.model.registrar.RegistrarContact; import google.registry.module.frontend.FrontendServlet; import google.registry.server.RegistryTestServer; import google.registry.testing.AppEngineRule; -import google.registry.webdriver.RepeatableRunner.AttemptNumber; import org.junit.Rule; import org.junit.Test; import org.junit.rules.Timeout; @@ -38,7 +37,7 @@ import org.openqa.selenium.By; /** WebDriver tests for Registrar Console UI. */ @RunWith(RepeatableRunner.class) -public class RegistrarConsoleWebTest { +public class RegistrarConsoleWebTest extends WebDriverTestCase { @Rule public final AppEngineRule appEngine = AppEngineRule.builder() @@ -59,8 +58,6 @@ public class RegistrarConsoleWebTest { .setEmail("Marla.Singer@google.com") .build(); - private final AttemptNumber attemptNumber = new AttemptNumber(); - @Rule public final WebDriverRule driver = new WebDriverRule(attemptNumber); @Rule public final Timeout deathClock = new Timeout(60000); diff --git a/javatests/google/registry/webdriver/RegistrarCreateConsoleScreenshotTest.java b/javatests/google/registry/webdriver/RegistrarCreateConsoleScreenshotTest.java index 3cf973a2e..8205aacb8 100644 --- a/javatests/google/registry/webdriver/RegistrarCreateConsoleScreenshotTest.java +++ b/javatests/google/registry/webdriver/RegistrarCreateConsoleScreenshotTest.java @@ -21,7 +21,6 @@ import com.googlecode.objectify.ObjectifyFilter; import google.registry.model.ofy.OfyFilter; import google.registry.module.frontend.FrontendServlet; import google.registry.server.RegistryTestServer; -import google.registry.webdriver.RepeatableRunner.AttemptNumber; import org.junit.Rule; import org.junit.Test; import org.junit.runner.RunWith; @@ -29,7 +28,7 @@ import org.openqa.selenium.By; /** Registrar Console Screenshot Differ tests. */ @RunWith(RepeatableRunner.class) -public class RegistrarCreateConsoleScreenshotTest { +public class RegistrarCreateConsoleScreenshotTest extends WebDriverTestCase { @Rule public final TestServerRule server = @@ -41,9 +40,6 @@ public class RegistrarCreateConsoleScreenshotTest { .setEmail("Marla.Singer@google.com") .build(); - private final AttemptNumber attemptNumber = new AttemptNumber(); - @Rule public final WebDriverRule driver = new WebDriverRule(attemptNumber); - @Test public void get_owner_fails() throws Throwable { driver.get(server.getUrl("/registrar-create")); diff --git a/javatests/google/registry/webdriver/RepeatableRunner.java b/javatests/google/registry/webdriver/RepeatableRunner.java index 76251ea92..53536bafb 100644 --- a/javatests/google/registry/webdriver/RepeatableRunner.java +++ b/javatests/google/registry/webdriver/RepeatableRunner.java @@ -20,7 +20,7 @@ import com.google.common.flogger.FluentLogger; import java.lang.reflect.Field; import java.util.List; import java.util.stream.Collectors; -import java.util.stream.Stream; +import org.apache.commons.lang3.reflect.FieldUtils; import org.junit.runners.BlockJUnit4ClassRunner; import org.junit.runners.model.FrameworkMethod; import org.junit.runners.model.InitializationError; @@ -68,7 +68,7 @@ public class RepeatableRunner extends BlockJUnit4ClassRunner { private Field getAttemptNumberField() { List attemptNumberFields = - Stream.of(getTestClass().getJavaClass().getDeclaredFields()) + FieldUtils.getAllFieldsList(getTestClass().getJavaClass()).stream() .filter(declaredField -> declaredField.getType().equals(AttemptNumber.class)) .collect(Collectors.toList()); @@ -163,7 +163,11 @@ public class RepeatableRunner extends BlockJUnit4ClassRunner { if (numSuccess == 0) { logger.atSevere().log( "[%s] didn't pass after all %d attempts failed!\n", method.getName(), MAX_ATTEMPTS); - throw lastException; + // In most cases, setting RUN_ALL_ATTEMPTS to true is to find the golden image, so we should + // not throw an exception to reduce confusion + if (!RUN_ALL_ATTEMPTS) { + throw lastException; + } } } } diff --git a/javatests/google/registry/webdriver/WebDriverPlusScreenDiffer.java b/javatests/google/registry/webdriver/ScreenDiffer.java similarity index 87% rename from javatests/google/registry/webdriver/WebDriverPlusScreenDiffer.java rename to javatests/google/registry/webdriver/ScreenDiffer.java index 3064b6de8..0842b21c1 100644 --- a/javatests/google/registry/webdriver/WebDriverPlusScreenDiffer.java +++ b/javatests/google/registry/webdriver/ScreenDiffer.java @@ -14,17 +14,10 @@ package google.registry.webdriver; -import org.openqa.selenium.WebDriver; import org.openqa.selenium.WebElement; -/** - * Interface to provide the implementation of {@link org.openqa.selenium.WebDriver} and APIs to - * compare screenshots for visual regression tests. - */ -interface WebDriverPlusScreenDiffer { - - /** Gets the implementation of {@link org.openqa.selenium.WebDriver}. */ - WebDriver getWebDriver(); +/** Interface to provide APIs to compare screenshots for visual regression tests. */ +interface ScreenDiffer { /** * Checks that the screenshot of the element matches the golden image by pixel comparison. {@link diff --git a/javatests/google/registry/webdriver/TestServerRule.java b/javatests/google/registry/webdriver/TestServerRule.java index cb021381f..aa4b96839 100644 --- a/javatests/google/registry/webdriver/TestServerRule.java +++ b/javatests/google/registry/webdriver/TestServerRule.java @@ -17,6 +17,7 @@ package google.registry.webdriver; import static com.google.common.base.Preconditions.checkArgument; import static com.google.common.base.Preconditions.checkNotNull; import static google.registry.testing.AppEngineRule.THE_REGISTRAR_GAE_USER_ID; +import static google.registry.util.NetworkUtils.getExternalAddressOfLocalSystem; import static google.registry.util.NetworkUtils.pickUnusedPort; import com.google.common.collect.ImmutableList; @@ -29,6 +30,7 @@ import google.registry.server.TestServer; import google.registry.testing.AppEngineRule; import google.registry.testing.UserInfo; import java.net.URL; +import java.net.UnknownHostException; import java.nio.file.Path; import java.util.concurrent.BlockingQueue; import java.util.concurrent.Callable; @@ -72,11 +74,19 @@ public final class TestServerRule extends ExternalResource { .withTaskQueue() .withUserService(UserInfo.createAdmin(email, THE_REGISTRAR_GAE_USER_ID)) .build(); - this.testServer = new TestServer( - HostAndPort.fromParts("localhost", pickUnusedPort()), - runfiles, - routes, - filters); + try { + this.testServer = + new TestServer( + HostAndPort.fromParts( + // Use external IP address here so the browser running inside Docker container + // can access this server. + getExternalAddressOfLocalSystem().getHostAddress(), pickUnusedPort()), + runfiles, + routes, + filters); + } catch (UnknownHostException e) { + throw new IllegalStateException(e); + } } @Override diff --git a/javatests/google/registry/webdriver/WebDriverRule.java b/javatests/google/registry/webdriver/WebDriverPlusScreenDifferRule.java similarity index 90% rename from javatests/google/registry/webdriver/WebDriverRule.java rename to javatests/google/registry/webdriver/WebDriverPlusScreenDifferRule.java index 12cf3e7a4..bfa368aae 100644 --- a/javatests/google/registry/webdriver/WebDriverRule.java +++ b/javatests/google/registry/webdriver/WebDriverPlusScreenDifferRule.java @@ -15,10 +15,10 @@ package google.registry.webdriver; import static com.google.common.io.Resources.getResource; -import static com.google.common.base.Preconditions.checkNotNull; import static java.util.stream.Collectors.joining; import static org.apache.commons.text.StringEscapeUtils.escapeEcmaScript; +import com.google.common.base.Preconditions; import google.registry.webdriver.RepeatableRunner.AttemptNumber; import java.net.URL; import java.util.List; @@ -44,8 +44,11 @@ import org.openqa.selenium.interactions.Keyboard; import org.openqa.selenium.interactions.Mouse; import org.openqa.selenium.remote.DesiredCapabilities; -/** WebDriver delegate JUnit Rule that sends Sponge a screenshot on failure. */ -public final class WebDriverRule extends ExternalResource +/** + * WebDriver delegate JUnit Rule that exposes most {@link WebDriver} API plus {@link ScreenDiffer} + * API. + */ +public final class WebDriverPlusScreenDifferRule extends ExternalResource implements WebDriver, HasInputDevices, TakesScreenshot, JavascriptExecutor, HasCapabilities { private static final int WAIT_FOR_ELEMENTS_POLLING_INTERVAL_MS = 10; @@ -67,19 +70,20 @@ public final class WebDriverRule extends ExternalResource private static final Dimension DEFAULT_WINDOW_SIZE = new Dimension(1200, 2000); private static final String GOLDENS_PATH = - getResource(WebDriverRule.class, "goldens/chrome-linux").getFile(); + getResource(WebDriverPlusScreenDifferRule.class, "goldens/chrome-linux").getFile(); - private AttemptNumber attemptNumber; + private WebDriverProvider webDriverProvider; private WebDriver driver; - private WebDriverPlusScreenDiffer webDriverPlusScreenDiffer; + private ScreenDiffer webDriverPlusScreenDiffer; + private AttemptNumber attemptNumber; // Prefix to use for golden image files, will be set to ClassName_MethodName once the test // starts. Will be added a user-given imageKey as a suffix, and of course a '.png' at the end. private String imageNamePrefix = null; - /** Constructs a {@link WebDriverRule} instance. */ - public WebDriverRule(AttemptNumber attemptNumber) { - this.attemptNumber = attemptNumber; + @FunctionalInterface + public interface WebDriverProvider { + WebDriver getWebDriver(); } @Override @@ -94,11 +98,18 @@ public final class WebDriverRule extends ExternalResource return super.apply(base, description); } + /** Constructs a {@link WebDriverPlusScreenDifferRule} instance. */ + public WebDriverPlusScreenDifferRule( + WebDriverProvider webDriverProvider, AttemptNumber attemptNumber) { + this.webDriverProvider = webDriverProvider; + this.attemptNumber = attemptNumber; + } + @Override protected void before() { + driver = webDriverProvider.getWebDriver(); webDriverPlusScreenDiffer = - new ChromeWebDriverPlusScreenDiffer(GOLDENS_PATH, MAX_COLOR_DIFF, MAX_PIXEL_DIFF); - driver = webDriverPlusScreenDiffer.getWebDriver(); + new WebDriverScreenDiffer(driver, GOLDENS_PATH, MAX_COLOR_DIFF, MAX_PIXEL_DIFF); // non-zero timeout so findByElement will wait for the element to appear driver.manage().timeouts().implicitlyWait(5, TimeUnit.SECONDS); driver.manage().window().setSize(DEFAULT_WINDOW_SIZE); @@ -106,12 +117,7 @@ public final class WebDriverRule extends ExternalResource @Override protected void after() { - try { - webDriverPlusScreenDiffer.verifyAndQuit(); - } finally { - driver.quit(); - driver = null; - } + webDriverPlusScreenDiffer.verifyAndQuit(); } /** @see #get(String) */ @@ -298,7 +304,7 @@ public final class WebDriverRule extends ExternalResource } private String getUniqueName(String imageKey) { - checkNotNull(imageNamePrefix); + Preconditions.checkNotNull(imageNamePrefix); return imageNamePrefix + "_" + imageKey; } } diff --git a/javatests/google/registry/webdriver/ChromeWebDriverPlusScreenDiffer.java b/javatests/google/registry/webdriver/WebDriverScreenDiffer.java similarity index 86% rename from javatests/google/registry/webdriver/ChromeWebDriverPlusScreenDiffer.java rename to javatests/google/registry/webdriver/WebDriverScreenDiffer.java index 9c8b2d102..2cc10c629 100644 --- a/javatests/google/registry/webdriver/ChromeWebDriverPlusScreenDiffer.java +++ b/javatests/google/registry/webdriver/WebDriverScreenDiffer.java @@ -15,7 +15,6 @@ package google.registry.webdriver; import static com.google.common.base.Preconditions.checkArgument; -import static com.google.common.base.Preconditions.checkNotNull; import static java.lang.Math.abs; import static java.util.stream.Collectors.joining; @@ -27,8 +26,6 @@ import java.awt.image.BufferedImage; import java.io.File; import java.io.IOException; import java.io.UncheckedIOException; -import java.net.MalformedURLException; -import java.net.URL; import java.nio.file.Path; import java.nio.file.Paths; import java.util.List; @@ -39,18 +36,11 @@ import org.openqa.selenium.OutputType; import org.openqa.selenium.TakesScreenshot; import org.openqa.selenium.WebDriver; import org.openqa.selenium.WebElement; -import org.openqa.selenium.chrome.ChromeDriver; -import org.openqa.selenium.chrome.ChromeOptions; -import org.openqa.selenium.remote.RemoteWebDriver; -/** Implementation of {@link WebDriverPlusScreenDiffer} that uses {@link ChromeDriver}. */ -class ChromeWebDriverPlusScreenDiffer implements WebDriverPlusScreenDiffer { +/** Implementation of {@link ScreenDiffer} that uses {@link WebDriver}. */ +class WebDriverScreenDiffer implements ScreenDiffer { private static final FluentLogger logger = FluentLogger.forEnclosingClass(); - // Url address to the remote Webdriver service. In this case, we use - // Docker to provision the service and it is configured in core/build.gradle - private static final String CHROME_DRIVER_SERVICE_URL = - checkNotNull(System.getProperty("webdriver.chromeDriverServiceUrl")); private final WebDriver webDriver; private final String goldensPath; @@ -60,24 +50,15 @@ class ChromeWebDriverPlusScreenDiffer implements WebDriverPlusScreenDiffer { private String screenshotDir = System.getProperty("test.screenshot.dir", "build/screenshots"); - public ChromeWebDriverPlusScreenDiffer(String goldensPath, int maxColorDiff, int maxPixelDiff) { - this.webDriver = createChromeDriver(); + public WebDriverScreenDiffer( + WebDriver webDriver, String goldensPath, int maxColorDiff, int maxPixelDiff) { + this.webDriver = webDriver; this.goldensPath = goldensPath; this.maxColorDiff = maxColorDiff; this.maxPixelDiff = maxPixelDiff; this.actualScreenshots = Lists.newArrayList(); } - private WebDriver createChromeDriver() { - ChromeOptions chromeOptions = new ChromeOptions(); - chromeOptions.setHeadless(true); - try { - return new RemoteWebDriver(new URL(CHROME_DRIVER_SERVICE_URL), chromeOptions); - } catch (MalformedURLException e) { - throw new IllegalArgumentException(e); - } - } - @AutoValue abstract static class ComparisonResult { abstract ActualScreenshot actualScreenshot(); @@ -91,7 +72,7 @@ class ChromeWebDriverPlusScreenDiffer implements WebDriverPlusScreenDiffer { abstract int numDiffPixels(); static Builder builder() { - return new AutoValue_ChromeWebDriverPlusScreenDiffer_ComparisonResult.Builder(); + return new AutoValue_WebDriverScreenDiffer_ComparisonResult.Builder(); } @AutoValue.Builder @@ -116,11 +97,6 @@ class ChromeWebDriverPlusScreenDiffer implements WebDriverPlusScreenDiffer { } } - @Override - public WebDriver getWebDriver() { - return webDriver; - } - @Override public void diffElement(WebElement element, String imageKey, int attempt) { ActualScreenshot elementImage = diff --git a/javatests/google/registry/webdriver/WebDriverTestCase.java b/javatests/google/registry/webdriver/WebDriverTestCase.java new file mode 100644 index 000000000..70c0a385e --- /dev/null +++ b/javatests/google/registry/webdriver/WebDriverTestCase.java @@ -0,0 +1,30 @@ +// Copyright 2019 The Nomulus Authors. All Rights Reserved. +// +// 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 google.registry.webdriver; + +import google.registry.webdriver.RepeatableRunner.AttemptNumber; +import org.junit.ClassRule; +import org.junit.Rule; + +/** Base class for tests that needs a {@link WebDriverPlusScreenDifferRule}. */ +public class WebDriverTestCase { + @ClassRule + public static final DockerWebDriverRule webDriverProvider = new DockerWebDriverRule(); + public final AttemptNumber attemptNumber = new AttemptNumber(); + + @Rule + public final WebDriverPlusScreenDifferRule driver = + new WebDriverPlusScreenDifferRule(webDriverProvider::getWebDriver, attemptNumber); +}