8000 Remove support for testing on Appium by jonkoops · Pull Request #29923 · keycloak/keycloak · GitHub
[go: up one dir, main page]

Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 0 additions & 14 deletions testsuite/integration-arquillian/HOW-TO-RUN.md
Original file line number Diff line number Diff line change
Expand Up @@ -310,20 +310,6 @@ Although technically they can be run with almost every test in the testsuite, th
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` or `-DchromeDriverVersion` CLI argument.

#### Mobile browsers
The support for testing with the mobile browsers is implemented using the [Appium](http://appium.io/) project.
This means the tests can be run with a real mobile browser in a real mobile OS. However, only emulators/simulators of mobile devices are supported at the moment (no physical devices) in our testsuite.

First, you need to install the Appium server. If you have Node.js and npm installed on your machine, you can do that with: `npm install -g appium`. For further details and requirements please refer to the [official Appium documentation](http://appium.io/docs/en/about-appium/intro/).
The tests will try to start the Appium server automatically but you can do it manually as well (just by executing `appium`).

To use a mobile browser you need to create a virtual device. The most convenient way to do so is to install the desired platform's IDE - either [Android Studio](https://developer.android.com/studio/) (for Android devices) or [Xcode](https://developer.apple.com/xcode/) (for iOS devices) - then you can create a device (smartphone/tablet) there. For details please refer to documentation of those IDEs.

**Tips & tricks:**
* If the AVD name contains any spaces, you need to replace them with underscores when specifying the `-Dappium.avd=...`.
* It's probable that a freshly created device will contain an outdated Chrome version. To update to the latest version (without using the Play Store) you need to download an `.apk` for Chrome and install it with `adb install -r path/to/chrome.apk`.
* Chrome on Android uses ChromeDriver similarly to regular desktop Chrome. The ChromeDriver is bundled with the Appium server. To use a newer ChromeDriver please follow the [Appium documentation](http://appium.io/docs/en/writing-running-appium/web/chromedriver/).

## Disabling TLS (SSL) in the tests

All tests are executed with TLS by default. In order to disable it, you need to switch the `auth.server.ssl.required` property off.
Expand Down
1 change: 0 additions & 1 deletion testsuite/integration-arquillian/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,6 @@
<undertow.version>${undertow-jakarta.version}</undertow.version>
<undertow-embedded.version>1.0.0.Final</undertow-embedded.version>
<version.org.wildfly.extras.creaper>1.6.1</version.org.wildfly.extras.creaper>
<appium.client.version>6.1.0</appium.client.version>
<jakarta.persistence-legacy.version>2.2.3</jakarta.persistence-legacy.version>
<smallrye.jandex.version>3.0.5</smallrye.jandex.version>

Expand Down
10000
Original file line number Diff line number Diff line change
@@ -1,18 +1,13 @@
package org.keycloak.testsuite.console.page.fragment;

import io.appium.java_client.android.AndroidDriver;
import io.appium.java_client.ios.IOSDriver;
import org.jboss.arquillian.drone.api.annotation.Drone;
import org.jboss.arquillian.graphene.fragment.Root;
import org.jboss.logging.Logger;
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.interactions.Actions;
import org.openqa.selenium.support.FindBy;

import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotEquals;
import static org.keycloak.testsuite.util.UIUtils.clickLink;
import static org.keycloak.testsuite.util.UIUtils.getTextFromElement;

Expand All @@ -22,9 +17,6 @@
public class LocaleDropdown {
protected Logger log = Logger.getLogger(this.getClass());

@Root
private WebElement root;

@FindBy(tagName = "ul")
private WebElement dropDownMenu;

Expand All @@ -39,25 +31,12 @@ public String getSelected() {
}

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) { // Android needs to tap (no cursor)
currentLocaleLink.click();
} else {
Actions actions = new Actions(driver);
log.info("Moving mouse cursor to the localization menu");
actions.moveToElement(currentLocaleLink, -10, 0)
.moveToElement(currentLocaleLink).perform();
}
Actions actions = new Actions(driver);
log.info("Moving mouse cursor to the localization menu");
actions.moveToElement(currentLocaleLink, -10, 0)
.moveToElement(currentLocaleLink).perform();

// click desired locale
clickLink(dropDownMenu.findElement(By.xpath("./li/a[text()='" + text + "']")));
}

public void selectAndAssert(String text) {
assertNotEquals(text, getSelected());
selectByText(text);
assertEquals(text, getSelected());
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@

import java.util.concurrent.TimeUnit;

import io.appium.java_client.AppiumDriver;
import org.jboss.arquillian.core.api.InstanceProducer;
import org.jboss.arquillian.core.api.annotation.Inject;
import org.jboss.arquillian.core.api.annotation.Observes;
Expand Down Expand Up @@ -60,7 +59,7 @@ public void configureWebDriver(@Observes AfterDroneEnhanced event, DroneContext
webDriverProducer.set(remoteWebDriver);
}

if (drone instanceof WebDriver && !(drone instanceof AppiumDriver)) {
if (drone instanceof WebDriver) {
WebDriver webDriver = (WebDriver) drone;
configureDriverSettings(webDriver);
webDriverProducer.set(webDriver);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,6 @@ public void createConfiguration(@Observes BeforeDroneInstantiated event, DroneCo

DesiredCapabilities capabilitiesToAdd = new DesiredCapabilities();
updateCapabilityKeys("htmlUnit", webDriverCfg, capabilitiesToAdd);
updateCapabilityKeys("appium", webDriverCfg, capabilitiesToAdd);
configurePhantomJSDriver(webDriverCfg, capabilitiesToAdd);
acceptAllSSLCerts(webDriverCfg, capabilitiesToAdd);

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
package org.keycloak.testsuite.util;

import io.appium.java_client.android.AndroidDriver;
import org.apache.commons.lang3.StringUtils;
import org.keycloak.testsuite.page.AbstractPatternFlyAlert;
import org.openqa.selenium.By;
Expand Down Expand Up @@ -141,12 +140,6 @@ public static void setTextInputValue(WebElement input, String value) {
input.sendKeys("1");
input.sendKeys(Keys.BACK_SPACE);
}

WebDriver driver = getCurrentDriver();
if (driver instanceof AndroidDriver) {
AndroidDriver androidDriver = (AndroidDriver) driver;
androidDriver.hideKeyboard(); // stability improvement
}
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
*/
package org.keycloak.testsuite;

import io.appium.java_client.AppiumDriver;
import jakarta.ws.rs.core.Response;
import org.apache.commons.configuration.ConfigurationException;
import org.apache.commons.configuration.PropertiesConfiguration;
Expand Down Expand Up @@ -302,24 +301,6 @@ protected void deleteAllSessionsInRealm(String realmName) {

protected void resetRealmSession(String realmName) {
deleteAllCookiesForRealm(realmName);

if (driver instanceof AppiumDriver) { // smartphone drivers don't support cookies deletion
try {
log.info("resetting realm session");

final RealmRepresentation realmRep = adminClient.realm(realmName).toRepresentation();

deleteAllSessionsInRealm(realmName); // logout users

if (realmRep.isInternationalizationEnabled()) { // reset the locale
String locale = getDefaultLocaleName(realmRep.getRealm());
loginPage.localeDropdown().selectByText(locale);
log.info("locale reset to " + locale);
}
} catch (NotFoundException e) {
log.warn("realm not found");
}
}
}

protected String getDefaultLocaleName(String realmName) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
<property name="htmlUnitWebClientOptions">cssEnabled=false;historyPageCacheLimit=1</property>

<!-- firefox -->
<property name="firefoxBinary">${firefox_binary}</property> <!-- we need to use 'firefoxBinary' instead of 'firefox_binary' due to some weird conflict with Appium -->
<property name="firefoxBinary">${firefox_binary}</property>
<property name="firefoxLogLevel">OFF</property>
<property name="firefoxLegacy">${firefoxLegacyDriver}</property>
<property name="firefoxDriverVersion">${firefoxDriverVersion}</property>
Expand All @@ -42,16 +42,6 @@
<property name="chromeBinary">${chromeBinary}</property>
<property name="chromeArguments">${chromeArguments}</property>
<property name="chromeDriverVersion">${chromeDriverVersion}</property>

<!-- appium -->
<property name="appium.platformName">${appium.platformName}</property>
<property name="appium.deviceName">${appium.deviceName}</property>
<property name="appium.browserName">${appium.browserName}</property>
<property name="appium.avd">${appium.avd}</property>
<property name="appium.automationName">${appium.automationName}</property>
<property name="appium.noReset">${appium.noReset}</property>
<property name="appium.fullReset">${appium.fullReset}</property>
<property name="appium.nativeWebScreenshot">true</property> <!-- there's some issue when taking screenshot using the chromedriver therefore we need to take screenshots of the whole screen (using adb) instead -->
</extension>

<extension qualifier="drone">
Expand Down
22 changes: 0 additions & 22 deletions testsuite/integration-arquillian/tests/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -226,14 +226,6 @@
<chromeArguments>--headless --window-size=1920,1080 --remote-allow-origins=*</chromeArguments>
<chromeDriverVersion/>

<appium.platformName/>
<appium.deviceName/>
<appium.browserName/>
<appium.avd/>
<appium.automationName/>
<appium.noReset/>
<appium.fullReset/>

<frontend.console.output>true</frontend.console.output>
<backends.console.output>true</backends.console.output>

Expand Down Expand Up @@ -602,14 +594,6 @@
<firefoxUserPreferences>${firefoxUserPreferences}</firefoxUserPreferences>
<firefoxHeadless>${firefoxHeadless}</firefoxHeadless>

<appium.platformName>${appium.platformName}</appium.platformName>
<appium.deviceName>${appium.deviceName}</appium.deviceName>
<appium.browserName>${appium.browserName}</appium.browserName>
<appium.avd>${appium.avd}</appium.avd>
<appium.automationName>${appium.automationName}</appium.automationName>
<appium.noReset>${appium.noReset}</appium.noReset>
<appium.fullReset>${appium.fullReset}</appium.fullReset>

<project.version>${project.version}</project.version>

<client.certificate.ca.path>${client.certificate.ca.path}</client.certificate.ca.path>
Expand Down Expand Up @@ -1647,12 +1631,6 @@
</exclusions>
</dependency>

<dependency>
<groupId>io.appium</groupId>
<artifactId>java-client</artifactId>
<version>${appium.client.version}</version>
</dependency>

<!--
httpclient and httpcore are here to ensure we use the same version
as in keycloak/pom.xml and to prevent the other versions beeing present
Expand Down
0