Search in sources :

Example 11 with AutomatorException

use of com.testsigma.automator.exceptions.AutomatorException in project testsigma by testsigmahq.

the class CloudAppBridge method postTestSuiteResult.

@Override
public void postTestSuiteResult(TestSuiteResult testSuiteResult) throws AutomatorException {
    try {
        String authHeader = HttpClient.BEARER + " " + agentConfig.getJwtApiKey();
        webAppHttpClient.put(ServerURLBuilder.testSuiteResultURL(testSuiteResult.getId()), testSuiteResult, null, authHeader);
    } 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)

Example 12 with AutomatorException

use of com.testsigma.automator.exceptions.AutomatorException in project testsigma by testsigmahq.

the class CloudAppBridge method getSuggestions.

@Override
public List<SuggestionEntity> getSuggestions(Integer naturalTextActionId) throws AutomatorException {
    try {
        String authHeader = HttpClient.BEARER + " " + agentConfig.getJwtApiKey();
        String url = ServerURLBuilder.suggestionsURL(naturalTextActionId);
        HttpResponse<List<SuggestionEntity>> response = webAppHttpClient.get(url, new TypeReference<>() {
        }, authHeader);
        if (response.getStatusCode() != HttpStatus.OK.value()) {
            throw new AutomatorException(response.getStatusMessage());
        }
        return response.getResponseEntity();
    } catch (Exception e) {
        log.error(e.getMessage(), e);
        throw new AutomatorException(e.getMessage(), e);
    }
}
Also used : AutomatorException(com.testsigma.automator.exceptions.AutomatorException) List(java.util.List) AutomatorException(com.testsigma.automator.exceptions.AutomatorException)

Example 13 with AutomatorException

use of com.testsigma.automator.exceptions.AutomatorException in project testsigma by testsigmahq.

the class CloudAppBridge method updateTestSuiteResultData.

@Override
public void updateTestSuiteResultData(TestSuiteResultRequest testSuiteResultRequest) throws AutomatorException {
    try {
        String url = ServerURLBuilder.testSuiteResultUpdateURL(testSuiteResultRequest.getId());
        String authHeader = HttpClient.BEARER + " " + agentConfig.getJwtApiKey();
        HttpResponse<String> response = webAppHttpClient.put(url, testSuiteResultRequest, new TypeReference<>() {
        }, authHeader);
        log.error(response.getStatusCode() + " - " + response.getResponseText());
    } 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)

Example 14 with AutomatorException

use of com.testsigma.automator.exceptions.AutomatorException in project testsigma by testsigmahq.

the class WdaService method startWdaOnDevice.

public void startWdaOnDevice(MobileDevice device) throws TestsigmaException, AutomatorException {
    try {
        log.info("Starting WDA on device - " + device.getName());
        log.info("Checking for any previously started WDA processes on device - " + device.getName());
        IosDeviceCommandExecutor iosDeviceCommandExecutor = new IosDeviceCommandExecutor();
        stopWdaOnDevice(device);
        device.setWdaExecutorService(Executors.newSingleThreadExecutor());
        device.setWdaRelayExecutorService(Executors.newSingleThreadExecutor());
        device.getWdaExecutorService().execute(() -> {
            try {
                Process p = iosDeviceCommandExecutor.runDeviceCommand(new String[] { "-u", device.getUniqueId(), "xctest", "-B", WDA_BUNDLE_ID });
                device.setWdaProcess(p);
            } catch (Exception e) {
                log.info(e.getMessage(), e);
            }
        });
        log.info("Putting the thread to sleep for 10 seconds so as wait for WDA process to start on device - " + device.getName());
        Thread.sleep(10000);
        checkWDAProcessStatus(device);
        device.getWdaRelayExecutorService().execute(() -> {
            try {
                Process p = iosDeviceCommandExecutor.runDeviceCommand(new String[] { "-u", device.getUniqueId(), "relay", WDA_PORT.toString(), WDA_PORT.toString() });
                device.setWdaRelayProcess(p);
            } catch (Exception e) {
                log.info(e.getMessage(), e);
            }
        });
        log.info("Putting the thread to sleep for 2 seconds so as wait for WDA relay process to start on device - " + device.getName());
        Thread.sleep(2000);
        checkWDARelayProcessStatus(device);
    } catch (Exception e) {
        throw new TestsigmaException(e.getMessage(), e);
    }
}
Also used : IosDeviceCommandExecutor(com.testsigma.automator.mobile.ios.IosDeviceCommandExecutor) TestsigmaException(com.testsigma.agent.exception.TestsigmaException) AutomatorException(com.testsigma.automator.exceptions.AutomatorException) TestsigmaException(com.testsigma.agent.exception.TestsigmaException)

Example 15 with AutomatorException

use of com.testsigma.automator.exceptions.AutomatorException in project testsigma by testsigmahq.

the class AddonAction method initRunTimeDataVariable.

private void initRunTimeDataVariable() throws AutomatorException {
    try {
        for (Field field : clazz.getDeclaredFields()) {
            RunTimeData runTimeData = field.getAnnotation(RunTimeData.class);
            if (runTimeData != null) {
                log.info("Initializing  Run Time Data for Addon Plugin Action Step - " + runTimeData);
                Object runTimeDataInstance = addonService.getRunTimeDataInstance();
                FieldUtils.writeField(instance, field.getName(), runTimeDataInstance, true);
                log.info("Setting run time data to the main instance - " + field.getName());
            }
        }
    } catch (Exception e) {
        log.error(e.getMessage(), e);
        throw new AutomatorException(e.getMessage(), e);
    }
}
Also used : AutomatorException(com.testsigma.automator.exceptions.AutomatorException) Field(java.lang.reflect.Field) RunTimeData(com.testsigma.sdk.annotation.RunTimeData) AutomatorException(com.testsigma.automator.exceptions.AutomatorException) UnreachableBrowserException(org.openqa.selenium.remote.UnreachableBrowserException) UnexpectedTagNameException(org.openqa.selenium.support.ui.UnexpectedTagNameException) MoveTargetOutOfBoundsException(org.openqa.selenium.interactions.MoveTargetOutOfBoundsException) IOException(java.io.IOException) InvocationTargetException(java.lang.reflect.InvocationTargetException) ElementNotDisplayedException(com.testsigma.automator.actions.exceptions.ElementNotDisplayedException)

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