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

File ToolBarElement.java

 

Coverage histogram

../../../../../img/srcFileCovDistChart0.png
83% of files have more coverage

Code metrics

0
4
3
1
68
21
3
0.75
1.33
3
1

Classes

Class Line # Actions
ToolBarElement 32 4 0% 3 7
0.00%
 

Contributing tests

This file is covered by 1 test. .

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.wysiwyg.test.po;
21   
22    import org.openqa.selenium.By;
23    import org.openqa.selenium.WebElement;
24    import org.xwiki.test.ui.po.BaseElement;
25   
26    /**
27    * Models the tool bar of the WYSIWYG content editor.
28    *
29    * @version $Id: 8bba7f0fdc2c8c5d017755c980229cad6273cf8b $
30    * @since 3.4RC1
31    */
 
32    public class ToolBarElement extends BaseElement
33    {
34    /**
35    * The element that wraps the tool bar.
36    */
37    private final WebElement container;
38   
39    /**
40    * Creates a new instance that can be used to control the tool bar inside the given container.
41    *
42    * @param container the element that wraps the tool bar
43    */
 
44  0 toggle public ToolBarElement(WebElement container)
45    {
46  0 this.container = container;
47    }
48   
49    /**
50    * Clicks on the Undo tool bar button.
51    */
 
52  0 toggle public void clickUndoButton()
53    {
54  0 clickToolBarButtonWithTitle("Undo (Ctrl+Z)");
55    }
56   
57    /**
58    * Clicks the tool bar button with the specified title.
59    *
60    * @param title the title of the tool bar button to be clicked
61    */
 
62  0 toggle protected void clickToolBarButtonWithTitle(String title)
63    {
64    // We have to wait for it to become enabled because the tool bar is updated with delay after each edit action.
65  0 String xpath = String.format("div[@title='%s' and not(contains(@class, '-disabled'))]", title);
66  0 this.container.findElement(By.xpath(xpath)).click();
67    }
68    }