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.WebDriverLegacyITBase;
20 import junit.framework.Assert;
21 import org.junit.Test;
22
23
24
25
26 public class ServerInfoLegacyIT extends WebDriverLegacyITBase {
27 @Override
28 public String getTestUrl() {
29 return "/kr-krad/uicomponents?viewId=Demo-ValidationLayout&methodToCall=start";
30 }
31
32 @Test
33 public void testServerInfoIT() throws Exception {
34 waitAndClickByXpath("//button[contains(.,'Get Info Messages')]");
35 waitIsVisibleByXpath("//div[@data-messagesfor='Demo-ValidationLayout-SectionsPage']");
36
37 Assert.assertTrue(isVisibleByXpath("//div[@data-messagesfor='Demo-ValidationLayout-SectionsPage']"));
38 Assert.assertTrue(isElementPresent("div[data-messagesfor=\"Demo-ValidationLayout-SectionsPage\"] .uif-infoMessageItem"));
39 Assert.assertTrue(isVisible("div[data-messagesfor=\"Demo-ValidationLayout-Section1\"]"));
40 Assert.assertTrue(isElementPresent("div[data-messagesfor=\"Demo-ValidationLayout-Section1\"] .uif-infoMessageItem"));
41 Assert.assertTrue(isElementPresentByXpath("//div[@data-role='InputField']//img[@alt='Information']"));
42 fireMouseOverEventByXpath("//a[contains(.,'Field 1')]");
43 Assert.assertTrue(isElementPresent(".uif-infoHighlight"));
44 waitAndClickByXpath("//a[contains(.,'Field 1')]");
45 for (int second = 0;; second++) {
46 if (second >= 60) Assert.fail("timeout");
47 try { if (isVisible(".jquerybubblepopup-innerHtml")) break; } catch (Exception e) {}
48 Thread.sleep(1000);
49 }
50
51 Assert.assertTrue(isVisible(".jquerybubblepopup-innerHtml > .uif-serverMessageItems"));
52 Assert.assertTrue(isVisible(".jquerybubblepopup-innerHtml > .uif-serverMessageItems .uif-infoMessageItem-field"));
53 waitAndTypeByName("field1", "");
54 fireEvent("field1", "blur");
55 fireEvent("field1", "focus");
56 for (int second = 0;; second++) {
57 if (second >= 60) Assert.fail("timeout");
58 try { if (isVisible(".jquerybubblepopup-innerHtml")) break; } catch (Exception e) {}
59 Thread.sleep(1000);
60 }
61
62 Assert.assertTrue(isVisible(".jquerybubblepopup-innerHtml > .uif-serverMessageItems .uif-infoMessageItem-field"));
63 for (int second = 0;; second++) {
64 if (second >= 60) Assert.fail("timeout");
65 try { if (isVisible(".jquerybubblepopup-innerHtml > .uif-clientMessageItems")) break; } catch (Exception e) {}
66 Thread.sleep(1000);
67 }
68
69 Assert.assertTrue(isVisible(".jquerybubblepopup-innerHtml > .uif-clientMessageItems .uif-errorMessageItem-field"));
70 waitAndTypeByName("field1", "b");
71 fireEvent("field1", "blur");
72 fireEvent("field1", "focus");
73 for (int second = 0;; second++) {
74 if (second >= 60) Assert.fail("timeout");
75 try { if (!isElementPresent(".jquerybubblepopup-innerHtml > .uif-clientMessageItems")) break; } catch (Exception e) {}
76 Thread.sleep(1000);
77 }
78 fireEvent("field1", "blur");
79 Thread.sleep(3000);
80 Assert.assertTrue(!isVisible(".jquerybubblepopup-innerHtml > .uif-serverMessageItems .uif-infoMessageItem-field"));
81 Assert.assertFalse(isElementPresent(".jquerybubblepopup-innerHtml > .uif-clientMessageItems"));
82 fireEvent("field1", "focus");
83 clearTextByName("field1");
84 fireEvent("field1", "blur");
85 Assert.assertTrue(isElementPresent("div.uif-hasError"));
86 Assert.assertTrue(isElementPresent("img[src*=\"error.png\"]"));
87 passed();
88 }
89 }