[richfaces-svn-commits] JBoss Rich Faces SVN: r15975 - branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/java/org/jboss/richfaces/integrationTest.
richfaces-svn-commits at lists.jboss.org
richfaces-svn-commits at lists.jboss.org
Mon Nov 23 07:27:24 EST 2009
Author: ppitonak at redhat.com
Date: 2009-11-23 07:27:24 -0500 (Mon, 23 Nov 2009)
New Revision: 15975
Modified:
branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/java/org/jboss/richfaces/integrationTest/AbstractSeleniumRichfacesTestCase.java
Log:
* method abstractTestSource refactored and rewritten to use jQuery locators
Modified: branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/java/org/jboss/richfaces/integrationTest/AbstractSeleniumRichfacesTestCase.java
===================================================================
--- branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/java/org/jboss/richfaces/integrationTest/AbstractSeleniumRichfacesTestCase.java 2009-11-23 12:27:12 UTC (rev 15974)
+++ branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/java/org/jboss/richfaces/integrationTest/AbstractSeleniumRichfacesTestCase.java 2009-11-23 12:27:24 UTC (rev 15975)
@@ -219,44 +219,36 @@
* an array of strings that should be in the snippet
*/
protected void abstractTestSource(int fieldset, String linkLabel, String[] expected) {
- final String xpathPrefix = String.format("//fieldset[%d]/div/div/span[contains(text(), '%s')]/..", fieldset,
- linkLabel);
- String text = null;
-
- scrollIntoView(xpathPrefix, true);
-
- text = selenium.getAttribute(xpathPrefix + "/div at style");
- assertTrue(text.contains("display: none;"),
- "Source should not be visible -- it has to contain 'display: none;'.");
-
+ final String prefix = format("jquery=fieldset:eq({0}) > div > div:has(span:textEndsWith({1}))", fieldset-1, linkLabel);
+
+ scrollIntoView(prefix, true);
+
+ assertFalse(isDisplayed(prefix + " > div"), "Source should not be visible -- it has to contain 'display: none;'.");
+
// click on 'View xxx Source'
- waitForElement(xpathPrefix + "/span[2]");
- selenium.click(xpathPrefix + "/span[2]");
+ waitForElement(prefix + " > span:eq(1)");
+ selenium.click(prefix + " > span:eq(1)");
- waitForElement(xpathPrefix + "/div/div[2]");
+ waitForElement(prefix + " div[class*=viewsourcebody]");
- text = selenium.getAttribute(xpathPrefix + "/div at id");
- assertFalse(text.contains("display: none;"),
- "Source should be visible -- it should not contain 'display: none;'");
-
- text = selenium.getText(xpathPrefix + "/div/div[2]/div/div");
-
+ assertTrue(isDisplayed(prefix + " > div"), "Source should be visible -- it should not contain 'display: none;'.");
+
+ String source = selenium.getText(prefix + " div.viewsourcediv");
for (String str : expected) {
- assertTrue(text.contains(str), "The code should contain \"" + str + "\".");
+ assertTrue(source.contains(str), "The code should contain \"" + str + "\".");
}
// click on 'Hide'
- selenium.click(xpathPrefix + "/span[1]");
+ selenium.click(prefix + " > span:eq(0)");
// wait while 'style' attribute changes
Wait.until(new Condition() {
public boolean isTrue() {
- return selenium.getAttribute(xpathPrefix + "/div at style").contains("display: none;");
+ return !isDisplayed(prefix + " > div");
}
});
- text = selenium.getAttribute(xpathPrefix + "/div at style");
- assertTrue(text.contains("display: none;"), "Source should be hidden.");
+ assertFalse(isDisplayed(prefix + " > div"), "Source should be hidden.");
}
/**
More information about the richfaces-svn-commits
mailing list