Package org.jboss.jsfunit.jsfsession

Examples of org.jboss.jsfunit.jsfsession.JSFServerSession


{
   public void testWithoutKeepalive() throws IOException
   {
      JSFSession jsfSession = JSFSessionFactory.makeSession("/richfaces/keepAlive.jsf");
      JSFClientSession client = jsfSession.getJSFClientSession();
      JSFServerSession server = jsfSession.getJSFServerSession();

      client.type("form1:firstAddend", '2');
      assertEquals(2, server.getManagedBeanValue("#{rsBean.addent1}"));
     
      client.type("form1:secondAddend", '3');
      assertEquals(3, server.getManagedBeanValue("#{rsBean.addent2}"));
     
      client.click("form1:btn");
      assertNotNull(server.getManagedBeanValue("#{rsBean}"));
      assertNull(server.getManagedBeanValue("#{rsBean.sum}"));
   }
View Full Code Here


  
   public void testWithKeepalive() throws IOException
   {
      JSFSession jsfSession = JSFSessionFactory.makeSession("/richfaces/keepAlive.jsf");
      JSFClientSession client = jsfSession.getJSFClientSession();
      JSFServerSession server = jsfSession.getJSFServerSession();

      client.type("form2:firstAddend", '2');
      assertEquals(2, server.getManagedBeanValue("#{rsBean2.addent1}"));
     
      client.type("form2:secondAddend", '3');
      assertEquals(3, server.getManagedBeanValue("#{rsBean2.addent2}"));
     
      client.click("form2:btn2");
      assertNotNull(server.getManagedBeanValue("#{rsBean2}"));
      assertEquals(5, server.getManagedBeanValue("#{rsBean2.sum}"));
   }
View Full Code Here

   public void testAjaxSupportWithOnkeyup() throws IOException
   {
      JSFSession jsfSession = JSFSessionFactory.makeSession("/richfaces/support.jsf");
      JSFClientSession client = jsfSession.getJSFClientSession();
      JSFServerSession server = jsfSession.getJSFServerSession();

      client.type("name", 'H');   
      client.type("name", 'e');
      client.type("name", 'l');
      client.type("name", 'l');
      client.type("name", 'o');
      client.type("name", ' ');
      client.type("name", 'W');
      client.type("name", 'o');
      client.type("name", 'r');
      client.type("name", 'l');
      client.type("name", 'd');
 
      Object userBeanValue = server.getManagedBeanValue("#{userBean.name}");
      assertEquals("Hello World", userBeanValue);
      String valueOfSpan = ((DomNode)client.getElement("outtext")).asText();
      assertEquals("Hello World", valueOfSpan)
   }
View Full Code Here

  
   public void testAjaxSupportWithOnchange() throws IOException
   {
      JSFSession jsfSession = JSFSessionFactory.makeSession("/richfaces/support.jsf");
      JSFClientSession client = jsfSession.getJSFClientSession();
      JSFServerSession server = jsfSession.getJSFServerSession();

      client.setValue("name", "Hello World");
      Object userBeanValue = server.getManagedBeanValue("#{userBean.name}");
      assertEquals("Hello World", userBeanValue);
     
      String valueOfSpan = ((DomNode)client.getElement("outtext")).asText();
      assertEquals("Hello World", valueOfSpan);
   }
View Full Code Here

   }

   public void testCommandButton() throws IOException, SAXException
   {
      JSFSession jsfSession = JSFSessionFactory.makeSession("/richfaces/commandButton.jsf");
      JSFServerSession server = jsfSession.getJSFServerSession();
      JSFClientSession client = jsfSession.getJSFClientSession();
     
      client.setValue("inputName", "World");    
      client.click("SayHelloButton");
      Object userBeanValue = server.getManagedBeanValue("#{userBean.name}");
      assertEquals("World", userBeanValue);
      //System.out.println(client.getPageAsText());
      assertTrue(client.getPageAsText().contains("Hello World"));
   }
View Full Code Here

