View Javadoc
1   /**
2    * Copyright 2005-2016 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 org.kuali.rice.krad.demo.travel.account;
17  
18  import org.junit.Ignore;
19  import org.kuali.rice.testtools.selenium.WebDriverLegacyITBase;
20  import org.junit.Test;
21  import org.openqa.selenium.By;
22  
23  /**
24   * @author Kuali Rice Team (rice.collab@kuali.org)
25   */
26  public class DemoTravelAccountInquiryAft extends WebDriverLegacyITBase {
27  
28      /**
29       * //a[@title='Travel Account ']
30       */
31      public static final String ANCHOR_TITLE_TRAVEL_ACCOUNT = "//a[@id='subAccounts_toggle']";
32  
33      /**
34       * /kr-krad/inquiry?methodToCall=start&number=a14&dataObjectClassName=org.kuali.rice.krad.demo.travel.dataobject.TravelAccount
35       */
36      public static final String BOOKMARK_URL = "/kr-krad/inquiry?methodToCall=start&number=a14&dataObjectClassName=org.kuali.rice.krad.demo.travel.dataobject.TravelAccount";
37  
38      /**
39       * Collapse All
40       */
41      public static final String COLLAPSE_ALL = "Collapse All";
42  
43      /**
44       * Expand All
45       */
46      public static final String EXPAND_ALL = "Expand All";
47  
48      @Override
49      public String getBookmarkUrl() {
50          return BOOKMARK_URL;
51      }
52  
53      @Override
54      protected void navigate() throws Exception {
55          waitAndClickDemoLink();
56          waitAndClickByLinkText("Travel Account Inquiry");
57      }
58  
59      protected void testInquiryBackButton() throws Exception {
60          waitAndClickButtonByText("Back");
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          waitForElementPresentById("Rice-LoginButton", "Expected Login - Travel Application Bookmark back work?");
68      }
69  
70      protected void testCollapseExpand() throws InterruptedException {
71          waitForElementPresentByClassName("demo-contactInfo");
72          assertTextPresent(new String[] {"Travel Account Number:", EXPAND_ALL, COLLAPSE_ALL});
73          assertIsVisibleByXpath(ANCHOR_TITLE_TRAVEL_ACCOUNT, "Expected Travel Sub Accounts");
74  
75          waitAndClickButtonByText(COLLAPSE_ALL);
76          Thread.sleep(2000);
77          assertIsNotVisible(By.linkText("A"), " after clicking " + COLLAPSE_ALL);
78  
79          waitAndClickButtonByText(EXPAND_ALL);
80          Thread.sleep(2000);
81          assertIsVisible(By.linkText("A"), " after clicking " + EXPAND_ALL);
82      }
83  
84      /**
85       * Tests selecting an inquiry inside this inquiry, making sure it can be opened more than once.
86       *
87       * @throws Exception for any test problems
88       */
89      protected void testInquiryNestedInquiry() throws Exception {
90          for (int i = 0; i < 2; i++) {
91              waitAndClickByLinkText("A", "Could not click in iteration " + i);
92              gotoLightBox();
93  
94              String[][] formattedLabeledText = {{"Travel Account Number:", "a14"},
95                                                 {"Travel Sub Account Number:", "A"},
96                                                 {"Sub Account Name:", "Sub Account A"}};
97              assertLabeledTextPresent(formattedLabeledText);
98  
99              waitAndClickButtonByText("Close", "Could not click in iteration " + i);
100             selectTopFrame();
101         }
102     }
103 
104     @Test
105     public void testInquiryCollapseExpandBookmark() throws Exception {
106         testCollapseExpand();
107         passed();
108     }
109 
110     @Test
111     public void testInquiryBackButtonBookmark() throws Exception {
112         testInquiryBackToLoginButton();
113         passed();
114     }
115 
116     @Test
117     public void testInquiryNestedInquiryBookmark() throws Exception {
118         testInquiryNestedInquiry();
119         passed();
120     }
121 
122     @Test
123     @Ignore // link removed
124     public void testInquiryCollapseExpandNav() throws Exception {
125         testCollapseExpand();
126         passed();
127     }
128 
129     @Test
130     @Ignore // link removed
131     public void testInquiryBackButtonNav() throws Exception {
132         testInquiryBackButton();
133         passed();
134     }
135 
136     @Test
137     @Ignore // link removed
138     public void testInquiryNestedInquiryNav() throws Exception {
139         testInquiryNestedInquiry();
140         passed();
141     }
142 
143 }