Author: jpapouse
Date: 2011-12-09 07:14:32 -0500 (Fri, 09 Dec 2011)
New Revision: 23066
Modified:
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/AbstractMetamerTest.java
Log:
RFPL-1924: fixed tests for lang attribute
Modified:
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/AbstractMetamerTest.java
===================================================================
---
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/AbstractMetamerTest.java 2011-12-08
16:08:50 UTC (rev 23065)
+++
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/AbstractMetamerTest.java 2011-12-09
12:14:32 UTC (rev 23066)
@@ -74,6 +74,8 @@
import org.testng.annotations.AfterMethod;
import org.testng.annotations.BeforeMethod;
+import com.thoughtworks.selenium.SeleniumException;
+
/**
* Abstract test case used as a basis for majority of test cases.
*
@@ -375,22 +377,35 @@
* locator of tested element
*/
protected void testLang(ElementLocator<?> element) {
- JavaScript getAttributeLang = null;
- if (SystemProperties.getBrowser().getType() == BrowserType.FIREFOX) {
- getAttributeLang = new JavaScript("window.jQuery('" +
element.getRawLocator() + "').attr('lang')");
- } else {
- getAttributeLang = new JavaScript("window.jQuery('" +
element.getRawLocator() + "').attr('xml:lang')");
- }
-
+// JavaScript getAttributeLang = null;
+// if (SystemProperties.getBrowser().getType() == BrowserType.FIREFOX) {
+// getAttributeLang = new JavaScript("window.jQuery('" +
element.getRawLocator() + "').attr('lang')");
+// } else {
+// getAttributeLang = new JavaScript("window.jQuery('" +
element.getRawLocator() + "').attr('xml:lang')");
+// }
+//
+// // lang = null
+// String langAttr = selenium.getEval(getAttributeLang);
+// assertTrue("null".equals(langAttr) || "".equals(langAttr),
"Attribute xml:lang should not be present.");
+//
+// selenium.type(pjq("input[type=text][id$=langInput]"),
"sk");
+// selenium.waitForPageToLoad();
+//
+ // lang = sk
+// assertEquals(selenium.getEval(getAttributeLang), "sk",
"Attribute xml:lang should be present.");
+
// lang = null
- String langAttr = selenium.getEval(getAttributeLang);
- assertTrue("null".equals(langAttr) || "".equals(langAttr),
"Attribute xml:lang should not be present.");
+ try {
+ String attrValue =
selenium.getAttribute(element.getAttribute(Attribute.LANG));
+ assertEquals(attrValue.trim(), "", "The attribute
'lang' shouldn't be present.");
+ } catch(SeleniumException ignored) {}
selenium.type(pjq("input[type=text][id$=langInput]"), "sk");
selenium.waitForPageToLoad();
-
+
// lang = sk
- assertEquals(selenium.getEval(getAttributeLang), "sk", "Attribute
xml:lang should be present.");
+ String attrValue = selenium.getAttribute(element.getAttribute(Attribute.LANG));
+ assertEquals(attrValue, "sk", "The attribute 'lang' should
be present.");
}
/**
Show replies by date