1. Project Clover database Tue Dec 20 2016 21:24:09 CET
  2. Package org.xwiki.annotation.test.po

File AnnotationsPane.java

 

Coverage histogram

../../../../../img/srcFileCovDistChart4.png
78% of files have more coverage

Code metrics

6
16
6
1
105
49
9
0.56
2.67
6
1.5

Classes

Class Line # Actions
AnnotationsPane 33 16 0% 9 19
0.3214285732.1%
 

Contributing tests

This file is covered by 2 tests. .

Source view

1    /*
2    * See the NOTICE file distributed with this work for additional
3    * information regarding copyright ownership.
4    *
5    * This is free software; you can redistribute it and/or modify it
6    * under the terms of the GNU Lesser General Public License as
7    * published by the Free Software Foundation; either version 2.1 of
8    * the License, or (at your option) any later version.
9    *
10    * This software is distributed in the hope that it will be useful,
11    * but WITHOUT ANY WARRANTY; without even the implied warranty of
12    * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13    * Lesser General Public License for more details.
14    *
15    * You should have received a copy of the GNU Lesser General Public
16    * License along with this software; if not, write to the Free
17    * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
18    * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
19    */
20    package org.xwiki.annotation.test.po;
21   
22    import org.openqa.selenium.By;
23    import org.openqa.selenium.WebElement;
24    import org.openqa.selenium.support.FindBy;
25    import org.xwiki.test.ui.po.BaseElement;
26   
27    /**
28    * Pane that opens when you click on the Annotation menu entry.
29    *
30    * @version $Id: acb487a3ca6ddee7d708341090f426a59d611171 $
31    * @since 4.2M1
32    */
 
33    public class AnnotationsPane extends BaseElement
34    {
35    @FindBy(id = "annotationsdisplay")
36    private WebElement checkBox;
37   
 
38  2 toggle private void clickOnAnnotationMenu()
39    {
40  2 String dropDownMenuXPath = "//div[@id='tmMoreActions']//ul[contains(@class, 'dropdown-menu')]";
41   
42    // Open the page menu
43  2 getDriver().findElement(By.xpath("//div[@id='tmMoreActions']/a[contains(@role, 'button')]")).click();
44    // Wait for the drop down menu to be displayed
45  2 getDriver().waitUntilElementIsVisible(By.xpath(dropDownMenuXPath));
46    // Click on the annotations button
47  2 WebElement annotationsPane = getDriver().findElement(
48    By.xpath(dropDownMenuXPath + "//a[contains(., 'Annotate')]"));
49  2 annotationsPane.click();
50    }
51   
52    /**
53    * Shows the annotations pane from the top of the page
54    */
 
55  2 toggle public void showAnnotationsPane()
56    {
57  2 clickOnAnnotationMenu();
58    // Verify that the annotationssettings panel is open
59  2 getDriver().waitUntilElementIsVisible(By.className("annotationsettings"));
60    }
61   
62    /**
63    * Hides the annotations pane from the top of the page
64    */
 
65  0 toggle public void hideAnnotationsPane()
66    {
67  0 clickOnAnnotationMenu();
68    // Verify that the annotationssettings panel is close
69  0 getDriver().waitUntilElementDisappears(By.className("annotationsettings"));
70    }
71   
72    /**
73    * Checks the "Show Annotations" check box.
74    */
 
75  0 toggle public void clickShowAnnotations()
76    {
77  0 if (this.checkBox.isSelected() == false) {
78  0 this.checkBox.click();
79    }
80    }
81   
82    /**
83    * Un-Checks the "Show Annotations" checkbox.
84    */
 
85  0 toggle public void clickHideAnnotations()
86    {
87  0 if (this.checkBox.isSelected() == true) {
88  0 this.checkBox.click();
89    }
90    }
91   
92    /**
93    * Checks if the checkBox within AnnotationsPane is visible
94    *
95    * @return returns true if the Show Annotations checkbox is displayed
96    */
 
97  0 toggle public boolean checkIfShowAnnotationsCheckboxExists()
98    {
99  0 if (getDriver().findElementsWithoutWaiting(By.id("annotationsdisplay")).size() > 0) {
100  0 return true;
101    } else {
102  0 return false;
103    }
104    }
105    }