0 Replies Latest reply on Apr 17, 2013 12:42 PM by betty19

    Navigation problem in JSFUNIT

    betty19

      Here's my funtion , im trying a simple redirection , it doesn't work ..

      public void testInitialPage() throws IOException

         {

            // Send an HTTP request for the initial page

            JSFSession jsfSession = new JSFSession("/login.jsf");

           

            // A JSFClientSession emulates the browser and lets you test HTML

            JSFClientSession client = jsfSession.getJSFClientSession();

           

            // A JSFServerSession gives you access to JSF state     

            JSFServerSession server = jsfSession.getJSFServerSession();

       

       

            // Test navigation to initial viewID

            assertEquals("/login.xhtml", server.getCurrentViewID());

       

       

            // Assert that the current value of username is guest

            //assertEquals(null, server.getManagedBeanValue("#{bean.username}")); 

           

            // set values and hit login

            System.out.println("4");

            client.setValue("form1:login","achraf");

            System.out.println("5");

            client.setValue("form1:password","wafaa");

            System.out.println("6");

            client.click("connex");

            // Test navigation

            System.out.println("7");

           assertEquals("/index.xhtml", server.getCurrentViewID());

           //assertEquals("/head4.xhtml", server.getCurrentViewID());

           System.out.println("8");

           //client.click(":formB:annonce".trim());

           System.out.println("9");

          // assertEquals("/annonces.xhtml", server.getCurrentViewID());

           System.out.println("FIN");

        

          client.click("formB:annonce"); // doesnt recognize those index's components

          assertEquals("/annonces.xhtml", server.getCurrentViewID());

      }