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