1 Reply Latest reply on Nov 6, 2015 9:29 AM by Thomas Peeters

    Warp: WebElementInstance.click() doesn't do anything

    Thomas Peeters Newbie

      Hey,

       

      First of all, I had quite the hard time to even get anything from Arquillan Warp (and its Maven dependencies) to work.  Maven.configureResolver() failed due to all kinds of classpath issues.  This got solved by using version 2.0.x of Shrinkwrap Maven resolver.

       

      Edit: techs used:

      JBoss EAP 6.2

      Maven 2

      JSF2 Mojarra + Richfaces 4

      ...

       

       

      After that I also had to force the selenium browser dependencies in the pom (pom content follow below), otherwise I would always get this error:

       

       

      org.jboss.arquillian.warp.impl.client.execution.WarpSynchronizationException: The Warp failed to observe requests or match them with response.

       

       

      There were no requests matched by observer [null]

       

      Now, the most basic test seems to work (code follows), but once I try to click a link or button nothing happens.

       

      Test code:

       

      @Test
      @RunAsClient
      public void testFrontPage() {
      
        Warp
        .initiate(new Activity() {
         public void perform() {
         browser.navigate().to(contextPath + "index.xhtml");
        }
        })
        .inspect(new Inspection() {
         private static final long serialVersionUID = 1L;
      
         @ManagedProperty(value = "#{homeBean}")
        HomeBean homeBean;
      
         @AfterPhase(RENDER_RESPONSE)
         public void initial_state_havent_changed_yet() {
         assertNotNull(homeBean);
         assertThat(homeBean.getPage(), is(1));
        System.err.println(homeBean.getApplicationBean().getAvailableOffices());
        }
        }
        );
      }
      
      

       

      This test excerpt above works.

       

      @Test
      @RunAsClient
      public void searchPersonAndRefMonthTest() {
      
        Warp.initiate(new Activity() {
      
         public void perform() {
         browser.navigate().to(contextPath + "index.xhtml");
        WebElement link = browser.findElement(By.id("mainMenuForm:searchPersonAndReferenceMonth"));
        System.err.println(link.getText());
        link.click();
        }
        }).inspect(new Inspection() {
      
         private static final long serialVersionUID = -4991505525911362482L;
      
         @AfterPhase(RENDER_RESPONSE)
         public void searchPageDisplayedTest(){
        String viewId = FacesContext.getCurrentInstance().getViewRoot().getViewId();
        System.err.println("--------------> "+viewId);
         assertEquals("/html/payment/searchPersonAndReferenceMonthPage.xhtml", viewId);
        }
        })
        ;
      }
      
      
      
      
      

       

      This test code above does not.  The link gets identified, its caption gets printed to the err console but nothing happens.  The test fails due to the browser still being on the index page.  This is the same for buttons too.

       

      Finally the Maven pom (using Warp 1.0.0.Alpha6, for Alpha7 i encountered something similar to Jboss issue ARQ-1769):

       

      <properties>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
      
        <version.jboss.bom>1.0.7.Final</version.jboss.bom>
        <version.org.jboss.arquillian>1.1.1.Final</version.org.jboss.arquillian>
        <version.org.jboss.arquillian.drone>1.2.0.Final</version.org.jboss.arquillian.drone>
        <version.org.jboss.arquillian.graphene2>2.0.0.Final</version.org.jboss.arquillian.graphene2>
        <version.org.jboss.arquillian.graphene>1.0.0.Final</version.org.jboss.arquillian.graphene>
        <version.org.jboss.arquillian.warp>1.0.0.Alpha6</version.org.jboss.arquillian.warp>
        <version.selenium>2.39.0</version.selenium>
      </properties>
      
      <dependencyManagement>
        <dependencies>
        <dependency>
        <groupId>org.jboss.arquillian</groupId>
        <artifactId>arquillian-bom</artifactId>
        <version>${version.org.jboss.arquillian}</version>
        <type>pom</type>
        <scope>import</scope>
        </dependency>
      
        <dependency>
        <groupId>org.jboss.arquillian.selenium</groupId>
        <artifactId>selenium-bom</artifactId>
        <version>${version.selenium}</version>
        <type>pom</type>
        <scope>import</scope>
        </dependency>
      
        <dependency>
        <groupId>org.jboss.arquillian.extension</groupId>
        <artifactId>arquillian-drone-bom</artifactId>
        <version>${version.org.jboss.arquillian.drone}</version>
        <type>pom</type>
        <scope>import</scope>
        </dependency>
      
        <dependency>
        <groupId>org.jboss.arquillian.extension</groupId>
        <artifactId>arquillian-warp-bom</artifactId>
        <version>${version.org.jboss.arquillian.warp}</version>
        <type>pom</type>
        <scope>import</scope>
        </dependency>
      
        <dependency>
        <groupId>org.jboss.bom</groupId>
        <artifactId>jboss-javaee-6.0-with-hibernate</artifactId>
        <version>${version.jboss.bom}</version>
        <type>pom</type>
        <scope>import</scope>
        </dependency>
        </dependencies>
      </dependencyManagement>
      
      <dependencies>
      
        <dependency>
        <groupId>javax.enterprise</groupId>
        <artifactId>cdi-api</artifactId>
        <scope>provided</scope>
        </dependency>
      
        <dependency>
        <groupId>org.jboss.spec.javax.annotation</groupId>
        <artifactId>jboss-annotations-api_1.1_spec</artifactId>
        <scope>provided</scope>
        </dependency>
      
        <dependency>
        <groupId>org.jboss.spec.javax.ws.rs</groupId>
        <artifactId>jboss-jaxrs-api_1.1_spec</artifactId>
        <scope>provided</scope>
        </dependency>
      
        <dependency>
        <groupId>org.hibernate.javax.persistence</groupId>
        <artifactId>hibernate-jpa-2.0-api</artifactId>
        <scope>provided</scope>
        </dependency>
      
        <dependency>
        <groupId>org.jboss.spec.javax.ejb</groupId>
        <artifactId>jboss-ejb-api_3.1_spec</artifactId>
        <scope>provided</scope>
        </dependency>
      
        <dependency>
        <groupId>org.jboss.spec.javax.faces</groupId>
        <artifactId>jboss-jsf-api_2.1_spec</artifactId>
        <scope>provided</scope>
        </dependency>
      
      
        <dependency>
        <groupId>junit</groupId>
        <artifactId>junit</artifactId>
        <version>4.8.1</version>
        <scope>test</scope>
        </dependency>
      
        <dependency>
        <groupId>org.jboss.arquillian.junit</groupId>
        <artifactId>arquillian-junit-container</artifactId>
        <scope>test</scope>
        </dependency>
      
        <dependency>
        <groupId>org.jboss.arquillian.protocol</groupId>
        <artifactId>arquillian-protocol-servlet</artifactId>
        <scope>test</scope>
        </dependency>
      
        <dependency>
        <groupId>org.jboss.arquillian.graphene</groupId>
        <artifactId>graphene-webdriver</artifactId>
        <version>${version.org.jboss.arquillian.graphene2}</version>
        <type>pom</type>
        <scope>test</scope>
        </dependency>
      
        <dependency>
        <groupId>org.jboss.arquillian.extension</groupId>
        <artifactId>arquillian-drone-webdriver-depchain</artifactId>
        <type>pom</type>
        <scope>test</scope>
        </dependency>
      
        <dependency>
        <groupId>org.jboss.arquillian.extension</groupId>
        <artifactId>arquillian-warp</artifactId>
        <type>pom</type>
        <scope>test</scope>
        </dependency>
      
        <dependency>
        <groupId>org.mockito</groupId>
        <artifactId>mockito-all</artifactId>
        <version>1.9.5</version>
        <scope>test</scope>
        </dependency>
        <dependency>
        <groupId>org.hamcrest</groupId>
        <artifactId>hamcrest-all</artifactId>
        <version>1.3</version>
        <scope>test</scope>
        </dependency>
        <dependency>
        <groupId>org.jboss.arquillian.extension</groupId>
        <artifactId>arquillian-warp-jsf</artifactId>
        <scope>test</scope>
        </dependency>
      
      
        <dependency>
        <groupId>org.seleniumhq.selenium</groupId>
        <artifactId>selenium-chrome-driver</artifactId>
         <!--<version>2.40.0</version>-->
         </dependency>
        <dependency>
        <groupId>org.seleniumhq.selenium</groupId>
        <artifactId>selenium-firefox-driver</artifactId>
        <scope>test</scope>
        </dependency>
        <dependency>
        <groupId>org.seleniumhq.selenium</groupId>
        <artifactId>selenium-htmlunit-driver</artifactId>
        <scope>test</scope>
        </dependency>
        <dependency>
        <groupId>org.seleniumhq.selenium</groupId>
        <artifactId>selenium-ie-driver</artifactId>
        <scope>test</scope>
        </dependency>
        <dependency>
        <groupId>org.seleniumhq.selenium</groupId>
        <artifactId>selenium-remote-driver</artifactId>
        <scope>test</scope>
        </dependency>
        <dependency>
        <groupId>com.opera</groupId>
        <artifactId>operadriver</artifactId>
        <version>1.5</version>
        <scope>test</scope>
        <exclusions>
        <exclusion>
        <artifactId>selenium-java</artifactId>
        <groupId>org.seleniumhq.selenium</groupId>
        </exclusion>
        </exclusions>
        </dependency>
        <dependency>
        <groupId>org.seleniumhq.selenium</groupId>
        <artifactId>selenium-safari-driver</artifactId>
        <version>${version.selenium}</version>
        </dependency>
        <dependency>
        <groupId>com.jcraft</groupId>
        <artifactId>jzlib</artifactId>
        <version>1.1.2</version>
        <scope>test</scope>
        </dependency>
        <dependency>
        <groupId>org.jboss.arquillian.extension</groupId>
        <artifactId>arquillian-phantom-binary</artifactId>
        <version>1.9.7</version>
        <classifier>windows</classifier>
        <scope>test</scope>
        </dependency>
      
        <dependency>
        <groupId>org.jboss.as</groupId>
        <artifactId>jboss-as-arquillian-container-remote</artifactId>
        <version>7.2.0.Final</version>
        <scope>test</scope>
        <exclusions>
        <exclusion>
        <groupId>org.hibernate</groupId>
        <artifactId>hibernate-validator</artifactId>
        </exclusion>
        </exclusions>
        </dependency>
      
      

      ...