From richfaces-svn-commits at lists.jboss.org Mon Jan 18 07:08:37 2010 Content-Type: multipart/mixed; boundary="===============6015436142268003757==" MIME-Version: 1.0 From: richfaces-svn-commits at lists.jboss.org To: richfaces-svn-commits at lists.jboss.org Subject: [richfaces-svn-commits] JBoss Rich Faces SVN: r16319 - in branches/sandbox/rf-demo-ftest-iexplore/src/test: java/org/jboss/richfaces/integrationTest/status and 2 other directories. Date: Mon, 18 Jan 2010 07:08:37 -0500 Message-ID: <201001181208.o0IC8bfr024173@svn01.web.mwc.hst.phx2.redhat.com> --===============6015436142268003757== Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Author: lfryc(a)redhat.com Date: 2010-01-18 07:08:37 -0500 (Mon, 18 Jan 2010) New Revision: 16319 Modified: branches/sandbox/rf-demo-ftest-iexplore/src/test/java/org/jboss/richface= s/integrationTest/SeleniumLoggingTestListener.java branches/sandbox/rf-demo-ftest-iexplore/src/test/java/org/jboss/richface= s/integrationTest/status/StatusTestCase.java branches/sandbox/rf-demo-ftest-iexplore/src/test/resources/org/jboss/ric= hfaces/integrationTest/status/messages.properties branches/sandbox/rf-demo-ftest-iexplore/src/test/resources/testng.xml Log: - merge of changes in branch community/3.3.X to locally - r16305 through r1= 6318 Modified: branches/sandbox/rf-demo-ftest-iexplore/src/test/java/org/jboss/r= ichfaces/integrationTest/SeleniumLoggingTestListener.java =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- branches/sandbox/rf-demo-ftest-iexplore/src/test/java/org/jboss/richfac= es/integrationTest/SeleniumLoggingTestListener.java 2010-01-18 12:00:58 UTC= (rev 16318) +++ branches/sandbox/rf-demo-ftest-iexplore/src/test/java/org/jboss/richfac= es/integrationTest/SeleniumLoggingTestListener.java 2010-01-18 12:08:37 UTC= (rev 16319) @@ -29,14 +29,14 @@ import org.testng.ITestResult; import org.testng.TestListenerAdapter; = -import com.thoughtworks.selenium.DefaultSelenium; +import com.thoughtworks.selenium.Selenium; = /** * Class determined to logging into Selenium Server's logs server.log via = the - * DefaultSelenium.getEval(String) method which will evaluate JavaScript + * Selenium.getEval(String) method which will evaluate JavaScript * comment. * = - * You must rewrite the DefaultSelenium selenium property to allow logging + * You must rewrite the Selenium selenium property to allow logging * facility. * = * @author Lukas Fryc @@ -48,13 +48,13 @@ /** * Must be specified to allow the logging facility */ - private DefaultSelenium selenium; + private Selenium selenium; = - public void setSelenium(DefaultSelenium selenium) { + public void setSelenium(Selenium selenium) { this.selenium =3D selenium; } = - public DefaultSelenium getSelenium() { + public Selenium getSelenium() { return selenium; } = @@ -80,7 +80,7 @@ = /** * This method will output method name and status into Selenium Server's = log - * server.log via the DefaultSelenium.getEval(String) method which will + * server.log via the Selenium.getEval(String) method which will * evaluate JavaScript comment * = * @param result Modified: branches/sandbox/rf-demo-ftest-iexplore/src/test/java/org/jboss/r= ichfaces/integrationTest/status/StatusTestCase.java =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- branches/sandbox/rf-demo-ftest-iexplore/src/test/java/org/jboss/richfac= es/integrationTest/status/StatusTestCase.java 2010-01-18 12:00:58 UTC (rev = 16318) +++ branches/sandbox/rf-demo-ftest-iexplore/src/test/java/org/jboss/richfac= es/integrationTest/status/StatusTestCase.java 2010-01-18 12:08:37 UTC (rev = 16319) @@ -21,17 +21,20 @@ *************************************************************************= ******/ package org.jboss.richfaces.integrationTest.status; = +import static org.testng.Assert.assertEquals; +import static org.testng.Assert.assertFalse; +import static org.testng.Assert.fail; + import java.util.regex.Matcher; import java.util.regex.Pattern; = import org.jboss.richfaces.integrationTest.AbstractSeleniumRichfacesTestCa= se; import org.jboss.test.selenium.dom.Event; -import org.jboss.test.selenium.waiting.Condition; -import static org.testng.Assert.*; - import org.testng.annotations.BeforeMethod; import org.testng.annotations.Test; = +import com.thoughtworks.selenium.SeleniumException; + /** * @author Lukas Fryc * @version $Revision$ @@ -45,7 +48,6 @@ private final String LOC_INPUT_JOB =3D getLoc("INPUT_JOB"); private final String LOC_OUTPUT_TEXT =3D getLoc("OUTPUT_TEXT"); = - private final String MSG_STYLE_DISPLAY =3D getMsg("STYLE_DISPLAY"); private final String MSG_PATTERN_NAME_JOB =3D getMsg("PATTERN_NAME_JOB"); = /** @@ -59,8 +61,6 @@ * This version using text like a status message for user. *

*/ - // TODO investigate JavaScript injecting to fix this, see - // https://jira.jboss.org/jira/browse/JBQA-2606 @Test public void testTextStatus() { doStatusTesting(0); @@ -75,8 +75,6 @@ * This version using image like a status message for user. *

*/ - // TODO investigate JavaScript injecting to fix this, see - // https://jira.jboss.org/jira/browse/JBQA-2606 @Test public void testImageStatus() { doStatusTesting(1); @@ -98,29 +96,21 @@ final String locButtonRequest =3D format(LOC_BUTTON_REQUEST_PREFORMATTED= , testNumber); = assertFalse(isDisplayed(locOutputStatusMessage), "Status message should = not be visible at start."); - = - // prepare both needed conditions for waiting so that it will be faster - Condition styleCondition =3D new Condition() { - public boolean isTrue() { - return isDisplayed(locOutputStatusMessage); - } - }; - = - Condition styleConditionNot =3D new Condition() { - public boolean isTrue() { - return !isDisplayed(locOutputStatusMessage); - } - }; - = - selenium.click(locButtonRequest); - = - // wait for style is changed to "processing" state indicates that - // request is in progress - waitModelUpdate.interval(0).failWith("Test timeouted when waiting for re= quest moves to processing state.").until(styleCondition); = - // wait for style is changed back to initial state after request is - // complete - waitModelUpdate.interval(0).failWith("Timeout when waiting for request m= oves to complete state.").until(styleConditionNot); + for (int i =3D 0; i < 20; i++) { + selenium.click(locButtonRequest); + try { + selenium.waitForCondition(format("jqFind('{0}').is(':visible')", locOu= tputStatusMessage.replaceFirst( + "^jquery=3D", "")), "500"); + } catch (SeleniumException e) { + if (e.getMessage().startsWith("Timed out")) { + continue; + } + throw e; + } + selenium.waitForCondition(format("jqFind('{0}').is(':hidden')", locOutp= utStatusMessage.replaceFirst("^jquery=3D", "")), "5000"); + break; + } } = /** @@ -133,8 +123,6 @@ * Watches the correct output value. *

*/ - // TODO investigate JavaScript injecting to fix testInputsStatus, see - // https://jira.jboss.org/jira/browse/JBQA-2606 @Test public void testInputsStatus() { scrollIntoView(format(LOC_FIELDSET_PAGE_PART_PREFORMATTED, 2), true); @@ -151,19 +139,6 @@ = assertFalse(isDisplayed(locOutputStatusMessage), "Status message should = not be visible at start."); = - // prepare both needed conditions for waiting so that it will be faster - Condition styleCondition =3D new Condition() { - public boolean isTrue() { - return isDisplayed(locOutputStatusMessage); - } - }; - = - Condition styleConditionNot =3D new Condition() { - public boolean isTrue() { - return !isDisplayed(locOutputStatusMessage); - } - }; - = // cycle over 30 chars and alternating between two inputs for (int counter =3D 1; counter <=3D 15; counter++) { // select input and it's buffered text by state of counter @@ -175,15 +150,24 @@ = selenium.type(selectedInput, selectedText.toString()); selenium.fireEvent(selectedInput, Event.KEYUP); - = - // wait for style is changed to "processing" state indicates that - // request is in progress - waitModelUpdate.interval(0).failWith("Test timeouted when waiting= for request moves to processing state.").until(styleCondition); = - // wait for style is changed back to initial state after request = is - // complete - waitModelUpdate.interval(0).failWith("Timeout when waiting for request = moves to complete state.").until(styleConditionNot); - = + try { + // wait for style is changed to "processing" state indicates + // that request is in progress + selenium.waitForCondition(format("jqFind('{0}').is(':visible')", locOu= tputStatusMessage.replaceFirst( + "^jquery=3D", "")), "500"); + } catch (SeleniumException e) { + // we can found that the request is so fast we cannot catch the + // element in visible state + if (!e.getMessage().startsWith("Timed out")) { + throw e; + } + } + // wait for element is back to hidden state after request is + // complete + selenium.waitForCondition(format("jqFind('{0}').is(':hidden')", locOutp= utStatusMessage.replaceFirst( + "^jquery=3D", "")), "5000"); + String outputText =3D selenium.getText(LOC_OUTPUT_TEXT); = // matches output to pattern declared above? @@ -201,29 +185,6 @@ } } = - /** - * Wait for display-style changes to specified initial (resp. other than - * initial) value depending on what we want. - * = - * @param locator - * of element we want watch - * @param initialStyle - * initial display-style value - * @param shouldEqualOldValue - * if true, wait for element's display-style became initialSty= le; - * if false, wait for element's display-style became other than - * initialStyle - */ - private void waitForDisplayChanges(final String locator, final String ini= tialStyle, - final boolean shouldEqualOldValue) { - waitModelUpdate.interval(0).until(new Condition() { - public boolean isTrue() { - String actualStyle =3D getStyle(locator, MSG_STYLE_DISPLAY); - return !shouldEqualOldValue ^ initialStyle.equals(actualStyle); - } - }); - } - = protected void loadPage() { openComponent("Status"); openTab("Usage"); Modified: branches/sandbox/rf-demo-ftest-iexplore/src/test/resources/org/jb= oss/richfaces/integrationTest/status/messages.properties =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- branches/sandbox/rf-demo-ftest-iexplore/src/test/resources/org/jboss/ri= chfaces/integrationTest/status/messages.properties 2010-01-18 12:00:58 UTC = (rev 16318) +++ branches/sandbox/rf-demo-ftest-iexplore/src/test/resources/org/jboss/ri= chfaces/integrationTest/status/messages.properties 2010-01-18 12:08:37 UTC = (rev 16319) @@ -1,2 +1 @@ -STYLE_DISPLAY=3Ddisplay -PATTERN_NAME_JOB=3D^Name: (\\w*), Job: (\\w*)\\s*$ \ No newline at end of file +PATTERN_NAME_JOB=3D^Name\: (\\w*), Job\: (\\w*)\\s*$ \ No newline at end of file Modified: branches/sandbox/rf-demo-ftest-iexplore/src/test/resources/testng= .xml =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- branches/sandbox/rf-demo-ftest-iexplore/src/test/resources/testng.xml 2= 010-01-18 12:00:58 UTC (rev 16318) +++ branches/sandbox/rf-demo-ftest-iexplore/src/test/resources/testng.xml 2= 010-01-18 12:08:37 UTC (rev 16319) @@ -510,11 +510,11 @@ = - - - - - + + + + + = --===============6015436142268003757==--