Search in sources :

Example 11 with DriverExceptions

use of com.seleniumtests.customexception.DriverExceptions in project seleniumRobot by bhecquet.

the class StubTestClass method testWithException.

@Test(groups = "stub")
public void testWithException() {
    count++;
    TestStep step1 = new TestStep("step 1", Reporter.getCurrentTestResult(), new ArrayList<>(), maskPassword);
    step1.addAction(new TestAction(String.format("played %d times", count), false, new ArrayList<>()));
    step1.addAction(new TestAction("click button", false, new ArrayList<>()));
    TestStepManager.logTestStep(step1);
    throw new DriverExceptions("some exception");
}
Also used : TestStep(com.seleniumtests.reporter.logger.TestStep) DriverExceptions(com.seleniumtests.customexception.DriverExceptions) ArrayList(java.util.ArrayList) TestAction(com.seleniumtests.reporter.logger.TestAction) Test(org.testng.annotations.Test)

Example 12 with DriverExceptions

use of com.seleniumtests.customexception.DriverExceptions in project seleniumRobot by bhecquet.

the class StubTestClass method testWithExceptionAndMaxRetryIncreasedWithLimit.

/**
 * Increase max retry above limit
 */
@Test(groups = "stub")
public void testWithExceptionAndMaxRetryIncreasedWithLimit() {
    count++;
    TestStep step1 = new TestStep("step 1", Reporter.getCurrentTestResult(), new ArrayList<>(), maskPassword);
    step1.addAction(new TestAction(String.format("played %d times", count), false, new ArrayList<>()));
    step1.addAction(new TestAction("click button", false, new ArrayList<>()));
    TestStepManager.logTestStep(step1);
    try {
        throw new DriverExceptions("some exception");
    } finally {
        if (count < 4) {
            increaseMaxRetry();
        }
    }
}
Also used : TestStep(com.seleniumtests.reporter.logger.TestStep) DriverExceptions(com.seleniumtests.customexception.DriverExceptions) ArrayList(java.util.ArrayList) TestAction(com.seleniumtests.reporter.logger.TestAction) Test(org.testng.annotations.Test)

Example 13 with DriverExceptions

use of com.seleniumtests.customexception.DriverExceptions in project seleniumRobot by bhecquet.

the class StubTestClassForEncoding method testWithChainedException.

@Test(groups = "stub")
public void testWithChainedException() {
    TestStep step1 = new TestStep("step 1", Reporter.getCurrentTestResult(), new ArrayList<>(), true);
    step1.addAction(new TestAction("click button", false, new ArrayList<>()));
    TestStepManager.logTestStep(step1);
    throw new DriverExceptions("& some exception \"with \" <strong><a href='http://someurl/link' style='background-color: red;'>HTML to encode</a></strong>", new DriverExceptions("root <error>"));
}
Also used : TestStep(com.seleniumtests.reporter.logger.TestStep) DriverExceptions(com.seleniumtests.customexception.DriverExceptions) ArrayList(java.util.ArrayList) TestAction(com.seleniumtests.reporter.logger.TestAction) Test(org.testng.annotations.Test)

Aggregations

DriverExceptions (com.seleniumtests.customexception.DriverExceptions)13 TestAction (com.seleniumtests.reporter.logger.TestAction)8 TestStep (com.seleniumtests.reporter.logger.TestStep)8 ArrayList (java.util.ArrayList)8 Test (org.testng.annotations.Test)8 MalformedURLException (java.net.MalformedURLException)3 URL (java.net.URL)3 MutableCapabilities (org.openqa.selenium.MutableCapabilities)3 WebElement (org.openqa.selenium.WebElement)3 AndroidDriver (io.appium.java_client.android.AndroidDriver)2 RemoteWebDriver (org.openqa.selenium.remote.RemoteWebDriver)2 ConfigurationException (com.seleniumtests.customexception.ConfigurationException)1 IOException (java.io.IOException)1 InputStream (java.io.InputStream)1 InvocationTargetException (java.lang.reflect.InvocationTargetException)1 Method (java.lang.reflect.Method)1 Path (java.nio.file.Path)1 RemoteWebElement (org.openqa.selenium.remote.RemoteWebElement)1