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.junit.Test;
19 import org.kuali.rice.kew.api.action.ActionRequestType;
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 DemoTravelAuthorizationCopyAft extends WebDriverLegacyITBase {
30
31
32
33
34 public static final String BOOKMARK_URL = "/kr-krad/approval?methodToCall=docHandler&command=initiate&docTypeName=TravelAuthorization";
35
36 private static final String DOCUMENT_DESCRIPTION_FIELD = "document.documentHeader.documentDescription";
37 private static final String CONTACT_NUMBER_FIELD = "document.cellPhoneNumber";
38
39 private static final String DOCUMENT_DESCRIPTION_VALUE = "Test Pessimistic Locking";
40 private static final String CONTACT_NUMBER_VALUE = "555-555-5555";
41
42 @Override
43 protected String getBookmarkUrl() {
44 return BOOKMARK_URL;
45 }
46
47 @Override
48 protected void navigate() throws Exception {
49 waitAndClickDemoLink();
50 waitAndClickByLinkText("Travel Authorization Document");
51 }
52
53
54
55
56
57
58 protected void testCopy() throws Exception {
59 String documentNumber = createTravelAuthorization();
60
61 waitForElementNotPresent(By.cssSelector("div[data-label = 'Copied from Document Number']"));
62
63 waitAndClick(By.cssSelector("button[data-submit_data = '{\\\"methodToCall\\\":\\\"copy\\\"}']"));
64
65 assertElementPresent(By.cssSelector("div[data-label = 'Copied from Document Number']"));
66 WebElement element = findElement(By.xpath("//div[@data-label = 'Copied from Document Number']/span"));
67 assertEquals("Copied document number does not match old document", documentNumber, element.getText());
68 }
69
70 private String createTravelAuthorization() throws Exception {
71 String documentNumber = waitForDocIdKrad();
72
73 waitAndTypeByName(DOCUMENT_DESCRIPTION_FIELD, DOCUMENT_DESCRIPTION_VALUE);
74
75 waitAndTypeByName(CONTACT_NUMBER_FIELD, CONTACT_NUMBER_VALUE);
76
77 waitAndClick(By.cssSelector("div[data-label = 'Primary Destination Id'] button"));
78 gotoLightBox();
79 waitAndClickButtonByText(SEARCH);
80 waitAndClickByLinkText(RETURN_VALUE_LINK_TEXT);
81
82 saveSuccessfully();
83
84 return documentNumber;
85 }
86
87 @Test
88 public void testCopyBookmark() throws Exception {
89 testCopy();
90 passed();
91 }
92
93 @Test
94 public void testCopyNav() throws Exception {
95 testCopy();
96 passed();
97 }
98
99 }