2 Replies Latest reply on Oct 11, 2016 10:41 AM by mjobanek

    Problems with Graphene2 in testing JSF2+Primefaces5 components ?

    screemer

      Hello,

      I am developing application based on JSF2 and Primefaces 5.0. I found arquillan to be very good tool to automate my integration testing, but I have some problems to test my application. In general I really love the way Graphene maps page elements into injected properties. It works great with simple fields like buttons, input fields etc (basic HTML form fields), but my problem is that most of the components I use are from primeface, are based on some javascript routines and in general rendered into html as "div" tags. When I try to find them by css or xpath and inject into form class in most cases I generate  an exception and the test fails with an error:

       

      org.openqa.selenium.ElementNotVisibleException:

      element not visible

        (Session info: chrome=52.0.2743.116)

       

      So I have some questions that maybe someone can answer:

      Is there any tutorial that exceeds the basic information from official that covers how to write a code for simulating user operating Primefaces components?

      Is it possible to nest Page fragments ? (page fragments inside another page fragment class)

      What am I doing wrong ?

       

      sample injections in my code:

      class SystemDescriptionForm{

        @Root

        private WebElement form;

        @FindBy(id = "tabs:systemDescription:interfaces")

          private WebElement interfaces; // this works - as this is input field <p:inputText>

      ;

       

          @FindBy(id = "tabs:systemDescription:family") // this is primefaces <p:selectOneMenu> - can not do anything - element not visible

          private WebElement label;

       

          @FindBy(css = "div#tabs:systemDescription:family_label")

          private WebElement firstOption; //this is a label on the dropdown as far I found - but runing click() on this gives element not visible exception

      }

       

      Also - Is there any problem with injecting page fragments inside page fragments ? (for example I have a <p:tabView> that contains multiple tabs and then <h:form> on every tab - can I make page fragment class for tabs and then FindBy the forms inside ?

       

      Thank you for any help.

      Regards,

      Artur

        • 1. Re: Problems with Graphene2 in testing JSF2+Primefaces5 components ?
          bmajsak

          Hi Artur,

           

          glad to hear you find the tools useful! Let me try to answer your questions.

           

          org.openqa.selenium.ElementNotVisibleException

          One problem which you might be facing is that particular PrimeFaces element is not physically visible in the browser (speaking from the user perspective). If it does not fit the viewport you can face this exception. More details can be found here in the  WebDriver spec.

           

          Is there any tutorial that exceeds the basic information from official that covers how to write a code for simulating user operating Primefaces components?

          Not that I'm aware of. mjobanek are you aware of something? On the other hand we would be extremely happy to see contribution for this If you could help us in this area we definitely can provide you all the details on how to write such a guide! And all the glory is yours

           

          Is there any problem with injecting page fragments inside page fragments ? (for example I have a <p:tabView> that contains multiple tabs and then <h:form> on every tab - can I make page fragment class for tabs and then FindBy the forms inside ?

           

          Are you experiencing any problems with it? For me that is the main killer feature of Graphene which let me write UI tests in a very concise and clean fashion in all the projects till date.

           

          HTH

           

          Bartosz

          • 2. Re: Problems with Graphene2 in testing JSF2+Primefaces5 components ?
            mjobanek

            Hi,

            sorry for my very late response. No, I'm not aware of any such a doc or guide.

            If you have any thoughts or notes on this which you could share with us, we (and many others) would be very thankful for them.