1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 package edu.samplu.krad.library.layoutmanagers;
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 DemoLibraryLayoutManagersBoxLayoutSmokeTest extends SmokeTestBase {
29
30
31
32
33 public static final String BOOKMARK_URL = "/kr-krad/kradsampleapp?viewId=Demo-BoxLayoutManager-View&methodToCall=start";
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("Layout Managers");
44 waitAndClickByLinkText("Box Layout");
45 }
46
47 protected void testLayoutManagersVerticalBoxLayout() throws Exception {
48 assertElementPresentByXpath("//div[@data-parent='Demo-BoxLayoutManager-Example1']/div/div/span/label");
49 assertElementPresentByXpath("//div[@data-parent='Demo-BoxLayoutManager-Example1']/div/div/input[@name='inputField1']");
50 assertElementPresentByXpath("//div[@data-parent='Demo-BoxLayoutManager-Example1']/div/div[2]/span/label");
51 assertElementPresentByXpath("//div[@data-parent='Demo-BoxLayoutManager-Example1']/div/div[2]/input[@name='inputField2']");
52 }
53
54 protected void testLayoutManagersHorizontalBoxLayout() throws Exception {
55 selectByName("exampleShown","Horizontal Box Layout");
56 assertElementPresentByXpath("//div[@data-parent='Demo-BoxLayoutManager-Example2']/div/div[@class='uif-inputField uif-inputField-labelTop uif-boxLayoutHorizontalItem']/span/label");
57 assertElementPresentByXpath("//div[@data-parent='Demo-BoxLayoutManager-Example2']/div/div[@class='uif-inputField uif-inputField-labelTop uif-boxLayoutHorizontalItem']/input[@name='inputField5']");
58 assertElementPresentByXpath("//div[@data-parent='Demo-BoxLayoutManager-Example2']/div/div[@class='uif-inputField uif-inputField-labelTop uif-boxLayoutHorizontalItem'][2]/span/label");
59 assertElementPresentByXpath("//div[@data-parent='Demo-BoxLayoutManager-Example2']/div/div[@class='uif-inputField uif-inputField-labelTop uif-boxLayoutHorizontalItem'][2]/input[@name='inputField6']");
60 }
61
62 protected void testLayoutManagersNestedExample1() throws Exception {
63 selectByName("exampleShown","Nested Example 1");
64 assertElementPresentByXpath("//div[@data-parent='Demo-BoxLayoutManager-Example3']/div[@class='uif-verticalBoxLayout clearfix']/div/div[@class='uif-horizontalBoxLayout clearfix']/div/span/label");
65 assertElementPresentByXpath("//div[@data-parent='Demo-BoxLayoutManager-Example3']/div[@class='uif-verticalBoxLayout clearfix']/div/div[@class='uif-horizontalBoxLayout clearfix']/div/input[@name='inputField9']");
66 assertElementPresentByXpath("//div[@data-parent='Demo-BoxLayoutManager-Example3']/div[@class='uif-verticalBoxLayout clearfix']/div/div[@class='uif-horizontalBoxLayout clearfix']/div[2]/span/label");
67 assertElementPresentByXpath("//div[@data-parent='Demo-BoxLayoutManager-Example3']/div[@class='uif-verticalBoxLayout clearfix']/div/div[@class='uif-horizontalBoxLayout clearfix']/div[2]/input[@name='inputField10']");
68 }
69
70 protected void testLayoutManagersNestedExample2() throws Exception {
71 selectByName("exampleShown","Nested Example 2");
72 assertElementPresentByXpath("//div[@data-parent='Demo-BoxLayoutManager-Example4']/div[@class='uif-horizontalBoxLayout clearfix']/div/div[@class='uif-verticalBoxLayout clearfix']/div/span/label");
73 assertElementPresentByXpath("//div[@data-parent='Demo-BoxLayoutManager-Example4']/div[@class='uif-horizontalBoxLayout clearfix']/div/div[@class='uif-verticalBoxLayout clearfix']/div/input[@name='inputField13']");
74 assertElementPresentByXpath("//div[@data-parent='Demo-BoxLayoutManager-Example4']/div[@class='uif-horizontalBoxLayout clearfix']/div/div[@class='uif-verticalBoxLayout clearfix']/div[2]/span/label");
75 assertElementPresentByXpath("//div[@data-parent='Demo-BoxLayoutManager-Example4']/div[@class='uif-horizontalBoxLayout clearfix']/div/div[@class='uif-verticalBoxLayout clearfix']/div[2]/input[@name='inputField14']");
76 }
77
78 protected void testLayoutManagersBoxLayoutPadding() throws Exception {
79 selectByName("exampleShown","Padding");
80 assertElementPresentByXpath("//div[@data-parent='Demo-BoxLayoutManager-Example5']/div/div[@style='padding-bottom: 50px;']/span/label");
81 assertElementPresentByXpath("//div[@data-parent='Demo-BoxLayoutManager-Example5']/div/div[@style='padding-bottom: 50px;']/input[@name='inputField17']");
82 assertElementPresentByXpath("//div[@data-parent='Demo-BoxLayoutManager-Example5']/div/div[@style='padding-bottom: 50px;'][2]/span/label");
83 assertElementPresentByXpath("//div[@data-parent='Demo-BoxLayoutManager-Example5']/div/div[@style='padding-bottom: 50px;'][2]/input[@name='inputField18']");
84 }
85
86 protected void testLayoutManagersBoxLayoutItemCSS() throws Exception {
87 selectByName("exampleShown","Item CSS");
88 assertElementPresentByXpath("//div[@data-parent='Demo-BoxLayoutManager-Example6']/div/div/span[@class='uif-labelTop uif-labelBlock']");
89 assertElementPresentByXpath("//div[@data-parent='Demo-BoxLayoutManager-Example6']/div/div/input[@name='inputField21' and @class='uif-textControl']");
90 }
91
92 protected void testLayoutManagersBoxLayoutItemStyle() throws Exception {
93 selectByName("exampleShown","Item style");
94 assertElementPresentByXpath("//div[@data-parent='Demo-BoxLayoutManager-Example7']/div/div[@style='background-color: #99FF99; margin-right: 5px; padding: 5px;']/span");
95 assertElementPresentByXpath("//div[@data-parent='Demo-BoxLayoutManager-Example7']/div/div[@style='background-color: #99FF99; margin-right: 5px; padding: 5px;']/input[@name='inputField24']");
96 }
97
98 @Test
99 public void testLayoutManagersBoxLayoutBookmark() throws Exception {
100 testLayoutManagersVerticalBoxLayout();
101 testLayoutManagersHorizontalBoxLayout();
102 testLayoutManagersNestedExample1();
103 testLayoutManagersNestedExample2();
104 testLayoutManagersBoxLayoutPadding();
105 testLayoutManagersBoxLayoutItemCSS();
106 testLayoutManagersBoxLayoutItemStyle();
107 passed();
108 }
109
110 @Test
111 public void testLayoutManagersBoxLayoutNav() throws Exception {
112 testLayoutManagersVerticalBoxLayout();
113 testLayoutManagersHorizontalBoxLayout();
114 testLayoutManagersNestedExample1();
115 testLayoutManagersNestedExample2();
116 testLayoutManagersBoxLayoutPadding();
117 testLayoutManagersBoxLayoutItemCSS();
118 testLayoutManagersBoxLayoutItemStyle();
119 passed();
120 }
121 }