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