1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 package org.kuali.rice.krad.demo.travel.application;
17
18 import org.apache.commons.lang.RandomStringUtils;
19 import org.junit.Test;
20 import org.kuali.rice.testtools.selenium.WebDriverLegacyITBase;
21 import org.openqa.selenium.By;
22 import org.openqa.selenium.WebElement;
23
24
25
26
27
28
29 public class DemoTravelAuthorizationAft extends WebDriverLegacyITBase {
30
31
32
33
34 public static final String BOOKMARK_URL = "/kr-krad/approval?methodToCall=docHandler&command=initiate&docTypeName=TravelAuthorization";
35
36 @Override
37 protected String getBookmarkUrl() {
38 return BOOKMARK_URL;
39 }
40
41 @Override
42 protected void navigate() throws Exception {
43 waitAndClickDemoLink();
44 waitAndClickByLinkText("Travel Authorization Document");
45 }
46
47
48
49
50
51
52 protected void testHeaderText() throws Exception {
53 WebElement element = findElement(By.cssSelector("#TravelAuthorization_header"));
54 assertEquals("Header content is incorrect", "Travel Authorization Document", element.getText());
55 }
56
57 protected void testTravelAuthorization() throws Exception {
58 String randomCode = RandomStringUtils.randomAlphabetic(9).toUpperCase();
59 waitAndTypeByName("document.documentHeader.documentDescription","Description : "+randomCode);
60 waitAndClickByXpath("//button[@id='travelerQuickfinder_quickfinder_act']");
61 gotoIframeByXpath("//iframe[@class='uif-iFrame uif-lookupDialog-iframe']");
62 waitAndClickByXpath("//button[contains(text(),'Search')]");
63 waitAndClickByXpath("//a[contains(text(),'return value')]");
64 waitAndTypeByName("document.cellPhoneNumber","8000884215");
65 waitAndClickByXpath("//div[@data-label='Primary Destination Id']/div/div/button");
66 gotoIframeByXpath("//iframe[@class='uif-iFrame uif-lookupDialog-iframe']");
67 waitAndClickByXpath("//button[contains(text(),'Clear Values')]");
68 waitAndClickByXpath("//button[contains(text(),'Search')]");
69 waitAndClickByXpath("//a[contains(text(),'return value')]");
70 waitAndClickByXpath("//button[contains(text(),'Submit')]");
71 waitAndClickConfirmSubmitOk();
72 waitForTextPresent("Document was successfully submitted.");
73 }
74
75 @Test
76 public void testHeaderTextBookmark() throws Exception {
77 testHeaderText();
78 testTravelAuthorization();
79 passed();
80 }
81
82 @Test
83 public void testHeaderTextNav() throws Exception {
84 testHeaderText();
85 passed();
86 }
87 }