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 waitAndClickByXpath("//a[@class='fancybox-item fancybox-close']");
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 waitAndClickByXpath("//a[@class='fancybox-item fancybox-close']");
82 }
83
84 private void validateDialogWithHTML() throws Exception {
85 waitForElementPresentByXpath("//form[@id='kualiLightboxForm']/b");
86 waitAndClickByXpath("//a[@class='fancybox-item fancybox-close']");
87 }
88
89 private void validateDialogWithPredefinedOkCancel() throws Exception {
90 waitForTextPresent("Please Confirm to Continue");
91 waitAndClickByXpath("//a[@class='fancybox-item fancybox-close']");
92 }
93
94 private void validateDialogWithRadioButton() throws Exception {
95 waitForElementPresentByXpath("//div[@id='sampleRadioButtonDialog']/div/fieldset/span/input[@type='radio']");
96 waitAndClickByXpath("//a[@class='fancybox-item fancybox-close']");
97 }
98
99 private void validateDialogWithProgressiveRendering() throws Exception {
100 waitForTextPresent("This is always displayed:");
101 waitAndClickByXpath("//a[@class='fancybox-item fancybox-close']");
102 }
103
104 private void validateDialogWithHiddenImage() throws Exception {
105 waitForElementPresentByXpath("//img[@src='/krad/images/computer_programming.jpg']");
106 waitAndClickByXpath("//a[@class='fancybox-item fancybox-close']");
107 }
108
109 private void validateDialogWithFormUrl() throws Exception {
110 waitForElementPresentByXpath("//iframe[@class='fancybox-iframe']");
111 waitAndClickByXpath("//a[@class='fancybox-item fancybox-close']");
112 }
113
114 private void validateDialogWithClientAjax() throws Exception {
115 waitForTextPresent("Please select from the values below");
116 waitAndClickByXpath("//a[@class='fancybox-item fancybox-close']");
117 }
118
119 private void validateDialogWithRegularGroup() throws Exception {
120 waitForTextPresent("This group does not inherit from Uif-DialogGroup:");
121 waitAndClickByXpath("//a[@class='fancybox-item fancybox-close']");
122 }
123
124 private void validateDialogWithExpression() throws Exception {
125 waitForTextPresent("Mark as Ready for Scheduling");
126 waitAndClickByXpath("//a[@class='fancybox-item fancybox-close']");
127 }
128
129 private void validateDialogWithExtended() throws Exception {
130 waitForElementPresentByXpath("//input[@name='field5']");
131 waitAndClickByXpath("//a[@class='fancybox-item fancybox-close']");
132 }
133
134 private void validateDialogWithDisplayResponseInLightBox() throws Exception {
135 waitForTextPresent("This group does not inherit from Uif-DialogGroup:");
136 waitAndClickByXpath("//a[@class='fancybox-item fancybox-close']");
137 }
138
139 @Test
140 public void testDialogTestViewBookmark() throws Exception {
141 testDialogTestView();
142 passed();
143 }
144
145 @Test
146 public void testDialogTestViewNav() throws Exception {
147 testDialogTestView();
148 passed();
149 }
150 }