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);
}
}
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);
}
}
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);
}
}
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);
}
}
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);
}
Aggregations