use of com.testsigma.automator.exceptions.AutomatorException in project testsigma by testsigmahq.
the class WaitUntilAllImagesAreLoadedAction method execute.
@Override
public void execute() throws Exception {
try {
List<WebElement> elements = getWebDriverWait().until(ExpectedConditions.visibilityOfAllElementsLocatedBy(By.xpath("//img")));
Assert.notNull(elements, FAILURE_MESSAGE);
setSuccessMessage(SUCCESS_MESSAGE);
} catch (TimeoutException e) {
throw new AutomatorException(FAILURE_MESSAGE, (Exception) e.getCause());
}
}
use of com.testsigma.automator.exceptions.AutomatorException in project testsigma by testsigmahq.
the class CheckboxElementStatusAction method execute.
@Override
public void execute() throws Exception {
String status = getTestData();
switch(status) {
case ActionConstants.CHECKED:
VerifySwitchEnabledAction enable = (VerifySwitchEnabledAction) this.initializeChildSnippet(VerifySwitchEnabledAction.class);
enable.execute();
this.setSuccessMessage(enable.getSuccessMessage());
break;
case ActionConstants.UN_CHECKED:
VerifySwitchDisabledAction disable = (VerifySwitchDisabledAction) this.initializeChildSnippet(VerifySwitchDisabledAction.class);
disable.execute();
this.setSuccessMessage(disable.getSuccessMessage());
break;
default:
setErrorMessage("Unable to Perform Verify Switch Status Action due to error at test data");
throw new AutomatorException("Unable to Perform Verify Switch Status Action due to error at test data");
}
}
use of com.testsigma.automator.exceptions.AutomatorException in project testsigma by testsigmahq.
the class MobileNativeVerifyCheckedAction method execute.
@Override
public void execute() throws Exception {
findElement();
WebElement targetElement = getElement();
String checkable = targetElement.getAttribute(CHECKABLE);
String checked = targetElement.getAttribute(CHECKED);
if (checkable.equals(TRUE)) {
if (!checked.equals(TRUE)) {
throw new AutomatorException(String.format("The element corresponding to the locator <b>\"%s:%s\"</b> is not in checked" + " state", getElementSearchCriteria().getFindByType(), getElementSearchCriteria().getByValue()));
} else {
log.info("The target element state is already checked, hence no action performed to uncheck.");
}
} else {
throw new AutomatorException(String.format(ELEMENT_IS_NOT_CHECKBLE, getFindByType(), getLocatorValue()));
}
setSuccessMessage(SUCCESS_MESSAGE);
}
use of com.testsigma.automator.exceptions.AutomatorException in project testsigma by testsigmahq.
the class MobileNativeVerifyUnCheckedAction method execute.
@Override
public void execute() throws Exception {
findElement();
WebElement targetElement = getElement();
String checkable = targetElement.getAttribute(CHECKABLE);
String checked = targetElement.getAttribute(CHECKED);
if (checkable.equals(TRUE)) {
if (checked.equals(TRUE)) {
throw new AutomatorException(String.format("The element corresponding to the locator <b>\"%s:%s\"</b> is not in " + "unchecked state", getElementSearchCriteria().getFindByType(), getElementSearchCriteria().getByValue()));
} else {
log.info("The target element state is already Unchecked, hence no action performed to check.");
}
} else {
throw new AutomatorException(String.format(ELEMENT_IS_NOT_CHECKBLE, getFindByType(), getLocatorValue()));
}
setSuccessMessage(SUCCESS_MESSAGE);
}
use of com.testsigma.automator.exceptions.AutomatorException in project testsigma by testsigmahq.
the class AlertVisibilityStatusAction method execute.
@Override
public void execute() throws Exception {
String status = getTestData();
switch(status) {
case ActionConstants.NOT_VISIBLE:
VerifyAlertAbsentAction absence = (VerifyAlertAbsentAction) this.initializeChildSnippet(VerifyAlertAbsentAction.class);
absence.execute();
this.setSuccessMessage(absence.getSuccessMessage());
break;
case ActionConstants.VISIBLE:
VerifyAlertPresentAction available = (VerifyAlertPresentAction) this.initializeChildSnippet(VerifyAlertPresentAction.class);
available.execute();
this.setSuccessMessage(available.getSuccessMessage());
break;
default:
setErrorMessage("Unable to Perform Verify Alert Status Action due to error at test data");
throw new AutomatorException("Unable to Perform Verify Alert Status due to error at test data");
}
}
Aggregations