Skip to content

Commit

Permalink
Bug fix: build of parameters for WebDriver instantiation.
Browse files Browse the repository at this point in the history
It is not necessary to use URL for local web drivers
  • Loading branch information
TikhomirovSergey committed Sep 6, 2018
1 parent 09eac99 commit 7cf1d40
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 9 deletions.
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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}
Expand Down Expand Up @@ -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<? extends WebDriver> getWebDriverClass() {
Expand Down

0 comments on commit 7cf1d40

Please sign in to comment.