Search in sources :

Example 1 with HasCapabilities

use of org.openqa.selenium.HasCapabilities in project FluentLenium by FluentLenium.

the class FluentDriverWrappedCapabilitiesProviderTest method shouldReturnInnerMostWrappedDriverCapabilities.

@Test
public void shouldReturnInnerMostWrappedDriverCapabilities() {
    when(((WrapsDriver) webDriverNotHaveCapabilities).getWrappedDriver()).thenReturn(webDriverHasCapabilities);
    when(((HasCapabilities) webDriverHasCapabilities).getCapabilities()).thenReturn(wrappedCapabilities);
    Capabilities capabilities = capabilitiesProvider.getCapabilities(webDriverNotHaveCapabilities);
    assertThat(capabilities).isSameAs(wrappedCapabilities);
}
Also used : HasCapabilities(org.openqa.selenium.HasCapabilities) Capabilities(org.openqa.selenium.Capabilities) HasCapabilities(org.openqa.selenium.HasCapabilities) WrapsDriver(org.openqa.selenium.WrapsDriver) Test(org.junit.Test)

Example 2 with HasCapabilities

use of org.openqa.selenium.HasCapabilities in project vividus by vividus-framework.

the class DelegatingWebDriverTests method testGetCapabilities.

@Test
void testGetCapabilities() {
    WebDriver driverWithCapabilities = Mockito.mock(WebDriver.class, withSettings().extraInterfaces(HasCapabilities.class));
    Capabilities capabilities = Mockito.mock(Capabilities.class);
    when(((HasCapabilities) driverWithCapabilities).getCapabilities()).thenReturn(capabilities);
    assertEquals(capabilities, new DelegatingWebDriver(driverWithCapabilities).getCapabilities());
}
Also used : WebDriver(org.openqa.selenium.WebDriver) HasCapabilities(org.openqa.selenium.HasCapabilities) Capabilities(org.openqa.selenium.Capabilities) HasCapabilities(org.openqa.selenium.HasCapabilities) Test(org.junit.jupiter.api.Test)

Example 3 with HasCapabilities

use of org.openqa.selenium.HasCapabilities in project vividus by vividus-framework.

the class ApplicationActionsTests method mockCapabilities.

private HasCapabilities mockCapabilities() {
    HasCapabilities hasCapabilities = mock(HasCapabilities.class);
    when(hasCapabilities.getCapabilities()).thenReturn(new MutableCapabilities(Map.of(APP, APP_NAME)));
    when(webDriverProvider.getUnwrapped(HasCapabilities.class)).thenReturn(hasCapabilities);
    return hasCapabilities;
}
Also used : MutableCapabilities(org.openqa.selenium.MutableCapabilities) HasCapabilities(org.openqa.selenium.HasCapabilities)

Example 4 with HasCapabilities

use of org.openqa.selenium.HasCapabilities in project vividus by vividus-framework.

the class ApplicationActions method reinstallApplication.

/**
 * Reinstall the application.
 * @param bundleId bundle identifier of the application to reinstall.
 */
public void reinstallApplication(String bundleId) {
    InteractsWithApps interactor = webDriverProvider.getUnwrapped(InteractsWithApps.class);
    HasCapabilities hasCapabilities = webDriverProvider.getUnwrapped(HasCapabilities.class);
    String appPath = hasCapabilities.getCapabilities().getCapability("app").toString();
    Validate.isTrue(interactor.removeApp(bundleId), "Unable to remove mobile application with the bundle identifier '%s'", bundleId);
    interactor.installApp(appPath);
}
Also used : HasCapabilities(org.openqa.selenium.HasCapabilities) InteractsWithApps(io.appium.java_client.InteractsWithApps)

Example 5 with HasCapabilities

use of org.openqa.selenium.HasCapabilities in project vividus by vividus-framework.

the class ApplicationSteps method startMobileApplication.

/**
 * Starts mobile application
 */
@Given("I start mobile application")
public void startMobileApplication() {
    HasCapabilities driverWithCapabilities = webDriverProvider.getUnwrapped(HasCapabilities.class);
    LOGGER.atInfo().addArgument(() -> CapabilityHelpers.getCapability(driverWithCapabilities.getCapabilities(), "app", String.class)).log("Started application located at {}");
}
Also used : HasCapabilities(org.openqa.selenium.HasCapabilities) Given(org.jbehave.core.annotations.Given)

Aggregations

HasCapabilities (org.openqa.selenium.HasCapabilities)19 Capabilities (org.openqa.selenium.Capabilities)13 Test (org.junit.jupiter.api.Test)7 WebDriver (org.openqa.selenium.WebDriver)7 URL (java.net.URL)5 Map (java.util.Map)5 DesiredCapabilities (org.openqa.selenium.remote.DesiredCapabilities)5 LoggingEvent.info (com.github.valfirst.slf4jtest.LoggingEvent.info)4 TestLogger (com.github.valfirst.slf4jtest.TestLogger)4 TestLoggerFactory (com.github.valfirst.slf4jtest.TestLoggerFactory)4 TestLoggerFactoryExtension (com.github.valfirst.slf4jtest.TestLoggerFactoryExtension)4 MalformedURLException (java.net.MalformedURLException)4 URI (java.net.URI)4 Arrays (java.util.Arrays)4 List (java.util.List)4 Optional (java.util.Optional)4 ConcurrentHashMap (java.util.concurrent.ConcurrentHashMap)4 FieldUtils (org.apache.commons.lang3.reflect.FieldUtils)4 MatcherAssert.assertThat (org.hamcrest.MatcherAssert.assertThat)4 Matchers.hasItem (org.hamcrest.Matchers.hasItem)4