View Javadoc
1   /**
2    * Copyright 2005-2015 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.labs;
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  
26  public class LabsPerformanceMediumAft extends WebDriverLegacyITBase {
27  
28      /**
29       * /kr-krad/labs?viewId=Lab-PerformanceMedium
30       */
31      public static final String BOOKMARK_URL = "/kr-krad/labs?viewId=Lab-PerformanceMedium";
32  
33      /**
34       * /kr-krad/labs?viewId=Lab-PerformanceMedium&pageId=Lab-Performance-Page1#Lab-Performance-Page2
35       */
36      public static final String BOOKMARK_URL_2 = "/kr-krad/labs?viewId=Lab-PerformanceMedium&pageId=Lab-Performance-Page1#Lab-Performance-Page2&methodToCall=start";
37  
38      @Override
39      protected String getBookmarkUrl() {
40          return BOOKMARK_URL;
41      }
42  
43      @Override
44      protected void navigate() throws Exception {
45          waitAndClickByLinkText("Performance Medium");
46      }
47  
48      @Test
49      public void testPerformanceMediumBookmark() throws Exception {
50          testPerformanceMedium();
51          navigateToSecondPage(); // how to bookmark the second page?
52          //        driver.navigate().to(ITUtil.getBaseUrlString() + BOOKMARK_URL_2);
53          passed();
54      }
55  
56      @Test
57      public void testPerformanceMediumNav() throws Exception {
58          testPerformanceMedium();
59          navigateToSecondPage();
60          passed();
61      }
62  
63      private void navigateToSecondPage() throws InterruptedException {
64          waitAndClickByLinkText("Page 2");
65          alertAccept();
66          waitForBottomButton();
67      }
68  
69      private void waitForBottomButton() throws InterruptedException {
70      	jiraAwareWaitFor(By.xpath("//button[contains(text(), 'Refresh - Non-Ajax')]"),11,"Timeout 11s - Button Not Present");
71      }
72  
73      protected void testPerformanceMedium()throws Exception {
74          waitForBottomButton();
75          selectByName("inputField6","Option 2");
76          selectByName("inputField7","Option 2");
77          assertElementPresentByXpath("//select[@name='inputField8' and @disabled]");
78          assertElementPresentByXpath("//button[contains(text(),'Add')]");
79          assertElementPresentByXpath("//button[contains(text(),'Delete')]");
80          assertTextPresent("null ( ab extra )");
81          assertElementPresentByXpath("//input[@name='mediumCollection2[0].field1' and @value='ab extra']");
82          assertTextPresent("SubCollection 1");
83      }
84  }