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

File WikiEditPage.java

 

Coverage histogram

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

Code metrics

4
17
9
1
139
66
14
0.82
1.89
9
1.56

Classes

Class Line # Actions
WikiEditPage 31 17 0% 14 1
0.9666666496.7%
 

Contributing tests

This file is covered by 24 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.test.ui.po.editor;
21   
22    import org.openqa.selenium.WebElement;
23    import org.openqa.selenium.support.FindBy;
24   
25    /**
26    * Represents the common actions possible on all Pages when using the "edit" action with "wiki" editor
27    *
28    * @version $Id: e38ca6d7ea559272a2495c283eae53416fc0e3d7 $
29    * @since 3.2M3
30    */
 
31    public class WikiEditPage extends PreviewableEditPage
32    {
33    @FindBy(id = "xwikidoctitleinput")
34    private WebElement titleInput;
35   
36    @FindBy(id = "xwikidocparentinput")
37    private WebElement parentInput;
38   
39    /**
40    * The hierarchy icon that needs to be clicked to reveal the parent field.
41    */
42    @FindBy(id = "editParentTrigger")
43    private WebElement editParentTrigger;
44   
45    @FindBy(id = "content")
46    private WebElement contentText;
47   
48    @FindBy(name = "minorEdit")
49    private WebElement minorEditCheckBox;
50   
51    @FindBy(name = "comment")
52    private WebElement commentInput;
53   
54    /**
55    * Go to the passed page in wiki edit mode.
56    */
 
57  24 toggle public static WikiEditPage gotoPage(String space, String page)
58    {
59  24 getUtil().gotoPage(space, page, "edit", "editor=wiki");
60  24 return new WikiEditPage();
61    }
62   
63    /**
64    * Get the <code>title</code> of the page.
65    */
 
66  4 toggle public String getTitle()
67    {
68  4 return this.titleInput.getAttribute("value");
69    }
70   
71    /**
72    * Set the <code>title</code> of the page.
73    */
 
74  4 toggle public void setTitle(String title)
75    {
76  4 this.titleInput.clear();
77  4 this.titleInput.sendKeys(title);
78    }
79   
80    /**
81    * @return the value of the parent field.
82    */
 
83  2 toggle public String getParent()
84    {
85  2 return this.parentInput.getAttribute("value");
86    }
87   
88    /**
89    * Set the {@code parent} of the page
90    *
91    * @param parent the value for the new parent to set
92    */
 
93  1 toggle public void setParent(String parent)
94    {
95  1 if (!this.parentInput.isDisplayed()) {
96  1 this.editParentTrigger.click();
97    }
98  1 this.parentInput.clear();
99  1 this.parentInput.sendKeys(parent);
100    }
101   
102    /**
103    * Get the <code>content</code> of the page.
104    */
 
105  13 toggle public String getContent()
106    {
107  13 return this.contentText.getText();
108    }
109   
110    /**
111    * Set the <code>content</code> of the page.
112    */
 
113  27 toggle public void setContent(String content)
114    {
115  27 this.contentText.clear();
116  27 this.contentText.sendKeys(content);
117    }
118   
119    /**
120    * Set the minor edit check box value.
121    */
 
122  2 toggle public void setMinorEdit(boolean value)
123    {
124  2 if ((this.minorEditCheckBox.isSelected() && !value)
125    || (!this.minorEditCheckBox.isSelected() && value))
126    {
127  1 this.minorEditCheckBox.click();
128    }
129    }
130   
131    /**
132    * Set <code>comment</code> for this change.
133    */
 
134  2 toggle public void setEditComment(String comment)
135    {
136  2 this.commentInput.clear();
137  2 this.commentInput.sendKeys(comment);
138    }
139    }