Author: andrei_exadel
Date: 2008-09-30 09:04:51 -0400 (Tue, 30 Sep 2008)
New Revision: 10621
Modified:
trunk/test-applications/seleniumTest/richfaces/src/test/java/org/richfaces/SeleniumTestBase.java
trunk/test-applications/seleniumTest/richfaces/src/test/java/org/richfaces/testng/ModalPanelTest.java
Log:
Modal Panel Test: test drag by header
Modified:
trunk/test-applications/seleniumTest/richfaces/src/test/java/org/richfaces/SeleniumTestBase.java
===================================================================
---
trunk/test-applications/seleniumTest/richfaces/src/test/java/org/richfaces/SeleniumTestBase.java 2008-09-30
12:28:56 UTC (rev 10620)
+++
trunk/test-applications/seleniumTest/richfaces/src/test/java/org/richfaces/SeleniumTestBase.java 2008-09-30
13:04:51 UTC (rev 10621)
@@ -554,6 +554,28 @@
public Number getHeightById(String id) {
return selenium.getElementHeight("id=" + id);
}
+
+ /**
+ * Returns element's left
+ *
+ * @param id -
+ * DOM element id
+ * @return
+ */
+ public Number getLeftById(String id) {
+ return selenium.getElementPositionLeft("id=" + id);
+ }
+
+ /**
+ * Returns element's top
+ *
+ * @param id -
+ * DOM element id
+ * @return
+ */
+ public Number getTopById(String id) {
+ return selenium.getElementPositionTop("id=" + id);
+ }
/**
* Clicks on element
Modified:
trunk/test-applications/seleniumTest/richfaces/src/test/java/org/richfaces/testng/ModalPanelTest.java
===================================================================
---
trunk/test-applications/seleniumTest/richfaces/src/test/java/org/richfaces/testng/ModalPanelTest.java 2008-09-30
12:28:56 UTC (rev 10620)
+++
trunk/test-applications/seleniumTest/richfaces/src/test/java/org/richfaces/testng/ModalPanelTest.java 2008-09-30
13:04:51 UTC (rev 10621)
@@ -8,6 +8,7 @@
import org.ajax4jsf.template.Template;
import org.richfaces.SeleniumTestBase;
+import org.testng.Assert;
import org.testng.annotations.Test;
/**
@@ -27,6 +28,7 @@
private final static String PANEL_C_DIV_ID = PANEL_ID + "CDiv";
private final static String PANEL_CONTENT_DIV_ID = PANEL_ID +
"ContentDiv";
private final static String PANEL_CONTAINER_DIV_ID = PANEL_ID +
"Container";
+ private final static String PANEL_HEADER_ID = PANEL_ID + "Header";
/**
@@ -123,7 +125,31 @@
// test height attribute - should be 104
assertStyleAttribute(panelContentId, "height: 104");
}
+
+ @Test
+ public void testDragByHeader(Template template) {
+ renderPage(template);
+
+ clickShow();
+ String headerId = getParentId() + FORM_ID + PANEL_HEADER_ID;
+ String cIdvId = getParentId() + FORM_ID + PANEL_C_DIV_ID;
+
+ Integer left = (Integer)getLeftById(cIdvId);
+ Integer top = (Integer)getTopById(cIdvId);
+
+ selenium.dragAndDrop(headerId, "+10,+10");
+
+ Assert.assertTrue((Integer)getLeftById(cIdvId) - left == 10, "Modal Panel drag
failured");
+ Assert.assertTrue((Integer)getTopById(cIdvId) - top == 10, "Modal Panel drag
failured");
+
+ selenium.dragAndDrop(headerId, "-10,-10");
+
+ Assert.assertTrue(((Integer)getLeftById(cIdvId)).equals(left), "Modal Panel
drag failured");
+ Assert.assertTrue(((Integer)getTopById(cIdvId)).equals(top), "Modal Panel drag
failured");
+
+ }
+
private void clickReset() {
String buttonId = getParentId() + FORM_ID + RESET_ID;
writeStatus("Click reset button");
Show replies by date