Hi Jev, Did you try running the tests in IE?
Yesterday I was able to run the tests successfully in IE at last. But now after doing an 'svn up', I'm getting errors again. 1. pop-up "To display the webpage again, ie needs to resend the information you've previously submitted" occurs during the waitForPageToLoad so I have to click the button 2. tests that include adding a maven two project failed. Thanks, -- Marica On Thu, Mar 18, 2010 at 5:53 PM, <[email protected]> wrote: > Author: jzurbano > Date: Thu Mar 18 09:53:20 2010 > New Revision: 924681 > > URL: http://svn.apache.org/viewvc?rev=924681&view=rev > Log: > [CONTINUUM-2482] - Replace the use of Thread.sleep to Selenium > waitForCondition > * removed unused method waitForTextPresent > * added property MAX_PROJECT_WAIT_TIME_IN_MS of 600000ms used in > waitForCondition to give enough time to build/update/check out projects > * added methods > * waitForProjectUpdate() and waitForProjectBuild() to wait for project > update and build to finish > * waitForElementPresent() which accepts as parameters the element locator > and boolean to determine if the element is expected or not > > > Modified: > > continuum/trunk/continuum-webapp-test/src/test/resources/testng.properties > > > continuum/trunk/continuum-webapp-test/src/test/testng/org/apache/continuum/web/test/parent/AbstractContinuumTest.java > > > continuum/trunk/continuum-webapp-test/src/test/testng/org/apache/continuum/web/test/parent/AbstractSeleniumTest.java > > Modified: > continuum/trunk/continuum-webapp-test/src/test/resources/testng.properties > URL: > http://svn.apache.org/viewvc/continuum/trunk/continuum-webapp-test/src/test/resources/testng.properties?rev=924681&r1=924680&r2=924681&view=diff > > ============================================================================== > --- > continuum/trunk/continuum-webapp-test/src/test/resources/testng.properties > (original) > +++ > continuum/trunk/continuum-webapp-test/src/test/resources/testng.properties > Thu Mar 18 09:53:20 2010 > @@ -5,6 +5,7 @@ > ####################### > > MAX_WAIT_TIME_IN_MS=60000 > +MAX_PROJECT_WAIT_TIME_IN_MS=600000 > > ADMIN_USERNAME=admin > ADMIN_FULLNAME=admin > > Modified: > continuum/trunk/continuum-webapp-test/src/test/testng/org/apache/continuum/web/test/parent/AbstractContinuumTest.java > URL: > http://svn.apache.org/viewvc/continuum/trunk/continuum-webapp-test/src/test/testng/org/apache/continuum/web/test/parent/AbstractContinuumTest.java?rev=924681&r1=924680&r2=924681&view=diff > > ============================================================================== > --- > continuum/trunk/continuum-webapp-test/src/test/testng/org/apache/continuum/web/test/parent/AbstractContinuumTest.java > (original) > +++ > continuum/trunk/continuum-webapp-test/src/test/testng/org/apache/continuum/web/test/parent/AbstractContinuumTest.java > Thu Mar 18 09:53:20 2010 > @@ -950,6 +950,42 @@ public abstract class AbstractContinuumT > currentIt++; > } > } > + > + public void waitForProjectUpdate() > + throws Exception > + { > + getSelenium().refresh(); > + waitPage(); > + > + if ( isElementPresent( "//i...@alt='Checking Out']" ) ) > + { > + waitForProjectCheckout(); > + } > + > + getSelenium().refresh(); > + waitPage(); > + > + // wait for project to finish updating > + waitForElementPresent( "//i...@alt='Updating']", false ); > + } > + > + public void waitForProjectBuild() > + throws Exception > + { > + getSelenium().refresh(); > + waitPage(); > + > + if ( isElementPresent( "//i...@alt='Checking Out']" ) || > isElementPresent( "//i...@alt='Updating']" ) ) > + { > + waitForProjectUpdate(); > + } > + > + getSelenium().refresh(); > + waitPage(); > + > + // wait for project to finish building > + waitForElementPresent( "//i...@alt='Building']", false ); > + } > > public void createNewUser( String username, String name, String email, > String password ) > { > > Modified: > continuum/trunk/continuum-webapp-test/src/test/testng/org/apache/continuum/web/test/parent/AbstractSeleniumTest.java > URL: > http://svn.apache.org/viewvc/continuum/trunk/continuum-webapp-test/src/test/testng/org/apache/continuum/web/test/parent/AbstractSeleniumTest.java?rev=924681&r1=924680&r2=924681&view=diff > > ============================================================================== > --- > continuum/trunk/continuum-webapp-test/src/test/testng/org/apache/continuum/web/test/parent/AbstractSeleniumTest.java > (original) > +++ > continuum/trunk/continuum-webapp-test/src/test/testng/org/apache/continuum/web/test/parent/AbstractSeleniumTest.java > Thu Mar 18 09:53:20 2010 > @@ -53,6 +53,8 @@ public abstract class AbstractSeleniumTe > private static Properties p; > > private final static String PROPERTIES_SEPARATOR = "="; > + > + private static String maxProjectWaitTimeInMs; > > /** > * Initialize properties. > @@ -65,6 +67,7 @@ public abstract class AbstractSeleniumTe > p.load( input ); > > maxWaitTimeInMs = getProperty( "MAX_WAIT_TIME_IN_MS" ); > + maxProjectWaitTimeInMs = getProperty( > "MAX_PROJECT_WAIT_TIME_IN_MS" ); > } > > /** > @@ -433,25 +436,16 @@ public abstract class AbstractSeleniumTe > getSelenium().refresh(); > } > } > - > - public void waitForTextPresent( String text ) > - throws InterruptedException > + > + /* > + * This will wait for the condition to be met. > + * * shouldBePresent - if the locator is expected or not (true or > false respectively) > + */ > + public void waitForElementPresent( String locator, boolean > shoulBePresent ) > + throws Exception > { > - getSelenium().waitForPageToLoad( maxWaitTimeInMs ); > - for ( int second = 0;; second++ ) > - { > - if ( second >= 60 ) > - Assert.fail( "Timeout" ); > - try > - { > - if ( isTextPresent( text ) ) > - break; > - } > - catch ( Exception e ) > - { > - } > - Thread.sleep( 1000 ); > - } > + String condition = "selenium.isElementPresent(\"" + locator + "\") > == " + shoulBePresent; > + waitForCondition( condition ); > } > > public void selectForOption( String locator, String text ) > > >
