View Javadoc

1   package edu.samplu.krad.demo.uif.library;
2   
3   import com.thoughtworks.selenium.SeleneseTestBase;
4   import edu.samplu.common.Failable;
5   import edu.samplu.common.ITUtil;
6   import edu.samplu.common.WebDriverLegacyITBase;
7   import org.kuali.rice.krad.uif.UifConstants;
8   import org.openqa.selenium.By;
9   import org.openqa.selenium.WebElement;
10  
11  import java.util.List;
12  
13  /**
14   * @author Kuali Rice Team (rice.collab@kuali.org)
15   */
16  public abstract class DemoGroupSmokeTestBase extends WebDriverLegacyITBase {
17  
18      public static final String BOOKMARK_URL = "/kr-krad/kradsampleapp?viewId=ComponentLibraryHome";
19  
20      @Override
21      public String getTestUrl() {
22          return ITUtil.KRAD_PORTAL;
23      }
24  
25      protected void navigation() throws Exception {
26          waitAndClickById("Demo-LibraryLink", "");
27      }
28  
29      protected void navigationMenu() throws Exception {
30          waitAndClickByLinkText("Containers");
31          waitAndClickByLinkText("Group");
32      }
33  
34      public void testBasicGroupNav(Failable failable) throws Exception {
35          navigation();
36  
37          testBasicGroupBookmark(this);
38      }
39  
40      /**
41       * Asserts basic group elements are present: header, validation messages,
42       * instructional text, and the actual items
43       *
44       * @param failable
45       * @throws Exception
46       */
47      public void testBasicGroupBookmark(Failable failable) throws Exception {
48          navigationMenu();
49  
50          WebElement element = driver.findElement(By.id("Demo-Group-Example1"));
51          element.findElement(By.tagName("h3"));
52  
53          getElementByDataAttributeValue(UifConstants.DataAttributes.MESSAGES_FOR, "Demo-Group-Example1");
54  
55          element.findElement(By.className("uif-instructionalMessage"));
56  
57          List<WebElement> inputFields = element.findElements(By.className("uif-inputField"));
58          SeleneseTestBase.assertTrue("group does not contain correct number of items", inputFields.size() == 4);
59      }
60  }