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.demo.uif.library.elements;
17  
18  import org.junit.Test;
19  
20  import org.kuali.rice.testtools.selenium.WebDriverLegacyITBase;
21  
22  /**
23   * @author Kuali Rice Team (rice.collab@kuali.org)
24   */
25  public class LibraryElementsProgressBarAft extends WebDriverLegacyITBase {
26  
27      /**
28       * /kr-krad/kradsampleapp?viewId=Demo-ProgressBarView
29       */
30      public static final String BOOKMARK_URL = "/kr-krad/kradsampleapp?viewId=Demo-ProgressBarView";
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("Elements");
41          waitAndClickByLinkText("Progress Bar");
42      }
43  
44      protected void testLibraryElementsProgressBarPercentage() throws Exception {
45          waitForElementPresentByXpath("//div[@class='progress uif-boxLayoutVerticalItem clearfix']/div[@style='width: 0%;']");
46          waitForElementPresentByXpath("//div[@class='progress uif-boxLayoutVerticalItem clearfix']/div[@style='width: 25%;']");
47          waitForElementPresentByXpath("//div[@class='progress uif-boxLayoutVerticalItem clearfix']/div[@style='width: 50%;']");
48          waitForElementPresentByXpath("//div[@class='progress uif-boxLayoutVerticalItem clearfix']/div[@style='width: 75%;']");
49          waitForElementPresentByXpath("//div[@class='progress uif-boxLayoutVerticalItem clearfix']/div[@style='width: 100%;']");
50          waitForElementPresentByXpath("//div[@class='progress uif-boxLayoutVerticalItem clearfix']/div[@style='width: 40%;']");
51      }
52      
53      protected void testLibraryElementsProgressBarSteps() throws Exception {
54      	selectByName("exampleShown","Steps");
55          waitForElementPresentByXpath("//div[@class='progress']/div[@class='progress-bar progress-bar-empty']");
56          waitForElementPresentByXpath("//div[@class='progress']/div[@class='progress-bar progress-bar-success']");
57          waitForElementPresentByXpath("//div[@class='progress']/div[@class='progress-bar progress-bar-info']");
58      }
59      
60      protected void testLibraryElementsProgressBarSuccessStep() throws Exception {
61      	selectByName("exampleShown","Success Step");
62          waitForElementPresentByXpath("//div[@aria-valuetext='Task Complete']/div/div[@class='progress-bar progress-bar-success']");
63      }
64      
65      protected void testLibraryElementsProgressBarVertical() throws Exception {
66      	selectByName("exampleShown","Vertical");
67          waitForElementPresentByXpath("//div[@class='progress uif-progressBar-vertical uif-boxLayoutHorizontalItem' and @aria-valuemin='0']");
68          waitForElementPresentByXpath("//div[@class='progress uif-progressBar-vertical uif-boxLayoutHorizontalItem' and @aria-valuemin='33']");
69          waitForElementPresentByXpath("//div[@class='progress uif-progressBar-vertical uif-boxLayoutHorizontalItem' and @aria-valuemin='66']");
70          waitForElementPresentByXpath("//div[@class='progress uif-progressBar-vertical uif-boxLayoutHorizontalItem' and @aria-valuemin='100']");
71      }
72      
73      protected void testLibraryElementsProgressBarVerticalSteps() throws Exception {
74      	selectByName("exampleShown","Vertical Steps");
75          waitForElementPresentByXpath("//div[@class='progress-details' and @style='height: 225px;']");
76          waitForElementPresentByXpath("//div[@class='progress-details' and @style='height: 225px;']/div[@class='uif-step complete']");
77          waitForElementPresentByXpath("//div[@class='progress-details' and @style='height: 225px;']/div[@class='uif-step active']");
78          waitForElementPresentByXpath("//div[@class='progress-details' and @style='height: 225px;']/div[@class='uif-step']");
79      }
80      
81      protected void testLibraryElementsProgressBarVerticalStepHeight() throws Exception {
82      	selectByName("exampleShown","Vertical Step Height");
83          waitForElementPresentByXpath("//div[@class='progress-details' and @style='height: 180px;']");
84          waitForElementPresentByXpath("//div[@class='progress-details' and @style='height: 225px;']/div[@style='height: 16.0%;']");
85          waitForElementPresentByXpath("//div[@class='progress-details' and @style='height: 225px;']/div[@style='height: 20.0%;']");
86      }
87      
88      protected void testLibraryElementsProgressBarLookOptions() throws Exception {
89      	selectByName("exampleShown","Look Options");
90          waitForElementPresentByXpath("//div[@class='progress-bar progress-bar-info']");
91          waitForElementPresentByXpath("//div[@class='progress-bar progress-bar-warning']");
92          waitForElementPresentByXpath("//div[@class='progress-bar progress-bar-danger']");
93      }
94      
95      protected void testLibraryElementsProgressBarStepSizes() throws Exception {
96      	selectByName("exampleShown","Step Sizes");
97          waitForElementPresentByXpath("//div[@class='progress-bar progress-bar-success' and @style='width: 20.0%;']");
98          waitForElementPresentByXpath("//div[@class='progress-bar progress-bar-success' and @style='width: 50.0%;']");
99          waitForElementPresentByXpath("//div[@class='progress-bar progress-bar-info' and @style='width: 30.0%;']");
100     }
101     
102     private void testLibraryElementsProgressBar() throws Exception {
103     	testLibraryElementsProgressBarPercentage();
104     	testLibraryElementsProgressBarSteps();
105     	testLibraryElementsProgressBarSuccessStep();
106     	testLibraryElementsProgressBarVertical();
107     	testLibraryElementsProgressBarVerticalSteps();
108     	testLibraryElementsProgressBarVerticalStepHeight();
109     	testLibraryElementsProgressBarLookOptions();
110     	testLibraryElementsProgressBarStepSizes();
111     }
112     
113     @Test
114     public void testLibraryElementsProgressBarBookmark() throws Exception {
115     	testLibraryElementsProgressBar();
116         passed();
117     }
118 
119     @Test
120     public void testLibraryElementsProgressBarNav() throws Exception {
121     	testLibraryElementsProgressBar();
122         passed();
123     }  
124 }