Search in sources :

Example 71 with AutomatorException

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

the class CloudAppBridge method getTestCase.

@Override
public TestCaseEntity getTestCase(Long environmentResultId, TestCaseEntity testCaseEntity) throws AutomatorException {
    try {
        MultiValueMap<String, String> queryParams = new LinkedMultiValueMap<>();
        if (StringUtils.isNotBlank(testCaseEntity.getTestDataSetName())) {
            queryParams.add("testDataSetName", testCaseEntity.getTestDataSetName());
        }
        queryParams.add("testCaseResultId", testCaseEntity.getTestCaseResultId().toString());
        queryParams.add("environmentResultId", environmentResultId.toString());
        String url = ServerURLBuilder.testCaseDetailsURL(testCaseEntity.getId(), queryParams);
        String authHeader = HttpClient.BEARER + " " + agentConfig.getJwtApiKey();
        HttpResponse<TestCaseEntity> response = webAppHttpClient.get(url, new TypeReference<>() {
        }, authHeader);
        if (response.getStatusCode() > 200) {
            log.error("---------------- Error while fetching test case - " + response.getStatusCode());
        }
        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) LinkedMultiValueMap(org.springframework.util.LinkedMultiValueMap) AutomatorException(com.testsigma.automator.exceptions.AutomatorException)

Example 72 with AutomatorException

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

the class CloudAppBridge method getWebDriverSettings.

@Override
public WebDriverSettingsDTO getWebDriverSettings(Long environmentResultId) throws AutomatorException {
    try {
        String authHeader = HttpClient.BEARER + " " + agentConfig.getJwtApiKey();
        String url = ServerURLBuilder.capabilitiesURL(environmentResultId);
        HttpResponse<WebDriverSettingsDTO> 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) AutomatorException(com.testsigma.automator.exceptions.AutomatorException)

Example 73 with AutomatorException

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

the class CloudAppBridge method postEnvironmentResult.

@Override
public void postEnvironmentResult(EnvironmentRunResult environmentRunResult) throws AutomatorException {
    try {
        String endpointUrl = ServerURLBuilder.environmentResultURL(environmentRunResult.getId());
        String authHeader = HttpClient.BEARER + " " + agentConfig.getJwtApiKey();
        log.info("Sending environment run results to - " + endpointUrl);
        HttpResponse<String> response = webAppHttpClient.put(endpointUrl, environmentRunResult, null, authHeader);
        log.debug("Sent environment run results to cloud servers successfully - " + response.getStatusCode() + " - " + response.getResponseEntity());
    } 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 74 with AutomatorException

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

the class CloudAppBridge method updateTestCaseResultData.

@Override
public void updateTestCaseResultData(TestCaseResultRequest testCaseResultRequest) throws AutomatorException {
    try {
        String url = ServerURLBuilder.testCaseResultUpdateURL(testCaseResultRequest.getId());
        String authHeader = HttpClient.BEARER + " " + agentConfig.getJwtApiKey();
        HttpResponse<String> response = webAppHttpClient.put(url, testCaseResultRequest, 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 75 with AutomatorException

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

the class SubmitFormAction method execute.

@Override
protected void execute() throws Exception {
    findElement();
    try {
        getElement().submit();
    } catch (Exception e) {
        throw new AutomatorException(String.format(FAILURE_MESSAGE, getFindByType(), getLocatorValue()));
    }
    setSuccessMessage(SUCCESS_MESSAGE);
}
Also used : AutomatorException(com.testsigma.automator.exceptions.AutomatorException) 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