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.kuali.rice.testtools.selenium.WebDriverUtils;
21  import org.openqa.selenium.By;
22  
23  /**
24   * @author Kuali Rice Team (rice.collab@kuali.org)
25   */
26  public class DemoGeneralFeaturesReadOnlyAft extends WebDriverLegacyITBase {
27  
28      /**
29       * /kr-krad/kradsampleapp?viewId=Demo-UnifiedHeaderView&methodToCall=start
30       */
31      public static final String BOOKMARK_URL = "/kr-krad/kradsampleapp?viewId=Demo-ReadOnlyView";
32      
33      @Override
34      protected String getBookmarkUrl() {
35          return BOOKMARK_URL;
36      }
37  
38      @Override
39      protected void navigate() throws Exception {
40          waitAndClickById("Demo-LibraryLink", "");
41          waitAndClickByLinkText("General Features");
42          waitAndClickByLinkText("Read Only");
43      }
44  
45      protected void testGeneralFeaturesReadOnly() throws Exception {
46          jGrowl("Click Read Only Example link");
47          waitAndClickByXpath("//header[@data-header_for=\"Demo-ReadOnly-Example1\"]/following-sibling::a");
48          switchToWindow("Kuali :: ReadOnly Test");
49          waitForElementPresentByXpath("//input[@name='inputField1']");
50          waitForElementPresentByXpath("//textarea[@name='inputField2']");
51          waitForElementPresentByXpath("//select[@name='inputField3']");
52          waitForElementPresentByXpath("//select[@name='inputField4']");
53          waitForElementPresentByXpath("//input[@name='inputField5']");
54          waitForElementPresentByXpath("//input[@name='booleanField1']");
55          waitForElementPresentByXpath("//input[@name='inputField6']");
56          waitForElementPresentByXpath("//input[@name='inputField7']");
57          waitForElementPresentByXpath("//select[@name='inputField8']");
58          waitForElementPresentByXpath("//input[@name='inputField9']");
59          waitForElementPresentByXpath("//input[@name='checkboxesField1']");
60          waitForElementPresentByXpath("//input[@name='checkboxesField2']");
61          waitAndClickButtonByText("Make ReadOnly");
62          waitForElementNotPresent(By.xpath("//input[@name='inputField1']"), WebDriverUtils.configuredImplicityWait() * 2);
63          waitForElementNotPresent(By.xpath("//textarea[@name='inputField2']"));
64          waitForElementNotPresent(By.xpath("//select[@name='inputField3']"));
65          waitForElementNotPresent(By.xpath("//select[@name='inputField4']"));
66          waitForElementNotPresent(By.xpath("//input[@name='inputField5']"));
67          waitForElementNotPresent(By.xpath("//input[@name='booleanField1']"));
68          waitForElementNotPresent(By.xpath("//input[@name='inputField6']"));
69          waitForElementNotPresent(By.xpath("//input[@name='inputField7']"));
70          waitForElementNotPresent(By.xpath("//select[@name='inputField8']"));
71          waitForElementNotPresent(By.xpath("//input[@name='inputField9']"));
72          waitForElementNotPresent(By.xpath("//input[@name='checkboxesField1']"));
73          waitForElementNotPresent(By.xpath("//input[@name='checkboxesField2']"));
74          waitForTextPresent("false");
75          waitForTextPresent("No Options Selected");
76          driver.close();
77          switchToWindow("Kuali");
78      }
79      
80      @Test
81      public void testGeneralFeaturesReadOnlyBookmark() throws Exception {
82          testGeneralFeaturesReadOnly();
83          passed();
84      }
85  
86      @Test
87      public void testGeneralFeaturesReadOnlyNav() throws Exception {
88          testGeneralFeaturesReadOnly();
89          passed();
90      }  
91  }