View Javadoc

1   /**
2    * Copyright 2005-2011 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.admin.test;
17  
18  import static org.junit.Assert.assertEquals;
19  
20  import org.junit.Test;
21  import org.openqa.selenium.By;
22  
23  import edu.samplu.common.AdminMenuLegacyITBase;
24  import edu.samplu.common.ITUtil;
25  import edu.samplu.common.WebDriverLegacyITBase;
26  
27  /**
28   * Create a document type via the document type creation screen and verify it in docsearch
29   * 
30   * @author Kuali Rice Team (rice.collab@kuali.org)
31   */
32  public class CreateDocTypeLegacyIT extends AdminMenuLegacyITBase{
33  
34      @Override
35      protected String getLinkLocator() {
36          return "Document Type";
37      }
38      @Test
39      public void createDocType() throws Exception {
40          super.gotoCreateNew();
41          waitForPageToLoad();
42          Thread.sleep(2000);
43          assertElementPresentByXpath("//*[@name='methodToCall.route' and @alt='submit']","save button does not exist on the page");
44          waitForElementPresentByXpath("//div[@id='headerarea']/div/table/tbody/tr[1]/td[1]");
45          String docId = driver.findElement(By.xpath("//div[@id='headerarea']/div/table/tbody/tr[1]/td[1]")).getText();
46          waitAndTypeByXpath("//input[@id='document.documentHeader.documentDescription']", "Creating new Document Type");
47          String parentDocType = "//input[@name='methodToCall.performLookup.(!!org.kuali.rice.kew.doctype.bo.DocumentType!!).(((name:document.newMaintainableObject.parentDocType.name,documentTypeId:document.newMaintainableObject.docTypeParentId,))).((`document.newMaintainableObject.parentDocType.name:name,`)).((<>)).(([])).((**)).((^^)).((&&)).((//)).((~~)).(::::;" + getBaseUrlString() + "/kr/lookup.do;::::).anchor4']";
48          waitAndClickByXpath(parentDocType);
49          waitForPageToLoad();
50          Thread.sleep(2000);
51          waitAndClickByXpath("//input[@name='methodToCall.search' and @value='search']");
52          waitForPageToLoad();
53          waitAndClickByLinkText("return value");
54          String docTypeName = "TestDocType " + ITUtil.DTS;
55          waitForElementPresentByXpath("//input[@id='document.newMaintainableObject.name']");
56          waitAndTypeByXpath("//input[@id='document.newMaintainableObject.name']", docTypeName);
57          waitAndTypeByXpath("//input[@id='document.newMaintainableObject.unresolvedDocHandlerUrl']", "${kr.url}/maintenance.do?methodToCall=docHandler");
58          waitAndTypeByXpath("//input[@id='document.newMaintainableObject.actualNotificationFromAddress']", "NFA");
59          waitAndTypeByXpath("//input[@id='document.newMaintainableObject.label']", "TestDocument Label");
60          waitAndTypeByXpath("//input[@id='document.newMaintainableObject.unresolvedHelpDefinitionUrl']", "default.htm?turl=WordDocuments%2Fdocumenttype.htm");
61          
62          waitAndClickByXpath("//*[@name='methodToCall.route' and @alt='submit']");
63          checkForIncidentReport();
64          waitForPageToLoad();
65          selectTopFrame();
66         // Thread.sleep(2000);
67         // assertElementPresentByXpath("//div[contains(div,'Document was successfully submitted.')]", "Document is not submitted successfully");
68          
69          waitAndClickByXpath("//a[@title='Document Search']");
70          waitForPageToLoad();
71          selectFrame("iframeportlet");
72          waitAndClickByXpath("//input[@name='methodToCall.search' and @value='search']");
73          Thread.sleep(2000);
74          
75          assertEquals(docId, driver.findElement(By.xpath("//table[@id='row']/tbody/tr[1]/td[1]/a")).getText());
76          
77      }
78  }