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

File WYSIWYGEditorAdministrationSectionPage.java

 

Coverage histogram

../../../../../img/srcFileCovDistChart10.png
0% of files have more coverage

Code metrics

0
10
4
1
92
40
4
0.4
2.5
4
1

Classes

Class Line # Actions
WYSIWYGEditorAdministrationSectionPage 35 10 0% 4 0
1.0100%
 

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.administration.test.po;
21   
22    import java.util.ArrayList;
23    import java.util.List;
24   
25    import org.openqa.selenium.By;
26    import org.openqa.selenium.WebElement;
27    import org.openqa.selenium.support.FindBy;
28   
29    /**
30    * Represents the actions possible on the WYSIWYG Editor administration section.
31    *
32    * @version $Id: 1ae67813903017a82dc507fef87cfcae73ea8272 $
33    * @since 4.2M1
34    */
 
35    public class WYSIWYGEditorAdministrationSectionPage extends AdministrationSectionPage
36    {
37    @FindBy(xpath = "//input[@type = 'submit' and @name = 'action_saveandcontinue']")
38    private WebElement saveButton;
39   
40    /**
41    * The text input used to enable a WYSIWYG editor plugin.
42    */
43    @FindBy(xpath = "//div[@class = 'hSortableWrapper'][1]//input[@type = 'text']")
44    private WebElement pluginInput;
45   
46    /**
47    * The button used to enable a WYSIWYG editor plugin.
48    */
49    @FindBy(xpath = "//div[@class = 'hSortableWrapper'][1]//input[@type = 'image']")
50    private WebElement enablePluginButton;
51   
 
52  2 toggle public WYSIWYGEditorAdministrationSectionPage()
53    {
54  2 super("WYSIWYG");
55    }
56   
57    /**
58    * @return the list of WYSIWYG editor plugins that are enabled
59    */
 
60  2 toggle public List<String> getEnabledPlugins()
61    {
62  2 List<String> plugins = new ArrayList<String>();
63  2 for (WebElement value : getDriver().findElements(
64    By.xpath("//div[@class = 'hSortableWrapper'][1]//span[@class = 'value']"))) {
65  105 plugins.add(value.getText());
66    }
67  2 return plugins;
68    }
69   
70    /**
71    * Enable the specified WYSIWYG editor plugin.
72    *
73    * @param name the name of the WYSIWYG editor plugin to enable
74    */
 
75  1 toggle public void enablePlugin(String name)
76    {
77  1 pluginInput.clear();
78  1 pluginInput.sendKeys(name);
79  1 enablePluginButton.click();
80    }
81   
82    /**
83    * Overwrite because the WYSIWYG Editor administration section uses a different Save button.
84    */
 
85  1 toggle @Override
86    public void clickSave()
87    {
88  1 this.saveButton.click();
89    // The configuration is saved without reloading the page. Wait until the page is really saved.
90  1 waitForNotificationSuccessMessage("Saved");
91    }
92    }