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.travel.account;
17  
18  import org.kuali.rice.testtools.selenium.SmokeTestBase;
19  import org.junit.Test;
20  import org.openqa.selenium.By;
21  
22  /**
23   * @author Kuali Rice Team (rice.collab@kuali.org)
24   */
25  public class DemoTravelAccountInquirySmokeTest extends SmokeTestBase {
26  
27      /**
28       * //a[@title='Travel Account ']
29       */
30      public static final String ANCHOR_TITLE_TRAVEL_ACCOUNT = "//a[@id='subAccounts_toggle']";
31  
32      /**
33       * /kr-krad/inquiry?methodToCall=start&number=a14&dataObjectClassName=org.kuali.rice.krad.demo.travel.dataobject.TravelAccount
34       */
35      public static final String BOOKMARK_URL = "/kr-krad/inquiry?methodToCall=start&number=a14&dataObjectClassName=org.kuali.rice.krad.demo.travel.dataobject.TravelAccount";
36  
37      /**
38       * Collapse All
39       */
40      public static final String COLLAPSE_ALL = "Collapse All";
41  
42      /**
43       * Expand All
44       */
45      public static final String EXPAND_ALL = "Expand All";
46  
47      @Override
48      public String getBookmarkUrl() {
49          return BOOKMARK_URL;
50      }
51  
52      @Override
53      protected void navigate() throws Exception {
54          waitAndClickById("Demo-DemoLink", "");
55          waitAndClickByLinkText("Travel Account Inquiry");
56      }
57  
58      protected void testInquiryBackButton() throws Exception {
59          waitAndClickButtonByText("Back");
60          Thread.sleep(2000); // seems to take a while to load
61          waitForElementPresentByXpath("//a[contains(text(), 'Account Inquiry')]", "Expected Demo - Travel Application did back work?");
62          assertTextPresent("Demo - Travel Application", "Expected Demo - Travel Application did back work?");
63      }
64  
65      protected void testInquiryBackToLoginButton() throws Exception {
66          waitAndClickButtonByText("Back");
67          Thread.sleep(2000); // seems to take a while to load
68          waitForElementPresentById("Rice-LoginButton", "Expected Login - Travel Application Bookmark back work?");
69      }
70  
71      protected void testCollapseExpand() throws InterruptedException {
72          checkForIncidentReport();
73          waitForElementPresentByClassName("demo-contactInfo");
74          assertTextPresent("Travel Account Number:");
75          assertTextPresent(EXPAND_ALL);
76          assertTextPresent(COLLAPSE_ALL);
77  //        assertIsVisibleByXpath(ANCHOR_TITLE_TRAVEL_ACCOUNT, ""); // sub accounts removed
78  
79          waitAndClickButtonByText(COLLAPSE_ALL);
80          Thread.sleep(2000);
81          assertIsNotVisible(By.linkText("a"), " after clicking " + COLLAPSE_ALL);
82  
83          waitAndClickButtonByText(EXPAND_ALL);
84          Thread.sleep(2000);
85          assertIsVisible(By.linkText("a"), " after clicking " + EXPAND_ALL);
86      }
87  
88      protected void testInquiryLightBox() throws Exception {
89          waitAndClickByLinkText("a14");
90          assertIsVisibleByXpath(ANCHOR_TITLE_TRAVEL_ACCOUNT, "");
91      }
92  
93      @Test
94      public void testInquiryCollapseExpandBookmark() throws Exception {
95          testCollapseExpand();
96          passed();
97      }
98  
99      @Test
100     public void testInquiryLightBoxBookmark() throws Exception {
101         testInquiryLightBox();
102         passed();
103     }
104 
105     @Test
106     public void testInquiryBackButtonBookmark() throws Exception {
107         testInquiryBackToLoginButton();
108         passed();
109     }
110 
111     @Test
112     public void testInquiryCollapseExpandNav() throws Exception {
113         testCollapseExpand();
114         passed();
115     }
116 
117     @Test
118     public void testInquiryLightBoxNav() throws Exception {
119         testInquiryLightBox();
120         passed();
121     }
122 
123     @Test
124     public void testInquiryBackButtonNav() throws Exception {
125         testInquiryBackButton();
126         passed();
127     }
128 }