View Javadoc
1   /**
2    * Copyright 2005-2014 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.elements;
17  
18  import org.junit.Test;
19  
20  import org.kuali.rice.testtools.selenium.WebDriverLegacyITBase;
21  
22  /**
23   * @author Kuali Rice Team (rice.collab@kuali.org)
24   */
25  public class LibraryElementsHeaderAft extends WebDriverLegacyITBase {
26  
27      /**
28       * /kr-krad/kradsampleapp?viewId=Demo-Header-View&methodToCall=start
29       */
30      public static final String BOOKMARK_URL = "/kr-krad/kradsampleapp?viewId=Demo-HeaderView";
31  
32      @Override
33      protected String getBookmarkUrl() {
34          return BOOKMARK_URL;
35      }
36  
37      @Override
38      protected void navigate() throws Exception {
39          waitAndClickLibraryLink();
40          waitAndClickByLinkText("Elements");
41          waitAndClickByLinkText("Header");
42      }
43  
44      protected void testLibraryElementsHeaderBaseHeader() throws Exception {
45          waitAndClickByLinkText("Base Header");
46          assertElementPresentByXpath("//header[@data-header_for='Demo-Header-Example1']/h3/span");
47      }
48      
49      protected void testLibraryElementsHeader1() throws Exception {
50          waitAndClickByLinkText("Header 1");
51          assertElementPresentByXpath("//h1/span");
52      }
53      
54      protected void testLibraryElementsHeader2() throws Exception {
55          waitAndClickByLinkText("Header 2");
56          assertElementPresentByXpath("//section[@id='Demo-Header-Example3']/header[2]/h2/span");
57      }
58      
59      protected void testLibraryElementsHeader3() throws Exception {
60          waitAndClickByLinkText("Header 3");
61          assertElementPresentByXpath("//section[@id='Demo-Header-Example4']/header[2]/h3/span");
62      }
63      
64      protected void testLibraryElementsHeader4() throws Exception {
65          waitAndClickByLinkText("Header 4");
66          assertElementPresentByXpath("//section[@id='Demo-Header-Example5']/header[2]/h4/span");
67      }
68      
69      protected void testLibraryElementsHeader5() throws Exception {
70          waitAndClickByLinkText("Header 5");
71          assertElementPresentByXpath("//section[@id='Demo-Header-Example6']/header[2]/h5/span");
72      }
73      
74      protected void testLibraryElementsHeader6() throws Exception {
75          waitAndClickByLinkText("Header 6");
76          assertElementPresentByXpath("//section[@id='Demo-Header-Example7']/header[2]/h6/span");
77      }
78      
79      protected void testLibraryElementsHeaderEditableHeader() throws Exception {
80          waitAndClickByLinkText("EditablePage Header");
81          assertElementPresentByXpath("//section[@id='Demo-Header-Example12']/header[2]/h2/span");
82          assertElementPresentByXpath("//section[@id='Demo-Header-Example12']/header[2]/div/div/button");
83          assertElementPresentByXpath("//section[@id='Demo-Header-Example12']/header[2]/div/div/button[2]");
84          assertElementPresentByXpath("//section[@id='Demo-Header-Example12']/p");
85      }
86      
87      protected void testLibraryElementsHeaderDisclosureHeader() throws Exception {
88          waitAndClickByLinkText("Disclosure Header");
89          assertElementPresentByXpath("//section[@id='Demo-Header-Example13']/header[2]/h2/span");
90      }
91  
92      protected void testLibraryElementsHeaderImageCaptionHeader() throws Exception {
93          waitAndClickByLinkText("ImageCaption Header");
94          assertElementPresentByXpath("//section[@id='Demo-Header-Example14']/header[2]/h4/span");
95      }
96     
97      protected void testLibraryElementsHeaderGroupsHeader() throws Exception {
98          waitAndClickByLinkText("Header Groups");
99          assertElementPresentByXpath("//section[@id='Demo-Header-Example15']/section/header/div/p");
100         assertElementPresentByXpath("//section[@id='Demo-Header-Example15']/section/header/div[2]/h3");
101         assertElementPresentByXpath("//section[@id='Demo-Header-Example15']/section/header/div[3]/p");
102     }
103 
104     private void testAllHeaders() throws Exception {
105         testLibraryElementsHeaderBaseHeader();
106         testLibraryElementsHeader1();
107         testLibraryElementsHeader2();
108         testLibraryElementsHeader3();
109         testLibraryElementsHeader4();
110         testLibraryElementsHeader5();
111         testLibraryElementsHeader6();
112         testLibraryElementsHeaderEditableHeader();
113         testLibraryElementsHeaderDisclosureHeader();
114         testLibraryElementsHeaderImageCaptionHeader();
115         testLibraryElementsHeaderGroupsHeader();
116     }
117 
118     @Test
119     public void testElementsHeaderNav() throws Exception {
120         testAllHeaders();
121         passed();
122     }  
123     
124     @Test
125     public void testElementsHeaderBookmark() throws Exception {
126         testAllHeaders();
127         passed();
128     }  
129 }