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  import org.openqa.selenium.By;
21  
22  /**
23   * @author Kuali Rice Team (rice.collab@kuali.org)
24   */
25  public class LabsTableCollectionEditDetailsAft extends WebDriverLegacyITBase {
26  
27      /**
28       * /kr-krad/labs?viewId=LabsAppContainerFixed
29       */
30      public static final String BOOKMARK_URL = "/kr-krad/labs?viewId=Lab-TableCollectionEditDetails";
31  
32      @Override
33      protected String getBookmarkUrl() {
34          return BOOKMARK_URL;
35      }
36  
37      @Override
38      protected void navigate() throws Exception {
39      	waitAndClickByLinkText("Table Collection Edit Details");
40      }
41  
42      protected void testLabsTableCollectionEditDetails() throws InterruptedException {
43          //Enter data in fields, add line; verify correct data is added in new line.
44          waitAndTypeByName("newCollectionLines['collection1'].field2","999");
45          waitAndTypeByName("newCollectionLines['collection1'].field4","999");
46          waitAndClickByXpath("//button[contains(text(),'Add')]");
47          waitForElementPresentByXpath("//span[contains(text(),'999')]");
48  
49          //Delete new line; verify line is gone from top of list.
50          waitAndClickByXpath("//button[contains(text(),'Delete')]");
51          waitForElementNotPresent(By.xpath("//span[contains(text(),'999')]"));
52  
53          //Edit an existing line; change values in fields; save; verify new values are retained.
54          waitAndClickByXpath("//button[contains(text(),'Edit in Dialog')]");
55          clearTextByName("dialogDataObject.field2");
56          waitAndTypeByName("dialogDataObject.field2","999");
57          clearTextByName("dialogDataObject.field4");
58          waitAndTypeByName("dialogDataObject.field4","999");
59          waitAndClickByXpath("//button[contains(text(),'Save Changes')]");
60          waitForElementPresentByXpath("//span[contains(text(),'999')]");
61          waitForElementPresentByXpath("//pre[contains(text(),'999')]");
62  
63          //Edit an existing line; change values; click No to cancel; verify new values are not retained.
64          waitAndClickByXpath("//button[contains(text(),'Edit in Dialog')]");
65          waitForElementVisibleBy(By.name("dialogDataObject.field2"));
66          clearTextByName("dialogDataObject.field2");
67          waitAndTypeByName("dialogDataObject.field2","111");
68          clearTextByName("dialogDataObject.field4");
69          waitAndTypeByName("dialogDataObject.field4","111");
70          waitAndClickByXpath("//button[contains(text(),'No')]");
71          waitForElementPresentByXpath("//span[contains(text(),'999')]");
72          waitForElementPresentByXpath("//pre[contains(text(),'999')]");
73          waitForElementNotPresent(By.xpath("//span[contains(text(),'111')]"));
74          waitForElementNotPresent(By.xpath("//pre[contains(text(),'111')]"));
75      }
76  
77      @Test
78      public void testLabsTableCollectionEditDetailsBookmark() throws Exception {
79      	testLabsTableCollectionEditDetails();
80          passed();
81      }
82  
83      @Test
84      public void testLabsTableCollectionEditDetailsNav() throws Exception {
85      	testLabsTableCollectionEditDetails();
86          passed();
87      }
88  }