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.navigation;
17  
18  import com.thoughtworks.selenium.SeleneseTestBase;
19  import edu.samplu.common.Failable;
20  import edu.samplu.common.ITUtil;
21  import edu.samplu.common.WebDriverLegacyITBase;
22  
23  /**
24   * @author Kuali Rice Team (rice.collab@kuali.org)
25   */
26  public class DemoLibraryNavigationSmokeTestBase extends WebDriverLegacyITBase{
27  
28      /**
29       * /kr-krad/kradsampleapp?viewId=ComponentLibraryHome
30       */
31      public static final String BOOKMARK_URL = "/kr-krad/kradsampleapp?viewId=ComponentLibraryHome";
32  
33      /**
34       * /kr-krad/kradsampleapp?viewId=NavigationGroup-NavigationView&methodToCall=start
35       */
36      public static final String BOOKMARK_VIEW_URL = "/kr-krad/kradsampleapp?viewId=NavigationGroup-NavigationView&methodToCall=start";
37  
38      @Override
39      public String getTestUrl() {
40          return ITUtil.KRAD_PORTAL;
41      }
42  
43      protected void navigation() throws Exception {
44          waitAndClickById("Demo-LibraryLink", "");
45      }
46  
47      protected void navigationMenu() throws Exception {
48          waitAndClickByLinkText("Navigation");
49          waitAndClickByLinkText("Left Menu");
50          waitAndClickByLinkText("Navigation Group Tab Example");
51          selectWindow(driver.getWindowHandles().toArray()[1].toString());
52      }
53  
54      protected void testNavigationMenu() throws Exception {
55          waitForElementPresentByClassName("uif-headerText-span");
56          SeleneseTestBase.assertTrue(driver.getTitle().contains("Kuali :: Navigation View"));
57          assertTextPresent("Navigation View");
58      }
59  
60      protected void testNavigationView() throws Exception {
61          assertNavigationView("Page 2", "Test Course 2");
62          assertNavigationView("Page 3", "Test Course 3");
63          assertNavigationView("Page 1", "Test Course 1");
64      }
65  
66      protected void assertNavigationView(String linkText, String supportTitleText) throws Exception {
67          waitAndClickByLinkText(linkText);
68          waitForElementPresentByClassName("uif-viewHeader-supportTitle");
69          SeleneseTestBase.assertTrue(getTextByClassName("uif-viewHeader-supportTitle").contains(supportTitleText));
70      }
71  
72      public void testNavigationMenuBookmark(Failable failable) throws Exception {
73          navigationMenu();
74          testNavigationMenu();
75          testNavigationView();
76          passed();
77      }
78  
79      public void testNavigationMenuNav(Failable failable) throws Exception {
80          navigation();
81          navigationMenu();
82          testNavigationMenu();
83          testNavigationView();
84          passed();
85      }
86  
87      public void testNavigationViewBookmark(Failable failable) throws Exception {
88          testNavigationView();
89          passed();
90      }
91  }