From 035ed200acd4898f788be3f5ed79651593d728ea Mon Sep 17 00:00:00 2001 From: Olivier Lamy Date: Mon, 19 Sep 2011 12:40:46 +0000 Subject: [PATCH] add a hack for selenium issue http://jira.openqa.org/browse/SRC-302 git-svn-id: https://svn.apache.org/repos/asf/archiva/trunk@1172592 13f79535-47bb-0310-9956-ffa450edef68 --- .../web/test/parent/AbstractArchivaTest.java | 4 ++-- .../archiva/web/test/parent/AbstractSearchTest.java | 3 ++- .../web/test/parent/AbstractSeleniumTest.java | 13 ++++++++++++- 3 files changed, 16 insertions(+), 4 deletions(-) diff --git a/archiva-modules/archiva-web/archiva-webapp-test/src/test/testng/org/apache/archiva/web/test/parent/AbstractArchivaTest.java b/archiva-modules/archiva-web/archiva-webapp-test/src/test/testng/org/apache/archiva/web/test/parent/AbstractArchivaTest.java index e838e0b27..ca5fe6334 100644 --- a/archiva-modules/archiva-web/archiva-webapp-test/src/test/testng/org/apache/archiva/web/test/parent/AbstractArchivaTest.java +++ b/archiva-modules/archiva-web/archiva-webapp-test/src/test/testng/org/apache/archiva/web/test/parent/AbstractArchivaTest.java @@ -587,7 +587,7 @@ public abstract class AbstractArchivaTest } public void addManagedRepository( String identifier, String name, String directory, String indexDirectory, - String type, String cron, String daysOlder, String retentionCount ) + String type, String cron, String daysOlder, String retentionCount, boolean wait) { // goToRepositoriesPage(); // clickLinkWithText( "Add" ); @@ -600,7 +600,7 @@ public abstract class AbstractArchivaTest setFieldValue( "repository.daysOlder", daysOlder ); setFieldValue( "repository.retentionCount", retentionCount ); // TODO - clickButtonWithValue( "Add Repository" ); + clickButtonWithValue( "Add Repository", wait ); } // artifact management diff --git a/archiva-modules/archiva-web/archiva-webapp-test/src/test/testng/org/apache/archiva/web/test/parent/AbstractSearchTest.java b/archiva-modules/archiva-web/archiva-webapp-test/src/test/testng/org/apache/archiva/web/test/parent/AbstractSearchTest.java index e2223dabe..33b12be0a 100644 --- a/archiva-modules/archiva-web/archiva-webapp-test/src/test/testng/org/apache/archiva/web/test/parent/AbstractSearchTest.java +++ b/archiva-modules/archiva-web/archiva-webapp-test/src/test/testng/org/apache/archiva/web/test/parent/AbstractSearchTest.java @@ -29,7 +29,8 @@ public abstract class AbstractSearchTest if (!isElementPresent( "quickSearchBox" ) ) { getSelenium().open( "/index.action"); - getSelenium().waitForPageToLoad( maxWaitTimeInMs ); + //getSelenium().waitForPageToLoad( maxWaitTimeInMs ); + waitPage(); assertElementPresent( "quickSearchSubmit" ); } } diff --git a/archiva-modules/archiva-web/archiva-webapp-test/src/test/testng/org/apache/archiva/web/test/parent/AbstractSeleniumTest.java b/archiva-modules/archiva-web/archiva-webapp-test/src/test/testng/org/apache/archiva/web/test/parent/AbstractSeleniumTest.java index a36db0234..76c025a37 100644 --- a/archiva-modules/archiva-web/archiva-webapp-test/src/test/testng/org/apache/archiva/web/test/parent/AbstractSeleniumTest.java +++ b/archiva-modules/archiva-web/archiva-webapp-test/src/test/testng/org/apache/archiva/web/test/parent/AbstractSeleniumTest.java @@ -237,7 +237,18 @@ public abstract class AbstractSeleniumTest public void waitPage() { // TODO define a smaller maxWaitTimeJsInMs for wait javascript response for browser side validation - getSelenium().waitForPageToLoad( maxWaitTimeInMs ); + //getSelenium().waitForPageToLoad( maxWaitTimeInMs ); + // http://jira.openqa.org/browse/SRC-302 + getSelenium().waitForCondition( "selenium.isElementPresent('document.body');", maxWaitTimeInMs ); + /* + try + { + Thread.sleep( 1000 ); + } + catch ( InterruptedException e ) + { + throw new RuntimeException( "issue on Thread.sleep : " + e.getMessage(), e ); + }*/ } public String getFieldValue( String fieldName )