View Javadoc
1   /**
2    * Copyright 2005-2014 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 edu.sampleu.kim.api.location;
17  
18  import edu.sampleu.admin.AdminTmplMthdAftNavBlanketAppBase;
19  import org.junit.Test;
20  import org.kuali.rice.testtools.selenium.AutomatedFunctionalTestUtils;
21  import org.kuali.rice.testtools.selenium.WebDriverUtils;
22  
23  import java.util.Arrays;
24  import java.util.List;
25  
26  /**
27   * @author Kuali Rice Team (rice.collab@kuali.org)
28   */
29  public class LocationStateAft extends AdminTmplMthdAftNavBlanketAppBase {
30  
31      public static final List<String> STATE_CODES = Arrays.asList(
32              new String[]{"AK", "AL", "AR", "AS", "AZ", "CA", "CO", "CT", "DC", "DE", "FL", "GA", "GU", "HI", "IA", "ID",
33                      "IL", "IN", "KS", "KY", "LA", "MA", "MD", "ME", "MH", "MI", "MN", "MO", "MS", "MT", "NC", "ND",
34                      "NE", "NH", "NJ", "NM", "NV", "NY", "OH", "OK", "OR", "PA", "PR", "PW", "RI", "SC", "SD", "TN",
35                      "TX", "UT", "VA", "VI", "VT", "WA", "WI", "WV", "WY"});
36  
37      /**
38       * ITUtil.PORTAL + "?channelTitle=State&channelUrl=" 
39       * + WebDriverUtils.getBaseUrlString() + ITUtil.KNS_LOOKUP_METHOD + "org.kuali.rice.location.impl.state.StateBo&docFormKey=88888888&returnLocation=" +
40       * ITUtil.PORTAL_URL + ITUtil.HIDE_RETURN_LINK;
41       */
42      public static final String BOOKMARK_URL = AutomatedFunctionalTestUtils.PORTAL + "?channelTitle=State&channelUrl="
43              + WebDriverUtils.getBaseUrlString() + AutomatedFunctionalTestUtils.KNS_LOOKUP_METHOD +
44              "org.kuali.rice.location.impl.state.StateBo&docFormKey=88888888&returnLocation=" +
45              AutomatedFunctionalTestUtils.PORTAL_URL + AutomatedFunctionalTestUtils.HIDE_RETURN_LINK + AutomatedFunctionalTestUtils.SHOW_MAINTENANCE_LINKS;
46  
47      @Override
48      protected String getBookmarkUrl() {
49          return BOOKMARK_URL;
50      }
51  
52      /**
53       * {@inheritDoc}
54       * State
55       * @return
56       */
57      @Override
58      protected String getLinkLocator() {
59          return "State";
60      }
61  
62      protected void createNewEnterDetails() throws InterruptedException {
63          inputDetails();
64  
65          jiraAwareTypeByName("document.newMaintainableObject.countryCode", "US");
66      }
67  
68      private void inputDetails() throws InterruptedException {
69          // Make sure we don't use an existing state abbreviation
70          getDescriptionUnique(); // trigger creating of uniqueString
71          while (STATE_CODES.contains(uniqueString.substring(5, 7).toUpperCase())) {
72              uniqueString = null;
73              getDescriptionUnique(); // trigger creating of uniqueString
74          }
75  
76          waitForElementPresentByName("document.documentHeader.documentDescription");
77  
78          jiraAwareClearAndTypeByName("document.documentHeader.documentDescription", getDescriptionUnique());
79          jiraAwareClearAndTypeByName("document.newMaintainableObject.name", "name" + uniqueString);
80          jiraAwareClearAndTypeByName("document.newMaintainableObject.code", uniqueString.substring(5, 7));
81      }
82  
83      @Override
84      protected void createNewLookupDetails() throws InterruptedException {
85          inputDetails();
86  
87          String countryLookUp = "//input[@name='methodToCall.performLookup.(!!org.kuali.rice.location.impl.country.CountryBo!!).(((code:document.newMaintainableObject.countryCode,))).((`document.newMaintainableObject.countryCode:code,`)).((<>)).(([])).((**)).((^^)).((&&)).((//)).((~~)).(::::;"
88                  + getBaseUrlString() + "/kr/lookup.do;::::).anchor4']";
89          waitAndClickByXpath(countryLookUp);
90          waitAndClickSearch();
91          waitAndClickReturnValue();
92      }
93  
94      @Test
95      public void testEditCancelBookmark() throws Exception {
96          testEditCancel();
97          passed();
98      }
99  
100     @Test
101     public void testEditCancelNav() throws Exception {
102         testEditCancel();
103         passed();
104     }
105 }