Author: ppitonak(a)redhat.com
Date: 2011-01-10 08:38:07 -0500 (Mon, 10 Jan 2011)
New Revision: 20929
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/richAccordion/TestRichAccordion.java
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richAccordionItem/TestRichAccordionItem.java
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richCollapsiblePanel/TestRichCollapsiblePanel.java
Log:
* fixed tests for accordion and accordion item
* removed unnecessary import from TestRichCollapsiblePanel
* testLang rewritten
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-01-10
11:53:42 UTC (rev 20928)
+++
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/AbstractMetamerTest.java 2011-01-10
13:38:07 UTC (rev 20929)
@@ -37,6 +37,8 @@
import org.apache.commons.lang.LocaleUtils;
import org.jboss.test.selenium.AbstractTestCase;
+import org.jboss.test.selenium.SystemProperties;
+import org.jboss.test.selenium.browser.BrowserType;
import org.jboss.test.selenium.dom.Event;
import org.jboss.test.selenium.encapsulated.JavaScript;
import org.jboss.test.selenium.locator.Attribute;
@@ -265,18 +267,23 @@
*/
protected void testLang(ElementLocator<?> element) {
JQueryLocator langInput = pjq("input[type=text][id$=langInput]");
+ 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
- AttributeLocator<?> langAttr = element.getAttribute(new
Attribute("lang"));
- assertFalse(selenium.isAttributePresent(langAttr), "Attribute xml:lang
should not be present.");
+ String langAttr = selenium.getEval(getAttributeLang);
+ assertTrue("null".equals(langAttr) || "".equals(langAttr),
"Attribute xml:lang should not be present.");
selenium.type(langInput, "sk");
selenium.waitForPageToLoad();
// lang = sk
- langAttr = element.getAttribute(new Attribute("lang"));
- assertTrue(selenium.isAttributePresent(langAttr), "Attribute xml:lang should
be present.");
- assertEquals(selenium.getAttribute(langAttr), "sk", "Attribute
xml:lang should be present.");
+ assertEquals(selenium.getEval(getAttributeLang), "sk", "Attribute
xml:lang should be present.");
}
/**
Modified:
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richAccordion/TestRichAccordion.java
===================================================================
---
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richAccordion/TestRichAccordion.java 2011-01-10
11:53:42 UTC (rev 20928)
+++
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richAccordion/TestRichAccordion.java 2011-01-10
13:38:07 UTC (rev 20929)
@@ -59,13 +59,15 @@
pjq("div[id$=item3:header]"), pjq("div[id$=item4:header]"),
pjq("div[id$=item5:header]")};
private JQueryLocator[] itemContents = {pjq("div[id$=item1:content]"),
pjq("div[id$=item2:content]"),
pjq("div[id$=item3:content]"), pjq("div[id$=item4:content]"),
pjq("div[id$=item5:content]")};
- private JQueryLocator[] activeHeaders =
{pjq("div.rf-ac-itm-hdr-act:eq(0)"),
pjq("div.rf-ac-itm-hdr-act:eq(1)"),
- pjq("div.rf-ac-itm-hdr-act:eq(2)"),
pjq("div.rf-ac-itm-hdr-act:eq(3)"),
pjq("div.rf-ac-itm-hdr-act:eq(4)")};
- private JQueryLocator[] inactiveHeaders =
{pjq("div.rf-ac-itm-hdr-inact:eq(0)"),
- pjq("div.rf-ac-itm-hdr-inact:eq(1)"),
pjq("div.rf-ac-itm-hdr-inact:eq(2)"),
- pjq("div.rf-ac-itm-hdr-inact:eq(3)"),
pjq("div.rf-ac-itm-hdr-inact:eq(4)")};
- private JQueryLocator[] disabledHeaders =
{pjq("div.rf-ac-itm-hdr-dis:eq(0)"),
pjq("div.rf-ac-itm-hdr-dis:eq(1)"),
- pjq("div.rf-ac-itm-hdr-dis:eq(2)"),
pjq("div.rf-ac-itm-hdr-dis:eq(3)"),
pjq("div.rf-ac-itm-hdr-dis:eq(4)")};
+ private JQueryLocator[] activeHeaders = {pjq("div[id$=item1:header]
div.rf-ac-itm-lbl-act"),
+ pjq("div[id$=item2:header] div.rf-ac-itm-lbl-act"),
pjq("div[id$=item3:header] div.rf-ac-itm-lbl-act"),
+ pjq("div[id$=item4:header] div.rf-ac-itm-lbl-act"),
pjq("div[id$=item5:header] div.rf-ac-itm-lbl-act")};
+ private JQueryLocator[] inactiveHeaders = {pjq("div[id$=item1:header]
div.rf-ac-itm-lbl-inact"),
+ pjq("div[id$=item2:header] div.rf-ac-itm-lbl-inact"),
pjq("div[id$=item3:header] div.rf-ac-itm-lbl-inact"),
+ pjq("div[id$=item4:header] div.rf-ac-itm-lbl-inact"),
pjq("div[id$=item5:header] div.rf-ac-itm-lbl-inact")};
+ private JQueryLocator[] disabledHeaders = {pjq("div[id$=item1:header]
div.rf-ac-itm-lbl-dis"),
+ pjq("div[id$=item2:header] div.rf-ac-itm-lbl-dis"),
pjq("div[id$=item3:header] div.rf-ac-itm-lbl-dis"),
+ pjq("div[id$=item4:header] div.rf-ac-itm-lbl-dis"),
pjq("div[id$=item5:header] div.rf-ac-itm-lbl-dis")};
@Override
public URL getTestUrl() {
@@ -102,7 +104,7 @@
@Test
public void testSwitchTypeAjax() {
- selenium.click(pjq("input[type=radio][id$=switchTypeInput:0]"));
+
selenium.click(pjq("input[type=radio][name$=switchTypeInput][value=ajax]"));
selenium.waitForPageToLoad();
testSwitchTypeNull();
@@ -110,7 +112,7 @@
@Test
public void testSwitchTypeClient() {
- selenium.click(pjq("input[type=radio][id$=switchTypeInput:1]"));
+
selenium.click(pjq("input[type=radio][name$=switchTypeInput][value=client]"));
selenium.waitForPageToLoad();
for (int i = 2; i >= 0; i--) {
@@ -123,7 +125,7 @@
@Test
@IssueTracking("https://issues.jboss.org/browse/RF-10040")
public void testSwitchTypeServer() {
- selenium.click(pjq("input[type=radio][id$=switchTypeInput:3]"));
+
selenium.click(pjq("input[type=radio][name$=switchTypeInput][value=server]"));
selenium.waitForPageToLoad();
for (int i = 2; i >= 0; i--) {
@@ -297,56 +299,17 @@
@Test
public void testItemHeaderClassActive() {
- selenium.type(pjq("input[id$=itemHeaderClassActiveInput]"),
"metamer-ftest-class");
- selenium.waitForPageToLoad();
-
- for (JQueryLocator loc : activeHeaders) {
- assertTrue(selenium.belongsClass(loc, "metamer-ftest-class"),
"itemHeaderClassActive does not work");
- }
-
- for (JQueryLocator loc : inactiveHeaders) {
- assertFalse(selenium.belongsClass(loc, "metamer-ftest-class"),
"itemHeaderClassActive does not work");
- }
-
- for (JQueryLocator loc : disabledHeaders) {
- assertFalse(selenium.belongsClass(loc, "metamer-ftest-class"),
"itemHeaderClassActive does not work");
- }
+ testStyleClass(activeHeaders[0], "itemHeaderClassActive");
}
@Test
public void testItemHeaderClassDisabled() {
- selenium.type(pjq("input[id$=itemHeaderClassDisabledInput]"),
"metamer-ftest-class");
- selenium.waitForPageToLoad();
-
- for (JQueryLocator loc : activeHeaders) {
- assertFalse(selenium.belongsClass(loc, "metamer-ftest-class"),
"itemHeaderClassDisabled does not work");
- }
-
- for (JQueryLocator loc : inactiveHeaders) {
- assertFalse(selenium.belongsClass(loc, "metamer-ftest-class"),
"itemHeaderClassDisabled does not work");
- }
-
- for (JQueryLocator loc : disabledHeaders) {
- assertTrue(selenium.belongsClass(loc, "metamer-ftest-class"),
"itemHeaderClassDisabled does not work");
- }
+ testStyleClass(disabledHeaders[3], "itemHeaderClassDisabled");
}
@Test
public void testItemHeaderClassInactive() {
- selenium.type(pjq("input[id$=itemHeaderClassInactiveInput]"),
"metamer-ftest-class");
- selenium.waitForPageToLoad();
-
- for (JQueryLocator loc : activeHeaders) {
- assertFalse(selenium.belongsClass(loc, "metamer-ftest-class"),
"itemHeaderClassInactive does not work");
- }
-
- for (JQueryLocator loc : inactiveHeaders) {
- assertTrue(selenium.belongsClass(loc, "metamer-ftest-class"),
"itemHeaderClassInactive does not work");
- }
-
- for (JQueryLocator loc : disabledHeaders) {
- assertFalse(selenium.belongsClass(loc, "metamer-ftest-class"),
"itemHeaderClassInactive does not work");
- }
+ testStyleClass(inactiveHeaders[1], "itemHeaderClassInactive");
}
@Test
@@ -381,7 +344,7 @@
String timeValue = selenium.getText(time);
- guardXhr(selenium).click(inactiveHeaders[1]);
+ guardXhr(selenium).click(itemHeaders[1]);
waitGui.failWith("Item 2 is not
displayed.").until(isDisplayed.locator(itemContents[1]));
String newTime = selenium.getText(time);
Modified:
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richAccordionItem/TestRichAccordionItem.java
===================================================================
---
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richAccordionItem/TestRichAccordionItem.java 2011-01-10
11:53:42 UTC (rev 20928)
+++
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richAccordionItem/TestRichAccordionItem.java 2011-01-10
13:38:07 UTC (rev 20929)
@@ -53,13 +53,15 @@
pjq("div[id$=item3:header]"), pjq("div[id$=item4:header]"),
pjq("div[id$=item5:header]")};
private JQueryLocator[] itemContents = {pjq("div[id$=item1:content]"),
pjq("div[id$=item2:content]"),
pjq("div[id$=item3:content]"), pjq("div[id$=item4:content]"),
pjq("div[id$=item5:content]")};
- private JQueryLocator[] activeHeaders =
{pjq("div.rf-ac-itm-hdr-act:eq(0)"),
pjq("div.rf-ac-itm-hdr-act:eq(1)"),
- pjq("div.rf-ac-itm-hdr-act:eq(2)"),
pjq("div.rf-ac-itm-hdr-act:eq(3)"),
pjq("div.rf-ac-itm-hdr-act:eq(4)")};
- private JQueryLocator[] inactiveHeaders =
{pjq("div.rf-ac-itm-hdr-inact:eq(0)"),
- pjq("div.rf-ac-itm-hdr-inact:eq(1)"),
pjq("div.rf-ac-itm-hdr-inact:eq(2)"),
- pjq("div.rf-ac-itm-hdr-inact:eq(3)"),
pjq("div.rf-ac-itm-hdr-inact:eq(4)")};
- private JQueryLocator[] disabledHeaders =
{pjq("div.rf-ac-itm-hdr-dis:eq(0)"),
pjq("div.rf-ac-itm-hdr-dis:eq(1)"),
- pjq("div.rf-ac-itm-hdr-dis:eq(2)"),
pjq("div.rf-ac-itm-hdr-dis:eq(3)"),
pjq("div.rf-ac-itm-hdr-dis:eq(4)")};
+ private JQueryLocator[] activeHeaders = {pjq("div[id$=item1:header]
div.rf-ac-itm-lbl-act"),
+ pjq("div[id$=item2:header] div.rf-ac-itm-lbl-act"),
pjq("div[id$=item3:header] div.rf-ac-itm-lbl-act"),
+ pjq("div[id$=item4:header] div.rf-ac-itm-lbl-act"),
pjq("div[id$=item5:header] div.rf-ac-itm-lbl-act")};
+ private JQueryLocator[] inactiveHeaders = {pjq("div[id$=item1:header]
div.rf-ac-itm-lbl-inact"),
+ pjq("div[id$=item2:header] div.rf-ac-itm-lbl-inact"),
pjq("div[id$=item3:header] div.rf-ac-itm-lbl-inact"),
+ pjq("div[id$=item4:header] div.rf-ac-itm-lbl-inact"),
pjq("div[id$=item5:header] div.rf-ac-itm-lbl-inact")};
+ private JQueryLocator[] disabledHeaders = {pjq("div[id$=item1:header]
div.rf-ac-itm-lbl-dis"),
+ pjq("div[id$=item2:header] div.rf-ac-itm-lbl-dis"),
pjq("div[id$=item3:header] div.rf-ac-itm-lbl-dis"),
+ pjq("div[id$=item4:header] div.rf-ac-itm-lbl-dis"),
pjq("div[id$=item5:header] div.rf-ac-itm-lbl-dis")};
@Override
public URL getTestUrl() {
@@ -107,7 +109,7 @@
selenium.type(pjq("input[id$=headerInput]"), "new header");
selenium.waitForPageToLoad();
- String header = selenium.getText(itemHeaders[0]);
+ String header = selenium.getText(activeHeaders[0]);
assertEquals(header, "new header", "Header of item1 did not
change.");
}
@@ -129,10 +131,10 @@
@Test
public void testHeaderClassDisabled() {
+
selenium.click(pjq("input[type=radio][name$=disabledInput][value=true]"));
+ selenium.waitForPageToLoad();
+
testStyleClass(disabledHeaders[0], "headerClassDisabled");
- assertFalse(selenium.belongsClass(disabledHeaders[1],
"metamer-ftest-class"), "headerClassDisabled should be set only on first
item");
- assertFalse(selenium.belongsClass(disabledHeaders[2],
"metamer-ftest-class"), "headerClassDisabled should be set only on first
item");
- assertFalse(selenium.belongsClass(disabledHeaders[3],
"metamer-ftest-class"), "headerClassDisabled should be set only on first
item");
}
@Test
Modified:
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richCollapsiblePanel/TestRichCollapsiblePanel.java
===================================================================
---
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richCollapsiblePanel/TestRichCollapsiblePanel.java 2011-01-10
11:53:42 UTC (rev 20928)
+++
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richCollapsiblePanel/TestRichCollapsiblePanel.java 2011-01-10
13:38:07 UTC (rev 20929)
@@ -24,7 +24,6 @@
import static org.jboss.test.selenium.guard.request.RequestTypeGuardFactory.guardHttp;
import static
org.jboss.test.selenium.guard.request.RequestTypeGuardFactory.guardNoRequest;
import static org.jboss.test.selenium.guard.request.RequestTypeGuardFactory.guardXhr;
-import static org.jboss.test.selenium.locator.LocatorFactory.jq;
import static org.jboss.test.selenium.utils.URLUtils.buildUrl;
import static org.testng.Assert.assertEquals;
import static org.testng.Assert.assertFalse;