View Javadoc
1   /**
2    * Copyright 2005-2015 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.kuali.rice.testtools.selenium.AutomatedFunctionalTestUtils;
20  import org.kuali.rice.testtools.selenium.WebDriverUtils;
21  
22  import java.util.Arrays;
23  import java.util.List;
24  
25  /**
26   * @author Kuali Rice Team (rice.collab@kuali.org)
27   */
28  public class LocationCountryAft extends AdminTmplMthdAftNavBlanketAppBase {
29  
30      public static final List<String> COUNTRY_CODES = Arrays.asList(
31              new String[] {"AW", "AG", "AF", "DZ", "AZ", "AL", "AM", "AD", "AO", "AS", "AR", "AU", "BF", "AT", "AI",
32                      "AQ", "BH", "BB", "BW", "BM", "BE", "BS", "BD", "BZ", "BA", "BO", "MM", "BJ", "BY", "SB", "BL",
33                      "BR", "MF", "BT", "BG", "BV", "BN", "BI", "CA", "KH", "TD", "LK", "CG", "CD", "CN", "CL", "KY",
34                      "CC", "CM", "KM", "CO", "MP", "GS", "CR", "CF", "CU", "CV", "CK", "CY", "DK", "DJ", "DM", "DO",
35                      "EC", "EG", "IE", "GQ", "EE", "ER", "SV", "ET", "TL", "CZ", "FK", "GF", "FI", "FJ", "FM", "FO",
36                      "PF", "AX", "FR", "TF", "GM", "GA", "GE", "GH", "GI", "GD", "GG", "GL", "DE", "GP", "GU", "GR",
37                      "GT", "GN", "GY", "PS", "HT", "HK", "HM", "HN", "HR", "HU", "IS", "ID", "IM", "IN", "IO", "IR",
38                      "IL", "IT", "CI", "IQ", "JP", "JE", "JM", "JO", "KE", "KG", "KP", "KI", "KR", "CX", "KW", "KZ",
39                      "LA", "LB", "LV", "LT", "LR", "SK", "LI", "LS", "LU", "LY", "MG", "MQ", "MO", "MD", "YT", "MN",
40                      "MS", "MW", "MK", "ML", "MC", "MA", "MU", "UM", "MR", "MT", "OM", "MV", "ME", "MX", "MY", "MZ",
41                      "AN", "NC", "NU", "NF", "NE", "VU", "NG", "NL", "NO", "NP", "NR", "SR", "NI", "NZ", "ZZ", "PY",
42                      "PN", "PE", "PK", "PL", "PA", "PT", "PG", "PW", "GW", "QA", "RE", "MH", "RO", "PH", "PR", "RU",
43                      "RW", "SA", "PM", "KN", "SC", "ZA", "SN", "SH", "SI", "SL", "SM", "SG", "SO", "ES", "RS", "LC",
44                      "SD", "SJ", "SE", "SY", "CH", "AE", "TT", "TH", "TJ", "TC", "TK", "TO", "TG", "ST", "TN", "TR",
45                      "TV", "TW", "TM", "TZ", "UG", "GB", "UA", "US", "UY", "UZ", "VC", "VE", "VG", "VN", "VI", "VA",
46                      "NA", "WF", "EH", "WS", "SZ", "YE", "ZM", "ZW"});
47  
48      /**
49       * ITUtil.PORTAL + "?channelTitle=Country&channelUrl=" 
50       * + WebDriverUtils.getBaseUrlString() + ITUtil.KNS_LOOKUP_METHOD + "org.kuali.rice.location.impl.country.CountryBo&docFormKey=88888888&returnLocation=" +
51       * ITUtil.PORTAL_URL + ITUtil.HIDE_RETURN_LINK;
52       */
53      public static final String BOOKMARK_URL = AutomatedFunctionalTestUtils.PORTAL + "?channelTitle=Country&channelUrl="
54              + WebDriverUtils.getBaseUrlString() + AutomatedFunctionalTestUtils.KNS_LOOKUP_METHOD +
55              "org.kuali.rice.location.impl.country.CountryBo&docFormKey=88888888&returnLocation=" +
56              AutomatedFunctionalTestUtils.PORTAL_URL + AutomatedFunctionalTestUtils.HIDE_RETURN_LINK ;
57  
58      @Override
59      protected String getBookmarkUrl() {
60          return BOOKMARK_URL;
61      }
62  
63      /**
64       * {@inheritDoc}
65       * Country
66       * @return
67       */
68      @Override
69      protected String getLinkLocator() {
70          return "Country";
71      }
72  
73      @Override
74      protected void createNewEnterDetails() throws InterruptedException {
75          // Make sure we don't use an existing country abbreviation
76          getDescriptionUnique(); // trigger creating of uniqueString
77          while (COUNTRY_CODES.contains(uniqueString.substring(5, 7).toUpperCase())) {
78              uniqueString = null;
79              getDescriptionUnique(); // trigger creating of uniqueString
80          }
81  
82          waitForElementPresentByName("document.documentHeader.documentDescription");
83  
84          jiraAwareClearAndTypeByName("document.documentHeader.documentDescription", getDescriptionUnique());
85          jiraAwareClearAndTypeByName("document.newMaintainableObject.code", uniqueString.substring(5, 7));
86          jiraAwareClearAndTypeByName("document.newMaintainableObject.name", "name" + uniqueString);
87      }
88  
89      @Override
90      protected void createNewLookupDetails() throws InterruptedException {
91          createNewEnterDetails(); // no required lookups
92      }
93  }