001 /**
002 * Copyright 2005-2013 The Kuali Foundation
003 *
004 * Licensed under the Educational Community License, Version 2.0 (the "License");
005 * you may not use this file except in compliance with the License.
006 * You may obtain a copy of the License at
007 *
008 * http://www.opensource.org/licenses/ecl2.php
009 *
010 * Unless required by applicable law or agreed to in writing, software
011 * distributed under the License is distributed on an "AS IS" BASIS,
012 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
013 * See the License for the specific language governing permissions and
014 * limitations under the License.
015 */
016 package edu.samplu.krad.library.collections;
017
018 import org.junit.Test;
019
020 import org.kuali.rice.testtools.selenium.SmokeTestBase;
021
022 /**
023 * @author Kuali Rice Team (rice.collab@kuali.org)
024 */
025 public class DemoLibraryCollectionFeaturesRowDetailsSmokeTest extends SmokeTestBase {
026
027 /**
028 * /kr-krad/kradsampleapp?viewId=Demo-TableLayoutDetails-View&methodToCall=start
029 */
030 public static final String BOOKMARK_URL = "/kr-krad/kradsampleapp?viewId=Demo-TableLayoutDetails-View&methodToCall=start";
031
032 @Override
033 protected String getBookmarkUrl() {
034 return BOOKMARK_URL;
035 }
036
037 @Override
038 protected void navigate() throws Exception {
039 waitAndClickById("Demo-LibraryLink", "");
040 waitAndClickByLinkText("Collection Features");
041 waitAndClickByLinkText("Row Details");
042 }
043
044 protected void testCollectionFeaturesRowDetails() throws Exception {
045 if(isElementPresentByXpath("//div[@id='Demo-TableLayoutDetails-Example1']/div[@class='uif-verticalBoxLayout clearfix']/div/div[@class='dataTables_wrapper']/table/tbody/tr[@class='detailsRow']")) {
046 fail("Row Details Present");
047 }
048 waitAndClickButtonByText("Open/Close Row Details");
049 assertElementPresentByXpath("//div[@id='Demo-TableLayoutDetails-Example1']/div[@class='uif-verticalBoxLayout clearfix']/div/div[@class='dataTables_wrapper']/table/tbody/tr[@class='detailsRow']");
050 waitAndClickButtonByText("Open/Close Row Details");
051 if(isElementPresentByXpath("//div[@id='Demo-TableLayoutDetails-Example1']/div[@class='uif-verticalBoxLayout clearfix']/div/div[@class='dataTables_wrapper']/table/tbody/tr[@class='detailsRow']")) {
052 fail("Row Details Present");
053 }
054 waitAndClickButtonByText("Open/Close Row Details");
055 }
056
057 protected void testCollectionFeaturesRowDetailsAjaxRetrival() throws Exception {
058 selectByName("exampleShown","Ajax Retrieval");
059 if(isElementPresentByXpath("//div[@id='Demo-TableLayoutDetails-Example2']/div[@class='uif-verticalBoxLayout clearfix']/div/div[@class='dataTables_wrapper']/table/tbody/tr[@class='detailsRow']")) {
060 fail("Row Details Present");
061 }
062 waitAndClickByXpath("//a[@id='Demo-TableLayoutDetails-Section2_detLink_line0']");
063 assertElementPresentByXpath("//div[@id='Demo-TableLayoutDetails-Example2']/div[@class='uif-verticalBoxLayout clearfix']/div/div[@class='dataTables_wrapper']/table/tbody/tr[@class='detailsRow']");
064 waitAndClickByXpath("//a[@id='Demo-TableLayoutDetails-Section2_detLink_line0']");
065 if(isElementPresentByXpath("//div[@id='Demo-TableLayoutDetails-Example2']/div[@class='uif-verticalBoxLayout clearfix']/div/div[@class='dataTables_wrapper']/table/tbody/tr[@class='detailsRow']")) {
066 fail("Row Details Present");
067 }
068 }
069
070 protected void testCollectionFeaturesRowDetailsTableSubCollection() throws Exception {
071 selectByName("exampleShown","W/ Table SubCollection");
072 if(isElementPresentByXpath("//div[@id='Demo-TableLayoutDetails-Example3']/div[@class='uif-verticalBoxLayout clearfix']/div/div[@class='dataTables_wrapper']/table/tbody/tr[@class='detailsRow']")) {
073 fail("Row Details Present");
074 }
075 waitAndClickByXpath("//a[@id='Demo-TableLayoutDetails-Section3_detLink_line0']");
076 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");
077 waitAndClickByXpath("//a[@id='Demo-TableLayoutDetails-Section3_detLink_line0']");
078 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")) {
079 fail("Row Details Present");
080 }
081 waitAndClickByXpath("//a[@id='Demo-TableLayoutDetails-Section3_detLink_line0']");
082 }
083
084 protected void testCollectionFeaturesRowDetailsStackedSubCollection() throws Exception {
085 selectByName("exampleShown","W/ Stacked SubCollection");
086 if(isElementPresentByXpath("//div[@id='Demo-TableLayoutDetails-Example4']/div[@class='uif-verticalBoxLayout clearfix']/div/div[@class='dataTables_wrapper']/table/tbody/tr[@class='detailsRow']")) {
087 fail("Row Details Present");
088 }
089 waitAndClickByXpath("//a[@id='Demo-TableLayoutDetails-Section4_detLink_line0']");
090 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");
091 waitAndClickByXpath("//a[@id='Demo-TableLayoutDetails-Section4_detLink_line0']");
092 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")) {
093 fail("Row Details Present");
094 }
095 waitAndClickByXpath("//a[@id='Demo-TableLayoutDetails-Section4_detLink_line0']");
096 }
097
098 protected void testCollectionFeaturesRowDetailsNestedDetails() throws Exception {
099 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 }