View Javadoc

1   /**
2    * Copyright 2005-2013 The Kuali Foundation
3    *
4    * Licensed under the Educational Community License, Version 2.0 (the "License");
5    * you may not use this file except in compliance with the License.
6    * You may obtain a copy of the License at
7    *
8    * http://www.opensource.org/licenses/ecl2.php
9    *
10   * Unless required by applicable law or agreed to in writing, software
11   * distributed under the License is distributed on an "AS IS" BASIS,
12   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13   * See the License for the specific language governing permissions and
14   * limitations under the License.
15   */
16  package edu.sampleu.krad.validationmessagesview;
17  
18  import com.thoughtworks.selenium.SeleneseTestBase;
19  import org.junit.Test;
20  import org.kuali.rice.testtools.selenium.WebDriverLegacyITBase;
21  
22  /**
23   * Tests the Component section in Rice.
24   *
25   * @author Kuali Rice Team (rice.collab@kuali.org)
26   */
27  public class ServerSideTestViewAft extends WebDriverLegacyITBase {
28  
29      /**
30       * "/kr-krad/uicomponents?viewId=UifCompView&methodToCall=start&readOnlyFields=field91";
31       */
32      public static final String BOOKMARK_URL = "/kr-krad/uicomponents?viewId=Demo-ValidationServerSide&methodToCall=start";
33  
34      @Override
35      protected String getBookmarkUrl() {
36          return BOOKMARK_URL;
37      }
38  
39      protected void navigate() throws InterruptedException {
40          waitAndClickKRAD();
41          waitAndClickByLinkText("ServerSide Constraint Validation Demo");
42          switchToWindow("Kuali :: Validation Server-side Test View");               
43      }
44  
45      //Code for KRAD Test Package.
46      protected void testServerSideTestView() throws Exception {
47        
48         //MinMax length and value  and Required Constraint
49         waitAndTypeByName("field9","a");
50         waitAndTypeByName("field10","1");
51         waitAndClickByXpath("//button[@id='usave']");
52         Thread.sleep(4000);
53         assertTextPresent("MinMax Length test: Must be between 2 and 5 characters long");
54         assertTextPresent("MinMax Value test: Value must be greater than 2 and no more than 50");
55         assertTextPresent("Required constraint: 4 errors");
56         
57         //PreRequisite constraint
58         waitForElementPresentByXpath("//input[@name='field7' and @disabled]");
59         waitAndClickByXpath("//input[@type='textbox' and @name='booleanField']");
60         if(isElementPresentByXpath("//input[@name='field7' and @disabled]"))
61         {
62             fail("PreRequisite Constraint isn't working !");
63         }
64         
65         //MustOccurs constraint
66         waitAndTypeByName("field14","a");
67         waitAndClickByXpath("//button[@id='usave']");
68         Thread.sleep(4000);
69  
70      }
71  
72      @Test
73      public void testServerSideTestViewBookmark() throws Exception {
74          testServerSideTestView();
75          passed();
76      }
77  
78      @Test
79      public void testServerSideTestViewNav() throws Exception {
80          testServerSideTestView();
81          passed();
82      }
83  }