[arquillian-issues] [JBoss JIRA] (ARQ-1366) Warp: support server-side testing of web pages that require authentication

Oliver Bock (JIRA) jira-events at lists.jboss.org
Thu Mar 28 11:13:41 EDT 2013


     [ https://issues.jboss.org/browse/ARQ-1366?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Oliver Bock updated ARQ-1366:
-----------------------------

    Description: 
When web pages are protected by a security-constraint (web.xml) that requires authentication, Warp JSF runs into a {{SynchronizationPoint$ServerResponseTimeoutException}} while executing server-side tests using {{inspect()}}, like the second one below. Standard FORM authentication (via {{j_security_check}}) and Web Driver's {{htmlunit}} browser are used in this case.

More observations:
* Client-side tests work just fine (first test below)
* Disabling the security-constraint (no authentication) allows the server-side test to finish successfully


{noformat}
    @Test
    @RunAsClient
    public void testOnClient() {
        browser.get(deploymentUrl + "index.xhtml");
        doLoginIfNeeded(browser);
        // this works just fine!
        Assert.assertEquals("INDEX", browser.getTitle());
    }

    @Test
    @RunAsClient
    public void testOnServer() {
        Warp.initiate(new Activity() {
            @Override
            public void perform() {
                browser.get(deploymentUrl + "index.xhtml");
                doLoginIfNeeded(browser);
                // this works just fine!
                Assert.assertEquals("INDEX", browser.getTitle());
            }
        })
        .group()
            .observe(request().uri().contains("index.xhtml"))
            .inspect(new Inspection() {
                private static final long serialVersionUID = 1L;

                @ArquillianResource
                private FacesContext facesContext;

                @AfterPhase(RENDER_RESPONSE)
                @SuppressWarnings("unused")
                public void testNavigation() {
                    // timeout exception before we reach this
                    Assert.assertTrue(facesContext.getViewRoot().getViewId().contains("index.xhtml"));
                }
            })
        .execute();
    }
{noformat}

Note: {{doLoginIfNeeded()}} is just a helper method that enters user name and password and hits the login button if the login form popped-up (in case there's no active session) following the initial {{browser.get()}} request in the test.

Exception:
{noformat}
org.jboss.arquillian.warp.impl.client.execution.SynchronizationPoint$ServerResponseTimeoutException
          at org.jboss.arquillian.warp.impl.client.execution.SynchronizationPoint.awaitResponses(SynchronizationPoint.java:155)
          at org.jboss.arquillian.warp.impl.client.execution.DefaultExecutionSynchronizer.waitForResponse(DefaultExecutionSynchronizer.java:60)
          at org.jboss.arquillian.warp.impl.client.execution.WarpExecutionObserver.awaitResponse(WarpExecutionObserver.java:64)
          at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
          at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
          at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
          at java.lang.reflect.Method.invoke(Method.java:597)
          at org.jboss.arquillian.core.impl.ObserverImpl.invoke(ObserverImpl.java:94)
          at org.jboss.arquillian.core.impl.EventContextImpl.invokeObservers(EventContextImpl.java:99)
          at org.jboss.arquillian.core.impl.EventContextImpl.proceed(EventContextImpl.java:81)
          at org.jboss.arquillian.core.impl.ManagerImpl.fire(ManagerImpl.java:135)
          at org.jboss.arquillian.core.impl.ManagerImpl.fire(ManagerImpl.java:115)
          at org.jboss.arquillian.core.impl.EventImpl.fire(EventImpl.java:67)
          at org.jboss.arquillian.warp.impl.client.execution.DefaultWarpExecutor.awaitServerExecution(DefaultWarpExecutor.java:95)
          at org.jboss.arquillian.warp.impl.client.execution.DefaultWarpExecutor.execute(DefaultWarpExecutor.java:65)
          at org.jboss.arquillian.warp.impl.client.execution.WarpExecutionObserver.executeWarp(WarpExecutionObserver.java:45)
          at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
          at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
          at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
          at java.lang.reflect.Method.invoke(Method.java:597)
{noformat}


  was:
When web pages are protected by a security-constraint (web.xml) that requires authentication, Warp JSF runs into a {{SynchronizationPoint$ServerResponseTimeoutException}} while executing server-side tests using {{inspect()}}, like the second one below. Standard FORM authentication (via {{j_security_check}}) and Web Driver's {{htmlunit}} browser are used in this case.

More observations:
* Client-side tests work just fine (first test below)
* Disabling the security-constraint (no authentication) allows the server-side test to finish successfully

{noformat}
    @Test
    @RunAsClient
    public void testOnClient() {
        browser.get(deploymentUrl + "index.xhtml");
        doLoginIfNeeded(browser);
        // this works just fine!
        Assert.assertEquals("INDEX", browser.getTitle());
    }

    @Test
    @RunAsClient
    public void testOnServer() {
        Warp.initiate(new Activity() {
            @Override
            public void perform() {
                browser.get(deploymentUrl + "index.xhtml");
                doLoginIfNeeded(browser);
                // this works just fine!
                Assert.assertEquals("INDEX", browser.getTitle());
            }
        })
        .group()
            .observe(request().uri().contains("index.xhtml"))
            .inspect(new Inspection() {
                private static final long serialVersionUID = 1L;

                @ArquillianResource
                private FacesContext facesContext;

                @AfterPhase(RENDER_RESPONSE)
                @SuppressWarnings("unused")
                public void testNavigation() {
                    // timeout exception before we reach this
                    Assert.assertTrue(facesContext.getViewRoot().getViewId().contains("index.xhtml"));
                }
            })
        .execute();
    }
{noformat}

Note: {{doLoginIfNeeded()}} is just a helper method that enters user name and password and hits the login button if the login form popped-up (in case there's no active session) following the initial {{browser.get()}} request in the test.

Exception:
{noformat}
org.jboss.arquillian.warp.impl.client.execution.SynchronizationPoint$ServerResponseTimeoutException
          at org.jboss.arquillian.warp.impl.client.execution.SynchronizationPoint.awaitResponses(SynchronizationPoint.java:155)
          at org.jboss.arquillian.warp.impl.client.execution.DefaultExecutionSynchronizer.waitForResponse(DefaultExecutionSynchronizer.java:60)
          at org.jboss.arquillian.warp.impl.client.execution.WarpExecutionObserver.awaitResponse(WarpExecutionObserver.java:64)
          at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
          at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
          at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
          at java.lang.reflect.Method.invoke(Method.java:597)
          at org.jboss.arquillian.core.impl.ObserverImpl.invoke(ObserverImpl.java:94)
          at org.jboss.arquillian.core.impl.EventContextImpl.invokeObservers(EventContextImpl.java:99)
          at org.jboss.arquillian.core.impl.EventContextImpl.proceed(EventContextImpl.java:81)
          at org.jboss.arquillian.core.impl.ManagerImpl.fire(ManagerImpl.java:135)
          at org.jboss.arquillian.core.impl.ManagerImpl.fire(ManagerImpl.java:115)
          at org.jboss.arquillian.core.impl.EventImpl.fire(EventImpl.java:67)
          at org.jboss.arquillian.warp.impl.client.execution.DefaultWarpExecutor.awaitServerExecution(DefaultWarpExecutor.java:95)
          at org.jboss.arquillian.warp.impl.client.execution.DefaultWarpExecutor.execute(DefaultWarpExecutor.java:65)
          at org.jboss.arquillian.warp.impl.client.execution.WarpExecutionObserver.executeWarp(WarpExecutionObserver.java:45)
          at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
          at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
          at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
          at java.lang.reflect.Method.invoke(Method.java:597)
{noformat}



    
> Warp: support server-side testing of web pages that require authentication
> --------------------------------------------------------------------------
>
>                 Key: ARQ-1366
>                 URL: https://issues.jboss.org/browse/ARQ-1366
>             Project: Arquillian
>          Issue Type: Feature Request
>      Security Level: Public(Everyone can see) 
>          Components: Extension - Warp
>    Affects Versions: warp_1.0.0.Alpha2
>            Reporter: Oliver Bock
>              Labels: authentication, exception, warp
>
> When web pages are protected by a security-constraint (web.xml) that requires authentication, Warp JSF runs into a {{SynchronizationPoint$ServerResponseTimeoutException}} while executing server-side tests using {{inspect()}}, like the second one below. Standard FORM authentication (via {{j_security_check}}) and Web Driver's {{htmlunit}} browser are used in this case.
> More observations:
> * Client-side tests work just fine (first test below)
> * Disabling the security-constraint (no authentication) allows the server-side test to finish successfully
> {noformat}
>     @Test
>     @RunAsClient
>     public void testOnClient() {
>         browser.get(deploymentUrl + "index.xhtml");
>         doLoginIfNeeded(browser);
>         // this works just fine!
>         Assert.assertEquals("INDEX", browser.getTitle());
>     }
>     @Test
>     @RunAsClient
>     public void testOnServer() {
>         Warp.initiate(new Activity() {
>             @Override
>             public void perform() {
>                 browser.get(deploymentUrl + "index.xhtml");
>                 doLoginIfNeeded(browser);
>                 // this works just fine!
>                 Assert.assertEquals("INDEX", browser.getTitle());
>             }
>         })
>         .group()
>             .observe(request().uri().contains("index.xhtml"))
>             .inspect(new Inspection() {
>                 private static final long serialVersionUID = 1L;
>                 @ArquillianResource
>                 private FacesContext facesContext;
>                 @AfterPhase(RENDER_RESPONSE)
>                 @SuppressWarnings("unused")
>                 public void testNavigation() {
>                     // timeout exception before we reach this
>                     Assert.assertTrue(facesContext.getViewRoot().getViewId().contains("index.xhtml"));
>                 }
>             })
>         .execute();
>     }
> {noformat}
> Note: {{doLoginIfNeeded()}} is just a helper method that enters user name and password and hits the login button if the login form popped-up (in case there's no active session) following the initial {{browser.get()}} request in the test.
> Exception:
> {noformat}
> org.jboss.arquillian.warp.impl.client.execution.SynchronizationPoint$ServerResponseTimeoutException
>           at org.jboss.arquillian.warp.impl.client.execution.SynchronizationPoint.awaitResponses(SynchronizationPoint.java:155)
>           at org.jboss.arquillian.warp.impl.client.execution.DefaultExecutionSynchronizer.waitForResponse(DefaultExecutionSynchronizer.java:60)
>           at org.jboss.arquillian.warp.impl.client.execution.WarpExecutionObserver.awaitResponse(WarpExecutionObserver.java:64)
>           at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>           at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
>           at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
>           at java.lang.reflect.Method.invoke(Method.java:597)
>           at org.jboss.arquillian.core.impl.ObserverImpl.invoke(ObserverImpl.java:94)
>           at org.jboss.arquillian.core.impl.EventContextImpl.invokeObservers(EventContextImpl.java:99)
>           at org.jboss.arquillian.core.impl.EventContextImpl.proceed(EventContextImpl.java:81)
>           at org.jboss.arquillian.core.impl.ManagerImpl.fire(ManagerImpl.java:135)
>           at org.jboss.arquillian.core.impl.ManagerImpl.fire(ManagerImpl.java:115)
>           at org.jboss.arquillian.core.impl.EventImpl.fire(EventImpl.java:67)
>           at org.jboss.arquillian.warp.impl.client.execution.DefaultWarpExecutor.awaitServerExecution(DefaultWarpExecutor.java:95)
>           at org.jboss.arquillian.warp.impl.client.execution.DefaultWarpExecutor.execute(DefaultWarpExecutor.java:65)
>           at org.jboss.arquillian.warp.impl.client.execution.WarpExecutionObserver.executeWarp(WarpExecutionObserver.java:45)
>           at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>           at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
>           at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
>           at java.lang.reflect.Method.invoke(Method.java:597)
> {noformat}

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira


More information about the arquillian-issues mailing list