001/** 002 * Copyright 2005-2014 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 */ 016package edu.sampleu.kim.api.location; 017 018import edu.sampleu.admin.AdminTmplMthdAftNavBlanketAppBase; 019import org.junit.Test; 020import org.kuali.rice.testtools.selenium.AutomatedFunctionalTestUtils; 021import org.kuali.rice.testtools.selenium.WebDriverUtils; 022 023import java.util.Arrays; 024import java.util.List; 025 026/** 027 * @author Kuali Rice Team (rice.collab@kuali.org) 028 */ 029public class LocationStateAft extends AdminTmplMthdAftNavBlanketAppBase { 030 031 public static final List<String> STATE_CODES = Arrays.asList( 032 new String[]{"AK", "AL", "AR", "AS", "AZ", "CA", "CO", "CT", "DC", "DE", "FL", "GA", "GU", "HI", "IA", "ID", 033 "IL", "IN", "KS", "KY", "LA", "MA", "MD", "ME", "MH", "MI", "MN", "MO", "MS", "MT", "NC", "ND", 034 "NE", "NH", "NJ", "NM", "NV", "NY", "OH", "OK", "OR", "PA", "PR", "PW", "RI", "SC", "SD", "TN", 035 "TX", "UT", "VA", "VI", "VT", "WA", "WI", "WV", "WY"}); 036 037 /** 038 * ITUtil.PORTAL + "?channelTitle=State&channelUrl=" 039 * + WebDriverUtils.getBaseUrlString() + ITUtil.KNS_LOOKUP_METHOD + "org.kuali.rice.location.impl.state.StateBo&docFormKey=88888888&returnLocation=" + 040 * ITUtil.PORTAL_URL + ITUtil.HIDE_RETURN_LINK; 041 */ 042 public static final String BOOKMARK_URL = AutomatedFunctionalTestUtils.PORTAL + "?channelTitle=State&channelUrl=" 043 + WebDriverUtils.getBaseUrlString() + AutomatedFunctionalTestUtils.KNS_LOOKUP_METHOD + 044 "org.kuali.rice.location.impl.state.StateBo&docFormKey=88888888&returnLocation=" + 045 AutomatedFunctionalTestUtils.PORTAL_URL + AutomatedFunctionalTestUtils.HIDE_RETURN_LINK + AutomatedFunctionalTestUtils.SHOW_MAINTENANCE_LINKS; 046 047 @Override 048 protected String getBookmarkUrl() { 049 return BOOKMARK_URL; 050 } 051 052 /** 053 * {@inheritDoc} 054 * State 055 * @return 056 */ 057 @Override 058 protected String getLinkLocator() { 059 return "State"; 060 } 061 062 protected void createNewEnterDetails() throws InterruptedException { 063 inputDetails(); 064 065 jiraAwareTypeByName("document.newMaintainableObject.countryCode", "US"); 066 } 067 068 private void inputDetails() throws InterruptedException { 069 // Make sure we don't use an existing state abbreviation 070 getDescriptionUnique(); // trigger creating of uniqueString 071 while (STATE_CODES.contains(uniqueString.substring(5, 7).toUpperCase())) { 072 uniqueString = null; 073 getDescriptionUnique(); // trigger creating of uniqueString 074 } 075 076 waitAndTypeByName("document.documentHeader.documentDescription", getDescriptionUnique()); 077 jiraAwareTypeByName("document.newMaintainableObject.name", "name" + uniqueString); 078 jiraAwareTypeByName("document.newMaintainableObject.code", uniqueString.substring(5, 7)); 079 } 080 081 @Override 082 protected void createNewLookupDetails() throws InterruptedException { 083 inputDetails(); 084 085 String countryLookUp = "//input[@name='methodToCall.performLookup.(!!org.kuali.rice.location.impl.country.CountryBo!!).(((code:document.newMaintainableObject.countryCode,))).((`document.newMaintainableObject.countryCode:code,`)).((<>)).(([])).((**)).((^^)).((&&)).((//)).((~~)).(::::;" 086 + getBaseUrlString() + "/kr/lookup.do;::::).anchor4']"; 087 waitAndClickByXpath(countryLookUp); 088 waitAndClickSearch(); 089 waitAndClickReturnValue(); 090 } 091 092 @Test 093 public void testEditCancelBookmark() throws Exception { 094 testEditCancel(); 095 passed(); 096 } 097 098 @Test 099 public void testEditCancelNav() throws Exception { 100 testEditCancel(); 101 passed(); 102 } 103}