1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17 package edu.samplu.krad.validationmessagesview;
18
19 import edu.samplu.common.ITUtil;
20 import edu.samplu.common.UpgradedSeleniumITBase;
21 import junit.framework.Assert;
22 import org.junit.Test;
23
24
25
26
27 public class ServerInfoIT extends UpgradedSeleniumITBase {
28 @Override
29 public String getTestUrl() {
30 return "/kr-krad/uicomponents?viewId=Demo-ValidationLayout&methodToCall=start";
31 }
32
33 @Test
34 public void testServerInfoIT() throws Exception {
35 waitAndClick("//button[contains(.,'Get Info Messages')]");
36 waitIsVisible("css=div[data-messagesfor=\"Demo-ValidationLayout-SectionsPage\"]");
37 Assert.assertTrue(isVisible("css=div[data-messagesfor=\"Demo-ValidationLayout-SectionsPage\"]"));
38 Assert.assertTrue(isElementPresent("css=div[data-messagesfor=\"Demo-ValidationLayout-SectionsPage\"] .uif-infoMessageItem"));
39 Assert.assertTrue(isVisible("css=div[data-messagesfor=\"Demo-ValidationLayout-Section1\"]"));
40 Assert.assertTrue(isElementPresent("css=div[data-messagesfor=\"Demo-ValidationLayout-Section1\"] .uif-infoMessageItem"));
41 Assert.assertTrue(isElementPresent("css=div[data-role=\"InputField\"] img[alt=\"Information\"]"));
42 mouseOver("//a[contains(.,'Field 1')]");
43 Assert.assertTrue(isElementPresent("css=.uif-infoHighlight"));
44 waitAndClick("//a[contains(.,'Field 1')]");
45 for (int second = 0;; second++) {
46 if (second >= 60) Assert.fail("timeout");
47 try { if (isVisible("css=.jquerybubblepopup-innerHtml")) break; } catch (Exception e) {}
48 Thread.sleep(1000);
49 }
50
51 Assert.assertTrue(isVisible("css=.jquerybubblepopup-innerHtml > .uif-serverMessageItems"));
52 Assert.assertTrue(isVisible("css=.jquerybubblepopup-innerHtml > .uif-serverMessageItems .uif-infoMessageItem-field"));
53 waitAndType("name=field1", "");
54 fireEvent("name=field1", "blur");
55 fireEvent("name=field1", "focus");
56 for (int second = 0;; second++) {
57 if (second >= 60) Assert.fail("timeout");
58 try { if (isVisible("css=.jquerybubblepopup-innerHtml")) break; } catch (Exception e) {}
59 Thread.sleep(1000);
60 }
61
62 Assert.assertTrue(isVisible("css=.jquerybubblepopup-innerHtml > .uif-serverMessageItems .uif-infoMessageItem-field"));
63 for (int second = 0;; second++) {
64 if (second >= 60) Assert.fail("timeout");
65 try { if (isVisible("css=.jquerybubblepopup-innerHtml > .uif-clientMessageItems")) break; } catch (Exception e) {}
66 Thread.sleep(1000);
67 }
68
69 Assert.assertTrue(isVisible("css=.jquerybubblepopup-innerHtml > .uif-clientMessageItems .uif-errorMessageItem-field"));
70 waitAndType("name=field1", "b");
71 fireEvent("name=field1", "blur");
72 fireEvent("name=field1", "focus");
73 for (int second = 0;; second++) {
74 if (second >= 60) Assert.fail("timeout");
75 try { if (!isElementPresent("css=.jquerybubblepopup-innerHtml > .uif-clientMessageItems")) break; } catch (Exception e) {}
76 Thread.sleep(1000);
77 }
78 fireEvent("name=field1", "blur");
79
80 Assert.assertTrue(!isVisible("css=.jquerybubblepopup-innerHtml > .uif-serverMessageItems .uif-infoMessageItem-field"));
81 Assert.assertFalse(isElementPresent("css=.jquerybubblepopup-innerHtml > .uif-clientMessageItems"));
82 waitAndType("name=field1", "");
83 fireEvent("name=field1", "focus");
84 fireEvent("name=field1", "blur");
85 Assert.assertTrue(isElementPresent("css=.uif-hasError"));
86 Assert.assertTrue(isElementPresent("css=img[src*=\"error.png\"]"));
87 }
88 }