From cf093bcd964183e7cf4066c7a428a832f1c5b15b Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 12 Nov 2024 18:06:58 +0000 Subject: [PATCH 1/4] chore(deps): bump org.seleniumhq.selenium:selenium-chrome-driver Bumps [org.seleniumhq.selenium:selenium-chrome-driver](https://github.com/SeleniumHQ/selenium) from 4.4.0 to 4.26.0. - [Release notes](https://github.com/SeleniumHQ/selenium/releases) - [Commits](https://github.com/SeleniumHQ/selenium/compare/selenium-4.4.0...selenium-4.26.0) --- updated-dependencies: - dependency-name: org.seleniumhq.selenium:selenium-chrome-driver dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] --- build.gradle.kts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build.gradle.kts b/build.gradle.kts index 2c1f0aa4d0..71c529eff5 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -222,7 +222,7 @@ dependencies { exclude(group = "org.slf4j") } testImplementation("org.seleniumhq.selenium:selenium-support:4.4.0") - testImplementation("org.seleniumhq.selenium:selenium-chrome-driver:4.4.0") + testImplementation("org.seleniumhq.selenium:selenium-chrome-driver:4.26.0") testImplementation("org.mockftpserver:MockFtpServer:3.2.0") testImplementation("org.springframework.ldap:spring-ldap-test") testImplementation("com.unboundid:unboundid-ldapsdk:6.0.5") From 53d00139e4652cfd89249467cdb76b19acd0a7d8 Mon Sep 17 00:00:00 2001 From: Deep Sidhu Date: Thu, 14 Nov 2024 14:26:56 -0600 Subject: [PATCH 2/4] Updated to use org.seleniumhq.selenium:selenium-java:4.4.0 --- build.gradle.kts | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/build.gradle.kts b/build.gradle.kts index 71c529eff5..dd52bc74e2 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -221,8 +221,7 @@ dependencies { testImplementation("org.dbunit:dbunit:2.7.3") { exclude(group = "org.slf4j") } - testImplementation("org.seleniumhq.selenium:selenium-support:4.4.0") - testImplementation("org.seleniumhq.selenium:selenium-chrome-driver:4.26.0") + testImplementation("org.seleniumhq.selenium:selenium-java:4.4.0") testImplementation("org.mockftpserver:MockFtpServer:3.2.0") testImplementation("org.springframework.ldap:spring-ldap-test") testImplementation("com.unboundid:unboundid-ldapsdk:6.0.5") From c93e6c2c9fe2e12e2024bf559d43f992fd1d04d4 Mon Sep 17 00:00:00 2001 From: Deep Sidhu Date: Thu, 14 Nov 2024 18:54:03 -0600 Subject: [PATCH 3/4] Removed passing in chromedriver to tests as it's no longer required in selenium 4 --- run-tests.sh | 20 ++--------- .../AbstractIridaUIITChromeDriver.java | 34 ++++++++----------- 2 files changed, 17 insertions(+), 37 deletions(-) diff --git a/run-tests.sh b/run-tests.sh index efdbc6ade6..495977dd8f 100755 --- a/run-tests.sh +++ b/run-tests.sh @@ -19,7 +19,6 @@ GALAXY_PORT=48889 GALAXY_URL=http://localhost:$GALAXY_PORT GALAXY_INVALID_URL=http://localhost:48890 GALAXY_INVALID_URL2=http://localhost:48891 -CHROME_DRIVER=$SCRIPT_DIR/src/main/webapp/chromedriver SELENIUM_DOCKER_NAME=irida-selenium SELENIUM_DOCKER_TAG=latest SELENIUM_URL=http://localhost:4444/wd/hub @@ -126,28 +125,15 @@ test_rest() { test_ui() { SELENIUM_OPTS="" - if [ "$SELENIUM_DOCKER" = false ]; - then - if [ -z ${CHROMEWEBDRIVER} ] + if [ "$SELENIUM_DOCKER" = true ]; then - # use default CHROME_DRIVER if CHROMEWEBDRIVER env var is not set - SELENIUM_OPTS="-Dwebdriver.chrome.driver=$CHROME_DRIVER" - else - if [ -d $CHROMEWEBDRIVER ] && [ -f "$CHROMEWEBDRIVER/chromedriver" ] - then - SELENIUM_OPTS="-Dwebdriver.chrome.driver=$CHROMEWEBDRIVER/chromedriver" - else - SELENIUM_OPTS="-Dwebdriver.chrome.driver=$CHROMEWEBDRIVER" - fi - fi - else # create the $TMP_DIRECTORY/irida folder before docker runs so that root doesn't create it mkdir -p $TMP_DIRECTORY/irida # reuse selenium docker image if it exists docker start $SELENIUM_DOCKER_NAME || docker run -d -p 4444:4444 --name $SELENIUM_DOCKER_NAME -v $PWD:$PWD -v $TMP_DIRECTORY/irida:$TMP_DIRECTORY/irida -v /dev/shm:/dev/shm selenium/standalone-chrome:$SELENIUM_DOCKER_TAG SELENIUM_OPTS="-Dwebdriver.selenium_url=$SELENIUM_URL -Dserver.port=33333 -Dserver.base.url=http://$HOSTNAME:33333/irida -Djava.io.tmpdir=$TMP_DIRECTORY/irida" fi - ./gradlew clean check uiITest $SELENIUM_OPTS -Dirida.it.nosandbox=true -Dirida.it.headless=$HEADLESS -Dspring.datasource.url=$JDBC_URL -Dfile.processing.decompress=true -Dirida.it.rootdirectory=$TMP_DIRECTORY -Dspring.datasource.dbcp2.max-wait=$DB_MAX_WAIT_MILLIS $@ + ./gradlew clean uiITest $SELENIUM_OPTS -Dirida.it.nosandbox=true -Dirida.it.headless=$HEADLESS -Dspring.datasource.url=$JDBC_URL -Dfile.processing.decompress=true -Dirida.it.rootdirectory=$TMP_DIRECTORY -Dspring.datasource.dbcp2.max-wait=$DB_MAX_WAIT_MILLIS $@ exit_code=$? if [[ "$DO_KILL_DOCKER" = true && "$SELENIUM_DOCKER" = true ]]; then docker rm -f -v $SELENIUM_DOCKER_NAME; fi return $exit_code @@ -169,7 +155,7 @@ test_galaxy_internal() { task=$1 shift docker run -d -p $GALAXY_PORT:80 --name $GALAXY_DOCKER_NAME -v $TMP_DIRECTORY:$TMP_DIRECTORY -v $SCRIPT_DIR:$SCRIPT_DIR $GALAXY_DOCKER && \ - ./gradlew clean check $task -Dspring.datasource.url=$JDBC_URL -Dfile.processing.decompress=true -Dirida.it.rootdirectory=$TMP_DIRECTORY -Dtest.galaxy.url=$GALAXY_URL -Dtest.galaxy.invalid.url=$GALAXY_INVALID_URL -Dtest.galaxy.invalid.url2=$GALAXY_INVALID_URL2 -Dspring.datasource.dbcp2.max-wait=$DB_MAX_WAIT_MILLIS $@ + ./gradlew clean $task -Dspring.datasource.url=$JDBC_URL -Dfile.processing.decompress=true -Dirida.it.rootdirectory=$TMP_DIRECTORY -Dtest.galaxy.url=$GALAXY_URL -Dtest.galaxy.invalid.url=$GALAXY_INVALID_URL -Dtest.galaxy.invalid.url2=$GALAXY_INVALID_URL2 -Dspring.datasource.dbcp2.max-wait=$DB_MAX_WAIT_MILLIS $@ exit_code=$? if [ "$DO_KILL_DOCKER" = true ]; then docker rm -f -v $GALAXY_DOCKER_NAME; fi return $exit_code diff --git a/src/test/java/ca/corefacility/bioinformatics/irida/ria/integration/AbstractIridaUIITChromeDriver.java b/src/test/java/ca/corefacility/bioinformatics/irida/ria/integration/AbstractIridaUIITChromeDriver.java index 0500629bec..0887210b53 100644 --- a/src/test/java/ca/corefacility/bioinformatics/irida/ria/integration/AbstractIridaUIITChromeDriver.java +++ b/src/test/java/ca/corefacility/bioinformatics/irida/ria/integration/AbstractIridaUIITChromeDriver.java @@ -46,8 +46,8 @@ @Tag("IntegrationTest") @Tag("UI") @ActiveProfiles("it") -@SpringBootTest(classes = { IridaApplication.class, IridaApiTestFilesystemConfig.class }, - webEnvironment = WebEnvironment.RANDOM_PORT) +@SpringBootTest(classes = { IridaApplication.class, + IridaApiTestFilesystemConfig.class }, webEnvironment = WebEnvironment.RANDOM_PORT) @Import(IridaIntegrationTestUriConfig.class) @TestExecutionListeners({ DependencyInjectionTestExecutionListener.class, DbUnitTestExecutionListener.class }) @@ -62,9 +62,6 @@ public class AbstractIridaUIITChromeDriver { private static boolean isSingleTest = false; - private static final String CHROMEDRIVER_PROP_KEY = "webdriver.chrome.driver"; - private static final String CHROMEDRIVER_LOCATION = "src/main/webapp/chromedriver"; - @RegisterExtension public ScreenshotOnFailureWatcher watcher = new ScreenshotOnFailureWatcher(); @@ -86,12 +83,8 @@ public static void destroy() { */ public static WebDriver driver() { if (IntegrationUITestListener.driver() == null) { - final String chromeDriverProp = System.getProperty(CHROMEDRIVER_PROP_KEY); - System.setProperty(CHROMEDRIVER_PROP_KEY, - Strings.isNullOrEmpty(chromeDriverProp) ? CHROMEDRIVER_LOCATION : chromeDriverProp); logger.debug( - "Starting ChromeDriver for a single test class. Using `chromedriver` at '" + System.getProperty( - CHROMEDRIVER_PROP_KEY) + "'"); + "Starting ChromeDriver for a single test class."); isSingleTest = true; IntegrationUITestListener.startWebDriver(); } @@ -107,11 +100,7 @@ public static WebDriver driver() { */ public static WebDriver driver2() { if (IntegrationUITestListener.driver2() == null) { - final String chromeDriverProp = System.getProperty(CHROMEDRIVER_PROP_KEY); - System.setProperty(CHROMEDRIVER_PROP_KEY, - Strings.isNullOrEmpty(chromeDriverProp) ? CHROMEDRIVER_LOCATION : chromeDriverProp); - logger.debug("Starting a second ChromeDriver for a single test class. Using `chromedriver` at '" - + System.getProperty(CHROMEDRIVER_PROP_KEY) + "'"); + logger.debug("Starting a second ChromeDriver for a single test class"); isSingleTest = true; IntegrationUITestListener.startWebDriver(); } @@ -121,12 +110,16 @@ public static WebDriver driver2() { } /** - * Method to use on any page to check to ensure that internationalization messages are being automatically loaded + * Method to use on any page to check to ensure that internationalization + * messages are being automatically loaded * onto the page. * - * @param page - the instance of {@link AbstractPage} to check for internationalization. - * @param entries - a {@link List} of bundle names. This will correspond to the loaded webpack bundles. - * @param header - Expected text for the main heading on the page. Needs to have class name `t-main-heading` + * @param page - the instance of {@link AbstractPage} to check for + * internationalization. + * @param entries - a {@link List} of bundle names. This will correspond to the + * loaded webpack bundles. + * @param header - Expected text for the main heading on the page. Needs to + * have class name `t-main-heading` */ public void checkTranslations(AbstractPage page, List entries, String header) { // Always check for app :) @@ -158,7 +151,8 @@ public void testFailed(ExtensionContext context, Throwable t) { try { final Path destination = Files.createTempFile( "irida-" + context.getRequiredTestClass().getSimpleName() + "#" - + context.getRequiredTestMethod().getName(), ".png"); + + context.getRequiredTestMethod().getName(), + ".png"); Files.move(screenshot, destination, StandardCopyOption.REPLACE_EXISTING); logger.info("Screenshot deposited at: [" + destination.toString() + "]"); } catch (final IOException e) { From 87e0e9a0e7877c99da844262e8ede8356ee68270 Mon Sep 17 00:00:00 2001 From: Deep Sidhu Date: Fri, 15 Nov 2024 12:24:07 -0600 Subject: [PATCH 4/4] Updated to latest version of selenium-java --- build.gradle.kts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build.gradle.kts b/build.gradle.kts index dd52bc74e2..1fc34e219f 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -221,7 +221,7 @@ dependencies { testImplementation("org.dbunit:dbunit:2.7.3") { exclude(group = "org.slf4j") } - testImplementation("org.seleniumhq.selenium:selenium-java:4.4.0") + testImplementation("org.seleniumhq.selenium:selenium-java:4.26.0") testImplementation("org.mockftpserver:MockFtpServer:3.2.0") testImplementation("org.springframework.ldap:spring-ldap-test") testImplementation("com.unboundid:unboundid-ldapsdk:6.0.5")