1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 package org.kuali.rice.krad.demo.uif.library.controls;
17
18 import org.junit.Test;
19
20 import org.kuali.rice.testtools.selenium.WebDriverLegacyITBase;
21
22
23
24
25 public class LibraryControlSelectAft extends WebDriverLegacyITBase {
26
27
28
29
30 public static final String BOOKMARK_URL = "/kr-krad/kradsampleapp?viewId=Demo-SelectControlView&methodToCall=start";
31
32 @Override
33 protected String getBookmarkUrl() {
34 return BOOKMARK_URL;
35 }
36
37 @Override
38 protected void navigate() throws Exception {
39 waitAndClickLibraryLink();
40 waitAndClickByLinkText("Controls");
41 waitAndClickByLinkText("Select");
42 }
43
44 protected void testLibraryControlSelectDefault() throws Exception {
45 assertElementPresentByXpath("//select[@name='inputField1']");
46 selectByName("inputField1","Option 1");
47 }
48
49 protected void testLibraryControlSelectMultiSelect() throws Exception {
50 waitAndClickByLinkText("MultiSelect");
51 assertElementPresentByXpath("//select[@name='multiSelectField1' and @multiple='multiple']");
52 selectByName("multiSelectField1","Select 1");
53 selectByName("multiSelectField1","Select 2");
54 selectByName("multiSelectField1","Select 3");
55 }
56
57 protected void testLibraryControlSelectDisabled() throws Exception {
58 waitAndClickByLinkText("Disabled");
59 assertElementPresentByXpath("//select[@name='inputField1' and @disabled='disabled']");
60 }
61
62 protected void testLibraryControlSelectGroupedOptions() throws Exception {
63 waitAndClickByXpath("//li[@data-tabfor='Demo-SelectControl-Example5']/a");
64 waitForElementPresentByXpath("//select/optgroup[@label='American']");
65 waitForElementPresentByXpath("//select/optgroup/option");
66 waitForElementPresentByXpath("//select/optgroup[@label='Japan']");
67 waitForElementPresentByXpath("//select[@multiple]/optgroup[@label='American']");
68 waitForElementPresentByXpath("//select[@multiple]/optgroup/option");
69 waitForElementPresentByXpath("//select[@multiple]/optgroup[@label='Japan']");
70 }
71
72 protected void testLibraryControlSelectNavigation() throws Exception {
73 waitAndClickByXpath("//li[@data-tabfor='Demo-SelectControl-Example4']/a");
74 assertElementPresentByXpath("//div[@data-parent='Demo-SelectControl-Example4']/select/option[@data-location='http://www.kuali.org']");
75 selectByXpath("//div[@data-parent='Demo-SelectControl-Example4']/select","Kuali.org");
76
77 }
78
79
80 @Test
81 public void testControlSelectBookmark() throws Exception {
82 testLibraryControlSelectDefault();
83 testLibraryControlSelectMultiSelect();
84 testLibraryControlSelectDisabled();
85 testLibraryControlSelectGroupedOptions();
86 testLibraryControlSelectNavigation();
87 passed();
88 }
89
90 @Test
91 public void testControlSelectNav() throws Exception {
92 testLibraryControlSelectDefault();
93 testLibraryControlSelectMultiSelect();
94 testLibraryControlSelectDisabled();
95 testLibraryControlSelectGroupedOptions();
96 testLibraryControlSelectNavigation();
97 passed();
98 }
99 }