View Javadoc
1   /**
2    * Copyright 2005-2015 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 org.kuali.rice.krad.demo.uif.library.containers;
17  
18  import org.junit.Test;
19  import org.kuali.rice.testtools.selenium.WebDriverLegacyITBase;
20  
21  /**
22   * @author Kuali Rice Team (rice.collab@kuali.org)
23   */
24  public class LibraryContainerGroupAft extends WebDriverLegacyITBase {
25  
26      /**
27       * /kr-krad/kradsampleapp?viewId=Demo-GroupView&methodToCall=start
28       */
29      public static final String BOOKMARK_URL = "/kr-krad/kradsampleapp?viewId=Demo-GroupView&methodToCall=start";
30  
31      @Override
32      protected String getBookmarkUrl() {
33          return BOOKMARK_URL;
34      }
35  
36      @Override
37      protected void navigate() throws Exception {
38          waitAndClickLibraryLink();
39          waitAndClickByLinkText("Containers");
40          waitAndClickByLinkText("Group");
41      }
42  
43      protected void testLibraryContainerGroupBasic() throws Exception {
44          selectByName("exampleShown","Basic Grid");
45          assertElementPresentByXpath("//input[@name='inputField1']");
46          assertElementPresentByXpath("//section[@id='Demo-Group-Example1']/div/table");
47      }
48      
49      protected void testLibraryContainerGroupBasicVerticalBox() throws Exception {
50          selectByName("exampleShown","Basic Vertical Box");
51          assertElementPresentByXpath("//input[@name='inputField3']");
52          assertElementPresentByXpath("//section[@id='Demo-Group-Example2']/div");
53      }
54      
55      protected void testLibraryContainerGroupBasicCssGrid() throws Exception {
56          selectByName("exampleShown","Basic CSS Grid");
57          assertElementPresentByXpath("//input[@name='inputField5']");
58          assertElementPresentByXpath("//section[@id='Demo-Group-Example3']/div");
59      }
60      
61      protected void testLibraryContainerGroupSectionVertical() throws Exception {
62          selectByName("exampleShown","Section Vertical");
63          assertElementPresentByXpath("//section[@id='Demo-Group-Example4']/header/h3");
64          assertElementPresentByXpath("//section[@id='Demo-Group-Example4']/section/header/h3/span[contains(text(),'Section 1')]");
65          assertElementPresentByXpath("//section[@id='Demo-Group-Example4']/section/header/h3/span[contains(text(),'Section 2')]");
66      }
67      
68      protected void testLibraryContainerGroupSectionHorizontal() throws Exception {
69          selectByName("exampleShown","Section Horizontal");
70          assertElementPresentByXpath("//main[@id='Demo-Group-Example5']/header/h2");
71          assertElementPresentByXpath("//main[@id='Demo-Group-Example5']/div/div/label[contains(text(),'Field 1:')]");
72          assertElementPresentByXpath("//main[@id='Demo-Group-Example5']/div/div[2]/label[contains(text(),'Field 1:')]");
73      }
74      
75      protected void testLibraryContainerGroupSubSection() throws Exception {
76          selectByName("exampleShown","Section Horizontal");
77          assertElementPresentByXpath("//section[@id='Demo-Group-Example6']/header/h3");
78          assertElementPresentByXpath("//section[@id='Demo-Group-Example6']/section/header/h3/span[contains(text(),'Section 1')]");
79          assertElementPresentByXpath("//section[@id='Demo-Group-Example6']/section/section/header/h4/span[contains(text(),'SubSection 1')]");
80          assertElementPresentByXpath("//section[@id='Demo-Group-Example6']/section/section/header/h4/span[contains(text(),'SubSection 2')]");
81          assertElementPresentByXpath("//section[@id='Demo-Group-Example6']/section/header/h3/span[contains(text(),'Section 2')]");
82      }
83      
84      protected void testLibraryContainerGroupDisclosure() throws Exception {
85          selectByName("exampleShown","Disclosure");
86          waitAndClickByLinkText("Disclosure Section");
87          waitForElementPresentByXpath("//section[@id='Demo-Group-Example7']/section/div[@class='uif-disclosureContent' and @style='overflow: hidden; display: none;']");
88          waitAndClickByLinkText("Disclosure Section");
89          waitForElementPresentByXpath("//section[@id='Demo-Group-Example7']/section/div[@class='uif-disclosureContent' and @style='overflow: hidden; display: block;']");
90          waitAndClickByLinkText("Predefined Disclosure Section");
91          waitForElementPresentByXpath("//section[@id='Demo-Group-Example7']/section[2]/div[@class='uif-disclosureContent' and @style='overflow: hidden; display: none;']");
92          waitAndClickByLinkText("Predefined Disclosure Section");
93          waitForElementPresentByXpath("//section[@id='Demo-Group-Example7']/section[2]/div[@class='uif-disclosureContent' and @style='overflow: hidden; display: block;']");
94      }
95      
96      protected void testLibraryContainerGroupScrollpane() throws Exception {
97          selectByName("exampleShown","Scrollpane");
98          waitForElementPresentByXpath("//section[@id='Demo-Group-Example8']/div[@style='height: 100px;overflow: auto;']");
99      }
100 
101     private void testAllGroups() throws Exception {
102         testLibraryContainerGroupBasic();
103         testLibraryContainerGroupBasicVerticalBox();
104         testLibraryContainerGroupBasicCssGrid();
105         testLibraryContainerGroupSectionVertical();
106         testLibraryContainerGroupSectionHorizontal();
107         testLibraryContainerGroupSubSection();
108         testLibraryContainerGroupDisclosure();
109         testLibraryContainerGroupScrollpane();
110     }
111 
112     @Test
113     public void testContainerGroupBookmark() throws Exception {
114         testAllGroups();
115         passed();
116     }
117 
118     @Test
119     public void testContainerGroupNav() throws Exception {
120         testAllGroups();
121         passed();
122     }  
123 }