1 Reply Latest reply on Jun 6, 2015 10:30 AM by Ramananda Prasad Garikipati

    selenium ui test in overlord

    David virgil naranjo Novice

      I have been investigating how to create the basic structure for the overlord ui projects.

       

      I started creating a basic structure for s-ramp-ui tests using Graphene, Drone, Arquillian + Selenium

       

      I could not make a proper structure using the graphene functionalities. Maybe it is due to the fact that I am new in those technologies and I do not know how to apply them.

       

      I have some doubts and I tried to find the graphene forum, but I didn't find it. I just have seen the issue tracker, but I do not want to open an issue that maybe is not an issue.

       

      The following will describe the problem I found:

       

      In the test the main problem I had was related with having an interaction of pages in the same Test. The normal flow of every action you have:

       

       

          1. Login

          2. Homepage

          3. Functionality to test (artifacts, ontologies...)

          4. Logout

       

      Sometimes in the same test you need to interact between pages, to make some checks.

       

      In the tests for having an abstraction of the pages you can either include a annotation @Page as attribute of the class or a @InitialPage as a param of the method to test. This 2 annotations will inject the WebDriver when a @Drone is found and will inject all the seleniums annotations (@FindBy or @FindByJQuery).

       

      But the problem is that, right now I think Arquillian/Graphene it does not suit this Suite Actions. It means that  there is an interaction of pages. When you click in one link then, another page is loaded. It fits perfectly for testing just one page, using the @Page annotation.

       

      You can place initially in the test the injection of the LoginPage with the @Page:

       

      @Page

      private LoginPage login;

       

      But you can not place the injection of the HomePage or the another page, because initially, the WebDriver (browser) is not pointing there, and when Graphene tries to inject these pages, an Exception appears.

       

      What would be very nice is to have a Suite of classes, that can share the same WebDriver. The suite classes would execute the tests in order:

       

      LoginTest

      HomepageTest

      ArtifactsTest

      LogoutTest

       

      It is not possible to inject in the same test:

       

      @Page LoginPage login;

      @Page HomePage homepage; (this will throw an exception).

       

      For us the interaction between pages is important and I do not know if the best solution could be to use the PageFactory.init method.

       

      The problem I found with the PageFactory.init call is that it initialize all the Selenium annotations (FindBy, FindByJQuery...), but it does not initialize the @Drone annotations. In case you need the WebDriver inside the page, then the webdriver has to be set manually.

       

      Another problem of using Arquillian was related the annotation @Location that can be placed in the Page Objects. For using the @Location tag it is necessary that the application is under the Arquillian Context. Then it is mandatory to be deployed using @Deployment annotation. It is not good for our tests, that for each UI Functionality test, the war artifact is deployed, in terms of performance.

       

      Then my opinion is the following:

      • We want to deploy only once, and then all the arquillian tests would be executed. Having a @Deployment annotation is not helping much in this. But it is necessary to have an arquillian context for using the @Location.
      • We need to implement a suite of tests. we could create one Test class that iterates from one view to another using the PageFactory.init, but it is a pity that using this initialization the @Drone annotations are not parsed. We need to manually set the WebDriver.

       

       

       

      David