aboutsummaryrefslogtreecommitdiffstats
path: root/archiva-modules/archiva-web/archiva-webapp-test
diff options
context:
space:
mode:
authorMartin Stockhammer <martin_s@apache.org>2017-06-11 22:08:22 +0200
committerMartin Stockhammer <martin_s@apache.org>2017-06-11 22:08:22 +0200
commit7abf559673a7e76c1f7fcf0ab2b64c1efb46f828 (patch)
treecb93fa56edb85cd77e6bc68f7cc4227df916a5ab /archiva-modules/archiva-web/archiva-webapp-test
parent087f6258f36e7a5b6112715d1a46499b6b6d8f38 (diff)
downloadarchiva-7abf559673a7e76c1f7fcf0ab2b64c1efb46f828.tar.gz
archiva-7abf559673a7e76c1f7fcf0ab2b64c1efb46f828.zip
Adding workaround for timing problems with htmlunit
Diffstat (limited to 'archiva-modules/archiva-web/archiva-webapp-test')
-rw-r--r--archiva-modules/archiva-web/archiva-webapp-test/src/test/java/org/apache/archiva/web/test/parent/AbstractSeleniumTest.java58
1 files changed, 32 insertions, 26 deletions
diff --git a/archiva-modules/archiva-web/archiva-webapp-test/src/test/java/org/apache/archiva/web/test/parent/AbstractSeleniumTest.java b/archiva-modules/archiva-web/archiva-webapp-test/src/test/java/org/apache/archiva/web/test/parent/AbstractSeleniumTest.java
index 8e4a340b0..b6741b19b 100644
--- a/archiva-modules/archiva-web/archiva-webapp-test/src/test/java/org/apache/archiva/web/test/parent/AbstractSeleniumTest.java
+++ b/archiva-modules/archiva-web/archiva-webapp-test/src/test/java/org/apache/archiva/web/test/parent/AbstractSeleniumTest.java
@@ -140,35 +140,41 @@ public abstract class AbstractSeleniumTest
WebDriverWait wait = new WebDriverWait(getWebDriver(),30);
wait.until(ExpectedConditions.presenceOfElementLocated(By.id("topbar-menu")));
- FluentWait fluentWait = new FluentWait(getWebDriver()).withTimeout(10, TimeUnit.SECONDS);
- fluentWait.until( ExpectedConditions.or(
- ExpectedConditions.visibilityOfElementLocated(By.id("create-admin-link")),
+ wait = new WebDriverWait( getWebDriver(), 20 );
+ Boolean found = wait.until( ExpectedConditions.or(
+ ExpectedConditions.visibilityOfElementLocated(By.id("create-admin-link-a")),
ExpectedConditions.visibilityOfElementLocated(By.id("login-link-a"))));
+ if (found)
+ {
+ WebElement adminLink = getWebDriver().findElement( By.id( "create-admin-link-a" ) );
+ WebElement loginLink = getWebDriver().findElement( By.id( "login-link-a" ) );
- // if not admin user created create one
- if ( isElementVisible( "create-admin-link" ) )
- {
- Assert.assertFalse( isElementVisible( "login-link-a" ) );
- Assert.assertFalse( isElementVisible( "register-link-a" ) );
- // skygo need to set to true for passing is that work as expected ?
- clickLinkWithLocator( "create-admin-link-a");
- wait = new WebDriverWait(getWebDriver(), 5);
- wait.until(ExpectedConditions.visibilityOfElementLocated(By.id("user-create")));
- assertCreateAdmin();
- String fullname = getProperty( "ADMIN_FULLNAME" );
- String username = getAdminUsername();
- String mail = getProperty( "ADMIN_EMAIL" );
- String password = getProperty( "ADMIN_PASSWORD" );
- submitAdminData( fullname, mail, password );
- assertUserLoggedIn( username );
- clickLinkWithLocator( "logout-link-a" , false);
- }
- else
- {
- Assert.assertTrue( isElementVisible( "login-link-a" ) );
- Assert.assertTrue( isElementVisible( "register-link-a" ) );
- login( getAdminUsername(), getAdminPassword() );
+ // if not admin user created create one
+ if ( adminLink != null && adminLink.isDisplayed() )
+ {
+
+ Assert.assertFalse( isElementVisible( "login-link-a" ) );
+ Assert.assertFalse( isElementVisible( "register-link-a" ) );
+ // skygo need to set to true for passing is that work as expected ?
+ adminLink.click();
+ wait = new WebDriverWait( getWebDriver(), 10 );
+ wait.until( ExpectedConditions.visibilityOfElementLocated( By.id( "user-create" ) ) );
+ assertCreateAdmin();
+ String fullname = getProperty( "ADMIN_FULLNAME" );
+ String username = getAdminUsername();
+ String mail = getProperty( "ADMIN_EMAIL" );
+ String password = getProperty( "ADMIN_PASSWORD" );
+ submitAdminData( fullname, mail, password );
+ assertUserLoggedIn( username );
+ clickLinkWithLocator( "logout-link-a", false );
+ }
+ else if ( loginLink != null && loginLink.isDisplayed() )
+ {
+ Assert.assertTrue( isElementVisible( "login-link-a" ) );
+ Assert.assertTrue( isElementVisible( "register-link-a" ) );
+ login( getAdminUsername(), getAdminPassword() );
+ }
}
}