Package org.jboss.jsfunit.jsfsession

Examples of org.jboss.jsfunit.jsfsession.JSFClientSession


   }
  
   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

   }
  
   public void testWithAjaxRegion() throws IOException
   {
      JSFSession jsfSession = JSFSessionFactory.makeSession("/richfaces/region.jsf");
      JSFClientSession client = jsfSession.getJSFClientSession();
      JSFServerSession server = jsfSession.getJSFServerSession();
     
      client.type("form2:inname", 'f');    
     
      Object userBeanValue = server.getManagedBeanValue("#{userBean.name}");
      assertEquals("f", userBeanValue);
      Iterator messages = server.getFacesContext().getMessages();
      assertFalse(messages.hasNext());
View Full Code Here

{
   public void testNumberSpinners() throws IOException
   {
      JSFSession jsfSession = JSFSessionFactory.makeSession("/richfaces/inputNumberSpinner.jsf");
      JSFServerSession server = jsfSession.getJSFServerSession();
      JSFClientSession client = jsfSession.getJSFClientSession();
      RichFacesClient ajaxClient = new RichFacesClient(client);
     
      ajaxClient.setInputNumberSpinner("spinner1", "44");
      ajaxClient.clickInputNumberSpinnerUp("spinner1");
      client.click("submit");
     
      String value = (String)server.getComponentValue("spinner1");
      assertEquals("45", value);
     
      ajaxClient.clickInputNumberSpinnerDown("spinner2");
      client.click("submit");
     
      value = (String)server.getComponentValue("spinner2");
      assertEquals("40", value);
   }
View Full Code Here

   }

   public void testCommandLink() throws IOException
   {
      JSFSession jsfSession = JSFSessionFactory.makeSession("/richfaces/commandLink.jsf");
      JSFClientSession client = jsfSession.getJSFClientSession();
      JSFServerSession server = jsfSession.getJSFServerSession();
     
      client.setValue("inputName", "World");    
      client.click("SayHelloLink");
      Object userBeanValue = server.getManagedBeanValue("#{userBean.name}");
      assertEquals("World", userBeanValue);
   }
View Full Code Here

public class AjaxRepeaterTest extends ServletTestCase
{
   public void testRepeater() throws IOException
   {
      JSFSession jsfSession = JSFSessionFactory.makeSession("/richfaces/repeat.jsf");
      JSFClientSession client = jsfSession.getJSFClientSession();
      JSFServerSession server = jsfSession.getJSFServerSession();
     
      client.setValue("0:proposedPrice", "10");

      Double margin = (Double)server.getManagedBeanValue("#{salesReport.items[0].proposedGrossMargin}");
      assertEquals(-1.0d, margin.doubleValue());
      Double price = (Double)server.getManagedBeanValue("#{salesReport.items[0].proposedPrice}");
      assertEquals(10.0d, price.doubleValue());
View Full Code Here

public class RichCalendarTest extends ServletTestCase
{
   public void testCalendar() throws IOException, SAXException
   {
      JSFSession jsfSession = JSFSessionFactory.makeSession("/richfaces/calendar.jsf");
      JSFClientSession client = jsfSession.getJSFClientSession();
      RichFacesClient ajaxClient = new RichFacesClient(client);
      JSFServerSession server = jsfSession.getJSFServerSession();
     
      client.click("pattern4"); // "MMM d, yyyy"
      ajaxClient.setCalendarValue("myCalendar", "Oct 31, 2007");
     
      client.click("german");
      client.click("pattern4"); // "MMM d, yyyy"
     
      Date date = (Date)server.getManagedBeanValue("#{calendarBean.selectedDate}");
      String pattern = (String)server.getManagedBeanValue("#{calendarBean.pattern}");
      Locale locale = (Locale)server.getManagedBeanValue("#{calendarBean.locale}");
      assertEquals("DE", locale.getCountry());
View Full Code Here

   }

   public void testNotUsingOutputTextTag() throws IOException
   {
      JSFSession jsfSession = JSFSessionFactory.makeSession("/richfaces/region.jsf");
      JSFClientSession client = jsfSession.getJSFClientSession();
      JSFServerSession server = jsfSession.getJSFServerSession();
     
      client.type("form3:name", 'f');
      client.type("form3:name", 'o');
      client.type("form3:name", 'o');
      client.type("form3:name", 'b');
      client.type("form3:name", 'a');
      client.type("form3:name", 'r');

      Object userBeanValue = server.getManagedBeanValue("#{userBean.name}");
      assertTrue(userBeanValue.equals("foobar"));
      String text = "This text will disappear during the partial update";
      HtmlElement span = (HtmlElement)client.getElement("out3");
      assertFalse(span.getTextContent().contains(text));
   }
View Full Code Here

   }
  
   public void testUsingOutputTextTag() throws IOException
   {
      JSFSession jsfSession = JSFSessionFactory.makeSession("/richfaces/region.jsf");
      JSFClientSession client = jsfSession.getJSFClientSession();
      JSFServerSession server = jsfSession.getJSFServerSession();
     
      client.type("form4:name", 'f');
      client.type("form4:name", 'o');
      client.type("form4:name", 'o');
      client.type("form4:name", 'b');
      client.type("form4:name", 'a');
      client.type("form4:name", 'r');
      Object userBeanValue = server.getManagedBeanValue("#{userBean.name}");
      assertTrue(userBeanValue.equals("foobar"));
      String text = "not disappear because it is printed with h:outputText";
      HtmlElement span = (HtmlElement)client.getElement("out4");
      assertTrue(span.getTextContent().contains(text));
   }
View Full Code Here

   private String[] Names = {"Alex", "Jonh", "Roger"};

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

      Map<String, String> param = new HashMap<String, String>();
      for (String name : Names)
      {
         HtmlElement element = (HtmlElement)client.getElement(name);
         element.mouseOver();
         assertEquals(name, server.getManagedBeanValue("#{userBean.name}"));
      }
   }
View Full Code Here

TOP

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

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.