1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 package org.kuali.rice.krad.demo.travel.account;
17
18 import org.junit.Ignore;
19 import org.kuali.rice.testtools.selenium.WebDriverLegacyITBase;
20 import org.junit.Test;
21 import org.openqa.selenium.By;
22
23
24
25
26 public class DemoTravelAccountInquiryAft extends WebDriverLegacyITBase {
27
28
29
30
31 public static final String ANCHOR_TITLE_TRAVEL_ACCOUNT = "//a[@id='subAccounts_toggle']";
32
33
34
35
36 public static final String BOOKMARK_URL = "/kr-krad/inquiry?methodToCall=start&number=a14&dataObjectClassName=org.kuali.rice.krad.demo.travel.dataobject.TravelAccount";
37
38
39
40
41 public static final String COLLAPSE_ALL = "Collapse All";
42
43
44
45
46 public static final String EXPAND_ALL = "Expand All";
47
48 @Override
49 public String getBookmarkUrl() {
50 return BOOKMARK_URL;
51 }
52
53 @Override
54 protected void navigate() throws Exception {
55 waitAndClickDemoLink();
56 waitAndClickByLinkText("Travel Account Inquiry");
57 }
58
59 protected void testInquiryBackButton() throws Exception {
60 waitAndClickButtonByText("Back");
61 waitForElementPresentByXpath("//a[contains(text(), 'Account Inquiry')]", "Expected Demo - Travel Application did back work?");
62 assertTextPresent("Demo - Travel Application", "Expected Demo - Travel Application did back work?");
63 }
64
65 protected void testInquiryBackToLoginButton() throws Exception {
66 waitAndClickButtonByText("Back");
67 waitForElementPresentById("Rice-LoginButton", "Expected Login - Travel Application Bookmark back work?");
68 }
69
70 protected void testCollapseExpand() throws InterruptedException {
71 waitForElementPresentByClassName("demo-contactInfo");
72 assertTextPresent(new String[] {"Travel Account Number:", EXPAND_ALL, COLLAPSE_ALL});
73 assertIsVisibleByXpath(ANCHOR_TITLE_TRAVEL_ACCOUNT, "Expected Travel Sub Accounts");
74
75 waitAndClickButtonByText(COLLAPSE_ALL);
76 Thread.sleep(2000);
77 assertIsNotVisible(By.linkText("A"), " after clicking " + COLLAPSE_ALL);
78
79 waitAndClickButtonByText(EXPAND_ALL);
80 Thread.sleep(2000);
81 assertIsVisible(By.linkText("A"), " after clicking " + EXPAND_ALL);
82 }
83
84
85
86
87
88
89 protected void testInquiryNestedInquiry() throws Exception {
90 for (int i = 0; i < 2; i++) {
91 waitAndClickByLinkText("A", "Could not click in iteration " + i);
92 gotoLightBox();
93
94 String[][] formattedLabeledText = {{"Travel Account Number:", "a14"},
95 {"Travel Sub Account Number:", "A"},
96 {"Sub Account Name:", "Sub Account A"}};
97 assertLabeledTextPresent(formattedLabeledText);
98
99 waitAndClickButtonByText("Close", "Could not click in iteration " + i);
100 selectTopFrame();
101 }
102 }
103
104 @Test
105 public void testInquiryCollapseExpandBookmark() throws Exception {
106 testCollapseExpand();
107 passed();
108 }
109
110 @Test
111 public void testInquiryBackButtonBookmark() throws Exception {
112 testInquiryBackToLoginButton();
113 passed();
114 }
115
116 @Test
117 public void testInquiryNestedInquiryBookmark() throws Exception {
118 testInquiryNestedInquiry();
119 passed();
120 }
121
122 @Test
123 @Ignore
124 public void testInquiryCollapseExpandNav() throws Exception {
125 testCollapseExpand();
126 passed();
127 }
128
129 @Test
130 @Ignore
131 public void testInquiryBackButtonNav() throws Exception {
132 testInquiryBackButton();
133 passed();
134 }
135
136 @Test
137 @Ignore
138 public void testInquiryNestedInquiryNav() throws Exception {
139 testInquiryNestedInquiry();
140 passed();
141 }
142
143 }