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 DialogTestViewAft extends WebDriverLegacyITBase {
27
28
29
30
31 public static final String BOOKMARK_URL ="/kr-krad/dialog-configuration-test?viewId=DialogTestView&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("Dialog Test View");
42 switchToWindow("Kuali :: Dialog Test View");
43 }
44
45 private void testDialogTestView() throws Exception{
46 waitAndClickButtonByText("Lightbox from hidden group");
47 validateSelectAuthorDialog();
48 waitAndClickButtonByText("Lightbox from hidden group with overrides");
49 validateSelectAuthorDialog();
50 waitAndClickButtonByText("Lightbox from HTML");
51 validateDialogWithHTML();
52 waitAndClickButtonByText("Predefined OK/Cancel");
53 validateDialogWithPredefinedOkCancel();
54 waitAndClickButtonByText("Radio Buttons");
55 validateDialogWithRadioButton();
56 waitAndClickButtonByText("Lightbox from hidden group with progressive rendering");
57 validateDialogWithProgressiveRendering();
58 waitAndClickButtonByText("Lightbox from hidden image");
59 validateDialogWithHiddenImage();
60 waitAndClickButtonByText("Lightbox from URL");
61 validateDialogWithFormUrl();
62 waitAndClickButtonByText("Client Ajax Dialog");
63 validateDialogWithClientAjax();
64 waitAndClickButtonByText("Regular Group");
65 validateDialogWithRegularGroup();
66 waitAndClickButtonByText("Expression dialog");
67 validateDialogWithExpression();
68 waitAndClickButtonByText("Extended Dialog");
69 validateDialogWithExtended();
70 waitAndClickButtonByText("Displays Response in LightBox");
71 validateDialogWithDisplayResponseInLightBox();
72 waitAndClickButtonByText("Tell Me A Story");
73 waitAndCloseDialog();
74 waitAndClickButtonByText("Close");
75 waitAndClickLinkContainingText("Cancel");
76 }
77
78 private void validateSelectAuthorDialog() throws Exception {
79 waitForElementPresentByXpath("//div[@class='fancybox-skin']/div/div/form/section/header/h3");
80 waitForElementPresentByXpath("//div[@class='fancybox-skin']/div/div/form/section/div/p");
81 waitAndCloseDialog();
82 }
83
84 private void waitAndCloseDialog() throws InterruptedException {
85 jGrowl("Click Dialog Close");
86 waitAndClickByXpath("//a[@class='fancybox-item fancybox-close']");
87 }
88
89 private void validateDialogWithHTML() throws Exception {
90 waitForElementPresentByXpath("//form[@id='kualiLightboxForm']/b");
91 waitAndCloseDialog();
92 }
93
94 private void validateDialogWithPredefinedOkCancel() throws Exception {
95 waitForTextPresent("Please Confirm to Continue");
96 waitAndCloseDialog();
97 }
98
99 private void validateDialogWithRadioButton() throws Exception {
100 waitForElementPresentByXpath("//div[@id='sampleRadioButtonDialog']/div/fieldset/span/input[@type='radio']");
101 waitAndCloseDialog();
102 }
103
104 private void validateDialogWithProgressiveRendering() throws Exception {
105 waitForTextPresent("This is always displayed:");
106 waitAndCloseDialog();
107 }
108
109 private void validateDialogWithHiddenImage() throws Exception {
110 waitForElementPresentByXpath("//img[@src='/krad/images/computer_programming.jpg']");
111 waitAndCloseDialog();
112 }
113
114 private void validateDialogWithFormUrl() throws Exception {
115 waitForElementPresentByXpath("//iframe[@class='fancybox-iframe']");
116 waitAndCloseDialog();
117 }
118
119 private void validateDialogWithClientAjax() throws Exception {
120 waitForTextPresent("Please select from the values below");
121 waitAndCloseDialog();
122 }
123
124 private void validateDialogWithRegularGroup() throws Exception {
125 waitForTextPresent("This group does not inherit from Uif-DialogGroup:");
126 waitAndCloseDialog();
127 }
128
129 private void validateDialogWithExpression() throws Exception {
130 waitForTextPresent("Mark as Ready for Scheduling");
131 waitAndCloseDialog();
132 }
133
134 private void validateDialogWithExtended() throws Exception {
135 waitForElementPresentByXpath("//input[@name='field5']");
136 waitAndCloseDialog();
137 }
138
139 private void validateDialogWithDisplayResponseInLightBox() throws Exception {
140 waitForTextPresent("This group does not inherit from Uif-DialogGroup:");
141 waitAndCloseDialog();
142 }
143
144 @Test
145 public void testDialogTestViewBookmark() throws Exception {
146 testDialogTestView();
147 passed();
148 }
149
150 @Test
151 public void testDialogTestViewNav() throws Exception {
152 testDialogTestView();
153 passed();
154 }
155 }