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.general;
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 LibraryGeneralFeaturesAuthorizationAft extends WebDriverLegacyITBase {
26  
27      /**
28       * /kr-krad/kradsampleapp?viewId=Demo-AuthorizationView
29       */
30      public static final String BOOKMARK_URL = "/kr-krad/kradsampleapp?viewId=Demo-AuthorizationView";
31  
32      @Override
33      protected String getBookmarkUrl() {
34          return BOOKMARK_URL;
35      }
36  
37      @Override
38      protected void navigate() throws Exception {
39          waitAndClickLibraryLink();
40          waitAndClickByLinkText("General Features");
41          waitAndClickByLinkText("Authorization");
42      }
43  
44      protected void testGeneralFeaturesAuthorizationSecureGroupView() throws Exception {
45      	selectByName("exampleShown","Secure Group View");
46          waitForElementPresentByXpath("//section[@id='Demo-Authorization-Example1']/div/div[@id='Uif-BreadcrumbWrapper']");
47      }
48      
49      protected void testGeneralFeaturesAuthorizationSecureGroupEdit() throws Exception {
50      	selectByName("exampleShown","Secure Group Edit");
51      	waitForElementPresentByXpath("//section[@id='Demo-Authorization-Example2']/div/div/label");
52      }
53      
54      protected void testGeneralFeaturesAuthorizationSecureFields() throws Exception {
55      	selectByName("exampleShown","Secure Fields");
56      	waitForElementPresentByXpath("//section[@id='Demo-Authorization-Example3']/div/div/input");
57      	waitForElementNotPresent(By.xpath("//section[@id='Demo-Authorization-Example3']/div/div[2]/input"));
58      	waitForElementNotPresent(By.xpath("//section[@id='Demo-Authorization-Example3']/div/div/label[contains(text(),'Field 2:')]"));
59      }
60      
61      protected void testGeneralFeaturesAuthorizationSecureFieldGroup() throws Exception {
62      	selectByName("exampleShown","Secure Fields");
63      	waitForElementPresentByXpath("//section[@id='Demo-Authorization-Example4']/div/div/input");
64      	waitForElementNotPresent(By.xpath("//section[@id='Demo-Authorization-Example4']/div/div[2]/input"));
65      	waitForElementNotPresent(By.xpath("//section[@id='Demo-Authorization-Example4']/div/div/label[contains(text(),'Field 2:')]"));
66      }
67      
68      protected void testGeneralFeaturesAuthorizationSecureActions() throws Exception {
69      	selectByName("exampleShown","Secure Actions");
70      	waitForElementPresentByXpath("//section[@id='Demo-Authorization-Example5']/div/button[contains(text(),'Close')]");
71      	waitForElementNotPresent(By.xpath("//section[@id='Demo-Authorization-Example5']/div/button[contains(text(),'Save')]"));
72      }
73      
74      protected void testGeneralFeaturesAuthorizationSecureWidgets() throws Exception {
75      	selectByName("exampleShown","Secure Widgets");
76      	waitForElementPresentByXpath("//section[@id='Demo-Authorization-Example6']/div/div/input");
77      	waitForElementNotPresent(By.xpath("//section[@id='Demo-Authorization-Example6']/div/div/a"));
78      }
79      
80      protected void testGeneralFeaturesAuthorizationSecureLineView() throws Exception {
81      	selectByName("exampleShown","Secure Line View");
82      	waitForElementPresentByXpath("//section[@id='Demo-Authorization-Example7']/div/table");
83      	waitForElementNotPresent(By.xpath("//section[@id='Demo-Authorization-Example7']/div/table[2]"));
84      }
85      
86      protected void testGeneralFeaturesAuthorizationSecureLineEdit() throws Exception {
87      	selectByName("exampleShown","Secure Line Edit");
88      	waitForElementPresentByXpath("//section[@id='Demo-Authorization-Example8']/div/table/tbody/tr[2]/td[2]/div[contains(text(),'A')]");
89      	waitAndClickByXpath("//section[@id='Demo-Authorization-Example8']/div/table/tbody/tr[2]/td[6]/div/fieldset/div/button");
90      	waitForElementNotPresent(By.xpath("//section[@id='Demo-Authorization-Example8']/div/table/tbody/tr[2]/td[2]/div[contains(text(),'A')]"));
91      }
92      
93      protected void testGeneralFeaturesAuthorizationSecureLineFields() throws Exception {
94      	selectByName("exampleShown","Secure Line Fields");
95      	waitForElementPresentByXpath("//section[@id='Demo-Authorization-Example9']/div/table/tbody/tr[2]/td[4]/div[contains(text(),'C')]");
96      	waitForElementPresentByXpath("//section[@id='Demo-Authorization-Example9']/div/table/tbody/tr[2]/td[3]/div[@style='display: none;']");
97      }
98      
99      protected void testGeneralFeaturesAuthorizationSecureLineActions() throws Exception {
100     	selectByName("exampleShown","Secure Line Actions");
101     	waitForElementNotPresent(By.xpath("//section[@id='Demo-Authorization-Example10']/div/table/tbody/tr[2]/td[6]/div/fieldset/div/button"));
102     }
103     
104     protected void testGeneralFeaturesAuthorizationEditModes() throws Exception {
105     	selectByName("exampleShown","Edit Modes");
106     	waitForElementPresentByXpath("//section[@id='Demo-Authorization-Example11']/section/div[2]/input");
107     	waitForElementPresentByXpath("//section[@id='Demo-Authorization-Example11']/section/div[2]/input");
108     }
109     
110     @Test
111     public void testGeneralFeaturesAuthorizationBookmark() throws Exception {
112     	testGeneralFeaturesAuthorizationAll();
113     }
114 
115     @Test
116     public void testGeneralFeaturesAuthorizationNav() throws Exception {
117     	testGeneralFeaturesAuthorizationAll();
118     }  
119     
120     private void testGeneralFeaturesAuthorizationAll() throws Exception {
121     	testGeneralFeaturesAuthorizationSecureGroupView();
122     	testGeneralFeaturesAuthorizationSecureGroupEdit();
123     	testGeneralFeaturesAuthorizationSecureFields();
124     	testGeneralFeaturesAuthorizationSecureFieldGroup();
125     	testGeneralFeaturesAuthorizationSecureActions();
126     	testGeneralFeaturesAuthorizationSecureWidgets();
127     	testGeneralFeaturesAuthorizationSecureLineView();
128     	testGeneralFeaturesAuthorizationSecureLineEdit();
129     	testGeneralFeaturesAuthorizationSecureLineFields();
130     	testGeneralFeaturesAuthorizationSecureLineActions();
131     	testGeneralFeaturesAuthorizationEditModes();
132         passed();
133     }
134 }