1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 package edu.sampleu.krad.screenelement;
17
18 import org.junit.Test;
19 import org.kuali.rice.testtools.selenium.AutomatedFunctionalTestUtils;
20 import org.kuali.rice.testtools.selenium.WebDriverLegacyITBase;
21 import org.kuali.rice.testtools.selenium.WebDriverUtils;
22
23
24
25
26 public class StateBasedValidationServerTestsAft extends WebDriverLegacyITBase {
27
28
29
30
31 public static final String BOOKMARK_URL ="/kr-krad/uicomponents?viewId=Demo-StateBasedValidation-Server&methodToCall=start";
32
33 @Override
34 protected String getBookmarkUrl() {
35 return BOOKMARK_URL;
36 }
37
38 @Override
39 protected void navigate() throws InterruptedException {
40 waitAndClickKRAD();
41 waitAndClickByLinkText("State-based Validation (Server test)");
42 switchToWindow("Kuali :: State-based Validation Server-side Test View");
43 }
44
45 private void testStateBasedValidationServerTests() throws Exception{
46
47 waitAndClickButtonByText("Check Form");
48 waitForElementPresentByXpath("//div[@class='uif-inputField uif-inputField-labelTop uif-boxLayoutVerticalItem clearfix uif-hasWarning' and @data-label='Field 1']");
49 waitForElementPresentByXpath("//div[@class='uif-inputField uif-inputField-labelTop uif-boxLayoutVerticalItem clearfix uif-hasWarning' and @data-label='Field 2']");
50 waitForElementPresentByXpath("//div[@class='uif-inputField uif-inputField-labelTop uif-boxLayoutVerticalItem clearfix uif-hasError' and @data-label='Field 3']");
51 waitForElementPresentByXpath("//div[@class='uif-inputField uif-inputField-labelTop uif-boxLayoutVerticalItem clearfix uif-hasError' and @data-label='Field 4']");
52 waitForElementPresentByXpath("//input[@maxlength='50']");
53
54
55 waitAndClickButtonByText("Change to State 2");
56 waitForElementPresentByXpath("//div[@class='uif-inputField uif-inputField-labelTop uif-boxLayoutVerticalItem clearfix uif-hasError' and @data-label='Field 1']");
57 waitForElementPresentByXpath("//div[@class='uif-inputField uif-inputField-labelTop uif-boxLayoutVerticalItem clearfix uif-hasError' and @data-label='Field 2']");
58 waitForElementPresentByXpath("//div[@class='uif-inputField uif-inputField-labelTop uif-boxLayoutVerticalItem clearfix uif-hasError' and @data-label='Field 3']");
59 waitForElementPresentByXpath("//input[@maxlength='50']");
60
61
62 waitAndTypeByName("field5","aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa");
63 waitAndClickButtonByText("Change to State 3");
64 waitForElementPresentByXpath("//div[@class='uif-inputField uif-inputField-labelTop uif-boxLayoutVerticalItem clearfix uif-hasError' and @data-label='Field 2']");
65 waitForElementPresentByXpath("//div[@class='uif-inputField uif-inputField-labelTop uif-boxLayoutVerticalItem clearfix uif-hasError' and @data-label='Field 4']");
66 waitForElementPresentByXpath("//div[@class='uif-inputField uif-inputField-labelTop uif-boxLayoutVerticalItem clearfix uif-hasError' and @data-label='Field 5']");
67 fireMouseOverEventByName("field5");
68 waitForTextPresent("For State 3, Must be at most 25 characters");
69
70
71 waitAndClickButtonByText("Change to State 4");
72 waitForElementPresentByXpath("//div[@class='uif-inputField uif-inputField-labelTop uif-boxLayoutVerticalItem clearfix uif-hasError' and @data-label='Field 2']");
73 waitForElementPresentByXpath("//div[@class='uif-inputField uif-inputField-labelTop uif-boxLayoutVerticalItem clearfix uif-hasError' and @data-label='Field 5']");
74 fireMouseOverEventByName("field5");
75 waitForTextPresent("For State 4, Must be at most 15 characters");
76 }
77
78 @Test
79 public void testStateBasedValidationServerTestsBookmark() throws Exception {
80 testStateBasedValidationServerTests();
81 passed();
82 }
83
84 @Test
85 public void testStateBasedValidationServerTestsNav() throws Exception {
86 testStateBasedValidationServerTests();
87 passed();
88 }
89
90 }