View Javadoc

1   /**
2    * Copyright 2005-2012 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.samplu.common;
17  
18  import org.junit.Test;
19  import org.openqa.selenium.By;
20  
21  import static org.junit.Assert.assertEquals;
22  
23  /**
24   * blanket approving a new document, results in a final document
25   *
26   * @author Kuali Rice Team (rice.collab@kuali.org)
27   * @deprecated
28   */
29  public abstract class AdminMenuBlanketAppLegacyITBase extends MenuLegacyITBase{
30  
31      /**
32       * blanket approve document, returning docId as a String
33       * @return docId
34       */
35      public abstract String blanketApprove() throws Exception;
36  
37      @Override
38      protected String getMenuLinkLocator() {
39          return AdminMenuLegacyITBase.ADMIN_LOCATOR;
40      }
41  
42      @Override
43      protected String getCreateNewLinkLocator() {
44          return AdminMenuLegacyITBase.CREATE_NEW_LOCATOR;
45      }
46  
47      @Test
48      public void testBlanketApprove() throws Exception {
49          gotoCreateNew();
50          String docId = blanketApprove();
51          blanketApproveTest();
52          assertDocFinal(docId);
53          passed();
54      }
55  
56      protected void assertBlanketApproveButtonsPresent() {
57          assertElementPresentByName("methodToCall.route");
58          assertElementPresentByName("methodToCall.save");
59          assertElementPresentByName("methodToCall.blanketApprove", "Blanket Approve button not present does " + user + " have permssion?");
60          assertElementPresentByName("methodToCall.close");
61          assertElementPresentByName("methodToCall.cancel");
62      }
63  
64      protected void assertDocFinal(String docId) throws InterruptedException {
65          waitFor(By.linkText("spreadsheet"));
66          if(isElementPresent(By.linkText(docId))){
67              assertEquals("FINAL", getDocStatus());
68          }else{
69              assertEquals(docId, driver.findElement(By.xpath("//table[@id='row']/tbody/tr[1]/td[1]")));
70              assertEquals("FINAL", getDocStatus());
71          }
72      }
73  
74      private String getDocStatus() {
75          return driver.findElement(By.xpath("//table[@id='row']/tbody/tr[1]/td[4]")).getText();
76      }
77  }