View Javadoc
1   /**
2    * Copyright 2005-2014 The Kuali Foundation
3    *
4    * Licensed under the Educational Community License, Version 2.0 (the "License");
5    * you may not use this file except in compliance with the License.
6    * You may obtain a copy of the License at
7    *
8    * http://www.opensource.org/licenses/ecl2.php
9    *
10   * Unless required by applicable law or agreed to in writing, software
11   * distributed under the License is distributed on an "AS IS" BASIS,
12   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13   * See the License for the specific language governing permissions and
14   * limitations under the License.
15   */
16  package org.kuali.rice.krad.demo.uif.library.containers;
17  
18  import org.junit.Test;
19  
20  import org.kuali.rice.testtools.selenium.WebDriverLegacyITBase;
21  import org.openqa.selenium.By;
22  
23  /**
24   * @author Kuali Rice Team (rice.collab@kuali.org)
25   */
26  public class LibraryContainerDialogGroupAft extends WebDriverLegacyITBase {
27  
28      /**
29       * /kr-krad/dialog?viewId=Demo-DialogGroupView
30       */
31      public static final String BOOKMARK_URL = "/kr-krad/dialog?viewId=Demo-DialogGroupView";
32      
33      @Override
34      protected String getBookmarkUrl() {
35          return BOOKMARK_URL;
36      }
37  
38      @Override
39      protected void navigate() throws Exception {
40          waitAndClickLibraryLink();
41          waitAndClickByLinkText("Containers");
42          waitAndClickByLinkText("Dialog Group");
43      }
44      
45      protected void testContainerDialogGroupConfirmAction() throws Exception {
46      	waitAndClickByXpath("//section[@id='Demo-DialogGroup-Example1']/button");
47      	waitAndClickByXpath("//section[@id='Uif-DialogGroup-YesNotmp']/div/div/div[@data-parent='Uif-DialogGroup-YesNo']/button[contains(text(),'No')]");
48      }
49  
50      protected void testContainerDialogGroupConfirmWithExplaination() throws Exception {
51      	waitAndClickByLinkText("Confirm with Explanation");
52      	waitAndClickByXpath("//section[@id='Demo-DialogGroup-Example2']/button");
53      	waitForElementPresentByXpath("//section[@id='Demo-DialogEx2']/div/div/div[@class='modal-body']/div/div/textarea");
54      	waitAndClickByXpath("//section[@id='Demo-DialogEx2']/div/div/div[@data-parent='Demo-DialogEx2']/button[contains(text(),'OK')]");
55      	waitForElementPresentByXpath("//a[contains(text(),'Required')]");
56      	waitAndClickByXpath("//section[@id='Demo-DialogEx2']/div/div/div[@data-parent='Demo-DialogEx2']/button[contains(text(),'Cancel')]");
57      }
58      
59      protected void testContainerDialogGroupGetDialogResponse1() throws Exception {
60      	waitAndClickByLinkText("Get Dialog Response Ex. 1");
61      	waitAndClickByXpath("//section[@id='Demo-DialogGroup-Example3']/button");
62      	waitAndClickByXpath("//section[@id='Demo-DialogGroup-DialogResponse1']/div/div/div[@data-parent='Demo-DialogGroup-DialogResponse1']/button[contains(text(),'OK')]");
63      	acceptAlertIfPresent();
64          waitAndClickByXpath("//section[@id='Demo-DialogGroup-Example3']/button");
65      	waitAndClickByXpath("//section[@id='Demo-DialogGroup-DialogResponse1']/div/div/div[@data-parent='Demo-DialogGroup-DialogResponse1']/button[contains(text(),'Cancel')]");
66      	acceptAlertIfPresent();
67      }
68  
69      protected void testContainerDialogGroupGetDialogResponse2() throws Exception {
70      	waitAndClickByLinkText("Get Dialog Response Ex. 2");
71      	waitAndClickByXpath("//section[@id='Demo-DialogGroup-Example4']/button");
72      	waitAndClickByXpath("//section[@id='Demo-DialogGroup-DialogResponse2']/div/div/div[@data-parent='Demo-DialogGroup-DialogResponse2']/button[contains(text(),'Green Eggs and Ham')]");
73      	acceptAlertIfPresent();
74      	waitAndClickByXpath("//section[@id='Demo-DialogGroup-Example4']/button");
75      	waitAndClickByXpath("//section[@id='Demo-DialogGroup-DialogResponse2']/div/div/div[@data-parent='Demo-DialogGroup-DialogResponse2']/button[contains(text(),'Cat in the Hat')]");
76      	acceptAlertIfPresent();
77      	waitAndClickByXpath("//section[@id='Demo-DialogGroup-Example4']/button");
78      	waitAndClickByXpath("//section[@id='Demo-DialogGroup-DialogResponse2']/div/div/div[@data-parent='Demo-DialogGroup-DialogResponse2']/button[contains(text(),'The Grinch')]");
79      	acceptAlertIfPresent();
80      }
81      
82      protected void testContainerDialogGroupShowDialog1() throws Exception {
83      	waitAndClickByLinkText("Show Dialog Ex. 1");
84      	waitAndClickByXpath("//section[@id='Demo-DialogGroup-Example5']/a[contains(text(),'Show Dialog')]");
85      	waitForElementPresentByXpath("//input[@name='inputField1']");
86      	waitForElementPresentByXpath("//input[@name='inputField2']");
87      	waitForElementPresentByXpath("//input[@name='inputField3']");
88      	waitForElementPresentByXpath("//input[@name='inputField4']");
89      	waitForElementPresentByXpath("//input[@name='inputField5']");
90      	waitAndClickByXpath("//section[@id='Demo-DialogGroup-ShowDialog1']/div/div/div[@data-parent='Demo-DialogGroup-ShowDialog1']/button[contains(text(),'Continue')]");
91      }
92  
93      protected void testContainerDialogGroupShowDialog2() throws Exception {
94      	waitAndClickByLinkText("Show Dialog Ex. 2");
95      	waitAndClickByXpath("//section[@id='Demo-DialogGroup-Example6']/a[contains(text(),'Show Dialog')]");
96      	waitForElementPresentByXpath("//section[@id='Demo-DialogGroup-ShowDialog2Refresh' and @style='display: none; background-color: rgba(255, 248, 198, 0);']");
97      	waitAndClickByXpath("//input[@name='inputField6' and @value='show']");
98      	waitForElementPresentByXpath("//section[@id='Demo-DialogGroup-ShowDialog2Refresh' and @style='display: block; background-color: rgba(255, 248, 198, 0);']");
99      	waitAndClickByXpath("//section[@id='Demo-DialogGroup-ShowDialog2']/div/div/div[@data-parent='Demo-DialogGroup-ShowDialog2']/button[contains(text(),'OK')]");
100     }
101     
102     protected void testContainerDialogGroupDialogEvents() throws Exception {
103     	waitAndClickByLinkText("Dialog Events");
104     	waitAndClickByXpath("//section[@id='Demo-DialogGroup-Example7']/button");
105     	waitAndClickByXpath("//section[@id='Demo-DialogGroup-DialogEvents']/div/div/div[@data-parent='Demo-DialogGroup-DialogEvents']/button[contains(text(),'Log out')]");
106     	acceptAlertIfPresent();
107     	acceptAlertIfPresent();
108     	waitAndClickByXpath("//section[@id='Demo-DialogGroup-Example7']/button");
109     	waitAndClickByXpath("//section[@id='Demo-DialogGroup-DialogEvents']/div/div/div[@data-parent='Demo-DialogGroup-DialogEvents']/button[contains(text(),'Continue')]");
110     	acceptAlertIfPresent();
111     	acceptAlertIfPresent();
112     }
113     
114     protected void testContainerDialogGroupServerDialog1() throws Exception {
115     	waitAndClickByLinkText("Server Dialog Ex. 1");
116     	waitAndClickByXpath("//section[@id='Demo-DialogGroup-Example8']/button");
117     }
118     
119     protected void testContainerDialogGroupServerDialog2() throws Exception {
120         waitAndClickByLinkText("Server Dialog Ex. 2");
121         waitAndClickByXpath("//section[@id='Demo-DialogGroup-Example9']/button");
122         waitForProgressLoading();
123         waitAndClickByXpath("//section[@id='Demo-DialogGroup-ServerResponse2']/div/div/div[@data-parent='Demo-DialogGroup-ServerResponse2']/button[contains(text(),'OK')]");
124         waitForElementPresentByXpath("//a[contains(text(),'Required')]");
125         waitIsVisible(By.xpath("//section[@id='Demo-DialogGroup-ServerResponse2']/div/div/div[@data-parent='Demo-DialogGroup-ServerResponse2']/button[contains(text(),'Cancel')]"));
126         waitAndClickByXpath("//section[@id='Demo-DialogGroup-ServerResponse2']/div/div/div[@data-parent='Demo-DialogGroup-ServerResponse2']/button[contains(text(),'Cancel')]");
127     }
128 
129     protected void testContainerDialogGroupAjaxRetrieval() throws Exception {
130     	waitAndClickByLinkText("Ajax Retrieval");
131     	//Needs to fix the functionality.
132     }
133     
134     protected void testContainerDialogGroupValidationInDialog() throws Exception {
135     	waitAndClickByLinkText("Validation in Dialog");
136     	waitAndClickByLinkText("Show Dialog");
137     	waitAndClickByXpath("//section[@id='Demo-DialogGroup-ShowDialog11']/div/div/div[@data-parent='Demo-DialogGroup-ShowDialog11']/button[contains(text(),'Continue')]");
138     	waitForElementPresentByXpath("//a[contains(text(),'Field 1: Required')]");
139     	waitForElementPresentByXpath("//a[contains(text(),'Field 2: Required')]");
140     	waitForElementPresentByXpath("//a[contains(text(),'Field 3: Required')]");
141     	waitForElementPresentByXpath("//a[contains(text(),'Field 4: Required')]");
142     	waitForElementPresentByXpath("//a[contains(text(),'Field 5: Required')]");
143     	waitAndClickByXpath("//section[@id='Demo-DialogGroup-ShowDialog11']/div/div/header/button");
144     }
145 
146     protected void testContainerDialogGroupDialogReuse() throws Exception {
147     	waitAndClickByLinkText("Dialog Reuse");
148     	waitAndClickByXpath("//button[@id='Demo-DialogGroup-WizardStep2_del_line1']");
149     	waitAndClickByXpath("//section[@id='Uif-DialogGroup-YesNotmp']/div/div/div[@data-parent='Uif-DialogGroup-YesNo']/button[contains(text(),'No')]");
150     }
151     
152     protected void testContainerDialogGroupSmallDialog() throws Exception {
153     	waitAndClickByLinkText("Small Dialog");
154     	waitAndClickByXpath("//section[@id='Demo-DialogGroup-Example13']/a");
155     	waitAndClickByXpath("//section[@id='Demo-DialogGroup-ShowSmallDialog']/div/div/div[@data-parent='Demo-DialogGroup-ShowSmallDialog']/button[contains(text(),'OK')]");
156     }
157     
158     protected void testContainerDialogGroupLargeDialog() throws Exception {
159     	waitAndClickByLinkText("Large Dialog");
160     	waitAndClickByXpath("//section[@id='Demo-DialogGroup-Example14']/a");
161     	waitAndClickByXpath("//section[@id='Demo-DialogGroup-ShowLargeDialog']/div/div/div[@data-parent='Demo-DialogGroup-ShowLargeDialog']/button[contains(text(),'OK')]");
162     }
163     
164     protected void testContainerDialogGroupAll() throws Exception {
165     	testContainerDialogGroupConfirmAction();
166     	testContainerDialogGroupGetDialogResponse1();
167     	testContainerDialogGroupGetDialogResponse2();
168     	testContainerDialogGroupShowDialog1();
169     	testContainerDialogGroupShowDialog2();
170     	testContainerDialogGroupDialogEvents();
171         testContainerDialogGroupServerDialog1();
172 //      testContainerDialogGroupServerDialog2(); // fails when run with others, test below
173     	testContainerDialogGroupAjaxRetrieval();
174 //    	testContainerDialogGroupValidationInDialog(); // fails when run with others, test below
175     	testContainerDialogGroupDialogReuse();
176 //    	testContainerDialogGroupSmallDialog(); // fails when run with others, test below
177     	testContainerDialogGroupLargeDialog();
178     }
179     
180     @Test
181     public void testContainerDialogGroupBookmark() throws Exception {
182     	testContainerDialogGroupAll();
183         passed();
184     }
185 
186     @Test
187     public void testContainerDialogGroupNav() throws Exception {
188     	testContainerDialogGroupAll();
189         passed();
190     }
191 
192     @Test
193     public void testContainerDialogGroupServerDialog2Bookmark() throws Exception {
194         testContainerDialogGroupServerDialog2();
195         passed();
196     }
197 
198     @Test
199     public void testContainerDialogGroupServerDialog2Nav() throws Exception {
200         testContainerDialogGroupServerDialog2();
201         passed();
202     }
203 
204     @Test
205     public void testContainerDialogGroupValidationInDialogBookmark() throws Exception {
206         testContainerDialogGroupValidationInDialog();
207         passed();
208     }
209 
210     @Test
211     public void testContainerDialogGroupValidationInDialogNav() throws Exception {
212         testContainerDialogGroupValidationInDialog();
213         passed();
214     }
215 
216     @Test
217     public void testContainerDialogGroupSmallDialogBookmark() throws Exception {
218         testContainerDialogGroupSmallDialog();
219         passed();
220     }
221 
222     @Test
223     public void testContainerDialogGroupSmallDialogNav() throws Exception {
224         testContainerDialogGroupSmallDialog();
225         passed();
226     }
227 }