use of com.seleniumtests.customexception.ConfigurationException in project seleniumRobot by bhecquet.
the class PerfectoCapabilitiesFactory method extractApiKey.
private String extractApiKey() {
List<String> hubUrls = webDriverConfig.getHubUrl();
if (hubUrls.isEmpty() || !hubUrls.get(0).contains(".perfectomobile.com/nexperience/perfectomobile/wd/hub")) {
throw new ConfigurationException("Perfecto usage needs configuring 'webDriverGrid' parameter with the format 'https://<apikey>@<cloudName>.perfectomobile.com/nexperience/perfectomobile/wd/hub'");
}
String hubUrl = hubUrls.get(0);
Matcher apiKeyMatcher = CLOUD_NAME_PATTERN.matcher(hubUrl);
if (apiKeyMatcher.matches()) {
return apiKeyMatcher.group(1);
} else {
throw new ConfigurationException("Api key no provided");
}
}
use of com.seleniumtests.customexception.ConfigurationException in project seleniumRobot by bhecquet.
the class TestExistingAppiumLauncher method testAppiumStartup.
@Test(groups = { "it" }, enabled = false)
public void testAppiumStartup() {
try {
ExistingAppiumLauncher appium = new ExistingAppiumLauncher("http://localhost:4723/wd/hub/");
appium.startAppium();
appium.stopAppium();
} catch (ConfigurationException e) {
throw new SkipException("Test skipped, appium not correctly configured", e);
}
}
use of com.seleniumtests.customexception.ConfigurationException in project seleniumRobot by bhecquet.
the class TestFieldDetectorConnector method testFieldDetection.
@Test(groups = "it", enabled = false)
public void testFieldDetection() throws IOException {
ImageFieldDetector imageFieldDetector;
try {
// imageFieldDetector = new ImageFieldDetector(createImageFromResource("tu/imageFieldDetection/browserCapture.png"), 0.75);
imageFieldDetector = new ImageFieldDetector(new File("D:\\Dev\\seleniumRobot\\seleniumRobot-core\\core\\test-output\\testSendKeysWithLabelOnTheLeft\\screenshots\\f5972501f7e893bfa3aa0281e4f647e1.png"), 0.75);
// imageFieldDetector = new ImageFieldDetector(createImageFromResource("ti/form_picture.png"), 0.75);
} catch (ConfigurationException e) {
throw new SkipException("no field detector server available");
}
List<Field> fields = imageFieldDetector.detectFields();
Assert.assertTrue(fields.size() > 10);
}
use of com.seleniumtests.customexception.ConfigurationException in project seleniumRobot by bhecquet.
the class BrowserInfo method addAndroidDriverFile.
/**
* Add the most suitable chrome driver for android driver version
* @throws IOException
*/
private void addAndroidDriverFile() throws IOException {
List<String> driverFiles = getDriverFiles();
driverFiles = driverFiles.stream().filter(s -> s.contains("android-") && s.startsWith("chromedriver_")).map(s -> s.replace(".exe", "")).sorted().collect(Collectors.toList());
if (driverFiles.isEmpty()) {
throw new ConfigurationException("no chromedriver in resources");
}
Map<String, String> driverVersion = new HashMap<>();
for (String fileName : driverFiles) {
Matcher matcher = REG_ANDROID_VERSION.matcher(fileName);
if (matcher.matches()) {
driverVersion.put(matcher.group(1), fileName);
} else {
throw new ConfigurationException(String.format("Driver %s is excluded as it does not match the pattern 'chromedriver_<version>_android-<x.y>'", fileName));
}
}
driverFileName = driverVersion.get(version);
if (driverFileName == null) {
throw new ConfigurationException(String.format("Chrome version %s does not have any associated driver, update seleniumRobot version", version));
}
}
use of com.seleniumtests.customexception.ConfigurationException in project seleniumRobot by bhecquet.
the class BrowserInfo method getDriverFiles.
public List<String> getDriverFiles() throws IOException {
if (driverList != null) {
return driverList;
} else {
// try to get file names from list generated by maven. In IDE mode, this should not work and we fall back to resource reading
String driverListFileName = String.format("driver-list-%s.txt", OSUtility.getCurrentPlatorm().toString().toLowerCase());
try {
List<String> drivers = new ArrayList<>();
String[] driverListFromFile = getDriverListFromJarResources(driverListFileName);
logger.info(String.format("getting drivers from %s", driverListFileName));
for (String driverNameWithPf : driverListFromFile) {
if (!driverNameWithPf.startsWith(os)) {
continue;
}
String driverName = driverNameWithPf.replace(os + "/", "");
drivers.add(driverName);
}
return drivers;
} catch (NullPointerException | IOException e) {
// issue #179: due to driver externalization in jars, it's not possible to read them from resources anymore
throw new ConfigurationException(String.format("Could not read driver from resource file %s, make sure that the dependency seleniumRobot-%s-driver.jar is accessible to robot (in maven repo for developpers and in lib/ folder with classpath option for testers)", driverListFileName, OSUtility.getCurrentPlatorm().toString().toLowerCase()));
}
}
}
Aggregations