I'm using RichFaces' <rich:panelmenu><rich:panelmenuitem></rich:panelmenuitem></rich:panelmenu>
This is HtmlUnit 2.3/Neko 1.9.9
If I use HtmlUnit to click the menu item, then no AJAX request is sent to the server. I've used Firebug to make sure that I'm clicking on the correct target and I've tried clicking on several different targets but nothing kicks off the AJAX request.
I've added a new test, RichPanelMenuTest.java, to the
htmlunit-richfaces project. To run the test:
svn co http://anonsvn.jboss.org/repos/jsfunit/htmlunit-richfaces/
cd htmlunit-richfaces
mvn -Dtest=RichPanelMenuTest
The WAR file can be deployed to Tomcat 5.5 if you want to run it by hand.
After putting richfaces-demo-3.2.2.GA.war in tomcat:
INFO: Initializing Mojarra (1.2_09-b02-FCS) for context '/richfaces-demo-3.2.2.GA'
Nov 10, 2008 1:38:36 AM org.apache.catalina.core.StandardContext start
SEVERE: Error listenerStart
Nov 10, 2008 1:38:36 AM org.apache.catalina.core.StandardContext start
SEVERE: Context [/richfaces-demo-3.2.2.GA] startup failed due to previous errors
log4j:WARN No appenders could be found for logger (org.directwebremoting.util.Logger).
Using Tomcat 5.5 (not 6), i am able to run the application.
However, IE7 doesn't change the value :)
For reference, elements used are "iconform:j_id261", "iconform:j_id262", "j_id316_lbl", "j_id256_lbl"
So, fix your test, and we should fix HtmlUnit.
The application works fine for me in both IE7.0.6000.16757 and FF3.0.3. You have to wait a second or two after the click because the span is updated via AJAX request. This is with Tomcat 5.5.
There is no element "iconform:j_whatever". I think that you didn't do an update and build from svn. If you did, you would see this xhtml file that overrides the default xhtml file from the original RichFaces demo: /htmlunit-richfaces/src/main/webapp/richfaces/panelMenu/examples/example.xhtml
@Ahmed: Are you still looking into this? If so, can you set yourself as the assignee?
Don't think I will look into it the very coming days.
I was using richfaces-demo-3.2.2.GA as used in the test case.
But now when I build it from htmlunit-richfaces trunk, there is no panelMenu.jsf
Please advise, I need to have working richfaces before tackling HtmlUnit area.
There is no panelMenu.jsf file. If you go to http://localhost:8080/htmlunit-richfaces/richfaces/panelMenu.jsf then you will see /richfaces/panelMenu.xhtml rendered using JavaServer Faces.
The htmlunit-richfaces application is based on richfaces-demo-3.2.2.GA.war. This is a dependent war, but we override certain files and classes such as src/main/webapp/richfaces/panelMenu/examples/example.xhtml. For example.xhtml, I changed the file to add id attributes to many of the elements.
So if you clean and build from the trunk of the htmlunit-richfaces application, then deploy the resulting WAR to Tomcat 5.5, you should be able to go to http://localhost:8080/htmlunit-richfaces/richfaces/panelMenu.jsf and see the page that isn't working with HtmlUnit.
Using latest SVN, it works perfectly.
Steps used to reproduce:
Try running
mvn -Dtest=RichPanelMenuTest
That will run the test against Jetty. It fails.
How did you run the test against Tomcat 5.5? I was only using Tomcat 5.5 as a way to look at the application, not to run the RichPanelMenuTest.
Did you run RichPanelMenuTest?
Yes, running "mvn -Dtest=RichPanelMenuTest" will fail.
The project has old HtmlUnit 2.3 dependency
Steps used to reproduce:
URL to tomcat local URL)
I believe we should have HtmlUnit snapshot in local maven repo specially for you :)
I changed it to HtmlUnit 2.4-SNAPSHOT. You can download the new pom. It still fails.
What URL are you changing? You are changing something in my pom?
After updating the whole project, mvn gives error:
Missing:
1) net.sourceforge.htmlunit:htmlunit:jar:2.4-SNAPSHOT
That means you don't have HtmlUnit 2.4-SNAPSHOT in your local Maven repo.
How can that be if you just built it?
Did you guys change the groupId or artifactId?
Are you no longer using 2.4-SNAPSHOT as the version?
:)
I build it in eclipse, but don't 'install' it in local repository.
Anyhow, even on 'mvn install', the 'RichPanelMenuTest' fails because:
2008-11-14 04:07:25.718::WARN: Failed startup of context org.mortbay.jetty.weba
pp.WebAppContext@eca36e{/htmlunit-richfaces,jar:file:/C:/use/eclipse/workspace/h
tmlunit-richfaces/target/htmlunit-richfaces.war!/}
javax.servlet.UnavailableException: org.ajax4jsf.Filter
at org.mortbay.jetty.servlet.Holder.doStart(Holder.java:78)
You can do the following:
Conclusion: the test fails because the web application didn't start, not because HtmlUnit has an issue.
I just did a svn update and rebuilt HtmlUnit to the very latest. I still get the failure.
My dear, let's forget HtmlUnit for a while.
Can you follow these steps and advise:
(Thread.sleep())
http://localhost:8080/htmlunit-richfaces/richfaces/panelMenu.jsf
I can clearly see that Jetty worked normally. Other tests also run without a problem.
This is the test result:
Test set: org.jboss.htmlunit.RichPanelMenuTest
Tests run: 1, Failures: 1, Errors: 0, Skipped: 0, Time elapsed: 8.285 sec <<< FAILURE!
testRichPanelMenu(org.jboss.htmlunit.RichPanelMenuTest) Time elapsed: 8.266 sec <<< FAILURE!
junit.framework.ComparisonFailure: expected:<item 1.1...=""> but was:<nothing...>
at junit.framework.Assert.assertEquals(Assert.java:81)
at junit.framework.Assert.assertEquals(Assert.java:87)
at org.jboss.htmlunit.RichPanelMenuTest.testRichPanelMenu(RichPanelMenuTest.java:53)</nothing...></item>
You would not get that far if Jetty wasn't running. Your conclusion is not valid, at least for when I run the test.
My Dear,
I did what you asked with the sleep and the real browser. The application came up normally. :-)
I am able to see your error now. Deploying the web application on tomcat is correctly processed by HU, but not when run from the 'mvn' jetty.
Sometimes I see see the RichFaces 3.2.2.GA is still used as shown in:
[INFO] Expanding: C:\Documents and Settings\ahmed.ashour.m2\repository\org\jbos
s\jsfunit\richfaces-demo\3.2.2.GA\richfaces-demo-3.2.2.GA.war into c:\use\eclips
e\workspace\rich2\target\war\work\org.jboss.jsfunit\richfaces-demo
The plot thickens. I just changed my pom to run against Tomcat 5.5 instead of Jetty. It works under Tomcat 5.5. It fails under Jetty 6.
That's funny. We both came to the same conclusion and posted within 2 seconds of each other.
I can't remove that dependency or there won't be much left in the WAR!
BTW, I changed the status back to open since it clearly fails under Jetty and we can't yet determine if it is a problem with Jetty or HtmlUnit.
Dear Stan,
Do you notice that testing with Jetty and IE, gives inconsistent results? Sometimes it works, sometimes it gives error.
Just retype the URL and test.
Do you have any idea why?
There is a problem in the application (using jetty at least): when accessing the page for the first time, the post url of the XHR ends with ;jsessionid=... which causes the server to answer with 404. This occurs as well with HtmlUnit as with FF (with empty cache, no session cookie)
=> workaround: change the test to invoke the page twice before performing any action on it... or better, fix the app!
=> test pass for FF2, FF3, IE6 and IE7.