1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 package edu.sampleu.krad.validationmessagesview;
17
18 import org.junit.Test;
19 import org.kuali.rice.testtools.selenium.WebDriverLegacyITBase;
20
21
22
23
24
25
26 public class ServerSideTestViewAft extends WebDriverLegacyITBase {
27
28
29
30
31 public static final String BOOKMARK_URL = "/kr-krad/uicomponents?viewId=Demo-ValidationServerSide&methodToCall=start";
32
33 @Override
34 protected String getBookmarkUrl() {
35 return BOOKMARK_URL;
36 }
37
38 protected void navigate() throws InterruptedException {
39 waitAndClickKRAD();
40 waitAndClickByLinkText("ServerSide Constraint Validation Demo");
41 switchToWindow("Kuali :: Validation Server-side Test View");
42 }
43
44
45 protected void testServerSideTestView() throws Exception {
46
47
48 waitAndTypeByName("field9","a");
49 waitAndTypeByName("field10","1");
50 waitAndClickByXpath("//button[@id='usave']");
51 Thread.sleep(4000);
52 assertTextPresent("MinMax Length test: Must be between 2 and 5 characters long");
53 assertTextPresent("MinMax Value test: Value must be greater than 2 and no more than 50");
54 assertTextPresent(new String[]{"Required constraint", "4 errors"});
55
56
57 waitForElementPresentByXpath("//input[@name='field7' and @disabled]");
58 waitAndClickByXpath("//input[@type='checkbox' and @name='booleanField']");
59 if(isElementPresentByXpath("//input[@name='field7' and @disabled]")) {
60 fail("PreRequisite Constraint isn't working !");
61 }
62
63
64 waitAndTypeByName("field14","a");
65 waitAndClickByXpath("//button[@id='usave']");
66 Thread.sleep(4000);
67
68 }
69
70 @Test
71 public void testServerSideTestViewBookmark() throws Exception {
72 testServerSideTestView();
73 passed();
74 }
75
76 @Test
77 public void testServerSideTestViewNav() throws Exception {
78 testServerSideTestView();
79 passed();
80 }
81 }