Search in sources :

Example 1 with ExecutionDecision

use of org.jboss.arquillian.test.spi.execution.ExecutionDecision in project keycloak by keycloak.

the class BrowserDriverIgnoreDecider method decideIgnoring.

private ExecutionDecision decideIgnoring(AnnotatedElement element) {
    final WebDriver webDriver = driver.get();
    Predicate<IgnoreBrowserDriver> shouldBeIgnored = (item) -> {
        return webDriver != null && (isDriverInstanceOf(webDriver, item.value()) ^ item.negate());
    };
    return Arrays.stream(element.getAnnotationsByType(IgnoreBrowserDriver.class)).filter(shouldBeIgnored).findAny().map(f -> ExecutionDecision.dontExecute("This test should not be executed with this browser.")).orElse(ExecutionDecision.execute());
}
Also used : WebDriver(org.openqa.selenium.WebDriver) TestExecutionDecider(org.jboss.arquillian.test.spi.execution.TestExecutionDecider) Arrays(java.util.Arrays) Predicate(java.util.function.Predicate) WebDriver(org.openqa.selenium.WebDriver) Instance(org.jboss.arquillian.core.api.Instance) IgnoreBrowserDriver(org.keycloak.testsuite.arquillian.annotation.IgnoreBrowserDriver) TestContext(org.keycloak.testsuite.arquillian.TestContext) BrowserDriverUtil.isDriverInstanceOf(org.keycloak.testsuite.util.BrowserDriverUtil.isDriverInstanceOf) Inject(org.jboss.arquillian.core.api.annotation.Inject) ExecutionDecision(org.jboss.arquillian.test.spi.execution.ExecutionDecision) IgnoreBrowserDrivers(org.keycloak.testsuite.arquillian.annotation.IgnoreBrowserDrivers) Method(java.lang.reflect.Method) AnnotatedElement(java.lang.reflect.AnnotatedElement) IgnoreBrowserDriver(org.keycloak.testsuite.arquillian.annotation.IgnoreBrowserDriver)

Aggregations

AnnotatedElement (java.lang.reflect.AnnotatedElement)1 Method (java.lang.reflect.Method)1 Arrays (java.util.Arrays)1 Predicate (java.util.function.Predicate)1 Instance (org.jboss.arquillian.core.api.Instance)1 Inject (org.jboss.arquillian.core.api.annotation.Inject)1 ExecutionDecision (org.jboss.arquillian.test.spi.execution.ExecutionDecision)1 TestExecutionDecider (org.jboss.arquillian.test.spi.execution.TestExecutionDecider)1 TestContext (org.keycloak.testsuite.arquillian.TestContext)1 IgnoreBrowserDriver (org.keycloak.testsuite.arquillian.annotation.IgnoreBrowserDriver)1 IgnoreBrowserDrivers (org.keycloak.testsuite.arquillian.annotation.IgnoreBrowserDrivers)1 BrowserDriverUtil.isDriverInstanceOf (org.keycloak.testsuite.util.BrowserDriverUtil.isDriverInstanceOf)1 WebDriver (org.openqa.selenium.WebDriver)1