Skip to content

Commit

Permalink
Test with latest selenium-java version
Browse files Browse the repository at this point in the history
  • Loading branch information
dsibilio committed Oct 7, 2024
1 parent 2426267 commit a01458c
Show file tree
Hide file tree
Showing 2 changed files with 37 additions and 45 deletions.
6 changes: 3 additions & 3 deletions test/saml/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
<java.version>11</java.version>
<selenium-server.version>3.141.59</selenium-server.version>
<selenium-java.version>4.25.0</selenium-java.version>
<java-jwt.version>3.19.4</java-jwt.version>
<commons-codec.version>1.15</commons-codec.version>
<logback-classic.version>1.3.14</logback-classic.version>
Expand Down Expand Up @@ -59,8 +59,8 @@
<dependencies>
<dependency>
<groupId>org.seleniumhq.selenium</groupId>
<artifactId>selenium-server</artifactId>
<version>${selenium-server.version}</version>
<artifactId>selenium-java</artifactId>
<version>${selenium-java.version}</version>
<scope>test</scope>
</dependency>
<dependency>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,28 +1,15 @@
package org.alfresco.identity.service.saml.test;

import static org.alfresco.identity.service.saml.test.TokenTestConstants.*;
import static org.junit.jupiter.api.Assertions.assertNotNull;

import java.io.BufferedReader;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStreamReader;
import java.lang.reflect.Type;
import java.security.KeyFactory;
import java.security.KeyManagementException;
import java.security.KeyStoreException;
import java.security.NoSuchAlgorithmException;
import java.security.interfaces.RSAPublicKey;
import java.security.spec.X509EncodedKeySpec;
import java.util.HashMap;
import java.util.Map;
import java.util.Objects;
import java.util.Properties;
import java.util.concurrent.TimeUnit;

import javax.net.ssl.SSLContext;

import com.auth0.jwt.JWT;
import com.auth0.jwt.JWTVerifier;
import com.auth0.jwt.algorithms.Algorithm;
import com.auth0.jwt.exceptions.JWTVerificationException;
import com.auth0.jwt.interfaces.DecodedJWT;
import com.google.gson.Gson;
import com.google.gson.reflect.TypeToken;
import io.github.bonigarcia.wdm.WebDriverManager;
import org.apache.commons.codec.binary.Base64;
import org.apache.commons.io.FileUtils;
import org.apache.commons.lang3.StringUtils;
import org.apache.http.HttpEntity;
import org.apache.http.client.methods.CloseableHttpResponse;
Expand All @@ -39,25 +26,34 @@
import org.openqa.selenium.By.ByName;
import org.openqa.selenium.OutputType;
import org.openqa.selenium.TakesScreenshot;
import java.io.File;
import org.apache.commons.io.FileUtils;
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.CapabilityType;
import org.openqa.selenium.remote.DesiredCapabilities;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import com.auth0.jwt.JWT;
import com.auth0.jwt.JWTVerifier;
import com.auth0.jwt.algorithms.Algorithm;
import com.auth0.jwt.exceptions.JWTVerificationException;
import com.auth0.jwt.interfaces.DecodedJWT;
import com.google.gson.Gson;
import com.google.gson.reflect.TypeToken;
import io.github.bonigarcia.wdm.WebDriverManager;
import javax.net.ssl.SSLContext;
import java.io.BufferedReader;
import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStreamReader;
import java.lang.reflect.Type;
import java.security.KeyFactory;
import java.security.KeyManagementException;
import java.security.KeyStoreException;
import java.security.NoSuchAlgorithmException;
import java.security.interfaces.RSAPublicKey;
import java.security.spec.X509EncodedKeySpec;
import java.util.HashMap;
import java.util.Map;
import java.util.Objects;
import java.util.Properties;
import java.util.concurrent.TimeUnit;

import static org.alfresco.identity.service.saml.test.TokenTestConstants.*;
import static org.junit.jupiter.api.Assertions.assertNotNull;

/**
* @author Jared Ottley
Expand Down Expand Up @@ -100,15 +96,13 @@ private WebDriver createChromeWebDriver()
{
WebDriverManager.chromedriver()
.setup();
return new ChromeDriver(getDesiredCapabilities());
return new ChromeDriver(getChromeOptions());
}

private DesiredCapabilities getDesiredCapabilities()
private ChromeOptions getChromeOptions()
{
DesiredCapabilities capabilities = DesiredCapabilities.chrome();
capabilities.setCapability(CapabilityType.ACCEPT_SSL_CERTS, true);

ChromeOptions chromeOptions = new ChromeOptions();
chromeOptions.setAcceptInsecureCerts(true);
chromeOptions.addArguments("--no-sandbox");
chromeOptions.addArguments("--disable-gpu");
chromeOptions.addArguments("--disable-dev-shm-usage");
Expand All @@ -131,9 +125,7 @@ private DesiredCapabilities getDesiredCapabilities()
chromePrefs.put("profile.password_manager_enabled", false);
// chromePrefs.put("download.default_directory", getDownloadLocation());
chromeOptions.setExperimentalOption("prefs", chromePrefs);

capabilities.setCapability(ChromeOptions.CAPABILITY, chromeOptions);
return capabilities;
return chromeOptions;
}

@AfterAll
Expand Down

0 comments on commit a01458c

Please sign in to comment.