Search in sources :

Example 96 with AutomatorException

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

the class IosDeviceService method setupWda.

public void setupWda(MobileDevice device) throws TestsigmaException, AutomatorException {
    log.info("Setting up WDA on device - " + device.getName());
    try {
        wdaService.installWdaToDevice(device);
        wdaService.startWdaOnDevice(device);
    } catch (Exception e) {
        log.error("Error while setting up wda and starting it. Error - ");
        log.error(e.getMessage(), e);
        cleanupWda(device);
        throw new TestsigmaException(e.getMessage(), e);
    }
}
Also used : TestsigmaException(com.testsigma.agent.exception.TestsigmaException) AutomatorException(com.testsigma.automator.exceptions.AutomatorException) TestsigmaException(com.testsigma.agent.exception.TestsigmaException)

Example 97 with AutomatorException

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:
            MobileNativeVerifyCheckedAction checked = (MobileNativeVerifyCheckedAction) this.initializeChildSnippet(MobileNativeVerifyCheckedAction.class);
            checked.execute();
            this.setSuccessMessage(checked.getSuccessMessage());
            break;
        case ActionConstants.UN_CHECKED:
            MobileNativeVerifyUnCheckedAction unChecked = (MobileNativeVerifyUnCheckedAction) this.initializeChildSnippet(MobileNativeVerifyUnCheckedAction.class);
            unChecked.execute();
            this.setSuccessMessage(unChecked.getSuccessMessage());
            break;
        default:
            setErrorMessage("Unable to Perform Verify Action due to error at test data");
            throw new AutomatorException("Unable to Perform Verify Action due to error at test data");
    }
}
Also used : AutomatorException(com.testsigma.automator.exceptions.AutomatorException) MobileNativeVerifyUnCheckedAction(com.testsigma.automator.actions.mobile.android.verify.MobileNativeVerifyUnCheckedAction) MobileNativeVerifyCheckedAction(com.testsigma.automator.actions.mobile.android.verify.MobileNativeVerifyCheckedAction)

Example 98 with AutomatorException

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

the class IfElementProxyAction method execute.

@Override
public void execute() throws Exception {
    String status = getTestData();
    switch(status) {
        case ActionConstants.ENABLED:
            VerifyEnabledSnippet enabled = (VerifyEnabledSnippet) this.initializeChildSnippet(VerifyEnabledSnippet.class);
            enabled.execute();
            this.setSuccessMessage(enabled.getSuccessMessage());
            break;
        case ActionConstants.DISABLED:
            VerifyDisabledSnippet disabled = (VerifyDisabledSnippet) this.initializeChildSnippet(VerifyDisabledSnippet.class);
            disabled.execute();
            this.setSuccessMessage(disabled.getSuccessMessage());
            break;
        case ActionConstants.VISIBLE:
            VerifyElementPresentSnippet visible = (VerifyElementPresentSnippet) this.initializeChildSnippet(VerifyElementPresentSnippet.class);
            visible.execute();
            this.setSuccessMessage(visible.getSuccessMessage());
            break;
        case ActionConstants.NOT_VISIBLE:
            VerifyElementAbsentSnippet notVisible = (VerifyElementAbsentSnippet) this.initializeChildSnippet(VerifyElementAbsentSnippet.class);
            notVisible.execute();
            this.setSuccessMessage(notVisible.getSuccessMessage());
            break;
        default:
            setErrorMessage("Unable to Perform Verify Action due to error at test data");
            throw new AutomatorException("Unable to Perform Verify Action due to error at test data");
    }
}
Also used : AutomatorException(com.testsigma.automator.exceptions.AutomatorException) VerifyEnabledSnippet(com.testsigma.automator.actions.mobile.android.verify.VerifyEnabledSnippet) VerifyElementPresentSnippet(com.testsigma.automator.actions.mobile.android.verify.VerifyElementPresentSnippet) VerifyElementAbsentSnippet(com.testsigma.automator.actions.mobile.android.verify.VerifyElementAbsentSnippet) VerifyDisabledSnippet(com.testsigma.automator.actions.mobile.android.verify.VerifyDisabledSnippet)

Example 99 with AutomatorException

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

the class PressMobileNativeKeyProxyAction method execute.

@Override
public void execute() throws Exception {
    String key = getTestData();
    switch(key) {
        case ActionConstants.SPACE:
            MobileNativePressSpaceAction space = (MobileNativePressSpaceAction) this.initializeChildSnippet(MobileNativePressSpaceAction.class);
            space.execute();
            this.setSuccessMessage(space.getSuccessMessage());
            break;
        case ActionConstants.ENTER:
            MobileNativePressEnterAction enter = (MobileNativePressEnterAction) this.initializeChildSnippet(MobileNativePressEnterAction.class);
            enter.execute();
            this.setSuccessMessage(enter.getSuccessMessage());
            break;
        case ActionConstants.BACKSPACE:
            MobileNativePressBackSpaceAction backSpace = (MobileNativePressBackSpaceAction) this.initializeChildSnippet(MobileNativePressBackSpaceAction.class);
            backSpace.execute();
            this.setSuccessMessage(backSpace.getSuccessMessage());
            break;
        case ActionConstants.SEARCH:
            TapOnSearchInKeyboardAction available = (TapOnSearchInKeyboardAction) this.initializeChildSnippet(TapOnSearchInKeyboardAction.class);
            available.execute();
            this.setSuccessMessage(available.getSuccessMessage());
            break;
        default:
            setErrorMessage("Unable to Perform Press Key Action due to error at test data");
            throw new AutomatorException("Unable to Perform Press Key Action due to error at test data");
    }
}
Also used : AutomatorException(com.testsigma.automator.exceptions.AutomatorException) TapOnSearchInKeyboardAction(com.testsigma.automator.actions.mobile.android.tap.TapOnSearchInKeyboardAction)

Example 100 with AutomatorException

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

the class MobileInspectorTapOnElement method execute.

@Override
public void execute() throws Exception {
    AppiumDriver driver = getDriver();
    findElement();
    WebElement targetElement = getElement();
    try {
        if (!targetElement.isEnabled()) {
            throw new AutomatorException(ELEMENT_IS_DISABLED);
        } else if (!targetElement.isDisplayed()) {
            throw new AutomatorException(ELEMENT_IS_NOT_DISPLAYED);
        }
        if (driver.getContextHandles().size() > 1) {
            tapByElementCoOrdinates(getElement(), driver);
        } else {
            targetElement.click();
        }
    } catch (StaleElementReferenceException staleException) {
        log.info("Encountered StaleElementReferenceException");
        handleStaleelementExecptionOnClickAction();
    }
    setSuccessMessage(SUCCESS_MESSAGE);
}
Also used : AutomatorException(com.testsigma.automator.exceptions.AutomatorException) AppiumDriver(io.appium.java_client.AppiumDriver) StaleElementReferenceException(org.openqa.selenium.StaleElementReferenceException) WebElement(org.openqa.selenium.WebElement)

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