1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18 package edu.samplu.krad.validationmessagesview;
19
20 import edu.samplu.common.WebDriverLegacyITBase;
21 import junit.framework.Assert;
22 import org.junit.Test;
23
24
25
26
27 public class ServerErrorsLegacyIT extends WebDriverLegacyITBase {
28
29 @Override
30 public String getTestUrl() {
31 return "/kr-krad/uicomponents?viewId=Demo-ValidationLayout&methodToCall=start";
32 }
33
34 @Test
35 public void testServerErrorsIT() throws Exception {
36 waitAndClickByXpath("//button[contains(.,'Get Error Messages')]");
37 waitForPageToLoad();
38
39 Thread.sleep(5000);
40 assertElementPresent("div[data-messagesfor=\"Demo-ValidationLayout-SectionsPage\"] .uif-errorMessageItem");
41 waitIsVisibleByXpath("//div[@data-headerfor='Demo-ValidationLayout-Section1']");
42 assertElementPresentByXpath("//*[@data-messageitemfor='Demo-ValidationLayout-Section1' and @class='uif-errorMessageItem']");
43 assertElementPresent("div[data-role=\"InputField\"] img[alt=\"Error\"]");
44 assertElementPresentByXpath("//a[contains(.,'Section 1 Title')]");
45
46 fireMouseOverEventByXpath("//a[contains(.,'Field 1')]");
47 assertElementPresent(".uif-errorMessageItem-field");
48 waitAndClickByXpath("//a[contains(.,'Field 1')]");
49 Thread.sleep(2000);
50 waitIsVisible(".jquerybubblepopup-innerHtml");
51
52 waitIsVisible(".jquerybubblepopup-innerHtml > .uif-serverMessageItems");
53 waitIsVisible(".jquerybubblepopup-innerHtml > .uif-serverMessageItems .uif-errorMessageItem-field");
54 waitAndTypeByName("field1", "");
55 fireEvent("field1", "blur");
56 fireEvent("field1", "focus");
57 waitIsVisible(".jquerybubblepopup-innerHtml");
58
59 waitIsVisible(".jquerybubblepopup-innerHtml > .uif-serverMessageItems .uif-errorMessageItem-field");
60 waitIsVisible(".jquerybubblepopup-innerHtml > .uif-clientMessageItems");
61 waitIsVisible(".jquerybubblepopup-innerHtml > .uif-clientMessageItems .uif-errorMessageItem-field");
62 waitAndTypeByName("field1", "t");
63
64
65
66 for (int second = 0; ; second++) {
67 if (second >= 60) {
68 Assert.fail("timeout");
69 }
70 try {
71 if (!isElementPresent(".jquerybubblepopup-innerHtml > .uif-clientMessageItems")) {
72 break;
73 }
74 } catch (Exception e) {
75 }
76 Thread.sleep(1000);
77 }
78
79 waitIsVisible(".jquerybubblepopup-innerHtml > .uif-serverMessageItems .uif-errorMessageItem-field");
80 Assert.assertFalse(isElementPresent(".jquerybubblepopup-innerHtml > .uif-clientMessageItems"));
81 passed();
82 }
83 }