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 org.kuali.rice.krad.labs.maintenance;
17  
18  import org.junit.Test;
19  import org.kuali.rice.testtools.selenium.WebDriverUtils;
20  
21  /**
22   * @author Kuali Rice Team (rice.collab@kuali.org)
23   */
24  public class LabsMaintenancePromptBeforeRoutingAft extends LabsMaintenanceBase {
25  
26      /**
27       * /kr-krad/account?methodToCall=start&dataObjectClassName=org.kuali.rice.krad.demo.travel.dataobject.TravelAccount&viewId=LabsMaintenance-PromptBeforeRoutingView
28       */
29      public static final String BOOKMARK_URL = "/kr-krad/account?methodToCall=start&dataObjectClassName=org.kuali.rice.krad.demo.travel.dataobject.TravelAccount&viewId=LabsMaintenance-PromptBeforeRoutingView";
30  
31      @Override
32      protected String getBookmarkUrl() {
33          return BOOKMARK_URL;
34      }
35  
36      @Override
37      protected void navigate() throws Exception {
38      	navigateToMaintenance("Maintenance Sample - Prompt Before Routing");
39      	waitAndClickByLinkText("Travel Account Maintenance prompting before routing on submit");
40      }
41  
42      protected void testMaintenancePromptBeforeRouting() throws InterruptedException {
43          // fill out the document
44      	waitAndTypeByName("document.documentHeader.documentDescription", getDescriptionUnique());
45      	waitAndTypeByName("document.newMaintainableObject.dataObject.number", uniqueString);
46      	waitAndTypeByName("document.newMaintainableObject.dataObject.name", "Travel Account 14" + uniqueString);
47      	waitAndClickByXpath("//input[@name='document.newMaintainableObject.dataObject.accountTypeCode' and @value='CAT']");
48      	waitAndTypeByName("document.newMaintainableObject.dataObject.fiscalOfficer.principalName", "fred");
49      	waitAndTypeByName("document.newMaintainableObject.dataObject.createDate", "04/09/2014");
50  
51          // submit and click OK on the first dialog (default to all documents)
52          waitAndClickSubmitByText();
53          waitAndClickConfirmSubmitOk();
54  
55          // click Yes on the next dialog (specific to this document)
56          waitAndClickByXpath("//div[@data-parent='TravelAccount-RouteConfirmationDialog']/button[contains(text(),'Yes')]");
57  
58          // verify successful submit
59          waitForProgressLoading(WebDriverUtils.configuredImplicityWait());
60          Thread.sleep(500);
61          checkForDocError();
62          checkForDocErrorKrad();
63          waitForTextPresent("Document was successfully submitted.");
64      }
65  
66      @Test
67      public void testMaintenancePromptBeforeRoutingBookmark() throws Exception {
68      	testMaintenancePromptBeforeRouting();
69          passed();
70      }
71  
72      @Test
73      public void testMaintenancePromptBeforeRoutingNav() throws Exception {
74      	testMaintenancePromptBeforeRouting();
75          passed();
76      }
77  }