Revision: 533
Author: henryju
Date: 2006-07-11 08:26:37 -0700 (Tue, 11 Jul 2006)
ViewCVS: http://svn.sourceforge.net/jwebunit/?rev=533&view=rev
Log Message:
-----------
Fix bug reported by Mark Chaimungkalanont on jWebUnit user mailing list
(current form was not reseted between 2 submits)
Modified Paths:
--------------
branches/1.x/jwebunit-commons-tests/src/main/java/net/sourceforge/jwebunit/tests/FormSubmissionTest.java
branches/1.x/jwebunit-htmlunit-plugin/src/main/java/net/sourceforge/jwebunit/htmlunit/HtmlUnitDialog.java
branches/1.x/src/changes/changes.xml
Added Paths:
-----------
branches/1.x/jwebunit-commons-tests/src/main/resources/testcases/FormSubmissionTest/Submit1.html
branches/1.x/jwebunit-commons-tests/src/main/resources/testcases/FormSubmissionTest/Submit2.html
branches/1.x/jwebunit-commons-tests/src/main/resources/testcases/FormSubmissionTest/Submit3.html
Modified:
branches/1.x/jwebunit-commons-tests/src/main/java/net/sourceforge/jwebunit/tests/FormSubmissionTest.java
===================================================================
---
branches/1.x/jwebunit-commons-tests/src/main/java/net/sourceforge/jwebunit/tests/FormSubmissionTest.java
2006-07-07 16:03:46 UTC (rev 532)
+++
branches/1.x/jwebunit-commons-tests/src/main/java/net/sourceforge/jwebunit/tests/FormSubmissionTest.java
2006-07-11 15:26:37 UTC (rev 533)
@@ -217,5 +217,14 @@
private void gotoMultiButtonPage() {
beginAt("/MultiNamedButtonForm.html");
}
+
+ public void testCachedForm() {
+ beginAt("/Submit1.html");
+ assertTextPresent("Page 1");
+ submit();
+ assertTextPresent("Page 2");
+ submit();
+ assertTextPresent("Page 3");
+ }
}
\ No newline at end of file
Added:
branches/1.x/jwebunit-commons-tests/src/main/resources/testcases/FormSubmissionTest/Submit1.html
===================================================================
---
branches/1.x/jwebunit-commons-tests/src/main/resources/testcases/FormSubmissionTest/Submit1.html
(rev 0)
+++
branches/1.x/jwebunit-commons-tests/src/main/resources/testcases/FormSubmissionTest/Submit1.html
2006-07-11 15:26:37 UTC (rev 533)
@@ -0,0 +1,9 @@
+<html>
+<head></head>
+<body>
+ <p>Page 1</p>
+ <form action="javascript:window.location.replace('Submit2.html')">
+ <input type="submit" name="button">
+ </form>
+</body>
+</html>
\ No newline at end of file
Added:
branches/1.x/jwebunit-commons-tests/src/main/resources/testcases/FormSubmissionTest/Submit2.html
===================================================================
---
branches/1.x/jwebunit-commons-tests/src/main/resources/testcases/FormSubmissionTest/Submit2.html
(rev 0)
+++
branches/1.x/jwebunit-commons-tests/src/main/resources/testcases/FormSubmissionTest/Submit2.html
2006-07-11 15:26:37 UTC (rev 533)
@@ -0,0 +1,9 @@
+<html>
+<head></head>
+<body>
+ <p>Page 2</p>
+ <form action="javascript:window.location.replace('Submit3.html')">
+ <input type="submit" name="button">
+ </form>
+</body>
+</html>
\ No newline at end of file
Added:
branches/1.x/jwebunit-commons-tests/src/main/resources/testcases/FormSubmissionTest/Submit3.html
===================================================================
---
branches/1.x/jwebunit-commons-tests/src/main/resources/testcases/FormSubmissionTest/Submit3.html
(rev 0)
+++
branches/1.x/jwebunit-commons-tests/src/main/resources/testcases/FormSubmissionTest/Submit3.html
2006-07-11 15:26:37 UTC (rev 533)
@@ -0,0 +1,6 @@
+<html>
+<head></head>
+<body>
+ <p>Page 3</p>
+</body>
+</html>
\ No newline at end of file
Modified:
branches/1.x/jwebunit-htmlunit-plugin/src/main/java/net/sourceforge/jwebunit/htmlunit/HtmlUnitDialog.java
===================================================================
---
branches/1.x/jwebunit-htmlunit-plugin/src/main/java/net/sourceforge/jwebunit/htmlunit/HtmlUnitDialog.java
2006-07-07 16:03:46 UTC (rev 532)
+++
branches/1.x/jwebunit-htmlunit-plugin/src/main/java/net/sourceforge/jwebunit/htmlunit/HtmlUnitDialog.java
2006-07-11 15:26:37 UTC (rev 533)
@@ -426,16 +426,17 @@
}
public void webWindowContentChanged(WebWindowEvent event) {
- String win = event.getWebWindow().getName();
+ form = null;
+ String winName = event.getWebWindow().getName();
Page oldPage = event.getOldPage();
Page newPage = event.getNewPage();
- String oldPageTitle = "non_html";
+ String oldPageTitle = "no_html";
if (oldPage instanceof HtmlPage)
oldPageTitle = ((HtmlPage) oldPage).getTitleText();
- String newPageTitle = "non_html";
+ String newPageTitle = "no_html";
if (newPage instanceof HtmlPage)
newPageTitle = ((HtmlPage) newPage).getTitleText();
- LOGGER.info("Window \"" + win + "\" changed : \""
+ LOGGER.info("Window \"" + winName + "\" changed : \""
+ oldPageTitle + "\" became \"" + newPageTitle + "\"");
}
@@ -535,8 +536,7 @@
if (hasForm()) {
setWorkingForm(getForm(0));
return getForm(0);
- }
- else {
+ } else {
throw new RuntimeException("No form in current page");
}
} else {
@@ -563,7 +563,7 @@
}
return null;
}
-
+
private HtmlForm getForm(String nameOrID, int index) {
HtmlForm form = null;
Iterator iter = getCurrentPage().getForms().iterator();
Modified: branches/1.x/src/changes/changes.xml
===================================================================
--- branches/1.x/src/changes/changes.xml 2006-07-07 16:03:46 UTC (rev
532)
+++ branches/1.x/src/changes/changes.xml 2006-07-11 15:26:37 UTC (rev
533)
@@ -5,6 +5,11 @@
<author email="dashorst at users.sourceforge.net">Martijn
Dashorst</author>
</properties>
<body>
+ <release version="1.3-SNAPSHOT" date="UNKNOW">
+ <action type="fix" dev="Julien Henry" due-to="Mark
Chaimungkalanont">
+ Current form was saved but not reseted when page content
change.
+ </action>
+ </release>
<release version="1.3-RC2" date="july 07, 2006">
<action type="add" dev="Julien Henry" due-to="Tetyana
Gimgina">
Show the getTable() method in WebTestCase to
allow custom assertions.
This was sent by the SourceForge.net collaborative development platform, the
world's largest Open Source development site.
-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
Jwebunit-development mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/jwebunit-development