Skip to content

Commit

Permalink
Merge pull request #1531 from phac-nml/dependabot/gradle/org.selenium…
Browse files Browse the repository at this point in the history
…hq.selenium-selenium-chrome-driver-4.26.0

chore(deps): bump org.seleniumhq.selenium:selenium-chrome-driver from 4.4.0 to 4.26.0
  • Loading branch information
ericenns authored Nov 15, 2024
2 parents 6a7bc5b + 87e0e9a commit 814db0d
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 39 deletions.
3 changes: 1 addition & 2 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -221,8 +221,7 @@ dependencies {
testImplementation("org.dbunit:dbunit:2.8.0") {
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-java:4.26.0")
testImplementation("org.mockftpserver:MockFtpServer:3.2.0")
testImplementation("org.springframework.ldap:spring-ldap-test")
testImplementation("com.unboundid:unboundid-ldapsdk:7.0.1")
Expand Down
20 changes: 3 additions & 17 deletions run-tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand All @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 })
Expand All @@ -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();

Expand All @@ -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();
}
Expand All @@ -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();
}
Expand All @@ -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<String> entries, String header) {
// Always check for app :)
Expand Down Expand Up @@ -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) {
Expand Down

0 comments on commit 814db0d

Please sign in to comment.