1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 package edu.sampleu.admin;
17
18 import org.junit.Test;
19 import org.kuali.rice.testtools.selenium.AutomatedFunctionalTestUtils;
20 import org.kuali.rice.testtools.selenium.WebDriverLegacyITBase;
21 import org.kuali.rice.testtools.selenium.WebDriverUtils;
22 import org.openqa.selenium.By;
23 import org.openqa.selenium.support.ui.Select;
24
25
26
27
28
29 public class AgendaEditRuleRefreshAft extends WebDriverLegacyITBase {
30
31 public static final String BOOKMARK_URL = AutomatedFunctionalTestUtils.PORTAL+"?channelTitle=Agenda%20Lookup&channelUrl="
32 + WebDriverUtils.getBaseUrlString() + AutomatedFunctionalTestUtils.KRAD_LOOKUP_METHOD
33 + "org.kuali.rice.krms.impl.repository.AgendaBo"
34 + AutomatedFunctionalTestUtils.SHOW_MAINTENANCE_LINKS
35 + "&returnLocation=" + AutomatedFunctionalTestUtils.PORTAL_URL + AutomatedFunctionalTestUtils.HIDE_RETURN_LINK;
36
37 @Override
38 protected String getBookmarkUrl() {
39 return BOOKMARK_URL;
40 }
41
42 @Override
43 protected void navigate() throws Exception {
44 waitAndClickByLinkText(AGENDA_LOOKUP_LINK_TEXT);
45 waitForPageToLoad();
46 }
47
48 protected void testAgendaEditRuleRefresh() throws Exception {
49 selectFrameIframePortlet();
50 waitAndClickSearchByText();
51
52 waitAndClickByXpath("//a[@title='edit Agenda Definition with Agenda Id=T1000']",
53 "Does user have edit permissions?");
54 waitAndClickByXpath("//li/a[@class='agendaNode ruleNode']"); // jiraAwareWaitAndClick("//li[@id='473_node_0_parent_root']/a");
55 waitAndClickByXpath("//li/a[@class='agendaNode logicNode whenTrueNode']");
56 waitAndClickByLinkText("[-] collapse all");
57
58
59 for (int i = 0; i < 6; i++) {
60 for (int second = 0;; second++) {
61 if (second >= waitSeconds)
62 jiraAwareFail(TIMEOUT_MESSAGE);
63 try {
64 if (isElementPresent(".kr-refresh-button"))
65 break;
66 } catch (Exception e) {}
67 Thread.sleep(1000);
68 }
69 waitAndClick("button.kr-refresh-button");
70 }
71 }
72
73 protected void testAgendaEditRuleCompoundOperation() throws Exception {
74 selectFrameIframePortlet();
75 waitAndClickSearchByText();
76 waitAndClickByXpath("//a[@title='edit Agenda Definition with Agenda Id=T1001']",
77 "Does user have edit permissions?");
78 waitAndClickByXpath("//li/a[@class='agendaNode ruleNode']");
79 waitAndClickButtonByText("Edit Rule");
80 waitForTextPresent("Campus Code = Muir AND Campus Code = Revelle AND Campus Code = Warren");
81
82 waitAndSelectBy(By.xpath("//div[@id='RuleEditorView-Tree_tree']/ul/li/ul/li[2]/div/div/select"), "OR");
83 waitForTextPresent("Campus Code = Muir OR Campus Code = Revelle OR Campus Code = Warren");
84 Select select = new Select(driver.findElement(By.xpath(
85 "//div[@id='RuleEditorView-Tree_tree']/ul/li/ul/li[4]/div/div/select")));
86 String selectedOption = select.getFirstSelectedOption().getText();
87 assertEquals("The second drop down should also be OR", "OR", selectedOption);
88
89 waitAndSelectBy(By.xpath("//div[@id='RuleEditorView-Tree_tree']/ul/li/ul/li[4]/div/div/select"), "AND");
90 waitForTextPresent("Campus Code = Muir AND Campus Code = Revelle AND Campus Code = Warren");
91 Select select2 = new Select(driver.findElement(By.xpath(
92 "//div[@id='RuleEditorView-Tree_tree']/ul/li/ul/li[2]/div/div/select")));
93 String selectedOption2 = select2.getFirstSelectedOption().getText();
94 assertEquals("The first drop down should also be AND", "AND", selectedOption2);
95 }
96
97
98
99
100 @Test
101 public void testAgendaEditRuleRefreshBookmark() throws Exception {
102 testAgendaEditRuleRefresh();
103 passed();
104 }
105
106
107
108
109 @Test
110 public void testAgendaEditRuleRefreshNav() throws Exception {
111 testAgendaEditRuleRefresh();
112 passed();
113 }
114
115
116
117
118 @Test
119 public void testAgendaEditRuleCompoundOperationBookmark() throws Exception {
120 testAgendaEditRuleCompoundOperation();
121 passed();
122 }
123
124
125
126
127 @Test
128 public void testAgendaEditRuleCompoundOperationNav() throws Exception {
129 testAgendaEditRuleCompoundOperation();
130 passed();
131 }
132 }
133