1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 package org.kuali.rice.krad.labs.kitchensink;
17
18 import org.junit.Test;
19
20
21
22
23 public class LabsOtherFieldsAft extends LabsKitchenSinkBase {
24
25
26
27
28 public static final String BOOKMARK_URL = "/kr-krad/uicomponents?viewId=UifCompView&pageId=UifCompView-Page2#UifCompView-Page2";
29
30 @Override
31 protected String getBookmarkUrl() {
32 return BOOKMARK_URL;
33 }
34
35 @Override
36 protected void navigate() throws Exception {
37 navigateToKitchenSink("Other Fields");
38 }
39
40 @Test
41 public void testAttributeSecurityBookmark() throws Exception {
42 testAttributeSecurity();
43 passed();
44 }
45
46 @Test
47 public void testAttributeSecurityNav() throws Exception {
48 testAttributeSecurity();
49 passed();
50 }
51
52 @Test
53 public void testOtherFieldsBookmark() throws Exception {
54 testOtherFields();
55 passed();
56 }
57
58 @Test
59 public void testOtherFieldsNav() throws Exception {
60 testOtherFields();
61 passed();
62 }
63
64 protected void testOtherFields() throws InterruptedException {
65
66 waitForElementPresentByXpath("//div[@class='uif-inputField uif-boxLayoutVerticalItem pull-left clearfix']/label[contains(text(),'Field 1:')]");
67 assertElementPresentByXpath("//div[@class='uif-inputField uif-boxLayoutVerticalItem pull-left clearfix']/input");
68 waitForElementPresentByXpath("//div[@class='uif-inputField uif-boxLayoutVerticalItem pull-left clearfix']/label[contains(text(),'Field 2:')]");
69 waitForElementPresentByXpath("//div[@id='UifCompView-FieldGroup2']/fieldset/div[@class='uif-horizontalBoxGroup clearfix']");
70 waitForElementPresentByXpath("//div[@id='UifCompView-FieldGroup3']/fieldset/div/div/input");
71 waitForElementPresentByXpath("//div[@id='UifCompView-FieldGroup3']/fieldset/div/button");
72
73
74 waitForElementPresentByXpath("//p[@id='UifCompView-MessageField1']");
75 waitForElementPresentByXpath("//p[@id='UifCompView-MessageFieldWithExpression']");
76
77
78 fireMouseOverEventByXpath("//div[@id='UifCompView-SyntaxHighlighter1']/div[@class='uif-syntaxHighlighter']");
79 waitForElementPresentByXpath("//a[@id='UifCompView-SyntaxHighlighter1_syntaxHighlightCopy']");
80 fireMouseOverEventByXpath("//div[@id='UifCompView-SyntaxHighlighter2']/div[@class='uif-syntaxHighlighter']");
81 waitForElementPresentByXpath("//a[@id='UifCompView-SyntaxHighlighter2_syntaxHighlightCopy']");
82 acceptAlertIfPresent();
83 fireMouseOverEventByXpath("//div[@id='UifCompView-SyntaxHighlighter3']/div[@class='uif-syntaxHighlighter']");
84 if(isElementPresentByXpath("//a[@id='UifCompView-SyntaxHighlighter3_syntaxHighlightCopy']")) {
85 fail("Copy is allowed.");
86 }
87
88
89 waitForTextPresent("*********");
90 waitForElementPresentByXpath("*****tInfo111");
91
92
93
94
95 waitForElementPresentByXpath("//img[@alt='pdf image']");
96 assertTextPresent("Image cutline text here ");
97 waitForElementPresentByXpath("//div[@id='UifCompView-ImageField2' and @title='computer programming']");
98
99
100 waitAndClickByXpath("//button[@id='submitButton1']");
101 waitForElementPresentByXpath("//div[@id='UifCompView-PopoverContent-1' and @style='margin-bottom: 0px; padding-left: 10px; display: block;']");
102 waitForElementPresentByXpath("//a[@id='UifCompView-ActionField9']/img[@class='actionImage rightActionImage uif-image']");
103 waitForElementPresentByXpath("//a[@id='UifCompView-ActionField11']/img[@class='actionImage leftActionImage uif-image']");
104 waitForElementPresentByXpath("//a[contains(text(),'ActionLinkField')]");
105 waitForElementPresentByXpath("//a[contains(text(),'ActionLinkField presubmit call true')]");
106 waitForElementPresentByXpath("//a[contains(text(),'ActionLinkField presubmit call false')]");
107 waitForElementPresentByXpath("//a[contains(text(),'ActionLinkField ajaxSubmit call false')]");
108 waitForElementPresentByXpath("//a[contains(text(),'ActionLinkField sucessCallBack')]");
109 waitForElementPresentByXpath("//a[contains(text(),'ActionLinkField validate')]");
110 waitForElementPresentByXpath("//a[contains(text(),'ActionLinkField errorCallBack')]");
111 waitForElementPresentByXpath("//a[contains(text(),'ActionLinkField ajax redirect')]");
112 waitForElementPresentByXpath("//input[@type='image' and @id='UifCompView-ActionField13']");
113 waitForElementPresentByXpath("//button[@id='UifCompView-ActionField14']");
114 waitForElementPresentByXpath("//button[@id='UifCompView-ActionField15']/span/img[@class='actionImage bottomActionImage uif-image']");
115 waitForElementPresentByXpath("//button[@id='UifCompView-ActionField16']/span/img[@class='actionImage topActionImage uif-image']");
116 waitForElementPresentByXpath("//button[@id='UifCompView-ActionField17']/img[@class='actionImage leftActionImage uif-image']");
117 waitForElementPresentByXpath("//button[@id='UifCompView-ActionField18']/img[@class='actionImage rightActionImage uif-image']");
118 waitForElementPresentByXpath("//button[@id='UifCompView-ActionField20' and @disabled]");
119 waitForElementPresentByXpath("//button/img[@alt='Image Only button']");
120
121
122 waitForElementPresentByXpath("//a[@href='http://www.kuali.org' and @target='_self']");
123 waitForElementPresentByXpath("//a[@href='http://www.kuali.org' and @target='_blank']");
124 waitAndClickByXpath("//div[@id='UifCompView-LinkField3']/a[@id='UifCompView-LinkField4']");
125 acceptAlertIfPresent();
126 waitAndClickByXpath("//div[@id='UifCompView-LinkField3']/a[@id='UifCompView-LinkField5']");
127 acceptAlertIfPresent();
128 waitAndClickByXpath("//div[@id='UifCompView-LinkField3']/a[@id='UifCompView-LinkField6']");
129 acceptAlertIfPresent();
130
131
132 waitForElementPresentByXpath("//ul[@id='UifCompView-Accordion1_accordList']/li/a");
133 waitForElementPresentByXpath("//div[@id='UifCompView-SubList1' and @style='display: none;']");
134 waitAndClickByXpath("//ul[@id='UifCompView-Accordion1_accordList']/li/a");
135 waitForElementPresentByXpath("//div[@id='UifCompView-SubList1' and @style='display: block;']");
136 waitForElementPresentByXpath("//div[@id='UifCompView-List1']/ul");
137 waitForElementPresentByXpath("//div[@id='UifCompView-List2']/ul");
138
139
140 waitForElementPresentByXpath("//input[@placeholder and @size='30' and @maxlength='40']");
141 waitForElementPresentByXpath("//input[@size='60']");
142 waitAndClickByXpath("//a[@title='Expand']");
143 waitForElementPresentByXpath("//textarea[@id='textarea_popout_control']");
144 waitAndClickByXpath("//input[@id='done_btn']");
145 waitForElementPresentByXpath("//input[@disabled and @name='field109']");
146 waitForElementPresentByXpath("//input[@style='text-transform: uppercase;']");
147 waitForElementPresentByXpath("//ul[@id='UifCompView-OtherField1_tabList']/li/a[contains(text(),'Text Control Options')]");
148 waitForElementPresentByXpath("//ul[@id='UifCompView-OtherField1_tabList']/li/a[contains(text(),'TextArea Control Options')]");
149
150
151 waitForElementPresentByXpath("//div[@id='UifCompView-OtherField2_tree']/ul/li/a/span[contains(text(),'Item 1 ')]");
152 waitForElementPresentByXpath("//div[@id='UifCompView-OtherField3_tree']/ul/li/div/div[@class='uif-verticalBoxLayout clearfix']");
153 waitForElementPresentByXpath("//iframe[@src='http://www.kuali.org']");
154
155
156 waitForElementPresentByXpath("//div[@style='height: 100px;overflow: auto;']");
157 }
158
159 private void testAttributeSecurity() throws InterruptedException {
160 boolean fullMaskPassed = false;
161 String fullMaskedError = "";
162 waitForProgressLoading();
163 waitForTextPresent("*********");
164 if (isTextPresent("SecretInfo555")) {
165 fullMaskedError = "SecretInfo555 not masked!";
166 } else {
167 fullMaskPassed = true;
168 }
169
170 if (!isTextPresent("*********")) {
171 fullMaskPassed = false;
172 fullMaskedError = fullMaskedError + " SecretInfo555 not masked with stars";
173 }
174
175 boolean partialMaskPassed = false;
176 String partialMaskError = "";
177 if (isTextPresent("SecretInfo111")) {
178 partialMaskError = "SecretInfo111 not masked!";
179 } else {
180 partialMaskPassed = true;
181 }
182
183 if (!isTextPresent("*****tInfo111")) {
184 partialMaskPassed = false;
185 partialMaskError = partialMaskError + " SecretInfo111 not partially masked with stars";
186 }
187
188 if (!fullMaskPassed || !partialMaskPassed) {
189 jiraAwareFail("LabsOtherFieldsAft attribute security fail " + fullMaskedError + " " + partialMaskError);
190 }
191 }
192 }