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