Search in sources :

Example 86 with AutomatorException

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);
    }
}
Also used : AutomatorException(com.testsigma.automator.exceptions.AutomatorException) AutomatorException(com.testsigma.automator.exceptions.AutomatorException) IOException(java.io.IOException)

Example 87 with AutomatorException

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);
    }
}
Also used : AutomatorException(com.testsigma.automator.exceptions.AutomatorException) AutomatorException(com.testsigma.automator.exceptions.AutomatorException) IOException(java.io.IOException)

Example 88 with AutomatorException

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);
    }
}
Also used : AutomatorException(com.testsigma.automator.exceptions.AutomatorException) AutomatorException(com.testsigma.automator.exceptions.AutomatorException) IOException(java.io.IOException)

Example 89 with AutomatorException

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);
    }
}
Also used : AutomatorException(com.testsigma.automator.exceptions.AutomatorException) MobileApp(com.testsigma.automator.mobile.MobileApp) AutomatorException(com.testsigma.automator.exceptions.AutomatorException)

Example 90 with AutomatorException

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;
}
Also used : AutomatorException(com.testsigma.automator.exceptions.AutomatorException) InputStreamReader(java.io.InputStreamReader) MobileApp(com.testsigma.automator.mobile.MobileApp) ArrayList(java.util.ArrayList) BufferedReader(java.io.BufferedReader) AutomatorException(com.testsigma.automator.exceptions.AutomatorException)

Aggregations

AutomatorException (com.testsigma.automator.exceptions.AutomatorException)119 TimeoutException (org.openqa.selenium.TimeoutException)31 WebElement (org.openqa.selenium.WebElement)19 IOException (java.io.IOException)12 ArrayList (java.util.ArrayList)9 Select (org.openqa.selenium.support.ui.Select)6 TestsigmaException (com.testsigma.agent.exception.TestsigmaException)5 JsonProcessingException (com.fasterxml.jackson.core.JsonProcessingException)3 RuntimeDataProvider (com.testsigma.automator.utilities.RuntimeDataProvider)3 InvocationTargetException (java.lang.reflect.InvocationTargetException)3 Map (java.util.Map)3 RemoteWebDriver (org.openqa.selenium.remote.RemoteWebDriver)3 LinkedMultiValueMap (org.springframework.util.LinkedMultiValueMap)3 PathNotFoundException (com.jayway.jsonpath.PathNotFoundException)2 ElementNotDisplayedException (com.testsigma.automator.actions.exceptions.ElementNotDisplayedException)2 MobileApp (com.testsigma.automator.mobile.MobileApp)2 ObjectMapperService (com.testsigma.automator.service.ObjectMapperService)2 ErrorUtil (com.testsigma.automator.utilities.ErrorUtil)2 File (java.io.File)2 MalformedURLException (java.net.MalformedURLException)2