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

Lukáš Fryč (JIRA) jira-events at lists.jboss.org
Wed Jul 17 04:03:26 EDT 2013


    [ https://issues.jboss.org/browse/ARQ-1366?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12790194#comment-12790194 ] 

Lukáš Fryč commented on ARQ-1366:
---------------------------------

Let's make this target for upcoming releases as it seems it comes out of scope of {{1.0.0.Final}}.

I would like to see it implemented. So I would appreciate any help with making this happen.

----

I think it comes to setting up little example followed by tests which will serve as reference usage.
                
> 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
>            Assignee: Oliver Bock
>              Labels: authentication, exception, warp
>             Fix For: warp_1.next
>
>
> 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