View Javadoc
1   /**
2    * Copyright 2005-2015 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.labs;
17  
18  import org.junit.Test;
19  import org.kuali.rice.testtools.selenium.WebDriverLegacyITBase;
20  
21  /**
22   * @author Kuali Rice Team (rice.collab@kuali.org)
23   */
24  public class LabsKSAdminRegistrationAft extends WebDriverLegacyITBase {
25  
26      /**
27       * /ksworkshop?viewId=KS-AdminRegistration
28       */
29      public static final String BOOKMARK_URL = "/kr-krad/ksworkshop?viewId=KS-AdminRegistration";
30  
31      @Override
32      protected String getBookmarkUrl() {
33          return BOOKMARK_URL;
34      }
35  
36      @Override
37      protected void navigate() throws Exception {
38      	waitAndClickByLinkText("KS Admin Registration");
39      }
40  
41      protected void testKSAdminRegistration() throws InterruptedException {
42          //Enter Student ID, confirm appropriate data appears on screen.
43      	waitAndTypeByName("studentId","1");
44          waitAndClickById("KS-AdminRegistration-StudentInfoGo");
45          waitForTextPresent("Allison Glass (Allison Glass)");
46  
47          //Delete a line item and confirms it no longer displays.
48          String textToAssert =getTextByXpath("//section[@id='KS-AdminRegistration-Registered']/table/tbody/tr/td/div/div");
49          waitAndClickByXpath("//button[@title='Drop Course']");
50          waitAndClickByXpath("//div[@class='modal-footer' and @data-parent='KS-AdminRegistration-DropRegisteredDialog']/button");
51          waitForTextNotPresent(textToAssert);
52          waitForTextPresent("You have deleted an item from Registered Courses");
53  
54          //Edit a line item and change values for Cr and Reg Options; cancel; confirm page reloads appropriately and changes are not retained.
55          textToAssert =getTextByXpath("//section[@id='KS-AdminRegistration-Registered']/table/tbody/tr/td[3]/div/span");
56          waitAndClickByXpath("//button[@title='Edit Course']");
57          waitForElementPresentByName("registeredCourses[0].credits");
58          selectByName("registeredCourses[0].credits","1.0");
59          selectByName("registeredCourses[0].regOptions","Audit");
60          waitAndClickByXpath("//button[@title='Cancel']");
61          waitForTextPresent(textToAssert);
62  
63          // Edit a line item and change values for Cr and Reg Options; save; confirm page reloads appropriately and changes are retained.
64          textToAssert =getTextByXpath("//section[@id='KS-AdminRegistration-Registered']/table/tbody/tr/td[3]/div/span");
65          waitAndClickByXpath("//button[@title='Edit Course']");
66          waitForElementPresentByName("registeredCourses[0].credits");
67          selectByName("registeredCourses[0].credits","1.0");
68          selectByName("registeredCourses[0].regOptions","Audit");
69          waitAndClickByXpath("//button[@title='Save']");
70          waitForTextPresent("Audit");
71          waitForTextPresent("1.0");
72  
73          // Click Add Another; change or add values; click Deny under Registration Issues; confirm new line item does not appear.
74          waitAndClickById("KS-AdminRegistration-RegFor_add");
75          waitAndTypeByName("pendingCourses[1].code","1");
76          waitAndTypeByName("pendingCourses[1].section","1");
77          waitAndClickByXpath("//button[contains(text(),'Register')]");
78          waitForElementPresentByXpath("//select[@name='pendingCourses[0].credits']");
79          selectByName("pendingCourses[0].credits","2.0");
80          waitAndClickByXpath("//div[@data-parent='KS-AdminRegistration-RegisterDialogResponse']/button[contains(text(),'Cancel')]");
81  
82          // Click Add Another; change or add values; click Allow under Registration Issues; confirm new line item appears and displays corrects values.
83          waitAndClickById("KS-AdminRegistration-RegFor_add");
84          waitAndTypeByName("pendingCourses[1].code","1");
85          waitAndTypeByName("pendingCourses[1].section","1");
86          waitAndClickByXpath("//button[contains(text(),'Register')]");
87          waitForElementPresentByXpath("//select[@name='pendingCourses[0].credits']");
88          selectByName("pendingCourses[0].credits","2.0");
89          waitAndClickByXpath("//button[contains(text(),'Confirm Registration')]");
90          waitForTextPresent("2.0");
91      }
92  
93      @Test
94      public void testKSAdminRegistrationBookmark() throws Exception {
95          testKSAdminRegistration();
96          passed();
97      }
98  
99      @Test
100     public void testKSAdminRegistrationNav() throws Exception {
101         testKSAdminRegistration();
102         passed();
103     }
104 }