1
2
3
4
5
6
7
8
9
10
11
12
13
14
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
29
30
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
67
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 }