View Javadoc
1   /**
2    * Copyright 2005-2016 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.layoutmanagers;
17  
18  import org.junit.Test;
19  import org.kuali.rice.testtools.selenium.WebDriverLegacyITBase;
20  
21  /**
22   * This class tests the Table Layout Cases included in Demo Library
23   *
24   * @author Kuali Rice Team (rice.collab@kuali.org)
25   */
26  public class LibraryLayoutManagersTableLayoutAft extends WebDriverLegacyITBase {
27  
28      /**
29       * /kr-krad/kradsampleapp?viewId=Demo-TableLayoutManagerView&methodToCall=start
30       */
31      public static final String BOOKMARK_URL =
32              "/kr-krad/kradsampleapp?viewId=Demo-TableLayoutManagerView&methodToCall=start";
33  
34      @Override
35      protected String getBookmarkUrl() {
36          return BOOKMARK_URL;
37      }
38  
39      @Override
40      protected void navigate() throws Exception {
41          waitAndClickLibraryLink();
42          waitAndClickByLinkText("Layout Managers");
43          waitAndClickByLinkText("Table Layout");
44      }
45  
46      protected void testLayoutManagersBasicTableLayout() throws Exception {
47          selectByName("exampleShown","Basic Table Layout");
48          waitForElementPresentByXpath("//section[@id='Demo-TableLayoutManager-Example1']/div/div/div/table");
49          waitForElementPresentByXpath("//button[@id='Demo-TableLayoutManager-Example1_add']");
50      }
51      
52      protected void testLayoutManagersJqueryTableFeatures() throws Exception {
53          selectByName("exampleShown","jQuery Table Features");
54          waitForElementPresentByXpath("//section[@id='Demo-TableLayoutManager-Example2']/div/div/div/table");
55      }
56      
57      protected void testLayoutManagersAddBlankLineTop() throws Exception {
58          selectByName("exampleShown","Add Blank Line Top");
59          waitForElementPresentByXpath("//section[@data-parent='Demo-TableLayoutManager-Example3']/div/div/table/tbody/tr/td[2]/div/input[@value='A']");
60          waitAndClickByXpath("//section[@data-parent='Demo-TableLayoutManager-Example3']/div/button[contains(text(),'Add Line')]");
61          waitForElementPresentByXpath("//section[@data-parent='Demo-TableLayoutManager-Example3']/div/div/table/tbody/tr/td[2]/div/input[@value='']");
62      }
63      
64      protected void testLayoutManagersAddBlankLineBottom() throws Exception {
65          selectByName("exampleShown","Add Blank Line Bottom");
66          waitForElementPresentByXpath("//section[@data-parent='Demo-TableLayoutManager-Example4']/div/div/table/tbody/tr/td[2]/div/input[@value='A']");
67          waitAndClickByXpath("//section[@data-parent='Demo-TableLayoutManager-Example4']/div/button[contains(text(),'Add Line')]");
68          waitForElementPresentByXpath("//section[@data-parent='Demo-TableLayoutManager-Example4']/div/div/table/tbody/tr[3]/td[2]/div/input[@value='']");
69      }
70      
71      protected void testLayoutManagersAddViaLightBoxTop() throws Exception {
72          selectByName("exampleShown","Add Via Lightbox TOP");
73          waitForElementPresentByXpath("//section[@data-parent='Demo-TableLayoutManager-Example5']/div/div/table/tbody/tr/td[2]/div/input[@value='a']");
74          waitAndClickByXpath("//section[@data-parent='Demo-TableLayoutManager-Example5']/div/button[contains(text(),'Add Line')]");
75          waitForElementPresentByXpath("//section[@class='modal fade uif-cssGridGroup in' and @style='display: block;']");
76          waitAndTypeByName("newCollectionLines['collection5'].field4", "4"); // last first since we are waiting for all inputs to be present
77          jiraAwareTypeByName("newCollectionLines['collection5'].field3", "3");
78          jiraAwareTypeByName("newCollectionLines['collection5'].field2", "2");
79          jiraAwareTypeByName("newCollectionLines['collection5'].field1", "1");
80          waitAndClickByXpath("//section[@class='modal fade uif-cssGridGroup in' and @style='display: block;']/div/div/div[2]/button[2]");
81          waitForElementPresentByXpath("//section[@data-parent='Demo-TableLayoutManager-Example5']/div/div/table/tbody/tr/td[2]/div/input[@value='1']");
82      }
83      
84      protected void testLayoutManagersAddViaLightBoxBottom() throws Exception {
85          selectByName("exampleShown","Add Via Lightbox BOTTOM");
86          waitForElementPresentByXpath("//section[@data-parent='Demo-TableLayoutManager-Example6']/div/div/table/tbody/tr/td[2]/div/input[@value='a']");
87          waitAndClickByXpath("//section[@data-parent='Demo-TableLayoutManager-Example6']/div/button[contains(text(),'Add Line')]");
88          waitForElementPresentByXpath("//section[@class='modal fade uif-cssGridGroup in' and @style='display: block;']");
89          waitAndTypeByName("newCollectionLines['collection6'].field4", "4");
90          jiraAwareTypeByName("newCollectionLines['collection6'].field3", "3");
91          jiraAwareTypeByName("newCollectionLines['collection6'].field2", "2");
92          jiraAwareTypeByName("newCollectionLines['collection6'].field1", "1");
93          waitAndClickByXpath("//section[@class='modal fade uif-cssGridGroup in' and @style='display: block;']/div/div/div[@class='modal-footer']/button[2]");
94          waitForElementPresentByXpath("//section[@data-parent='Demo-TableLayoutManager-Example6']/div/div/table/tbody/tr[4]/td[2]/div/input[@value='1']");
95      }
96      
97      protected void testLayoutManagersActionColumnLeft() throws Exception {
98          selectByName("exampleShown","Action Column Left");
99          waitForElementPresentByXpath("//section[@data-parent='Demo-TableLayoutManager-Example7']/div/div/table/tbody/tr/td/div/fieldset/div/button");
100     }
101     
102     protected void testLayoutManagersActionColumn3() throws Exception {
103         selectByName("exampleShown","Action Column 3");
104         waitForElementPresentByXpath("//section[@data-parent='Demo-TableLayoutManager-Example8']/div/div/table/tbody/tr/td[3]/div/fieldset/div/button");
105     }
106     
107     protected void testLayoutManagersSaveRow() throws Exception {
108         selectByName("exampleShown","Save Row");
109         waitForElementPresentByXpath("//section[@data-parent='Demo-TableLayoutManager-Example9']/div/div/table/tbody/tr/td[6]/div/fieldset/div/button[contains(text(),'Save')]");
110     }
111     
112     protected void testLayoutManagersMultirow() throws Exception {
113         selectByName("exampleShown","Multirow");
114         waitForElementPresentByXpath("//section[@id='Demo-TableLayoutManager-Example10']/div/div/div/table/thead/tr/th[@rowspan='2']");
115     }
116     
117     protected void testLayoutManagersSeparateAddLine() throws Exception {
118         selectByName("exampleShown","Separate Add Line");
119         waitForElementPresentByXpath("//section[@class='uif-collectionItem uif-tableCollectionItem uif-collectionAddItem']");
120     }
121 
122     @Test
123     public void testLayoutManagersBoxLayoutBookmark() throws Exception {
124     	testLayoutManagersAll();
125     }
126 
127     @Test
128     public void testLayoutManagersBoxLayoutNav() throws Exception {
129     	testLayoutManagersAll();
130     }
131     
132     private void testLayoutManagersAll() throws Exception {
133     	testLayoutManagersBasicTableLayout();
134     	testLayoutManagersJqueryTableFeatures();
135     	testLayoutManagersAddBlankLineTop();
136     	testLayoutManagersAddBlankLineBottom();
137     	testLayoutManagersActionColumnLeft();
138     	testLayoutManagersActionColumn3();
139     	testLayoutManagersSaveRow();
140     	testLayoutManagersMultirow();
141     	testLayoutManagersSeparateAddLine();
142         // these to are failing on the Add button click of the lightbox
143         testLayoutManagersAddViaLightBoxBottom();
144         testLayoutManagersAddViaLightBoxTop();
145     	passed();
146     }
147 }