Bugs item #981534, was opened at 2004-06-28 13:27
Message generated for change (Comment added) made by dblock
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=497982&aid=981534&group_id=61302

Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: None
Group: Release 1.3
Status: Closed
Resolution: Fixed
Priority: 7
Submitted By: Jim Weaver (jimweaver)
Assigned to: Jim Weaver (jimweaver)
Summary: Javascript onchange bug

Initial Comment:
OK, I dunno if this was introduced with the new
versions of httpunit etc., or not but we have a problem
when an onchange event ends up changing the response
(via form submission or setting window.location). 
HttpUnitDialog ends up with the old response, not the
new one.

The problem is demonstrated in a test in the
JavaScriptEventsTest, which I have named such that it
won't run from AllTests:
notestOnChangeOnFormElementChangesWindowLocation()

This sort of thing used to work, I'm pretty sure. 
Probably we have a change in HttpUnit that is
clobbering us.

Note that after triggering the onchange, you can check
dialog.webClient.getCurrentPage() from your test and it
will return the proper response that the onchange
directed us to.  But, HttpUnitDialog's response object
is wrong - and that is what the assertions drive off of.  

The client listener does get alerted by httpunit from
the onchange, but the new response at that point is on
the response parameter passed into the client listener
- not on webclilent.getCurrentPage().  We used to use
the response parameter ages ago, but the listner was
getting called when javascript resources loaded, and
that caused the response to unexpectedly be the
contents of a javascript file ;-).

Fun, fun, fun

----------------------------------------------------------------------

Comment By: David Block (dblock)
Date: 2006-07-24 11:29

Message:
Logged In: YES 
user_id=437534

Does this functionality work with the htmlunit plugin?  
I'm trying to add a test to old code with two frames.  The
top frame loads from a jsp, and the bottom frame initially
loads an almost blank page, then after the top jsp is
loaded, it calls javascript like this: 

parent.otherFrame.location.href="otherPage.jsp";

(no human intervention required).

This is legacy (read: don't change it) code.

My jWebUnit code looks like

    assertTitleEquals("Configuration Details");
    assertFramePresent("otherFrame");
    gotoFrame("otherFrame");
    assertFormPresent("otherForm");

The unit test fails at this point because it cannot find
"otherForm".  When I run this code in Firefox or IE, I of
course get the proper content in "otherFrame".

Thanks for a great tool (besides this small snafu)!!

Dave

----------------------------------------------------------------------

Comment By: Jim Weaver (jimweaver)
Date: 2004-06-28 16:22

Message:
Logged In: YES 
user_id=619947

OK fixed - setting a form parameter will no refresh the
response to the current page if the current page changed as
a result of setting the parameter in httpunit.  That takes
into account change of location by onchange of input element
without breaking the frame support.

Unit test in place for this now in JavaScriptEventsTest.

----------------------------------------------------------------------

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=497982&aid=981534&group_id=61302

-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys -- and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
Jwebunit-development mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/jwebunit-development

Reply via email to