001 /**
002 * Copyright 2005-2014 The Kuali Foundation
003 *
004 * Licensed under the Educational Community License, Version 2.0 (the "License");
005 * you may not use this file except in compliance with the License.
006 * You may obtain a copy of the License at
007 *
008 * http://www.opensource.org/licenses/ecl2.php
009 *
010 * Unless required by applicable law or agreed to in writing, software
011 * distributed under the License is distributed on an "AS IS" BASIS,
012 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
013 * See the License for the specific language governing permissions and
014 * limitations under the License.
015 */
016 package edu.sampleu.krad.screenelement;
017
018 import org.junit.Test;
019 import org.kuali.rice.testtools.selenium.AutomatedFunctionalTestUtils;
020 import org.kuali.rice.testtools.selenium.WebDriverLegacyITBase;
021 import org.kuali.rice.testtools.selenium.WebDriverUtils;
022
023 /**
024 * @author Kuali Rice Team (rice.collab@kuali.org)
025 */
026 public class DialogTestViewAft extends WebDriverLegacyITBase {
027
028 /**
029 * /kr-krad/dialog-configuration-test?viewId=DialogTestView&methodToCall=start
030 */
031 public static final String BOOKMARK_URL ="/kr-krad/dialog-configuration-test?viewId=DialogTestView&methodToCall=start";
032
033 @Override
034 protected String getBookmarkUrl() {
035 return BOOKMARK_URL;
036 }
037
038 @Override
039 protected void navigate() throws InterruptedException {
040 waitAndClickKRAD();
041 waitAndClickByLinkText("Dialog Test View");
042 switchToWindow("Kuali :: Dialog Test View");
043 }
044
045 private void testDialogTestView() throws Exception{
046 waitAndClickButtonByText("Lightbox from hidden group");
047 validateSelectAuthorDialog();
048 waitAndClickButtonByText("Lightbox from hidden group with overrides");
049 validateSelectAuthorDialog();
050 waitAndClickButtonByText("Lightbox from HTML");
051 validateDialogWithHTML();
052 waitAndClickButtonByText("Predefined OK/Cancel");
053 validateDialogWithPredefinedOkCancel();
054 waitAndClickButtonByText("Radio Buttons");
055 validateDialogWithRadioButton();
056 waitAndClickButtonByText("Lightbox from hidden group with progressive rendering");
057 validateDialogWithProgressiveRendering();
058 waitAndClickButtonByText("Lightbox from hidden image");
059 validateDialogWithHiddenImage();
060 waitAndClickButtonByText("Lightbox from URL");
061 validateDialogWithFormUrl();
062 waitAndClickButtonByText("Client Ajax Dialog");
063 validateDialogWithClientAjax();
064 waitAndClickButtonByText("Regular Group");
065 validateDialogWithRegularGroup();
066 waitAndClickButtonByText("Expression dialog");
067 validateDialogWithExpression();
068 waitAndClickButtonByText("Extended Dialog");
069 validateDialogWithExtended();
070 waitAndClickButtonByText("Displays Response in LightBox");
071 validateDialogWithDisplayResponseInLightBox();
072 }
073
074 private void validateSelectAuthorDialog() throws Exception {
075 waitForElementPresentByXpath("//div[@class='fancybox-skin']/div/div/form/section/header/h3");
076 waitForElementPresentByXpath("//div[@class='fancybox-skin']/div/div/form/section/div/p");
077 waitAndClickByXpath("//a[@class='fancybox-item fancybox-close']");
078 }
079
080 private void validateDialogWithHTML() throws Exception {
081 waitForElementPresentByXpath("//form[@id='kualiLightboxForm']/b");
082 waitAndClickByXpath("//a[@class='fancybox-item fancybox-close']");
083 }
084
085 private void validateDialogWithPredefinedOkCancel() throws Exception {
086 waitForTextPresent("Please Confirm to Continue");
087 waitAndClickByXpath("//a[@class='fancybox-item fancybox-close']");
088 }
089
090 private void validateDialogWithRadioButton() throws Exception {
091 waitForElementPresentByXpath("//div[@id='sampleRadioButtonDialog']/div/fieldset/span/input[@type='radio']");
092 waitAndClickByXpath("//a[@class='fancybox-item fancybox-close']");
093 }
094
095 private void validateDialogWithProgressiveRendering() throws Exception {
096 waitForTextPresent("This is always displayed:");
097 waitAndClickByXpath("//a[@class='fancybox-item fancybox-close']");
098 }
099
100 private void validateDialogWithHiddenImage() throws Exception {
101 waitForElementPresentByXpath("//img[@src='/krad/images/computer_programming.jpg']");
102 waitAndClickByXpath("//a[@class='fancybox-item fancybox-close']");
103 }
104
105 private void validateDialogWithFormUrl() throws Exception {
106 waitForElementPresentByXpath("//iframe[@class='fancybox-iframe']");
107 waitAndClickByXpath("//a[@class='fancybox-item fancybox-close']");
108 }
109
110 private void validateDialogWithClientAjax() throws Exception {
111 waitForTextPresent("Please select from the values below");
112 waitAndClickByXpath("//a[@class='fancybox-item fancybox-close']");
113 }
114
115 private void validateDialogWithRegularGroup() throws Exception {
116 waitForTextPresent("This group does not inherit from Uif-DialogGroup:");
117 waitAndClickByXpath("//a[@class='fancybox-item fancybox-close']");
118 }
119
120 private void validateDialogWithExpression() throws Exception {
121 waitForTextPresent("Mark as Ready for Scheduling");
122 waitAndClickByXpath("//a[@class='fancybox-item fancybox-close']");
123 }
124
125 private void validateDialogWithExtended() throws Exception {
126 waitForElementPresentByXpath("//input[@name='field5']");
127 waitAndClickByXpath("//a[@class='fancybox-item fancybox-close']");
128 }
129
130 private void validateDialogWithDisplayResponseInLightBox() throws Exception {
131 waitForTextPresent("This group does not inherit from Uif-DialogGroup:");
132 waitAndClickByXpath("//a[@class='fancybox-item fancybox-close']");
133 }
134
135 @Test
136 public void testDialogTestViewBookmark() throws Exception {
137 testDialogTestView();
138 passed();
139 }
140
141 @Test
142 public void testDialogTestViewNav() throws Exception {
143 testDialogTestView();
144 passed();
145 }
146 }