View Javadoc

1   /**
2    * Copyright 2005-2013 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 edu.samplu.krad.library.collections;
17  
18  import org.junit.Test;
19  
20  import org.kuali.rice.testtools.selenium.SmokeTestBase;
21  
22  /**
23   * @author Kuali Rice Team (rice.collab@kuali.org)
24   */
25  public class DemoLibraryCollectionFeaturesRowDetailsSmokeTest extends SmokeTestBase {
26  
27      /**
28       * /kr-krad/kradsampleapp?viewId=Demo-TableLayoutDetails-View&methodToCall=start
29       */
30      public static final String BOOKMARK_URL = "/kr-krad/kradsampleapp?viewId=Demo-TableLayoutDetails-View&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-Example1']/div[@class='uif-verticalBoxLayout clearfix']/div/div[@class='dataTables_wrapper']/table/tbody/tr[@class='detailsRow']")) {
46          fail("Row Details Present");
47        }
48        waitAndClickButtonByText("Open/Close Row Details");
49        assertElementPresentByXpath("//div[@id='Demo-TableLayoutDetails-Example1']/div[@class='uif-verticalBoxLayout clearfix']/div/div[@class='dataTables_wrapper']/table/tbody/tr[@class='detailsRow']");
50        waitAndClickButtonByText("Open/Close Row Details");
51        if(isElementPresentByXpath("//div[@id='Demo-TableLayoutDetails-Example1']/div[@class='uif-verticalBoxLayout clearfix']/div/div[@class='dataTables_wrapper']/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-Example3']/div[@class='uif-verticalBoxLayout clearfix']/div/div[@class='dataTables_wrapper']/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-Example3']/div[@class='uif-verticalBoxLayout clearfix']/div/div[@class='dataTables_wrapper']/table/tbody/tr[@class='detailsRow']/td/div/div[@class='uif-verticalBoxLayout clearfix']/div[@class='uif-disclosure uif-boxLayoutVerticalItem clearfix']/div[@class='uif-disclosureContent']/div[@class='dataTables_wrapper']/table");
77          waitAndClickByXpath("//a[@id='Demo-TableLayoutDetails-Section3_detLink_line0']");
78          if(isElementPresentByXpath("//div[@id='Demo-TableLayoutDetails-Example3']/div[@class='uif-verticalBoxLayout clearfix']/div/div[@class='dataTables_wrapper']/table/tbody/tr[@class='detailsRow']/td/div/div[@class='uif-verticalBoxLayout clearfix']/div[@class='uif-disclosure uif-boxLayoutVerticalItem clearfix']/div[@class='uif-disclosureContent']/div[@class='dataTables_wrapper']/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-Example4']/div[@class='uif-verticalBoxLayout clearfix']/div/div[@class='dataTables_wrapper']/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-Example4']/div[@class='uif-verticalBoxLayout clearfix']/div/div[@class='dataTables_wrapper']/table/tbody/tr[@class='detailsRow']/td/div/div[@class='uif-verticalBoxLayout clearfix']/div[@class='uif-stackedSubCollection uif-boxLayoutVerticalItem clearfix']/div[@class='uif-stackedCollectionLayout']/div/table");
91          waitAndClickByXpath("//a[@id='Demo-TableLayoutDetails-Section4_detLink_line0']");
92          if(isElementPresentByXpath("//div[@id='Demo-TableLayoutDetails-Example4']/div[@class='uif-verticalBoxLayout clearfix']/div/div[@class='dataTables_wrapper']/table/tbody/tr[@class='detailsRow']/td/div/div[@class='uif-verticalBoxLayout clearfix']/div[@class='uif-stackedSubCollection uif-boxLayoutVerticalItem clearfix']/div[@class='uif-stackedCollectionLayout']/div/table")) {
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-Example5']/div[@class='uif-verticalBoxLayout clearfix']/div/div[@class='dataTables_wrapper']/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-Example5']/div[@class='uif-verticalBoxLayout clearfix']/div/div[@class='dataTables_wrapper']/table/tbody/tr[@class='detailsRow']/td/div/div[@class='uif-verticalBoxLayout clearfix']/div[@class='uif-tableSubCollection uif-boxLayoutVerticalItem clearfix']/div[@class='dataTables_wrapper']/table");
105         waitAndClickByXpath("//a[@id='Demo-TableLayoutDetails-Section5_detLink_line0']");
106         if(isElementPresentByXpath("//div[@id='Demo-TableLayoutDetails-Example5']/div[@class='uif-verticalBoxLayout clearfix']/div/div[@class='dataTables_wrapper']/table/tbody/tr[@class='detailsRow']/td/div/div[@class='uif-verticalBoxLayout clearfix']/div[@class='uif-tableSubCollection uif-boxLayoutVerticalItem clearfix']/div[@class='dataTables_wrapper']/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         if(isElementPresentByXpath("//div[@id='Demo-TableLayoutDetails-Example6']/div[@class='uif-verticalBoxLayout clearfix']/div/div[@class='dataTables_wrapper']/table/tbody/tr[@class='detailsRow']")) {
115           fail("Row Details Present");
116         }
117         waitAndClickByXpath("//a[@id='Demo-TableLayoutDetails-Section6_detLink_add']");
118         assertElementPresentByXpath("//div[@id='Demo-TableLayoutDetails-Example6']/div[@class='uif-verticalBoxLayout clearfix']/div/div[@class='dataTables_wrapper']/table/tbody/tr[@class='detailsRow']");
119         waitAndClickByXpath("//div[@id='Demo-TableLayoutDetails-Section6']/button");
120         if(isElementPresentByXpath("//div[@id='Demo-TableLayoutDetails-Example6']/div[@class='uif-verticalBoxLayout clearfix']/div/div[@class='dataTables_wrapper']/table/tbody/tr[@class='detailsRow']")) {
121           fail("Row Details Present");
122         }
123       }
124     
125     @Test
126     public void testCollectionFeaturesRowDetailsBookmark() throws Exception {
127         testCollectionFeaturesRowDetails();
128         testCollectionFeaturesRowDetailsAjaxRetrival();
129         testCollectionFeaturesRowDetailsTableSubCollection();
130         testCollectionFeaturesRowDetailsStackedSubCollection();
131         testCollectionFeaturesRowDetailsNestedDetails();
132         testCollectionFeaturesRowDetailsOpenedDetails();
133         passed();
134     }
135 
136     @Test
137     public void testCollectionFeaturesRowDetailsNav() throws Exception {
138         testCollectionFeaturesRowDetails();
139         testCollectionFeaturesRowDetailsAjaxRetrival();
140         testCollectionFeaturesRowDetailsTableSubCollection();
141         testCollectionFeaturesRowDetailsStackedSubCollection();
142         testCollectionFeaturesRowDetailsNestedDetails();
143         testCollectionFeaturesRowDetailsOpenedDetails();
144         passed();
145     }  
146 }