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.collections;
17  
18  import org.junit.Test;
19  
20  import org.kuali.rice.testtools.selenium.WebDriverLegacyITBase;
21  
22  /**
23   * @author Kuali Rice Team (rice.collab@kuali.org)
24   */
25  public class DemoCollectionFeaturesRowDetailsAft extends WebDriverLegacyITBase {
26  
27      /**
28       * /kr-krad/kradsampleapp?viewId=Demo-TableLayoutDetailsView&methodToCall=start
29       */
30      public static final String BOOKMARK_URL = "/kr-krad/kradsampleapp?viewId=Demo-TableLayoutDetailsView&methodToCall=start";
31  
32      @Override
33      protected String getBookmarkUrl() {
34          return BOOKMARK_URL;
35      }
36  
37      @Override
38      protected void navigate() throws Exception {
39          waitAndClickById("Demo-LibraryLink", "");
40          waitAndClickByLinkText("Collection Features");
41          waitAndClickByLinkText("Row Details");
42      }
43  
44      protected void testCollectionFeaturesRowDetails() throws Exception {
45        if(isElementPresentByXpath("//div[@id='Demo-TableLayoutDetails-Section1']/div/table/tbody/tr[@class='detailsRow']")) {
46          fail("Row Details Present");
47        }
48        waitAndClickButtonByText("Open/Close Row Details");
49        assertElementPresentByXpath("//div[@id='Demo-TableLayoutDetails-Section1']/div/table/tbody/tr[@class='detailsRow']");
50        waitAndClickButtonByText("Open/Close Row Details");
51        if(isElementPresentByXpath("//div[@id='Demo-TableLayoutDetails-Section1']/div/table/tbody/tr[@class='detailsRow']")) {
52          fail("Row Details Present");
53        }
54        waitAndClickButtonByText("Open/Close Row Details");
55      }
56      
57      protected void testCollectionFeaturesRowDetailsAjaxRetrival() throws Exception {
58          selectByName("exampleShown","Ajax Retrieval");
59          if(isElementPresentByXpath("//div[@id='Demo-TableLayoutDetails-Example2']/div[@class='uif-verticalBoxLayout clearfix']/div/div[@class='dataTables_wrapper']/table/tbody/tr[@class='detailsRow']")) {
60            fail("Row Details Present");
61          }
62          waitAndClickByXpath("//a[@id='Demo-TableLayoutDetails-Section2_detLink_line0']");
63          assertElementPresentByXpath("//div[@id='Demo-TableLayoutDetails-Example2']/div[@class='uif-verticalBoxLayout clearfix']/div/div[@class='dataTables_wrapper']/table/tbody/tr[@class='detailsRow']");
64          waitAndClickByXpath("//a[@id='Demo-TableLayoutDetails-Section2_detLink_line0']");
65          if(isElementPresentByXpath("//div[@id='Demo-TableLayoutDetails-Example2']/div[@class='uif-verticalBoxLayout clearfix']/div/div[@class='dataTables_wrapper']/table/tbody/tr[@class='detailsRow']")) {
66            fail("Row Details Present");
67          }
68      }
69      
70      protected void testCollectionFeaturesRowDetailsTableSubCollection() throws Exception {
71          selectByName("exampleShown","W/ Table SubCollection");
72          if(isElementPresentByXpath("//div[@id='Demo-TableLayoutDetails-Section3']/div/table/tbody/tr[@class='detailsRow']")) {
73              fail("Row Details Present");
74          }
75          waitAndClickByXpath("//a[@id='Demo-TableLayoutDetails-Section3_detLink_line0']");
76          assertElementPresentByXpath("//div[@id='Demo-TableLayoutDetails-Section3']/div/table/tbody/tr[@class='detailsRow']/td/div/section/div/div/table");
77          waitAndClickByXpath("//a[@id='Demo-TableLayoutDetails-Section3_detLink_line0']");
78          if(isElementPresentByXpath("//div[@id='Demo-TableLayoutDetails-Section3']/div/table/tbody/tr[@class='detailsRow']/td/div/section/div/div/table")) {
79              fail("Row Details Present");
80          }
81          waitAndClickByXpath("//a[@id='Demo-TableLayoutDetails-Section3_detLink_line0']");
82      }
83      
84      protected void testCollectionFeaturesRowDetailsStackedSubCollection() throws Exception {
85          selectByName("exampleShown","W/ Stacked SubCollection");
86          if(isElementPresentByXpath("//div[@id='Demo-TableLayoutDetails-Section4']/div/table/tbody/tr[@class='detailsRow']")) {
87              fail("Row Details Present");
88          }
89          waitAndClickByXpath("//a[@id='Demo-TableLayoutDetails-Section4_detLink_line0']");
90          waitForElementPresentByXpath("//div[@id='Demo-TableLayoutDetails-Section4']/div/table/tbody/tr[@class='detailsRow']/td/div/div[2]/div[2]/table");
91          waitAndClickByXpath("//a[@id='Demo-TableLayoutDetails-Section4_detLink_line0']");
92          if(isElementPresentByXpath("//div[@id='Demo-TableLayoutDetails-Section4']/div/table/tbody/tr[@class='detailsRow']")) {
93              fail("Row Details Present");
94          }
95          waitAndClickByXpath("//a[@id='Demo-TableLayoutDetails-Section4_detLink_line0']");
96      }
97      
98      protected void testCollectionFeaturesRowDetailsNestedDetails() throws Exception {
99          selectByName("exampleShown","Nested Details");
100         if(isElementPresentByXpath("//div[@id='Demo-TableLayoutDetails-Section5']/div/table/tbody/tr[@class='detailsRow']")) {
101             fail("Row Details Present");
102         }
103         waitAndClickByXpath("//a[@id='Demo-TableLayoutDetails-Section5_detLink_line0']");
104         assertElementPresentByXpath("//div[@id='Demo-TableLayoutDetails-Section5']/div/table/tbody/tr[@class='detailsRow']/td/div/section/div/table/tbody/tr/td/div/fieldset/div/a");
105         waitAndClickByXpath("//a[@id='Demo-TableLayoutDetails-Section5_detLink_line0']");
106         if(isElementPresentByXpath("//div[@id='Demo-TableLayoutDetails-Section5']/div/table/tbody/tr[@class='detailsRow']/td/div/section/div/table")) {
107             fail("Row Details Present");
108         }
109         waitAndClickByXpath("//a[@id='Demo-TableLayoutDetails-Section5_detLink_line0']");
110     }
111     
112     protected void testCollectionFeaturesRowDetailsOpenedDetails() throws Exception {
113         selectByName("exampleShown","Opened Details");
114         assertElementPresentByXpath("//div[@id='Demo-TableLayoutDetails-Section6']/div/table/tbody/tr[@class='detailsRow']");
115         waitAndClickByXpath("//a[@id='Demo-TableLayoutDetails-Section6_detLink_add']");
116         assertElementPresentByXpath("//div[@id='Demo-TableLayoutDetails-Section6']/div/table/tbody/tr[@class='detailsRow']/td");
117         waitAndClickByXpath("//div[@id='Demo-TableLayoutDetails-Section6']/button");
118         if(isElementPresentByXpath("//div[@id='Demo-TableLayoutDetails-Section6']/div/table/tbody/tr[@class='detailsRow']/td")) {
119           fail("Row Details Present");
120         }
121       }
122     
123     @Test
124     public void testCollectionFeaturesRowDetailsBookmark() throws Exception {
125         testCollectionFeaturesRowDetails();
126         //testCollectionFeaturesRowDetailsAjaxRetrival();   //Commented as this feature is not present on the environment
127         testCollectionFeaturesRowDetailsTableSubCollection();
128         testCollectionFeaturesRowDetailsStackedSubCollection();
129         testCollectionFeaturesRowDetailsNestedDetails();
130         testCollectionFeaturesRowDetailsOpenedDetails();
131         passed();
132     }
133 
134     @Test
135     public void testCollectionFeaturesRowDetailsNav() throws Exception {
136         testCollectionFeaturesRowDetails();
137         //testCollectionFeaturesRowDetailsAjaxRetrival();	//Commented as this feature is not present on the environment
138         testCollectionFeaturesRowDetailsTableSubCollection();
139         testCollectionFeaturesRowDetailsStackedSubCollection();
140         testCollectionFeaturesRowDetailsNestedDetails();
141         testCollectionFeaturesRowDetailsOpenedDetails();
142         passed();
143     }  
144 }