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.labs;
17  
18  import org.junit.Test;
19  import org.kuali.rice.testtools.selenium.WebDriverLegacyITBase;
20  
21  /**
22   * @author Kuali Rice Team (rice.collab@kuali.org)
23   */
24  public class LabsProgressBarsAft extends WebDriverLegacyITBase {
25  
26      /**
27       * /kr-krad/labs?viewId=Lab-ProgressBar
28       */
29      public static final String BOOKMARK_URL = "/kr-krad/labs?viewId=Lab-ProgressBar";
30     
31      @Override
32      protected String getBookmarkUrl() {
33          return BOOKMARK_URL;
34      }
35  
36      @Override
37      protected void navigate() throws Exception {
38      	waitAndClickByLinkText("Progress Bars");
39      }
40  
41      protected void testProgressBarPercentage() throws Exception {
42          waitForElementPresentByXpath("//div[@class='progress uif-boxLayoutVerticalItem clearfix']/div[@style='width: 0%;']");
43          waitForElementPresentByXpath("//div[@class='progress uif-boxLayoutVerticalItem clearfix']/div[@style='width: 25%;']");
44          waitForElementPresentByXpath("//div[@class='progress uif-boxLayoutVerticalItem clearfix']/div[@style='width: 50%;']");
45          waitForElementPresentByXpath("//div[@class='progress uif-boxLayoutVerticalItem clearfix']/div[@style='width: 75%;']");
46          waitForElementPresentByXpath("//div[@class='progress uif-boxLayoutVerticalItem clearfix']/div[@style='width: 100%;']");
47          waitForElementPresentByXpath("//div[@class='progress uif-boxLayoutVerticalItem clearfix']/div[@style='width: 40%;']");
48      }
49      
50      protected void testProgressBarSteps() throws Exception {
51          waitForElementPresentByXpath("//div[@class='progress']/div[@class='progress-bar progress-bar-empty']");
52          waitForElementPresentByXpath("//div[@class='progress']/div[@class='progress-bar progress-bar-success']");
53          waitForElementPresentByXpath("//div[@class='progress']/div[@class='progress-bar progress-bar-info']");
54      }
55      
56      protected void testProgressBarSuccessStep() throws Exception {
57          waitForElementPresentByXpath("//div[@aria-valuetext='Task Complete']/div/div[@class='progress-bar progress-bar-success']");
58      }
59      
60      protected void testProgressBarVertical() throws Exception {
61          waitForElementPresentByXpath("//div[@class='progress uif-progressBar-vertical uif-boxLayoutHorizontalItem' and @aria-valuemin='0']");
62          waitForElementPresentByXpath("//div[@class='progress uif-progressBar-vertical uif-boxLayoutHorizontalItem' and @aria-valuemin='33']");
63          waitForElementPresentByXpath("//div[@class='progress uif-progressBar-vertical uif-boxLayoutHorizontalItem' and @aria-valuemin='66']");
64          waitForElementPresentByXpath("//div[@class='progress uif-progressBar-vertical uif-boxLayoutHorizontalItem' and @aria-valuemin='100']");
65      }
66      
67      protected void testProgressBarVerticalSteps() throws Exception {
68          waitForElementPresentByXpath("//div[@class='progress-details' and @style='height: 225px;']");
69          waitForElementPresentByXpath("//div[@class='progress-details' and @style='height: 225px;']/div[@class='uif-step complete']");
70          waitForElementPresentByXpath("//div[@class='progress-details' and @style='height: 225px;']/div[@class='uif-step active']");
71          waitForElementPresentByXpath("//div[@class='progress-details' and @style='height: 225px;']/div[@class='uif-step']");
72      }
73      
74      protected void testProgressBarVerticalStepHeight() throws Exception {
75          waitForElementPresentByXpath("//div[@class='progress-details' and @style='height: 180px;']");
76          waitForElementPresentByXpath("//div[@class='progress-details' and @style='height: 225px;']/div[@style='height: 16.0%;']");
77          waitForElementPresentByXpath("//div[@class='progress-details' and @style='height: 225px;']/div[@style='height: 20.0%;']");
78      }
79      
80      protected void testProgressBarLookOptions() throws Exception {
81          waitForElementPresentByXpath("//div[@class='progress-bar progress-bar-info']");
82          waitForElementPresentByXpath("//div[@class='progress-bar progress-bar-warning']");
83          waitForElementPresentByXpath("//div[@class='progress-bar progress-bar-danger']");
84      }
85      
86      protected void testProgressBarStepSizes() throws Exception {
87          waitForElementPresentByXpath("//div[@class='progress-bar progress-bar-success' and @style='width: 20.0%;']");
88          waitForElementPresentByXpath("//div[@class='progress-bar progress-bar-success' and @style='width: 50.0%;']");
89          waitForElementPresentByXpath("//div[@class='progress-bar progress-bar-info' and @style='width: 30.0%;']");
90      }
91      
92      private void testProgressBar() throws Exception {
93      	testProgressBarPercentage();
94      	testProgressBarSteps();
95      	testProgressBarSuccessStep();
96      	testProgressBarVertical();
97      	testProgressBarVerticalSteps();
98      	testProgressBarVerticalStepHeight();
99      	testProgressBarLookOptions();
100     	testProgressBarStepSizes();
101     }
102 
103     @Test
104     public void testProgressBarBookmark() throws Exception {
105     	testProgressBar();
106         passed();
107     }
108 
109     @Test
110     public void testProgressBarNav() throws Exception {
111     	testProgressBar();
112         passed();
113     }
114 }