use of com.testsigma.automator.exceptions.AutomatorException in project testsigma by testsigmahq.
the class DriverManager method storeEnvironmentSessionId.
private void storeEnvironmentSessionId(Long entityId) throws AutomatorException {
try {
TestDeviceResultRequest testDeviceResultRequest = new TestDeviceResultRequest();
testDeviceResultRequest.setId(entityId);
testDeviceResultRequest.setSessionId(getSessionId());
AutomatorConfig.getInstance().getAppBridge().updateEnvironmentResultData(testDeviceResultRequest);
} catch (Exception e) {
log.error(e.getMessage(), e);
throw new AutomatorException(e.getMessage(), e);
}
}
use of com.testsigma.automator.exceptions.AutomatorException in project testsigma by testsigmahq.
the class DriverManager method storeTestCaseSessionId.
private void storeTestCaseSessionId(Long entityId) throws AutomatorException {
try {
TestCaseResultRequest testCaseResultRequest = new TestCaseResultRequest();
testCaseResultRequest.setId(entityId);
testCaseResultRequest.setSessionId(getSessionId());
AutomatorConfig.getInstance().getAppBridge().updateTestCaseResultData(testCaseResultRequest);
} catch (Exception e) {
log.error(e.getMessage(), e);
throw new AutomatorException(e.getMessage(), e);
}
}
use of com.testsigma.automator.exceptions.AutomatorException in project testsigma by testsigmahq.
the class DriversUpdateService method syncBrowserDriver.
public void syncBrowserDriver(OsBrowserType browserType, String browserVersion, String driverPath) throws AutomatorException {
log.info(String.format("Trying to check and sync browser - %s - %s - %s", browserType, browserVersion, driverPath));
try {
if (!isDriverExecutableExists(driverPath)) {
log.info(String.format("%s : %s - Browser driver does not exist. downloading it", browserType, browserVersion));
updateDriver(browserType, browserVersion);
log.info(String.format("%s : %s - Finished downloading the browser driver", browserType, browserVersion));
}
} catch (Exception e) {
log.error(e.getMessage(), e);
throw new AutomatorException(e.getMessage(), e);
}
}
use of com.testsigma.automator.exceptions.AutomatorException in project testsigma by testsigmahq.
the class AppInstaller method checkIfInstalled.
public boolean checkIfInstalled(String deviceName, String deviceUniqueId, String bundleId) throws AutomatorException {
try {
log.info("Checking if a mobile app with bundle id - " + bundleId + " is installed in device - " + deviceName);
boolean installed = false;
int i = 0;
while (i < 12) {
List<MobileApp> apps = getMobileApps(deviceName, deviceUniqueId);
for (MobileApp app : apps) {
if (app.getBundleId().equals(bundleId)) {
installed = true;
break;
}
}
if (installed)
break;
log.info("Looks like app is not installed yet...retrying in 5 seconds...");
Thread.sleep(5000);
i++;
}
if (!installed) {
log.info("Looks like some issue app installation. For now assuming its installed and proceeding");
installed = true;
}
return installed;
} catch (Exception e) {
throw new AutomatorException(e.getMessage(), e);
}
}
use of com.testsigma.automator.exceptions.AutomatorException in project testsigma by testsigmahq.
the class AppInstaller method getMobileApps.
public List<MobileApp> getMobileApps(String deviceName, String deviceUniqueId) throws AutomatorException {
List<MobileApp> apps = new ArrayList<>();
log.info("Fetching list of mobile apps on device - " + deviceName);
try {
Process p = iosDeviceCommandExecutor.runDeviceCommand(new String[] { "-u", deviceUniqueId, "applist" });
BufferedReader br = new BufferedReader(new InputStreamReader(p.getInputStream()));
String line;
while ((line = br.readLine()) != null) {
String[] tokens = line.split(" ");
if (tokens.length >= 3) {
MobileApp app = new MobileApp();
app.setBundleId(tokens[0]);
StringBuilder appName = new StringBuilder();
for (int i = 1; i < (tokens.length - 1); i++) {
appName.append(tokens[i]);
}
app.setName(appName.toString());
app.setVersion(tokens[tokens.length - 1]);
app.setAppType(MobileAppType.iOS);
apps.add(app);
}
}
} catch (Exception e) {
throw new AutomatorException(e.getMessage(), e);
}
log.info("List of mobile apps for device - " + deviceName + ". App list - " + apps);
return apps;
}
Aggregations