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 org.kuali.rice.testtools.selenium.SmokeTestBase; 019 import org.junit.Test; 020 import org.openqa.selenium.By; 021 022 /** 023 * @author Kuali Rice Team (rice.collab@kuali.org) 024 */ 025 public class DemoTravelAccountInquirySmokeTest extends SmokeTestBase { 026 027 /** 028 * //a[@title='Travel Account '] 029 */ 030 public static final String ANCHOR_TITLE_TRAVEL_ACCOUNT = "//a[@id='subAccounts_toggle']"; 031 032 /** 033 * /kr-krad/inquiry?methodToCall=start&number=a14&dataObjectClassName=org.kuali.rice.krad.demo.travel.dataobject.TravelAccount 034 */ 035 public static final String BOOKMARK_URL = "/kr-krad/inquiry?methodToCall=start&number=a14&dataObjectClassName=org.kuali.rice.krad.demo.travel.dataobject.TravelAccount"; 036 037 /** 038 * Collapse All 039 */ 040 public static final String COLLAPSE_ALL = "Collapse All"; 041 042 /** 043 * Expand All 044 */ 045 public static final String EXPAND_ALL = "Expand All"; 046 047 @Override 048 public String getBookmarkUrl() { 049 return BOOKMARK_URL; 050 } 051 052 @Override 053 protected void navigate() throws Exception { 054 waitAndClickById("Demo-DemoLink", ""); 055 waitAndClickByLinkText("Travel Account Inquiry"); 056 } 057 058 protected void testInquiryBackButton() throws Exception { 059 waitAndClickButtonByText("Back"); 060 Thread.sleep(2000); // seems to take a while to load 061 waitForElementPresentByXpath("//a[contains(text(), 'Account Inquiry')]", "Expected Demo - Travel Application did back work?"); 062 assertTextPresent("Demo - Travel Application", "Expected Demo - Travel Application did back work?"); 063 } 064 065 protected void testInquiryBackToLoginButton() throws Exception { 066 waitAndClickButtonByText("Back"); 067 Thread.sleep(2000); // seems to take a while to load 068 waitForElementPresentById("Rice-LoginButton", "Expected Login - Travel Application Bookmark back work?"); 069 } 070 071 protected void testCollapseExpand() throws InterruptedException { 072 checkForIncidentReport(); 073 waitForElementPresentByClassName("demo-contactInfo"); 074 assertTextPresent("Travel Account Number:"); 075 assertTextPresent(EXPAND_ALL); 076 assertTextPresent(COLLAPSE_ALL); 077 // assertIsVisibleByXpath(ANCHOR_TITLE_TRAVEL_ACCOUNT, ""); // sub accounts removed 078 079 waitAndClickButtonByText(COLLAPSE_ALL); 080 Thread.sleep(2000); 081 assertIsNotVisible(By.linkText("a"), " after clicking " + COLLAPSE_ALL); 082 083 waitAndClickButtonByText(EXPAND_ALL); 084 Thread.sleep(2000); 085 assertIsVisible(By.linkText("a"), " after clicking " + EXPAND_ALL); 086 } 087 088 protected void testInquiryLightBox() throws Exception { 089 waitAndClickByLinkText("a14"); 090 assertIsVisibleByXpath(ANCHOR_TITLE_TRAVEL_ACCOUNT, ""); 091 } 092 093 @Test 094 public void testInquiryCollapseExpandBookmark() throws Exception { 095 testCollapseExpand(); 096 passed(); 097 } 098 099 @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 }