From 7cf1d40bdb1f51544645e2f1a2ab5b0dd3e16528 Mon Sep 17 00:00:00 2001 From: Sergey Tikhomirov Date: Thu, 6 Sep 2018 13:08:32 +0300 Subject: [PATCH] Bug fix: build of parameters for WebDriver instantiation. It is not necessary to use URL for local web drivers --- build.gradle | 2 +- .../properties/SupportedWebDrivers.java | 19 +++++++++++-------- 2 files changed, 12 insertions(+), 9 deletions(-) diff --git a/build.gradle b/build.gradle index fabbb6d25f..b67c602688 100644 --- a/build.gradle +++ b/build.gradle @@ -5,7 +5,7 @@ subprojects { apply plugin: 'maven-publish' group 'ru.tinkoff.qa.neptune' - version '0.1.7-ALPHA' + version '0.1.8-ALPHA' sourceCompatibility = 1.9 targetCompatibility = 1.9 diff --git a/selenium/src/main/java/ru/tinkoff/qa/neptune/selenium/properties/SupportedWebDrivers.java b/selenium/src/main/java/ru/tinkoff/qa/neptune/selenium/properties/SupportedWebDrivers.java index 1d3c26c73f..1a2cbe9f79 100644 --- a/selenium/src/main/java/ru/tinkoff/qa/neptune/selenium/properties/SupportedWebDrivers.java +++ b/selenium/src/main/java/ru/tinkoff/qa/neptune/selenium/properties/SupportedWebDrivers.java @@ -15,11 +15,11 @@ import java.net.URL; import java.util.function.Supplier; +import static org.apache.commons.lang3.ArrayUtils.addAll; import static ru.tinkoff.qa.neptune.selenium.properties.CapabilityTypes.*; import static ru.tinkoff.qa.neptune.selenium.properties.URLProperties.REMOTE_WEB_DRIVER_URL_PROPERTY; import static io.github.bonigarcia.wdm.WebDriverManager.*; import static java.util.Optional.ofNullable; -import static org.apache.commons.lang3.ArrayUtils.add; /** * This enum wraps a class of supported {@link WebDriver} and array of arguments @@ -71,6 +71,15 @@ public WebDriverManager getWebDriverManager() { return null; } + + @Override + public Object[] get() { + return ofNullable(REMOTE_WEB_DRIVER_URL_PROPERTY.get()) + .map(url -> { + Object[] result = new Object[]{url}; + return addAll(result, super.get()); + }).orElseGet(super::get); + } }, /** * This item describes instantiation of {@link ChromeDriver} @@ -154,13 +163,7 @@ public WebDriverManager getWebDriverManager() { } public Object[] get() { - Object[] args = new Object[]{}; - URL remoteURL = URLProperties.REMOTE_WEB_DRIVER_URL_PROPERTY.get(); - if (remoteURL != null) { - args = add(args, remoteURL); - } - args = add(args, capabilityType.get()); - return args; + return new Object[]{capabilityType.get()}; } public Class getWebDriverClass() {