nl.praegus.fitnesse.slim.util.AndroidHelper Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of toolchain-appium-fixtures Show documentation
Show all versions of toolchain-appium-fixtures Show documentation
Fixtures to assist in android, iOS and windows app testing via FitNesse
package nl.praegus.fitnesse.slim.util;
import io.appium.java_client.MobileBy;
import io.appium.java_client.android.AndroidDriver;
import io.appium.java_client.android.AndroidElement;
import nl.praegus.fitnesse.slim.util.by.AndroidBy;
import nl.praegus.fitnesse.slim.util.scroll.AndroidScrollHelper;
import org.openqa.selenium.By;
import java.util.function.Function;
import static nl.hsac.fitnesse.fixture.util.FirstNonNullHelper.firstNonNull;
import static nl.hsac.fitnesse.fixture.util.selenium.by.TechnicalSelectorBy.byIfStartsWith;
/**
* Specialized helper to deal with appium's Android web getDriver.
*/
public class AndroidHelper extends AppiumHelper> {
private static final Function ANDROID_UI_AUTOMATOR_BY = byIfStartsWith("uiAutomator", MobileBy::AndroidUIAutomator);
public AndroidHelper() {
setScrollHelper(new AndroidScrollHelper(this));
}
@Override
public By placeToBy(String place) {
return firstNonNull(place,
super::placeToBy,
ANDROID_UI_AUTOMATOR_BY);
}
protected By getElementBy(String place) {
return AndroidBy.heuristic(place);
}
protected By getClickBy(String place) {
return AndroidBy.clickableHeuristic(place);
}
protected By getContainerBy(String container) {
return AndroidBy.heuristic(container);
}
protected By getElementToCheckVisibilityBy(String text) {
return AndroidBy.partialText(text);
}
}