@@ -66,9 +66,11 @@ public class RepositoryAdminTest | |||
el.click(); | |||
wait.until(ExpectedConditions.visibilityOfElementLocated(By.id("remote-repositories-view-a"))); | |||
el = wait.until(ExpectedConditions.elementToBeClickable( By.id("menu-proxy-connectors-list-a") )); | |||
el.click(); | |||
wait.until(ExpectedConditions.visibilityOfElementLocated(By.id("proxy-connectors-view-tabs-a-network-proxies-grid"))); | |||
tryClick(By.id("menu-proxy-connectors-list-a"), | |||
ExpectedConditions.visibilityOfElementLocated(By.id("proxy-connectors-view-tabs-a-network-proxies-grid")), | |||
"Network proxies not available", | |||
3,10 | |||
); | |||
wait.until(ExpectedConditions.textToBePresentInElementLocated(By.id("main-content"), "Proxy Connectors")); | |||
// proxy connect | |||
wait.until(ExpectedConditions.textToBePresentInElementLocated(By.id("proxy-connectors-view"), "central" )); |
@@ -620,6 +620,32 @@ public abstract class AbstractSeleniumTest | |||
} | |||
} | |||
public <V> V tryClick(By clickableLocator, Function<? super WebDriver, V> conditions, String message, int attempts, int maxWaitTimeInS) { | |||
int count = attempts; | |||
WebDriverWait wait = new WebDriverWait( getWebDriver(), maxWaitTimeInS ); | |||
V result = null; | |||
Exception ex = null; | |||
while(count>0) | |||
{ | |||
try | |||
{ | |||
WebElement el = wait.until(ExpectedConditions.elementToBeClickable( clickableLocator )); | |||
el.click(); | |||
result = wait.until( conditions ); | |||
count=0; | |||
ex = null; | |||
} catch (Exception e) { | |||
ex = e; | |||
count--; | |||
} | |||
} | |||
if (ex!=null) { | |||
Assert.fail( message); | |||
} | |||
return result; | |||
} | |||
/** | |||
* Executes click() on the WebElement <code>el</code> and waits for the conditions. | |||
* If the condition is not fulfilled in <code>maxWaitTimeInS</code>, the click is executed again |
@@ -23,6 +23,7 @@ import org.apache.commons.io.FileUtils; | |||
import org.apache.commons.lang3.StringUtils; | |||
import org.openqa.selenium.*; | |||
import org.openqa.selenium.chrome.ChromeDriver; | |||
import org.openqa.selenium.chrome.ChromeOptions; | |||
import org.openqa.selenium.firefox.FirefoxDriver; | |||
import org.openqa.selenium.htmlunit.HtmlUnitDriver; | |||
import org.openqa.selenium.ie.InternetExplorerDriver; | |||
@@ -69,13 +70,17 @@ public class WebdriverUtility | |||
try { | |||
if ( StringUtils.contains(seleniumBrowser, "chrome")) { | |||
ChromeOptions options = new ChromeOptions(); | |||
options.addArguments("start-maximized"); | |||
if (seleniumRemote) | |||
{ | |||
DesiredCapabilities capabilities = DesiredCapabilities.chrome(); | |||
capabilities.setCapability( ChromeOptions.CAPABILITY, options ); | |||
return new RemoteWebDriver( new URL( "http://" + seleniumHost + ":" + seleniumPort + "/wd/hub" ), | |||
DesiredCapabilities.chrome() | |||
capabilities | |||
); | |||
} else { | |||
return new ChromeDriver( ); | |||
return new ChromeDriver( options ); | |||
} | |||
} | |||