Update of /cvsroot/jwebunit/jWebUnit/test/net/sourceforge/jwebunit
In directory
sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv4304/test/net/sourceforge/jwebunit
Modified Files:
FramesAndWindowsTest.java
Log Message:
Continued the conversion to JWebUnitAPITestCase. All html extracted to jetty
pages. The window tests still don't work.
Index: FramesAndWindowsTest.java
===================================================================
RCS file:
/cvsroot/jwebunit/jWebUnit/test/net/sourceforge/jwebunit/FramesAndWindowsTest.java,v
retrieving revision 1.8
retrieving revision 1.9
diff -C2 -d -r1.8 -r1.9
*** FramesAndWindowsTest.java 28 Jul 2004 17:39:06 -0000 1.8
--- FramesAndWindowsTest.java 26 Dec 2005 10:53:21 -0000 1.9
***************
*** 5,8 ****
--- 5,12 ----
package net.sourceforge.jwebunit;
+ import junit.framework.Test;
+ import junit.framework.TestSuite;
+ import net.sourceforge.jwebunit.util.JettySetup;
+
/**
* User: djoiner
***************
*** 11,46 ****
*/
! public class FramesAndWindowsTest extends JWebUnitTest {
!
public void setUp() throws Exception {
super.setUp();
! defineWebPage("RootPage",
! "This is the Root" +
! "<form name='realform'><input name='color'
value='blue'></form>" +
! "<a id=\"SetColorGreen\" href='nothing.html'
onClick=\"JavaScript:document.realform.color.value='green';return
false;\">green</a>" +
! "<a id=\"ChildPage1\" href=\"\"
onClick=\"JavaScript:window.open('ChildPage1.html', 'ChildPage1');\">green</a>"
+
! "<a id=\"ChildPage2\" href=\"\"
onClick=\"JavaScript:window.open('ChildPage2.html',
'WindowNameForChilePage2');\">Child Page 2</a>\n");
! defineWebPage("ChildPage1", "This is child 1");
! defineWebPage("ChildPage2", "This is child 2");
! defineResource("Frames.html", "<html><head></head><frameset
rows=\"33%, 33%, 33%\"><frame name=\"TopFrame\" src=\"TopFrame.html\"><frame
name=\"ContentFrame\" src=\"ContentFrame.html\"><frame name=\"BottomFrame\"
src=\"BottomFrame.html\"></frameset></html>");
! defineWebPage("TopFrame", "<html><body>TopFrame</body></html>");
! defineWebPage("ContentFrame", "<html><body>ContentFrame" +
! "<form name='frameForm' method ='GET'
action='TargetPage'>" +
! " <input name='color' value='blue'>" +
! " <input type='submit'>" +
! "</form></body></html>");
! defineWebPage("BottomFrame", "<html><body>BottomFrame</body></html>");
! defineResource("TargetPage?color=red", "<html><body>This is the red
page</html></body>");
! defineResource("TargetPage?color=green",
"<html><head><title>Frames2</title></head><frameset rows=\"33%, 33%,
33%\"><frame name=\"TopFrame\" src=\"TopFrame.html\"><frame
name=\"ContentFrame\" src=\"ContentFrame.html\"><frame name=\"BottomFrame\"
src=\"BottomFrame.html\"></frameset></html>");
! defineResource("InlineFrame.html",
! "<html><head></head><body>TopFrame<br/><iframe
name=\"ContentFrame\" src=\"ContentFrame.html\"/></body></html>");
! defineWebPage("ContentFrame", "<html><body>ContentFrame" +
! "<form name='frameForm' method
='GET' action='TargetPage'>" +
! " <input name='color'
value='blue'>" +
! " <input type='submit'>" +
! "</form></body></html>");
}
!
public void testOpenWindow() throws Throwable {
gotoRootAndOpenChild("ChildPage1");
--- 15,41 ----
*/
! public class FramesAndWindowsTest extends JWebUnitAPITestCase {
!
! public static Test suite() {
! Test suite = new TestSuite(FramesAndWindowsTest.class);
! return new JettySetup(suite);
! }
!
public void setUp() throws Exception {
super.setUp();
! getTestContext().setBaseUrl(HOST_PATH + "/FramesAndWindowsTest");
! }
+ /**
+ * helper function
+ * @param childName
+ */
+ private void gotoRootAndOpenChild(String childName) {
+ beginAt("RootPage.html");
+ clickLink(childName);
}
!
! // ------------ windows test ------------
!
public void testOpenWindow() throws Throwable {
gotoRootAndOpenChild("ChildPage1");
***************
*** 57,60 ****
--- 52,56 ----
public void testGotoWindow() {
+ beginAt("RootPage.html");
gotoRootAndOpenChild("ChildPage1");
gotoWindow("ChildPage1");
***************
*** 80,87 ****
}
! private void gotoRootAndOpenChild(String childName) {
! beginAt("RootPage.html");
! clickLink(childName);
! }
public void testGotoFrame() {
--- 76,80 ----
}
! // ----------- frames test --------------
public void testGotoFrame() {
***************
*** 98,110 ****
}
- /**
- * Broken in httpunit
- *
- */
public void testGotoInlineFrame() {
beginAt("InlineFrame.html");
assertTextPresent("TopFrame");
gotoFrame("ContentFrame");
! assertTextPresent("ContentFrame");
}
--- 91,101 ----
}
public void testGotoInlineFrame() {
beginAt("InlineFrame.html");
assertTextPresent("TopFrame");
+ // Is this how it should work? see also the test below
+ assertTextNotPresent("<p>ContentFrame</p>");
gotoFrame("ContentFrame");
! assertTextPresent("<p>ContentFrame</p>"); // only
'ContentFrame' matches frameset tag too
}
***************
*** 112,121 ****
beginAt("Frames.html");
gotoFrame("ContentFrame");
setFormElement("color", "red");
! submit();
! assertTextPresent("This is the red page");
}
! public void testFormInputInFrameToFrame() {
beginAt("Frames.html");
gotoFrame("ContentFrame");
--- 103,116 ----
beginAt("Frames.html");
gotoFrame("ContentFrame");
+ assertFormPresent();
setFormElement("color", "red");
! submit("submit");
! // TODO should it bee nessecary to select frame again?
! gotoFrame("ContentFrame");
! assertTextPresent(" color=red ");
}
! /* this just posts to a new frameset inside the frame, is the test
needed?
! public void testFormInputInFrameToFrame() {
beginAt("Frames.html");
gotoFrame("ContentFrame");
***************
*** 123,127 ****
submit();
assertTitleEquals("Frames2");
! }
!
}
--- 118,122 ----
submit();
assertTitleEquals("Frames2");
! } */
!
}
-------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc. Do you grep through log files
for problems? Stop! Download the new AJAX search engine that makes
searching your log files as easy as surfing the web. DOWNLOAD SPLUNK!
http://ads.osdn.com/?ad_id=7637&alloc_id=16865&op=click
_______________________________________________
Jwebunit-development mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/jwebunit-development