1 2 Previous Next 22 Replies Latest reply on Jan 24, 2011 9:58 AM by ssilvert

    Does JSFUnit support testing of jsf pages with rich:editor control

    kiransri

      I am trying to test a JSF page with rich:editor controls and facing some internal errors. Please let me know if JSFUnit support testing of rich:editor.

       

      Regards

      Kiran

        • 1. Re: Does JSFUnit support testing of jsf pages with rich:editor control
          kragoth

          A quick look at the API would indicate that the answer is "No", JSFUnit hasn't provided direct support for the rich:editor component yet.

           

          That being said, JSFUnit is basically a wrapper around HtmlUnit that just makes working with JSF much much easier. So, feel free to post the exceptions you are getting (full stacktraces). And the code you are using to test it and let's see how far we can get

          • 2. Re: Does JSFUnit support testing of jsf pages with rich:editor control
            ssilvert

             

            Tim Evers wrote:

             

            That being said, JSFUnit is basically a wrapper around HtmlUnit that just makes working with JSF much much easier.

            Tim's analysis of your problem is correct, and I thank him for providing a good answer.  But I wouldn't want anyone to take his above statement at face value.  Only JSFClientSession and RichFacesClient wrap HtmlUnit.  You need this in order simulate a user hitting your app from a browser.

             

            If you want to write really insightful tests that provide the most value then you will do most of your assertions on server side artifacts that HtmlUnit can't  even see.  That's where JSFServerSession comes in.

             

            Back to rich:editor, I haven't tried it.  I've written tests for most RichFaces components and tried to cover the most common use cases.  But I don't have the bandwidth to make sure that every component and every component attribute works perfectly with JSFUnit.  Most things do work fine.

             

            But I need help for the things that don't.  Usually, it is indeed a matter of dealing with some edge case that breaks HtmlUnit.  To get the problem fixed, we need a simple test app that reproduces the problem.  Preferably, the app only uses the HtmlUnit API and leaves JSFUnit out of it.  That way we can provide the HtmlUnit project team some proof that there is something they need to fix.

             

            Stan

            • 3. Re: Does JSFUnit support testing of jsf pages with rich:editor control
              kiransri

              Thanks for the response Tim and Stan. I am not testing the rich editor per se but trying to test a jsf page with these controls. I have not touched the rich editor elements in the code but still I am getting an error which is pointing to the editor.js. I have posted the error stack traces in a different thread which I had launched for a similiar issue ( http://community.jboss.org/message/570539#570539)  and Tim has replied to that too. I am hopeful of a solution and would request you to continue to help me on this. Please let me know if you require any other logs.

               

               

              • 4. Re: Does JSFUnit support testing of jsf pages with rich:editor control
                kragoth

                Stan Silvert wrote:

                 

                 

                Tim Evers wrote:

                 

                That being said, JSFUnit is basically a wrapper around HtmlUnit that just makes working with JSF much much easier.

                Tim's analysis of your problem is correct, and I thank him for providing a good answer.  But I wouldn't want anyone to take his above statement at face value.  Only JSFClientSession and RichFacesClient wrap HtmlUnit.  You need this in order simulate a user hitting your app from a browser.

                 

                If you want to write really insightful tests that provide the most value then you will do most of your assertions on server side artifacts that HtmlUnit can't  even see.  That's where JSFServerSession comes in.

                 

                Stan

                Ah yeah...oops

                 

                Thanks for fixing that up

                • 5. Re: Does JSFUnit support testing of jsf pages with rich:editor control
                  ssilvert

                  Kiran Srinivasa wrote:

                   

                  Thanks for the response Tim and Stan. I am not testing the rich editor per se but trying to test a jsf page with these controls. I have not touched the rich editor elements in the code but still I am getting an error which is pointing to the editor.js. I have posted the error stack traces in a different thread which I had launched for a similiar issue ( http://community.jboss.org/message/570539#570539)  and Tim has replied to that too. I am hopeful of a solution and would request you to continue to help me on this. Please let me know if you require any other logs.

                   

                   

                   

                  Update.  I'm working to get someone from the RichFaces team to help  with this.  I think they will be able to work with the HtmlUnit team a  lot more efficiently that I could.  It will be a couple of weeks before  someone is freed up though.

                   

                  Stan

                  • 6. Re: Does JSFUnit support testing of jsf pages with rich:editor control
                    kiransri

                    Thanks Stan. It will be great if you can get someone earlier since my project deadlines are stiff. Hoping for the best.

                     

                    Regards

                    Kiran

                    • 7. Re: Does JSFUnit support testing of jsf pages with rich:editor control
                      kiransri

                      Hi Stan,

                       

                      I will following up on this. Please let me know if you got anyone from the richfaces team to work on this issue.

                       

                      Regards

                      Kiran

                      • 8. Re: Does JSFUnit support testing of jsf pages with rich:editor control
                        ssilvert

                        Still working on it.  I think someone from the RichFaces team will be freed up soon.

                         

                        Stan

                        • 9. Re: Does JSFUnit support testing of jsf pages with rich:editor control
                          kiransri

                          Thanks Stan.

                           

                          Regards

                          Kiran

                          • 10. Re: Does JSFUnit support testing of jsf pages with rich:editor control
                            kiransri

                            Hello Stan,

                             

                            A quick followup. Is anyone from the Richfaces team available now ?

                             

                            Regards

                            Kiran

                            • 11. Re: Does JSFUnit support testing of jsf pages with rich:editor control
                              ssilvert

                              I've been told that someone will be available this week.  Sorry for the long delay.  I do want to get this resolved.

                               

                              Stan

                              • 12. Re: Does JSFUnit support testing of jsf pages with rich:editor control
                                kiransri

                                Thanks Stan. I look forward for a quick resolution.

                                 

                                Regards

                                Kiran

                                • 13. Re: Does JSFUnit support testing of jsf pages with rich:editor control
                                  ssilvert

                                  Kiran,

                                   

                                  I did a quick test that hits http://livedemo.exadel.com/richfaces-demo/richfaces/editor.jsf.  It does not fail.

                                   

                                  WebClient webClient = new WebClient();
                                  HtmlPage page = webClient.getPage("http://livedemo.exadel.com/richfaces-demo/richfaces/editor.jsf");

                                   

                                  I also tried it through JSFUnit using a local version of the demo like this:

                                  JSFSession jsfSession = new JSFSession("/richfaces/editor.jsf");

                                   

                                  So I'm wondering what else needs to be done to reproduce the error.  Just hitting a page with a rich:editor doesn't cause the problem.  Any ideas?

                                   

                                  Stan

                                  • 14. Re: Does JSFUnit support testing of jsf pages with rich:editor control
                                    testvogel

                                    I have the same issue now and debugged my application a little bit.

                                     

                                    The problem is that HtmlUnit doesnt render anything of the editor (using tinymce).

                                     

                                    Html code in working application (with firebug):

                                     

                                     

                                    <div class="rich-editor " id="newNewsForm:newNewsTable:0:newsEntryText">
                                    <textarea style="visibility: hidden; display: none;" name="newNewsForm:newNewsTable:0:newsEntryTextTextArea" id="newNewsForm:newNewsTable:0:newsEntryTextTextArea"></textarea>
                                    <span class="mceEditor richfacesSkin" id="newNewsForm:newNewsTable:0:newsEntryTextTextArea_parent">
                                    
                                    editor....
                                    
                                    </span>
                                    <script.....>
                                    </div>
                                    
                                    
                                    
                                    

                                     

                                    The important part is the <span> but this component won't be rendered in HtmlUnit.

                                    I get the <div> (id="newNewsForm:newNewsTable:0:newsEntryText") component and print all child elements in HtmlUnit.

                                     

                                    output:

                                     

                                     

                                    <textarea id="newNewsForm:newNewsTable:0:newsEntryTextTextArea" name="newNewsForm:newNewsTable:0:newsEntryTextTextArea" style="visibility: hidden">HALLO WELT</textarea>
                                    <script....>
                                    

                                     

                                    The <span> component is missing and it's impossible to get any editor components.

                                     

                                    Is this a HtmlUnit configuration issue or a bug? Any solutions?

                                     

                                    Regards,

                                    Ole

                                    1 2 Previous Next