-
1. Re: Upgrade HtmlUnit to 2.7?
ssilvert Feb 5, 2010 7:58 AM (in response to andrewg)Yesterday I comitted the changes for HtmlUnit 2.7 and Neko 1.9.14. I'm attaching the core and richclient jars to this thread. Also, I'll deploy them as snapshots. Let me know how it goes.
Stan
-
2. Re: Upgrade HtmlUnit to 2.7?
ssilvert Feb 5, 2010 8:07 AM (in response to ssilvert)BTW, you'll probably need to tell RichFaces to use Tidy instead of Neko:
<context-param>
<param-name>org.ajax4jsf.xmlparser.ORDER</param-name>
<param-value>TIDY,NEKO</param-value>
</context-param>RichFaces can't handle the latest Neko. When you do this, RichFaces will use Tidy but JSFUnit will use the new Neko.
Stan
-
3. Re: Upgrade HtmlUnit to 2.7?
andrewg Feb 5, 2010 9:45 PM (in response to ssilvert)Thank you Stan, for your prompt response and providing you code, I thought I had a long weekend of refactoring ahead of me!
Unfortunatley I am still getting the same error I was with JSFUnit 1.1.0.
Wrapped java.lang.ClassCastException: com.gargoylesoftware.htmlunit.xml.XmlPage cannot be cast to
com.gargoylesoftware.htmlunit.html.HtmlPage
(http://localhost:8080/mars/a4j/g/3_3_0.GA/org/ajax4jsf/framework.pack.js#2238)see the attachment - exception.txt
I have tried with HtmlUnit 2.6 and 2.7-SNAPSHOT - both fail.
So I will post on the htmlUnit site.
-
exception.txt.zip 3.1 KB
-
-
4. Re: Upgrade HtmlUnit to 2.7?
ssilvert Feb 8, 2010 8:09 AM (in response to andrewg)Yes, I think the HtmlUnit team needs to see this one. Please post right away. They are getting ready to release 2.7 and if we are lucky they can do a quick fix and get this in.
Stan
-
5. Re: Upgrade HtmlUnit to 2.7?
andrewg Feb 16, 2010 5:49 AM (in response to ssilvert)I missed the HtmlUnit 2.7 release so I thought I would do a thorough job on testing this out.
Here are my findings:
- The snapshot provided seems to work OK aginaist HtmlUnit 2.7 (I would suggest a name change as it is a bit confusing calling it 1.2.0 which works with HtmlUnit 2.6)
- I am still having trouble testing a <rich:suggestionbox> BUT here is the thing:
- Having a <rich:suggestionbox> on an xhtmlpage works OK - I just don't know how to select an option in the suggestion box in my test
- Having a <rich:suggestionbox> on a <rich:modalPanel> causes a cast exception
Caused by: java.lang.ClassCastException: com.gargoylesoftware.htmlunit.xml.XmlPage cannot be cast to com.gargoylesoftware.htmlunit.html.HtmlPage
- Having a <rich:suggestionbox> on an xhtmlpage works OK - I just don't know how to select an option in the suggestion box in my test
I have created an eclipse seam project to demonstrate this problem please see the attached files.
Due to size constraints lib.zip needs to be extracted to ..\jsfUnitTest\jsfUnitTest\WebContent\WEB-INF
If you wish I can also post the ear file.
-
lib.zip 11.8 MB
-
jsfUnitTest.zip 5.6 MB
- The snapshot provided seems to work OK aginaist HtmlUnit 2.7 (I would suggest a name change as it is a bit confusing calling it 1.2.0 which works with HtmlUnit 2.6)
-
6. Re: Upgrade HtmlUnit to 2.7?
ssilvert Feb 16, 2010 9:25 AM (in response to andrewg)Hi Andrew. As always, thanks for the good feedback.
andrewg wrote:
I missed the HtmlUnit 2.7 release so I thought I would do a thorough job on testing this out.
Here are my findings:
- The snapshot provided seems to work OK aginaist HtmlUnit 2.7 (I would suggest a name change as it is a bit confusing calling it 1.2.0 which works with HtmlUnit 2.6)
JSFUnit relies on several other technologies such as Cactus and Neko. I don't think it would make sense to sync the version with HtmlUnit. Is that what you were suggesting or did you mean something else?
Having a <rich:suggestionbox> on an xhtmlpage works OK - I just don't know how to select an option in the suggestion box in my test
I'm sure selecting an option can be accomplished, but I'm not sure if that's really what you want to test? I might not understand your requirements but I would think that you really want to test and see if the proper values are populated when you type a character into the suggestion box. So I would just use something like
JSFClientSession.type("myinput", 'a').
Then I would check the resulting page to make sure the values that start with 'a' were downloaded to the page.
assertTrue(JSFClientSession.getPageAsText().contains("Atlanta");
Then to test "Atlanta" I would just fill that in to the input:
JSFClientSession.setValue("myinput", "Atlanta");
Having a <rich:suggestionbox> on a <rich:modalPanel> causes a cast exception
Caused by: java.lang.ClassCastException: com.gargoylesoftware.htmlunit.xml.XmlPage cannot be cast to com.gargoylesoftware.htmlunit.html.HtmlPageThis looks like a bug that I just reported to the HtmlUnit team yesterday:
https://sourceforge.net/tracker/?func=detail&aid=2952333&group_id=47038&atid=448266
They usually get these turned around pretty fast.
Stan
- The snapshot provided seems to work OK aginaist HtmlUnit 2.7 (I would suggest a name change as it is a bit confusing calling it 1.2.0 which works with HtmlUnit 2.6)
-
7. Re: Upgrade HtmlUnit to 2.7?
andrewg Feb 16, 2010 10:15 PM (in response to ssilvert)Hi Stan,
You are welcome, I hope it makes your job a little easier
andrewg wrote:
I missed the HtmlUnit 2.7 release so I thought I would do a thorough job on testing this out.
Here are my findings:
- The snapshot provided seems to work OK aginaist HtmlUnit 2.7 (I would suggest a name change as it is a bit confusing calling it 1.2.0 which works with HtmlUnit 2.6)
JSFUnit relies on several other technologies such as Cactus and Neko. I don't think it would make sense to sync the version with HtmlUnit. Is that what you were suggesting or did you mean something else?
This is just me getting confused as early versions of jboss-jsfunit-core-1.2.0.GA-SNAPSHOT.jar i.e. build 2009-10-23 was dependent on HtmlUnit 2.6.
Later versions of jboss-jsfunit-core-1.2.0.GA-SNAPSHOT.jar are now dependent on HtmlUnit 2.7 and it caught me out a few times when switching between jars trying to figure out where my problem lay. Understandable that snapshots are just that and 1.2.0 will now have a dependency on HtmlUnit 2.7.
Andrew
- The snapshot provided seems to work OK aginaist HtmlUnit 2.7 (I would suggest a name change as it is a bit confusing calling it 1.2.0 which works with HtmlUnit 2.6)
-
8. Re: Upgrade HtmlUnit to 2.7?
andrewg Feb 16, 2010 10:53 PM (in response to ssilvert)Decided to split my replies to make tracking them easier.
andrewg wrote:
Having a <rich:suggestionbox> on an xhtmlpage works OK - I just don't know how to select an option in the suggestion box in my teststan.silvert@jboss.com wrote:
I'm sure selecting an option can be accomplished, but I'm not sure if that's really what you want to test? I might not understand your requirements but I would think that you really want to test and see if the proper values are populated when you type a character into the suggestion box. So I would just use something like
JSFClientSession.type("myinput", 'a').
Then I would check the resulting page to make sure the values that start with 'a' were downloaded to the page.
assertTrue(JSFClientSession.getPageAsText().contains("Atlanta");
Then to test "Atlanta" I would just fill that in to the input:
JSFClientSession.setValue("myinput", "Atlanta")
That is exactly what I want to do! I just explained what I wanted badly.
There is a catch though (as you would see from my code - A001_TestOnPage.java ).
My suggestionbox is on a Suburb input field, when a minimum of 3 characters are entered it does a looked on the DB ('newc%') and returns matching rows containing 3 values, Suburb, State, Postcode.
When one of the rows is selected a listener will populate the Suburb, State and Postcode input fields in the form.
In A001_TestOnPage.java replace line 35 with this:
jsfClientSession.type("m7_address_suburb", 'n');
jsfClientSession.type("m7_address_suburb", 'e');
jsfClientSession.type("m7_address_suburb", 'w');
jsfClientSession.type("m7_address_suburb", 'c');
textRequired = "NEWCASTLE";
assertTrue(testName + "Text not found on page - " + textRequired, jsfClientSession.getPageAsText().contains(textRequired));
and I get the following error :
14:13:32,949 ERROR [JavaScriptJobManagerImpl] Job run failed with unexpected RuntimeException: No active event context java.lang.IllegalStateException: No active event context at org.jboss.seam.core.Manager.instance(Manager.java:368) at org.jboss.jsfunit.seam.SeamRequestListener.tearDownConversation(SeamRequestListener.java:86) at org.jboss.jsfunit.seam.SeamRequestListener.beforeRequest(SeamRequestListener.java:56) at org.jboss.jsfunit.framework.JSFUnitWebConnection.notifyListenersBefore(JSFUnitWebConnection.java:92) at org.jboss.jsfunit.framework.JSFUnitWebConnection.getResponse(JSFUnitWebConnection.java:69) at com.gargoylesoftware.htmlunit.WebClient.loadWebResponseFromWebConnection(WebClient.java:1407) at com.gargoylesoftware.htmlunit.WebClient.loadWebResponse(WebClient.java:1340) at com.gargoylesoftware.htmlunit.javascript.host.xml.XMLHttpRequest.doSend(XMLHttpRequest.java:483) at com.gargoylesoftware.htmlunit.javascript.host.xml.XMLHttpRequest.access$000(XMLHttpRequest.java:60) at com.gargoylesoftware.htmlunit.javascript.host.xml.XMLHttpRequest$1.run(XMLHttpRequest.java:440) at net.sourceforge.htmlunit.corejs.javascript.Context.call(Context.java:537) at net.sourceforge.htmlunit.corejs.javascript.ContextFactory.call(ContextFactory.java:538) at com.gargoylesoftware.htmlunit.javascript.host.xml.XMLHttpRequest$2.run(XMLHttpRequest.java:446) at com.gargoylesoftware.htmlunit.javascript.background.JavaScriptJobManagerImpl$ExecutingJobTracker.run(JavaScriptJobManagerImpl.java:101) at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:441) at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303) at java.util.concurrent.FutureTask.run(FutureTask.java:138) at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$301(ScheduledThreadPoolExecutor.java:98) at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:207) at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908) at java.lang.Thread.run(Thread.java:619)
junit.framework.AssertionFailedError: A001_TestOnPage:testSuggestionOnPage - Text not found on page - NEWCASTLE
at tk.glover.jsfUnitTest.test.suggestion.A001_TestOnPage.testSuggestionOnPage(A001_TestOnPage.java:44)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at org.apache.cactus.internal.AbstractCactusTestCase.runBareServer(AbstractCactusTestCase.java:153)
at org.apache.cactus.internal.server.AbstractWebTestCaller.doTest(AbstractWebTestCaller.java:119)
at org.apache.cactus.internal.server.AbstractWebTestController.handleRequest_aroundBody0(AbstractWebTestController.java:93)
at org.apache.cactus.internal.server.AbstractWebTestController.handleRequest_aroundBody1$advice(AbstractWebTestController.java:224)
at org.apache.cactus.internal.server.AbstractWebTestController.handleRequest(AbstractWebTestController.java)
at org.apache.cactus.server.ServletTestRedirector.doPost_aroundBody2(ServletTestRedirector.java:101)
at org.apache.cactus.server.ServletTestRedirector.doPost_aroundBody3$advice(ServletTestRedirector.java:224)
at org.apache.cactus.server.ServletTestRedirector.doPost(ServletTestRedirector.java)
at org.jboss.jsfunit.framework.JSFUnitServletRedirector.doPost(JSFUnitServletRedirector.java:46)
at org.apache.cactus.server.ServletTestRedirector.doGet_aroundBody0(ServletTestRedirector.java:72)
at org.apache.cactus.server.ServletTestRedirector.doGet_aroundBody1$advice(ServletTestRedirector.java:224)
at org.apache.cactus.server.ServletTestRedirector.doGet(ServletTestRedirector.java)
at org.jboss.jsfunit.framework.JSFUnitServletRedirector.doGet(JSFUnitServletRedirector.java:52)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:617)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at org.jboss.jsfunit.framework.JSFUnitFilter.doFilter(JSFUnitFilter.java:119)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:83)
at org.jboss.seam.web.IdentityFilter.doFilter(IdentityFilter.java:40)
at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
at org.jboss.seam.web.MultipartFilter.doFilter(MultipartFilter.java:90)
at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
at org.jboss.seam.web.ExceptionFilter.doFilter(ExceptionFilter.java:64)
at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
at org.jboss.seam.web.RedirectFilter.doFilter(RedirectFilter.java:45)
at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
at org.ajax4jsf.webapp.BaseXMLFilter.doXmlFilter(BaseXMLFilter.java:178)
at org.ajax4jsf.webapp.BaseFilter.handleRequest(BaseFilter.java:290)
at org.ajax4jsf.webapp.BaseFilter.processUploadsAndHandleRequest(BaseFilter.java:390)
at org.ajax4jsf.webapp.BaseFilter.doFilter(BaseFilter.java:517)
at org.jboss.seam.web.Ajax4jsfFilter.doFilter(Ajax4jsfFilter.java:56)
at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
at org.jboss.seam.web.LoggingFilter.doFilter(LoggingFilter.java:60)
at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:73)
at org.jboss.seam.servlet.SeamFilter.doFilter(SeamFilter.java:158)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:235)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:190)
at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:433)
at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:92)
at org.jboss.web.tomcat.security.SecurityContextEstablishmentValve.process(SecurityContextEstablishmentValve.java:126)
at org.jboss.web.tomcat.security.SecurityContextEstablishmentValve.invoke(SecurityContextEstablishmentValve.java:70)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
at org.jboss.web.tomcat.service.jca.CachedConnectionValve.invoke(CachedConnectionValve.java:158)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:330)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:829)
at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:598)
at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447)
at java.lang.Thread.run(Thread.java:619)So clearly I still have something missing.
Thanx,
Andrew
-
9. Re: Upgrade HtmlUnit to 2.7?
andrewg Feb 16, 2010 10:59 PM (in response to ssilvert)3rd reply to Stans post above
andrewg wrote:
Having a <rich:suggestionbox> on a <rich:modalPanel> causes a cast exception
Caused by: java.lang.ClassCastException: com.gargoylesoftware.htmlunit.xml.XmlPage cannot be cast to com.gargoylesoftware.htmlunit.html.HtmlPagestan.silvert@jboss.com wrote:
This looks like a bug that I just reported to the HtmlUnit team yesterday:
https://sourceforge.net/tracker/?func=detail&aid=2952333&group_id=47038&atid=448266
They usually get these turned around pretty fast.
Stan
Thank you for doing that Stan, I will monitor the bug and test with JsfUnit when fixed.
All the best,
Andrew
-
10. Re: Upgrade HtmlUnit to 2.7?
ssilvert Feb 17, 2010 1:38 PM (in response to andrewg)Looks like they've fixed it in HtmlUnit SVN. I don't think they do nightly snapshots so you'll have to build HtmlUnit from scratch if you want to try it out.andrewg wrote:
3rd reply to Stans post above
andrewg wrote:
Having a <rich:suggestionbox> on a <rich:modalPanel> causes a cast exception
Caused by: java.lang.ClassCastException: com.gargoylesoftware.htmlunit.xml.XmlPage cannot be cast to com.gargoylesoftware.htmlunit.html.HtmlPagestan.silvert@jboss.com wrote:
This looks like a bug that I just reported to the HtmlUnit team yesterday:
https://sourceforge.net/tracker/?func=detail&aid=2952333&group_id=47038&atid=448266
They usually get these turned around pretty fast.
Stan
Thank you for doing that Stan, I will monitor the bug and test with JsfUnit when fixed.
All the best,
Andrew
-
11. Re: Upgrade HtmlUnit to 2.7?
ssilvert Feb 17, 2010 1:40 PM (in response to andrewg)andrewg wrote:
and I get the following error :
14:13:32,949 ERROR [JavaScriptJobManagerImpl] Job run failed with unexpected RuntimeException: No active event context java.lang.IllegalStateException: No active event context at org.jboss.seam.core.Manager.instance(Manager.java:368) at org.jboss.jsfunit.seam.SeamRequestListener.tearDownConversation(SeamRequestListener.java:86) at org.jboss.jsfunit.seam.SeamRequestListener.beforeRequest(SeamRequestListener.java:56) at org.jboss.jsfunit.framework.JSFUnitWebConnection.notifyListenersBefore(JSFUnitWebConnection.java:92)
So clearly I still have something missing.
Thanx,
Andrew
No, I think that's a bug on my part. I ignore that error, which should be OK. But I wasn't ignoring it in tearDownConversation(). I've uploaded a new snapshot of JSFUnit core for you to try out. Please let me know how it goes.
Stan
-
12. Re: Upgrade HtmlUnit to 2.7?
andrewg Feb 18, 2010 6:37 PM (in response to ssilvert)Hi Stan,
This relates to a suggestionbox on xhtml. (I want to get this working before I attempt the modalpanel as that relies on the HtmlUnit fix).
Unfortunately your latest snapshot did not work either.
The exception is now being caught (good) but the suggestion box action is not being triggered (bad).In my code (A001_TestOnPage.java line 35) I have tried to populate the form field with
jsfClientSession.type("m7_address_suburb", 'n');
jsfClientSession.type("m7_address_suburb", 'e');
jsfClientSession.type("m7_address_suburb", 'w');
jsfClientSession.type("m7_address_suburb", 'c');
AND THEN THIS (just to check)
jsfClientSession.setValue("m7_address_suburb", "newca");
in both instances neither worked. The rendered html from jsfClientSession.getPageAsText(); does not contain the values expected to be return from the lookup (which is not triggered.)
Attached this the getPageAsText() from using type().
I am not sure if there is something wrong with my code. In the war previously provided suggestionOnPage.xhtml.
Thanx, Andrew
-
13. Re: Upgrade HtmlUnit to 2.7?
andrewg Feb 22, 2010 4:22 PM (in response to andrewg)Hi Stan,
Have you got any thoughts on my post above. Should I be raising a bug for this issue?
Thank you for your help,
Andrew
-
14. Re: Upgrade HtmlUnit to 2.7?
ssilvert Feb 23, 2010 8:24 AM (in response to andrewg)andrewg wrote:
Hi Stan,
Have you got any thoughts on my post above. Should I be raising a bug for this issue?
Thank you for your help,
Andrew
Hopefully I'll have time to take a closer look today. I did see your post but I have to finish something else first.
Did you build HtmlUnit from SVN to get around the other bug? If so, can you attach it to save me a little time?
Stan