1 package edu.samplu.krad.compview;
2
3
4 import edu.samplu.common.WebDriverLegacyITBase;
5
6 import org.junit.Assert;
7 import org.junit.Test;
8
9
10
11
12 public class RichMessagesValidationLegacyIT extends WebDriverLegacyITBase {
13
14 @Override
15 public String getTestUrl() {
16 return "/kr-krad/uicomponents?viewId=RichMessagesView&methodToCall=start";
17 }
18
19 @Test
20 public void testRichMessagesValidationIT() throws Exception {
21
22 checkForIncidentReport(getTestUrl());
23 Thread.sleep(9000);
24
25
26
27 this.verifyBasicFunctionality();
28
29
30 this.verifyAdvancedFunctionality();
31
32
33 this.verifyLettersNumbersValidation();
34
35
36 this.verifyRadioAndCheckBoxGroupFunctionality();
37
38
39 this.verifyLinkDeclarationsFunctionality();
40 passed();
41 }
42
43 private void verifyBasicFunctionality() throws Exception
44 {
45 Assert.assertTrue(isElementPresentByXpath("//input[@type='text' and @name='field1']"));
46 Assert.assertTrue(isElementPresentByXpath("//a[contains(text(), 'Kuali')]"));
47 Assert.assertTrue(isElementPresentByXpath("//input[@type='checkbox' and @name='field2']"));
48 Thread.sleep(3000);
49 }
50
51 private void verifyAdvancedFunctionality() throws Exception
52 {
53
54 Assert.assertTrue(isElementPresentByXpath("//span[@style='color: green;']"));
55 Assert.assertTrue(isElementPresentByXpath("//span[@style='color: blue;']"));
56
57
58 Assert.assertTrue(isElementPresentByXpath("//span[@class='fl-text-underline fl-text-larger']"));
59
60
61 Assert.assertTrue(isElementPresentByXpath("//input[@type='text' and @name='field3']"));
62 Assert.assertTrue(isElementPresentByXpath("//select[@name='field4']"));
63 Assert.assertTrue(isElementPresentByXpath("//button[contains(text(), 'Action Button')]"));
64
65
66 Assert.assertTrue(isElementPresentByXpath("//label[contains(., 'Label With')]/span[contains(., 'Color')]"));
67 Assert.assertTrue(isElementPresentByXpath("//label[contains(., 'Label With')]/i/b[contains(., 'Html')]"));
68 Assert.assertTrue(isElementPresentByXpath("//label[contains(., 'Label With')]/img[@class='uif-image inlineBlock']"));
69
70 Thread.sleep(3000);
71 }
72
73 private void verifyLettersNumbersValidation() throws Exception
74 {
75
76 Assert.assertTrue(isElementPresentByXpath("//input[@type='text' and @name='field5']"));
77 waitAndTypeByXpath("//div[@class='uif-field uif-inputField uif-inputField-labelTop inlineBlock']/input[@name= 'field5']","abc");
78 Assert.assertFalse(isElementPresentByXpath("//div[@class='uif-field uif-inputField uif-inputField-labelTop inlineBlock uif-hasError']"));
79 clearTextByXpath("//div[@class='uif-field uif-inputField uif-inputField-labelTop inlineBlock']/input[@name= 'field5']");
80 waitAndTypeByXpath("//div[@class='uif-field uif-inputField uif-inputField-labelTop inlineBlock']/input[@name= 'field5']","abc12");
81
82 waitAndTypeByXpath("//input[@name= 'field6']","");
83 Assert.assertTrue(isElementPresentByXpath("//div[@class='uif-field uif-inputField uif-inputField-labelTop inlineBlock uif-hasError']"));
84 Thread.sleep(3000);
85 clearTextByXpath("//div[@class='uif-field uif-inputField uif-inputField-labelTop inlineBlock uif-hasError']/input[@name= 'field5']");
86 waitAndTypeByXpath("//div[@class='uif-field uif-inputField uif-inputField-labelTop inlineBlock uif-hasError']/input[@name= 'field5']","abc");
87 waitAndTypeByXpath("//input[@name= 'field6']","");
88
89
90
91 waitAndTypeByXpath("//input[@name= 'field6']","123");
92 Assert.assertFalse(isElementPresentByXpath("//div[@class='uif-field uif-inputField uif-inputField-labelTop inlineBlock uif-hasError']"));
93 clearTextByXpath("//input[@name= 'field6']");
94 waitAndTypeByXpath("//input[@name= 'field6']","123ab");
95 fireEvent("field6","blur");
96 Thread.sleep(5000);
97 Assert.assertTrue(isElementPresentByXpath("//div[@class='uif-field uif-inputField uif-inputField-labelTop inlineBlock uif-hasError']"));
98
99 Thread.sleep(3000);
100 }
101
102 private void verifyRadioAndCheckBoxGroupFunctionality() throws Exception
103 {
104
105 Assert.assertTrue(isElementPresentByXpath("//fieldset[@class='uif-verticalRadioFieldset']/span/input[@type='radio' and @name='field24' and @value='1']"));
106 Assert.assertTrue(isElementPresentByXpath("//fieldset[@class='uif-verticalRadioFieldset']/span/input[@type='radio' and @name='field24' and @value='2']"));
107 Assert.assertTrue(isElementPresentByXpath("//fieldset[@class='uif-verticalRadioFieldset']/span/input[@type='radio' and @name='field24' and @value='3']"));
108 Assert.assertTrue(isElementPresentByXpath("//fieldset[@class='uif-verticalRadioFieldset']/span/input[@type='radio' and @name='field24' and @value='4']"));
109
110
111 Assert.assertTrue(isElementPresentByXpath("//fieldset[@class='uif-verticalCheckboxesFieldset']/span/input[@type='checkbox' and @name='field115' and @value='1']"));
112 Assert.assertTrue(isElementPresentByXpath("//fieldset[@class='uif-verticalCheckboxesFieldset']/span/input[@type='checkbox' and @name='field115' and @value='2']"));
113 Assert.assertTrue(isElementPresentByXpath("//fieldset[@class='uif-verticalCheckboxesFieldset']/span/input[@type='checkbox' and @name='field115' and @value='3']"));
114 Assert.assertTrue(isElementPresentByXpath("//fieldset[@class='uif-verticalCheckboxesFieldset']/span/label/div/select[@name='field4']"));
115
116
117 Assert.assertTrue(isElementPresentByXpath("//input[@type='checkbox' and @name='bField1']"));
118 Assert.assertTrue(isElementPresentByXpath("//input[@type='text' and @name='field103']"));
119
120 }
121
122 private void verifyLinkDeclarationsFunctionality() throws Exception
123 {
124
125 waitAndClickByXpath("//div[contains(., 'Testing link tag')]/a");
126 Thread.sleep(9000);
127 switchToWindow("Open Source Software | www.kuali.org");
128 switchToWindow("Kuali :: Rich Messages");
129
130
131 waitAndClickByXpath("//div[contains(., 'Testing methodToCall action')]/a");
132 Thread.sleep(3000);
133 Assert.assertTrue(isElementPresentByXpath("//div[@class='fancybox-wrap fancybox-desktop fancybox-type-html fancybox-opened']"));
134 Assert.assertTrue(isElementPresentByXpath("//div[@class='uif-validationMessages uif-groupValidationMessages uif-pageValidationMessages uif-pageValidationMessages-error']"));
135 Assert.assertTrue(isElementPresentByXpath("//div[@id='Demo-AdvancedMessagesSection']/div[@class='uif-validationMessages uif-groupValidationMessages']"));
136 Assert.assertTrue(isElementPresentByXpath("//div[@id='Demo-RadioCheckboxMessageSection']/div[@class='uif-validationMessages uif-groupValidationMessages']"));
137
138
139 waitAndClickByXpath("//div[contains(., 'Testing methodToCall action (no client validation check)')]/a");
140 Assert.assertTrue(isElementPresentByXpath("//div[@class='uif-validationMessages uif-groupValidationMessages uif-pageValidationMessages uif-pageValidationMessages-error']"));
141 Assert.assertTrue(isElementPresentByXpath("//div[@class='uif-validationMessages uif-groupValidationMessages']"));
142 Assert.assertTrue(isElementPresentByXpath("//div[@class='uif-validationMessages uif-groupValidationMessages uif-pageValidationMessages uif-pageValidationMessages-error']"));
143 Assert.assertTrue(isElementPresentByXpath("//div[@id='Demo-AdvancedMessagesSection']/div[@class='uif-validationMessages uif-groupValidationMessages']"));
144 Assert.assertTrue(isElementPresentByXpath("//div[@id='Demo-RadioCheckboxMessageSection']/div[@class='uif-validationMessages uif-groupValidationMessages']"));
145 Thread.sleep(3000);
146 }
147
148 }