use of com.testsigma.automator.exceptions.AutomatorException in project testsigma by testsigmahq.
the class ScrollInsideElementToTopAction method execute.
@Override
public void execute() throws Exception {
findElement();
try {
WebElement webElement = getElement();
JavascriptExecutor js = (JavascriptExecutor) getDriver();
js.executeScript("arguments[0].scrollTo(0,0);", webElement);
} catch (Exception e) {
log.error("unable to scroll inside an element", e);
throw new AutomatorException(String.format(FAILURE_MESSAGE, getFindByType(), getLocatorValue()));
}
setSuccessMessage(SUCCESS_MESSAGE);
}
use of com.testsigma.automator.exceptions.AutomatorException in project testsigma by testsigmahq.
the class RestAPIRunTimeDataProcessor method updateRequestUrlRuntimeValues.
private void updateRequestUrlRuntimeValues() throws AutomatorException {
log.debug("Updating runtime variables in URL, RestStep ID:" + restfulStepEntity.getId());
try {
String updatedURL = replaceRuntimeVariables(restfulStepEntity.getUrl());
restfulStepEntity.setUrl(updatedURL.trim());
} catch (AutomatorException e) {
throw new AutomatorException("Error while replacing runtime variables in request URL." + e.getMessage());
}
}
use of com.testsigma.automator.exceptions.AutomatorException in project testsigma by testsigmahq.
the class RestAPIRunTimeDataProcessor method updateExpectedStatusRuntimeVariables.
private void updateExpectedStatusRuntimeVariables() throws AutomatorException {
log.debug("Updating Run time data in Status, RestStep ID:" + restfulStepEntity.getId());
try {
String updatedExpectedStatus = replaceRuntimeVariables(restfulStepEntity.getStatus());
restfulStepEntity.setStatus(updatedExpectedStatus);
} catch (AutomatorException e) {
throw new AutomatorException("Error while replacing runtime variables in Verify Response Status." + e.getMessage());
}
}
use of com.testsigma.automator.exceptions.AutomatorException in project testsigma by testsigmahq.
the class RestAPIRunTimeDataProcessor method updateExpectedBodyRuntimeVariables.
private void updateExpectedBodyRuntimeVariables() throws AutomatorException {
log.debug("Updating runtime data in expected body,RestStep ID:" + restfulStepEntity.getId());
try {
String updatedExpectedResponse = replaceRuntimeVariables(restfulStepEntity.getResponse());
restfulStepEntity.setResponse(updatedExpectedResponse);
} catch (AutomatorException e) {
throw new AutomatorException("Error while replacing runtime variables in Verify Response body." + e.getMessage());
}
}
use of com.testsigma.automator.exceptions.AutomatorException in project testsigma by testsigmahq.
the class RestAPIRunTimeDataProcessor method replaceRuntimeVariables.
private String replaceRuntimeVariables(String inputData) throws AutomatorException {
log.debug("Replacing runtime parameters in :" + inputData);
String updatedData = inputData;
String[] names = StringUtils.substringsBetween(inputData, NaturalTextActionConstants.restDataiRunStartPattern, NaturalTextActionConstants.restDataiRunaEndPattern);
if (names == null) {
return inputData;
}
for (String runTimeVarName : names) {
String runTimeValue = new RuntimeDataProvider().getRuntimeData(runTimeVarName);
if (runTimeValue == null) {
throw new AutomatorException(String.format(MSG_RUN_TIME_VARIABLE_NOT_SET, runTimeVarName));
}
String runTimeVarPattern = String.format("%s%s%s", NaturalTextActionConstants.restDataRunStartPattern, Pattern.quote(runTimeVarName), NaturalTextActionConstants.restDatRunaEndPattern);
updatedData = updatedData.replaceAll(runTimeVarPattern, Matcher.quoteReplacement(runTimeValue));
log.debug(String.format("Replaced runtime var:%s with %s", runTimeVarName, runTimeValue));
}
return updatedData;
}
Aggregations