1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 package edu.samplu.krad.library.elements;
17
18 import org.junit.Test;
19
20 import org.kuali.rice.testtools.selenium.Failable;
21 import org.kuali.rice.testtools.selenium.ITUtil;
22 import org.kuali.rice.testtools.selenium.SmokeTestBase;
23 import org.kuali.rice.testtools.selenium.WebDriverLegacyITBase;
24
25
26
27
28 public class DemoLibraryElementsDropdownMenuSmokeTest extends SmokeTestBase {
29
30
31
32
33 public static final String BOOKMARK_URL = "/kr-krad/kradsampleapp?viewId=Demo-DropdownMenu-View";
34
35 @Override
36 protected String getBookmarkUrl() {
37 return BOOKMARK_URL;
38 }
39
40 @Override
41 protected void navigate() throws Exception {
42 waitAndClickById("Demo-LibraryLink", "");
43 waitAndClickByLinkText("Elements");
44 waitAndClickByLinkText("Dropdown Menu");
45 }
46
47 protected void testLibraryElementsDropdownBasic() throws Exception {
48 waitAndClickByLinkText("User thclark");
49 assertElementPresentByXpath("//div[@id='Demo-DropdownMenu-Example1']/div[3]/div/ul/li/a[contains(text(),'Preferences')]");
50 }
51
52 protected void testLibraryElementsDropdownWithDivider() throws Exception {
53 waitAndClickByLinkText("Dropdown with Divider");
54 waitAndClickByLinkText("Action List");
55 assertElementPresentByXpath("//div[@id='Demo-DropdownMenu-Example2']/div[3]/div/ul/li/a[contains(text(),'Proposal #1034')]");
56 assertElementPresentByXpath("//div[@id='Demo-DropdownMenu-Example2']/div[3]/div/ul/li[@class='uif-actionLink divider ui-corner-right']");
57 }
58
59 protected void testLibraryElementsDropdownWithHeader() throws Exception {
60 waitAndClickByLinkText("Dropdown with Headers");
61 waitAndClickByLinkText("Favorites");
62 assertElementPresentByXpath("//div[@id='Demo-DropdownMenu-Example3']/div[3]/div/ul/li/a[contains(text(),'Proposal')]");
63 assertElementPresentByXpath("//div[@id='Demo-DropdownMenu-Example3']/div[3]/div/ul/li[@class='uif-actionLink dropdown-header ui-corner-right']");
64 }
65
66 protected void testLibraryElementsDropdownWithDisabled() throws Exception {
67 waitAndClickByLinkText("Dropdown with Disabled");
68 waitAndClickByXpath("//div[@id='Demo-DropdownMenu-Example4']/div[3]/div/a");
69 assertElementPresentByXpath("//div[@id='Demo-DropdownMenu-Example4']/div[3]/div/ul/li/a[@class='uif-actionLink']");
70 assertElementPresentByXpath("//div[@id='Demo-DropdownMenu-Example4']/div[3]/div/ul/li/a[@class='uif-actionLink disabled']");
71 }
72
73 protected void testLibraryElementsDropdownWithActionOptions() throws Exception {
74 waitAndClickByLinkText("Dropdown with Action Options");
75 waitAndClickByXpath("//div[@id='Demo-DropdownMenu-Example5']/div[3]/div/a");
76 assertElementPresentByXpath("//div[@id='Demo-DropdownMenu-Example5']/div[3]/div/ul/li/a[contains(text(),'Refresh Section')]");
77 }
78
79 protected void testLibraryElementsDropdownWithToggleButton() throws Exception {
80 waitAndClickByLinkText("Dropdown with Toggle Button");
81 waitAndClickByXpath("//div[@id='Demo-DropdownMenu-Example6']/div[3]/div/a/b[@class='caret']");
82 assertElementPresentByXpath("//div[@id='Demo-DropdownMenu-Example6']/div[3]/div/ul/li/a[contains(text(),'Preferences')]");
83 }
84 @Test
85 public void testLibraryElementsDropdownBookmark() throws Exception {
86 testLibraryElementsDropdownBasic();
87 testLibraryElementsDropdownWithDivider();
88 testLibraryElementsDropdownWithHeader();
89 testLibraryElementsDropdownWithDisabled();
90 testLibraryElementsDropdownWithActionOptions();
91 testLibraryElementsDropdownWithToggleButton();
92 passed();
93 }
94
95 @Test
96 public void testLibraryElementsDropdownNav() throws Exception {
97 testLibraryElementsDropdownBasic();
98 testLibraryElementsDropdownWithDivider();
99 testLibraryElementsDropdownWithHeader();
100 testLibraryElementsDropdownWithDisabled();
101 testLibraryElementsDropdownWithActionOptions();
102 testLibraryElementsDropdownWithToggleButton();
103 passed();
104 }
105 }