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')]"); 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 Login - Travel Application Bookmark back work?"); 068 } 069 070 protected void testCollapseExpand() throws InterruptedException { 071 waitForElementPresentByClassName("demo-contactInfo"); 072 assertTextPresent("Travel Account Number:"); 073 assertTextPresent(EXPAND_ALL); 074 assertTextPresent(COLLAPSE_ALL); 075 assertIsVisibleByXpath(ANCHOR_TITLE_TRAVEL_ACCOUNT, ""); 076 077 waitAndClickButtonByText(COLLAPSE_ALL); 078 assertIsNotVisibleByXpath(ANCHOR_TITLE_TRAVEL_ACCOUNT, " after clicking " + COLLAPSE_ALL); 079 080 waitAndClickButtonByText(EXPAND_ALL); 081 assertIsVisibleByXpath(ANCHOR_TITLE_TRAVEL_ACCOUNT, " after clicking " + EXPAND_ALL); 082 } 083 084 protected void testInquiryLightBox() throws Exception { 085 waitAndClickByLinkText("a6"); 086 assertIsVisibleByXpath(ANCHOR_TITLE_TRAVEL_ACCOUNT, ""); 087 } 088 089 @Test 090 public void testInquiryCollapseExpandBookmark() throws Exception { 091 testCollapseExpand(); 092 passed(); 093 } 094 095 @Test 096 public void testInquiryLightBoxBookmark() throws Exception { 097 testInquiryLightBox(); 098 passed(); 099 } 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 }