{
   public void testDropDownMenuWithIE6() throws IOException, SAXException
   {
      JSFSession jsfSession = JSFSessionFactory.makeSession("/richfaces/dropDownMenu.jsf", BrowserVersion.INTERNET_EXPLORER_6_0);
      JSFClientSession client = jsfSession.getJSFClientSession();
      JSFServerSession server = jsfSession.getJSFServerSession();
     
      client.click("New");
      String selection = (String)server.getManagedBeanValue("#{ddmenu.current}");
      assertEquals("New", selection);
     
      client.click("Open");
      selection = (String)server.getManagedBeanValue("#{ddmenu.current}");
      assertEquals("Open", selection);
     
      client.click("TextFile");
      selection = (String)server.getManagedBeanValue("#{ddmenu.current}");
      assertEquals("Save as Text File", selection);
     
      client.click("Close");
      selection = (String)server.getManagedBeanValue("#{ddmenu.current}");
      assertEquals("Close", selection);
     
      client.click("Exit");
      selection = (String)server.getManagedBeanValue("#{ddmenu.current}");
      assertEquals("Exit", selection);
   }
View Full Code Here

  
   public void testDropDownMenu() throws IOException, SAXException
   {
      JSFSession jsfSession = JSFSessionFactory.makeSession("/richfaces/dropDownMenu.jsf");
      JSFClientSession client = jsfSession.getJSFClientSession();
      JSFServerSession server = jsfSession.getJSFServerSession();
     
      client.click("New");
      String selection = (String)server.getManagedBeanValue("#{ddmenu.current}");
      assertEquals("New", selection);
     
      client.click("Open");
      selection = (String)server.getManagedBeanValue("#{ddmenu.current}");
      assertEquals("Open", selection);
     
      client.click("TextFile");
      selection = (String)server.getManagedBeanValue("#{ddmenu.current}");
      assertEquals("Save as Text File", selection);
     
      client.click("Close");
      selection = (String)server.getManagedBeanValue("#{ddmenu.current}");
      assertEquals("Close", selection);
     
      client.click("Exit");
      selection = (String)server.getManagedBeanValue("#{ddmenu.current}");
      assertEquals("Exit", selection);
   }
View Full Code Here

   public void testServerModeDropDownMenuWithIE6() throws IOException, SAXException
   {
      JSFSession jsfSession = JSFSessionFactory.makeSession("/richfaces/dropDownMenu.jsf", BrowserVersion.INTERNET_EXPLORER_6_0);
      JSFClientSession client = jsfSession.getJSFClientSession();
      JSFServerSession server = jsfSession.getJSFServerSession();
     
      client.click("NewServerMode");
      String selection = (String)server.getManagedBeanValue("#{ddmenu.current}");
      assertEquals("New", selection);
     
      client.click("OpenServerMode");
      selection = (String)server.getManagedBeanValue("#{ddmenu.current}");
      assertEquals("Open", selection);
     
      client.click("TextFileServerMode");
      selection = (String)server.getManagedBeanValue("#{ddmenu.current}");
      assertEquals("Save as Text File", selection);
     
      client.click("CloseServerMode");
      selection = (String)server.getManagedBeanValue("#{ddmenu.current}");
      assertEquals("Close", selection);
     
      client.click("ExitServerMode");
      selection = (String)server.getManagedBeanValue("#{ddmenu.current}");
      assertEquals("Exit", selection);
   }
View Full Code Here

  
   public void testServerModeDropDownMenu() throws IOException, SAXException
   {
      JSFSession jsfSession = JSFSessionFactory.makeSession("/richfaces/dropDownMenu.jsf");
      JSFClientSession client = jsfSession.getJSFClientSession();
      JSFServerSession server = jsfSession.getJSFServerSession();
     
      client.click("NewServerMode");
      String selection = (String)server.getManagedBeanValue("#{ddmenu.current}");
      assertEquals("New", selection);
     
      client.click("OpenServerMode");
      selection = (String)server.getManagedBeanValue("#{ddmenu.current}");
      assertEquals("Open", selection);
     
      client.click("TextFileServerMode");
      selection = (String)server.getManagedBeanValue("#{ddmenu.current}");
      assertEquals("Save as Text File", selection);
     
      client.click("CloseServerMode");
      selection = (String)server.getManagedBeanValue("#{ddmenu.current}");
      assertEquals("Close", selection);
     
      client.click("ExitServerMode");
      selection = (String)server.getManagedBeanValue("#{ddmenu.current}");
      assertEquals("Exit", selection);
   }
View Full Code Here

   public void testNoAjaxRegion() throws IOException
   {
      JSFSession jsfSession = JSFSessionFactory.makeSession("/richfaces/region.jsf");
      JSFClientSession client = jsfSession.getJSFClientSession();
      JSFServerSession server = jsfSession.getJSFServerSession();
     
      client.type("form1:inname", 'f');    
     
      Object userBeanValue = server.getManagedBeanValue("#{userBean.name}");
      assertTrue((userBeanValue == null) || (userBeanValue.equals("")));
      FacesMessage message = (FacesMessage)server.getFacesContext().getMessages().next();
      assertTrue(message.getDetail().contains("Value is required"));
   }
View Full Code Here

TOP

Related Classes of org.jboss.jsfunit.jsfsession.JSFServerSession

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.