View Javadoc
1   /**
2    * Copyright 2005-2016 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 org.kuali.rice.krad.labs.maintenance;
17  
18  import org.apache.commons.lang.RandomStringUtils;
19  import org.junit.Ignore;
20  import org.junit.Test;
21  
22  /**
23   * @author Kuali Rice Team (rice.collab@kuali.org)
24   */
25  public class LabsMaintenanceExistenceCheckAft extends LabsMaintenanceBase {
26  
27      /**
28       * /kr-krad/kradsampleapp?viewId=KradMaintenanceSample-PageR1C1
29       */
30      public static final String BOOKMARK_URL = "/kr-krad/kradsampleapp?viewId=KradMaintenanceSample-PageR6C1";
31      
32      @Override
33      protected String getBookmarkUrl() {
34          return BOOKMARK_URL;
35      }
36  
37      @Override
38      protected void navigate() throws Exception {
39      	navigateToMaintenance("Maintenance Sample - Existence Check");
40      }
41  
42      protected void testMaintenanceExistenceCheck() throws InterruptedException {
43          waitAndClickByLinkText("Travel Account Maintenance Existence Check - The account type code and fiscal officer must exist.");
44  
45          waitAndTypeByName("document.documentHeader.documentDescription", "New Travel Account");
46          String randomCode = RandomStringUtils.randomAlphabetic(9).toUpperCase();
47          waitAndTypeByName("document.newMaintainableObject.dataObject.number",randomCode);
48          waitAndTypeByName("document.newMaintainableObject.dataObject.name","Test Account Name");
49  
50          // Enter a nonexistent account type code
51          waitAndTypeByName("document.newMaintainableObject.dataObject.accountTypeCode","xxx");
52          waitAndClickSubmitByText();
53          waitAndClickConfirmSubmitOk();
54          assertTextPresent("INITIATED");
55          waitForTextPresent("Travel Account Type Code: The specified Travel Account Type Code does not exist.");
56  
57          // Correct the account type code and enter a nonexistent fiscal officer
58          Thread.sleep(1000);
59          clearTextByName("document.newMaintainableObject.dataObject.accountTypeCode");
60          waitAndTypeByName("document.newMaintainableObject.dataObject.accountTypeCode", "CAT");
61          clearTextByName("document.newMaintainableObject.dataObject.foId");
62          waitAndTypeByName("document.newMaintainableObject.dataObject.foId", "xxxx");
63          waitAndClickSubmitByText();
64          waitAndClickConfirmSubmitOk();
65          assertTextPresent("INITIATED");
66          waitForTextPresent("Fiscal Officer User ID: The specified Fiscal Officer does not exist.");
67  
68          // Correct the fiscal officer and submit the document
69          Thread.sleep(1000);
70          clearTextByName("document.newMaintainableObject.dataObject.foId");
71          waitAndTypeByName("document.newMaintainableObject.dataObject.foId", "fred");
72          waitAndClickSubmitByText();
73          waitAndClickConfirmSubmitOk();
74          assertTextPresent("ENROUTE");
75      }
76  
77      @Test
78      @Ignore //Ignore these tests until KULRICE-12849 and KULRICE-12850 are fixed.  They will fail until that time.
79      public void testMaintenanceExistenceCheckBookmark() throws Exception {
80          testMaintenanceExistenceCheck();
81          passed();
82      }
83  
84      @Test
85      @Ignore //Ignore these tests until KULRICE-12849 and KULRICE-12850 are fixed.  They will fail until that time.
86      public void testMaintenanceExistenceCheckNav() throws Exception {
87          testMaintenanceExistenceCheck();
88          passed();
89      }
90  }