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.samplu.krad.demo.uif.library;
17  
18  import com.thoughtworks.selenium.SeleneseTestBase;
19  import edu.samplu.common.Failable;
20  import org.junit.Test;
21  import org.kuali.rice.krad.uif.UifConstants;
22  import org.openqa.selenium.By;
23  import org.openqa.selenium.WebElement;
24  
25  import java.util.List;
26  
27  /**
28   * @author Kuali Rice Team (rice.collab@kuali.org)
29   */
30  public class DemoLibraryGroupSmokeTest extends DemoLibraryBase {
31  
32      public static final String BOOKMARK_URL = "/kr-krad/kradsampleapp?viewId=ComponentLibraryHome";
33  
34      @Override
35      public String getBookmarkUrl() {
36          return BOOKMARK_URL;
37      }
38  
39      @Override
40      protected void navigate() throws Exception {
41          waitAndClickById("Demo-LibraryLink", "");
42      }
43  
44      protected void navigationMenu() throws Exception {
45          waitAndClickByLinkText("Containers");
46          waitAndClickByLinkText("Group");
47      }
48  
49      public void testBasicGroupNav(Failable failable) throws Exception {
50          testBasicGroupBookmark(this);
51      }
52  
53      /**
54       * Asserts basic group elements are present: header, validation messages,
55       * instructional text, and the actual items
56       *
57       * @param failable
58       * @throws Exception
59       */
60      public void testBasicGroupBookmark(Failable failable) throws Exception {
61          navigationMenu();
62  
63          WebElement element = driver.findElement(By.id("Demo-Group-Example1"));
64          element.findElement(By.tagName("h3"));
65  
66          getElementByDataAttributeValue(UifConstants.DataAttributes.MESSAGES_FOR, "Demo-Group-Example1");
67  
68          element.findElement(By.className("uif-instructionalMessage"));
69  
70          List<WebElement> inputFields = element.findElements(By.className("uif-inputField"));
71          SeleneseTestBase.assertTrue("group does not contain correct number of items", inputFields.size() == 4);
72          passed();
73      }
74  
75      @Test
76      public void testBasicGroupBookmark() throws Exception {
77          testBasicGroupBookmark(this);
78      }
79  
80      @Test
81      public void testBasicGroupNav() throws Exception {
82          testBasicGroupNav(this);
83      }
84  }