001 /**
002 * Copyright 2005-2013 The Kuali Foundation
003 *
004 * Licensed under the Educational Community License, Version 2.0 (the "License");
005 * you may not use this file except in compliance with the License.
006 * You may obtain a copy of the License at
007 *
008 * http://www.opensource.org/licenses/ecl2.php
009 *
010 * Unless required by applicable law or agreed to in writing, software
011 * distributed under the License is distributed on an "AS IS" BASIS,
012 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
013 * See the License for the specific language governing permissions and
014 * limitations under the License.
015 */
016 package edu.samplu.krad.demo.travel.account;
017
018 import edu.samplu.common.SmokeTestBase;
019 import org.junit.Test;
020
021 /**
022 * @author Kuali Rice Team (rice.collab@kuali.org)
023 */
024 public class DemoTravelAccountInquirySmokeTest extends SmokeTestBase {
025
026 /**
027 * //a[@title='Travel Account ']
028 */
029 public static final String ANCHOR_TITLE_TRAVEL_ACCOUNT = "//a[@title='Travel Account ']";
030
031 /**
032 * /kr-krad/inquiry?methodToCall=start&number=a14&dataObjectClassName=org.kuali.rice.krad.demo.travel.account.TravelAccount
033 */
034 public static final String BOOKMARK_URL = "/kr-krad/inquiry?methodToCall=start&number=a14&dataObjectClassName=org.kuali.rice.krad.demo.travel.account.TravelAccount";
035
036 /**
037 * Collapse All
038 */
039 public static final String COLLAPSE_ALL = "Collapse All";
040
041 /**
042 * Expand All
043 */
044 public static final String EXPAND_ALL = "Expand All";
045
046 @Override
047 public String getBookmarkUrl() {
048 return BOOKMARK_URL;
049 }
050
051 @Override
052 protected void navigate() throws Exception {
053 waitAndClickById("Demo-DemoLink", "");
054 waitAndClickByLinkText("Account Inquiry");
055 }
056
057 protected void testInquiryBackButton() throws Exception {
058 waitAndClickButtonByText("Back");
059 Thread.sleep(2000); // seems to take a while to load
060 waitForElementPresentByXpath("//a[contains(text(), 'Account Inquiry')]", "Expected Demo - Travel Application did back work?");
061 assertTextPresent("Demo - Travel Application", "Expected Demo - Travel Application did back work?");
062 }
063
064 protected void testInquiryBackToLoginButton() throws Exception {
065 waitAndClickButtonByText("Back");
066 Thread.sleep(2000); // seems to take a while to load
067 waitForElementPresentById("Rice-LoginButton", "Expected Demo - Travel Application did back work?");
068 assertTextPresent("Demo - Travel Application", "Expected Demo - Travel Application did back work?");
069 }
070
071 protected void testCollapseExpand() throws InterruptedException {
072 waitForElementPresentByClassName("demo-contactInfo");
073 assertTextPresent("Travel Account Number:");
074 assertTextPresent(EXPAND_ALL);
075 assertTextPresent(COLLAPSE_ALL);
076 assertIsVisibleByXpath(ANCHOR_TITLE_TRAVEL_ACCOUNT, "");
077
078 waitAndClickButtonByText(COLLAPSE_ALL);
079 assertIsNotVisibleByXpath(ANCHOR_TITLE_TRAVEL_ACCOUNT, " after clicking " + COLLAPSE_ALL);
080
081 waitAndClickButtonByText(EXPAND_ALL);
082 assertIsVisibleByXpath(ANCHOR_TITLE_TRAVEL_ACCOUNT, " after clicking " + EXPAND_ALL);
083 }
084
085 protected void testInquiryLightBox() throws Exception {
086 waitAndClickByLinkText("a6");
087 assertIsVisibleByXpath(ANCHOR_TITLE_TRAVEL_ACCOUNT, "");
088 }
089
090 @Test
091 public void testInquiryCollapseExpandBookmark() throws Exception {
092 testCollapseExpand();
093 passed();
094 }
095
096 @Test
097 public void testInquiryLightBoxBookmark() throws Exception {
098 testInquiryLightBox();
099 passed();
100 }
101
102 @Test
103 public void testInquiryBackButtonBookmark() throws Exception {
104 testInquiryBackToLoginButton();
105 passed();
106 }
107
108 @Test
109 public void testInquiryCollapseExpandNav() throws Exception {
110 testCollapseExpand();
111 passed();
112 }
113
114 @Test
115 public void testInquiryLightBoxNav() throws Exception {
116 testInquiryLightBox();
117 passed();
118 }
119
120 @Test
121 public void testInquiryBackButtonNav() throws Exception {
122 testInquiryBackButton();
123 passed();
124 }
125 }