Skip to content

Commit

Permalink
Remove support for IE (keycloak#11271)
Browse files Browse the repository at this point in the history
  • Loading branch information
mabartos authored Apr 22, 2022
1 parent 435a783 commit 53ea60b
Show file tree
Hide file tree
Showing 10 changed files with 19 additions and 467 deletions.
11 changes: 2 additions & 9 deletions testsuite/integration-arquillian/HOW-TO-RUN.md
Original file line number Diff line number Diff line change
Expand Up @@ -454,7 +454,7 @@ For the available versions, take a look at the directory [tests/other/server-con


## Admin Console UI tests
The UI tests are real-life, UI focused integration tests. Hence they do not support the default HtmlUnit browser. Only the following real-life browsers are supported: Mozilla Firefox, Google Chrome and Internet Explorer. For details on how to run the tests with these browsers, please refer to [Different Browsers](#different-browsers) chapter.
The UI tests are real-life, UI focused integration tests. Hence they do not support the default HtmlUnit browser. Only the following real-life browsers are supported: Mozilla Firefox and Google Chrome. For details on how to run the tests with these browsers, please refer to [Different Browsers](#different-browsers) chapter.

The UI tests are focused on the Admin Console. They are placed in the `console` module and are disabled by default.

Expand Down Expand Up @@ -598,13 +598,6 @@ Although technically they can be run with almost every test in the testsuite, th
* **Driver download required:** [ChromeDriver](https://sites.google.com/a/chromium.org/chromedriver/) that corresponds with your version of the browser
* **Run with:** `-Dbrowser=chrome -Dwebdriver.chrome.driver=path/to/chromedriver`

#### Internet Explorer
* **Supported test modules:** `console`, `base-ui`
* **Supported version:** 11
* **Driver download required:** [Internet Explorer Driver Server](http://www.seleniumhq.org/download/); recommended version [3.5.1 32-bit](http://selenium-release.storage.googleapis.com/3.5/IEDriverServer_Win32_3.5.1.zip)
* **Run with:** `-Dbrowser=internetExplorer -Dwebdriver.ie.driver=path/to/IEDriverServer.exe -Dauth.server.ssl.required=false`
Note: We currently do not support SSL in IE.

#### Apple Safari
* **Supported test modules:** `base-ui`
* **Supported version:** latest stable
Expand All @@ -619,7 +612,7 @@ Note: We currently do not support SSL in IE.

#### Automatic driver downloads
You can rely on automatic driver downloads which is provided by [Arquillian Drone](http://arquillian.org/arquillian-extension-drone/#_automatic_download). To do so just omit the `-Dwebdriver.{browser}.driver` CLI argument when running the tests.
By default latest driver version is always downloaded. To download a specific version, add `-DfirefoxDriverVersion`, `-DchromeDriverVersion` or `-DieDriverVersion` CLI argument.
By default latest driver version is always downloaded. To download a specific version, add `-DfirefoxDriverVersion` or `-DchromeDriverVersion` CLI argument.

#### Mobile browsers
The support for testing with the mobile browsers is implemented using the [Appium](http://appium.io/) project.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.ie.InternetExplorerDriver;
import org.openqa.selenium.interactions.Actions;
import org.openqa.selenium.support.FindBy;

Expand Down Expand Up @@ -43,12 +42,9 @@ public void selectByText(String text) {
// open the menu
if (driver instanceof IOSDriver) { // TODO: Fix this! It's a very, very, ... very nasty hack for Safari on iOS - see KEYCLOAK-7947
((IOSDriver) driver).executeScript("arguments[0].setAttribute('style', 'display: block')", dropDownMenu);
}
else if (driver instanceof AndroidDriver || driver instanceof InternetExplorerDriver) { // Android needs to tap (no cursor)
// and IE has some bug so needs to click as well (instead of moving cursor)
} else if (driver instanceof AndroidDriver) { // Android needs to tap (no cursor)
currentLocaleLink.click();
}
else {
} else {
Actions actions = new Actions(driver);
log.info("Moving mouse cursor to the localization menu");
actions.moveToElement(currentLocaleLink, -10, 0)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,9 +61,6 @@ public void createConfiguration(@Observes BeforeDroneInstantiated event, DroneCo
}

private void acceptAllSSLCerts(WebDriverConfiguration webDriverCfg, DesiredCapabilities capabilitiesToAdd) {
if (webDriverCfg.getBrowser().equals("internetexplorer")) {
return; // IE not supported
}
capabilitiesToAdd.setCapability(CapabilityType.ACCEPT_SSL_CERTS, true);
capabilitiesToAdd.setCapability(CapabilityType.ACCEPT_INSECURE_CERTS, true);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,7 @@
package org.keycloak.testsuite.page;

import org.keycloak.testsuite.util.WaitUtils;
import org.openqa.selenium.WebDriverException;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.ie.InternetExplorerDriver;
import org.openqa.selenium.support.FindBy;

import static org.junit.Assert.assertEquals;
Expand Down Expand Up @@ -87,20 +85,11 @@ public void assertDanger(String expectedText) {
}

public void close() {
try {
closeButton.click();
WaitUtils.pause(500); // Sometimes, when a test is too fast,
// one of the consecutive alerts is not displayed;
// to prevent this we need to slow down a bit
}
catch (WebDriverException e) {
if (driver instanceof InternetExplorerDriver) {
log.warn("Failed to close the alert; test is probably too slow and alert has already closed itself");
}
else {
throw e;
}
}
closeButton.click();
WaitUtils.pause(500);
// Sometimes, when a test is too fast,
// one of the consecutive alerts is not displayed;
// to prevent this we need to slow down a bit
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
import org.keycloak.common.util.KeycloakUriBuilder;
import org.openqa.selenium.TimeoutException;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.ie.InternetExplorerDriver;
import org.openqa.selenium.support.ui.ExpectedCondition;
import org.openqa.selenium.support.ui.WebDriverWait;

Expand All @@ -29,22 +28,10 @@ public final class URLUtils {
private static Logger log = Logger.getLogger(URLUtils.class);

public static void navigateToUri(String uri) {
navigateToUri(uri, true);
}

private static void navigateToUri(String uri, boolean enableIEWorkaround) {
WebDriver driver = getCurrentDriver();

log.info("starting navigation");

// In IE, sometime the current URL is not correct; one of the indicators is that the target URL
// equals the current URL
if (driver instanceof InternetExplorerDriver && driver.getCurrentUrl().equals(uri)) {
log.info("IE workaround: target URL equals current URL - refreshing the page");
driver.navigate().refresh();
waitForPageToLoad();
}

log.info("current URL: " + driver.getCurrentUrl());
log.info("navigating to " + uri);
if (driver.getCurrentUrl().equals(uri)) { // Some browsers won't do anything if navigating to the same URL; this "fixes" it
Expand All @@ -58,19 +45,7 @@ private static void navigateToUri(String uri, boolean enableIEWorkaround) {
waitForPageToLoad();

log.info("new current URL: " + driver.getCurrentUrl());

// In IE, after deleting the cookies for test realm, the first loaded page in master's admin console
// contains invalid URL (misses #/realms/[realm] or contains state and code fragments), although the
// address bar states the correct URL; seemingly this is another bug in IE WebDriver)
if (enableIEWorkaround && driver instanceof InternetExplorerDriver
&& (driver.getCurrentUrl().matches("^[^#]+/#state=[^#/&]+&code=[^#/&]+$")
|| driver.getCurrentUrl().matches("^.+/auth/admin/[^/]+/console/$"))) {
log.info("IE workaround: reloading the page after deleting the cookies...");
navigateToUri(uri, false);
}
else {
log.info("navigation complete");
}
log.info("navigation complete");
}

public static boolean currentUrlEquals(String url) {
Expand Down Expand Up @@ -109,27 +84,14 @@ public static boolean currentUrlMatches(String regex) {
return urlCheck(urlMatches(regex));
}

private static boolean urlCheck(ExpectedCondition condition) {
return urlCheck(condition, false);
}

@SuppressWarnings("unchecked")
private static boolean urlCheck(ExpectedCondition condition, boolean secondTry) {
private static boolean urlCheck(ExpectedCondition condition) {
WebDriver driver = getCurrentDriver();

try {
(new WebDriverWait(driver, 5, 100)).until(condition);
}
catch (TimeoutException e) {
if (driver instanceof InternetExplorerDriver && !secondTry) {
// IE WebDriver has sometimes invalid current URL
log.info("IE workaround: checking URL failed at first attempt - refreshing the page and trying one more time...");
driver.navigate().refresh();
urlCheck(condition, true);
}
else {
return false;
}
} catch (TimeoutException e) {
return false;
}
return true;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,10 +45,6 @@
<property name="chromeArguments">${chromeArguments}</property>
<property name="chromeDriverVersion">${chromeDriverVersion}</property>

<!-- internet explorer -->
<property name="ieDriverArch">${ieDriverArch}</property>
<property name="ieDriverVersion">${ieDriverVersion}</property>

<!-- appium -->
<property name="appium.platformName">${appium.platformName}</property>
<property name="appium.deviceName">${appium.deviceName}</property>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@

<properties>
<keycloak.theme.dir>${auth.server.home}/themes</keycloak.theme.dir>
<supportedBrowsers>firefox|chrome|internetExplorer|safari|chromeHeadless|edge</supportedBrowsers>
<supportedBrowsers>firefox|chrome|safari|chromeHeadless|edge</supportedBrowsers>
</properties>

<build>
Expand Down
Loading

0 comments on commit 53ea60b

Please sign in to comment.