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.library.elements;
17  
18  import org.junit.Test;
19  
20  import org.kuali.rice.testtools.selenium.Failable;
21  import org.kuali.rice.testtools.selenium.ITUtil;
22  import org.kuali.rice.testtools.selenium.SmokeTestBase;
23  import org.kuali.rice.testtools.selenium.WebDriverLegacyITBase;
24  
25  /**
26   * @author Kuali Rice Team (rice.collab@kuali.org)
27   */
28  public class DemoLibraryElementsDropdownMenuSmokeTest extends SmokeTestBase {
29  
30      /**
31       * /kr-krad/kradsampleapp?viewId=Demo-DropdownMenu-View
32       */
33      public static final String BOOKMARK_URL = "/kr-krad/kradsampleapp?viewId=Demo-DropdownMenu-View";
34   
35      @Override
36      protected String getBookmarkUrl() {
37          return BOOKMARK_URL;
38      }
39  
40      @Override
41      protected void navigate() throws Exception {
42          waitAndClickById("Demo-LibraryLink", "");
43          waitAndClickByLinkText("Elements");
44          waitAndClickByLinkText("Dropdown Menu");
45      }
46  
47      protected void testLibraryElementsDropdownBasic() throws Exception {
48          waitAndClickByLinkText("User thclark");
49          assertElementPresentByXpath("//div[@id='Demo-DropdownMenu-Example1']/div[3]/div/ul/li/a[contains(text(),'Preferences')]");
50      }
51      
52      protected void testLibraryElementsDropdownWithDivider() throws Exception {
53          waitAndClickByLinkText("Dropdown with Divider");
54          waitAndClickByLinkText("Action List");
55          assertElementPresentByXpath("//div[@id='Demo-DropdownMenu-Example2']/div[3]/div/ul/li/a[contains(text(),'Proposal #1034')]");
56          assertElementPresentByXpath("//div[@id='Demo-DropdownMenu-Example2']/div[3]/div/ul/li[@class='uif-actionLink divider ui-corner-right']");
57      }
58      
59      protected void testLibraryElementsDropdownWithHeader() throws Exception {
60          waitAndClickByLinkText("Dropdown with Headers");
61          waitAndClickByLinkText("Favorites");
62          assertElementPresentByXpath("//div[@id='Demo-DropdownMenu-Example3']/div[3]/div/ul/li/a[contains(text(),'Proposal')]");
63          assertElementPresentByXpath("//div[@id='Demo-DropdownMenu-Example3']/div[3]/div/ul/li[@class='uif-actionLink dropdown-header ui-corner-right']");
64      }
65      
66      protected void testLibraryElementsDropdownWithDisabled() throws Exception {
67          waitAndClickByLinkText("Dropdown with Disabled");
68          waitAndClickByXpath("//div[@id='Demo-DropdownMenu-Example4']/div[3]/div/a");
69          assertElementPresentByXpath("//div[@id='Demo-DropdownMenu-Example4']/div[3]/div/ul/li/a[@class='uif-actionLink']");
70          assertElementPresentByXpath("//div[@id='Demo-DropdownMenu-Example4']/div[3]/div/ul/li/a[@class='uif-actionLink disabled']");
71      }
72      
73      protected void testLibraryElementsDropdownWithActionOptions() throws Exception {
74          waitAndClickByLinkText("Dropdown with Action Options");
75          waitAndClickByXpath("//div[@id='Demo-DropdownMenu-Example5']/div[3]/div/a");
76          assertElementPresentByXpath("//div[@id='Demo-DropdownMenu-Example5']/div[3]/div/ul/li/a[contains(text(),'Refresh Section')]");
77      }
78      
79      protected void testLibraryElementsDropdownWithToggleButton() throws Exception {
80          waitAndClickByLinkText("Dropdown with Toggle Button");
81          waitAndClickByXpath("//div[@id='Demo-DropdownMenu-Example6']/div[3]/div/a/b[@class='caret']");
82          assertElementPresentByXpath("//div[@id='Demo-DropdownMenu-Example6']/div[3]/div/ul/li/a[contains(text(),'Preferences')]");
83      }
84      @Test
85      public void testLibraryElementsDropdownBookmark() throws Exception {
86          testLibraryElementsDropdownBasic();
87          testLibraryElementsDropdownWithDivider();
88          testLibraryElementsDropdownWithHeader();
89          testLibraryElementsDropdownWithDisabled();
90          testLibraryElementsDropdownWithActionOptions();
91          testLibraryElementsDropdownWithToggleButton();
92          passed();
93      }
94  
95      @Test
96      public void testLibraryElementsDropdownNav() throws Exception {
97          testLibraryElementsDropdownBasic();
98          testLibraryElementsDropdownWithDivider();
99          testLibraryElementsDropdownWithHeader();
100         testLibraryElementsDropdownWithDisabled();
101         testLibraryElementsDropdownWithActionOptions();
102         testLibraryElementsDropdownWithToggleButton();
103         passed();
104     }  
105 }