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.UpgradedSeleniumITBase;
20 import junit.framework.Assert;
21 import org.junit.Test;
22
23
24
25
26 public class ServerErrorsIT extends UpgradedSeleniumITBase {
27
28 @Override
29 public String getTestUrl() {
30 return "/kr-krad/uicomponents?viewId=Demo-ValidationLayout&methodToCall=start";
31 }
32
33 @Test
34 public void testServerErrorsIT() throws Exception {
35 waitAndClick("//button[contains(.,'Get Error Messages')]");
36 waitForPageToLoad();
37
38 Thread.sleep(1000);
39 assertElementPresent("css=div[data-messagesfor=\"Demo-ValidationLayout-SectionsPage\"] .uif-errorMessageItem");
40 waitIsVisible("css=div[data-messagesfor=\"Demo-ValidationLayout-Section1\"]");
41 assertElementPresent("css=div[data-messagesfor=\"Demo-ValidationLayout-Section1\"] .uif-errorMessageItem");
42 assertElementPresent("css=div[data-role=\"InputField\"] img[alt=\"Error\"]");
43 waitAndClick("//a[contains(.,'\"Section 1 Title\"')]");
44 mouseOver("//a[contains(.,'Field 1')]");
45 assertElementPresent("css=.uif-errorHighlight");
46 waitAndClick("//a[contains(.,'Field 1')]");
47 waitIsVisible("css=.jquerybubblepopup-innerHtml");
48
49 waitIsVisible("css=.jquerybubblepopup-innerHtml > .uif-serverMessageItems");
50 waitIsVisible("css=.jquerybubblepopup-innerHtml > .uif-serverMessageItems .uif-errorMessageItem-field");
51 waitAndType("name=field1", "");
52 fireEvent("name=field1", "blur");
53 fireEvent("name=field1", "focus");
54 waitIsVisible("css=.jquerybubblepopup-innerHtml");
55
56 waitIsVisible("css=.jquerybubblepopup-innerHtml > .uif-serverMessageItems .uif-errorMessageItem-field");
57 waitIsVisible("css=.jquerybubblepopup-innerHtml > .uif-clientMessageItems");
58 waitIsVisible("css=.jquerybubblepopup-innerHtml > .uif-clientMessageItems .uif-errorMessageItem-field");
59 keyDown("name=field1", "t");
60 keyPress("name=field1", "t");
61 keyUp("name=field1", "t");
62 for (int second = 0; ; second++) {
63 if (second >= 60) {
64 Assert.fail("timeout");
65 }
66 try {
67 if (!isElementPresent("css=.jquerybubblepopup-innerHtml > .uif-clientMessageItems")) {
68 break;
69 }
70 } catch (Exception e) {
71 }
72 Thread.sleep(1000);
73 }
74
75 waitIsVisible("css=.jquerybubblepopup-innerHtml > .uif-serverMessageItems .uif-errorMessageItem-field");
76 Assert.assertFalse(isElementPresent("css=.jquerybubblepopup-innerHtml > .uif-clientMessageItems"));
77 }
78 }