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

File CopyPage.java

 

Coverage histogram

../../../../../img/srcFileCovDistChart8.png
54% of files have more coverage

Code metrics

2
15
9
1
162
63
10
0.67
1.67
9
1.11

Classes

Class Line # Actions
CopyPage 33 15 0% 10 7
0.730769273.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.test.ui.po;
21   
22    import org.openqa.selenium.WebElement;
23    import org.openqa.selenium.support.FindBy;
24   
25    /**
26    * Represents the common actions possible on the Copy Page page.
27    * <p>
28    * TODO: Refactor using the {@link DocumentPicker} and drop the org.xwiki.index.test.po.CopyPage workaround.
29    *
30    * @version $Id: 52d655f2439e6fa2975b95317f46ea378585065c $
31    * @since 3.2M3
32    */
 
33    public class CopyPage extends ViewPage
34    {
35    /**
36    * The value attribute name.
37    */
38    private static final String VALUE = "value";
39   
40    @FindBy(css = "form#copy .breadcrumb")
41    private WebElement sourceBreadcrumbElement;
42   
43    private BreadcrumbElement sourceBreadcrumb;
44   
45    /**
46    * The hidden input containing the space name of the source page.
47    */
48    @FindBy(xpath = "//input[@type='hidden' and @name = 'sourceSpaceName']")
49    private WebElement sourceSpaceName;
50   
51    /**
52    * The hidden input containing the source page name.
53    */
54    @FindBy(xpath = "//input[@type='hidden' and @name = 'sourcePageName']")
55    private WebElement sourcePageName;
56   
57    /**
58    * The text input field to enter the name of the target space.
59    */
60    @FindBy(xpath = "//input[@name = 'targetSpaceName']")
61    private WebElement targetSpaceName;
62   
63    /**
64    * The text input field to enter the name of the target page.
65    */
66    @FindBy(xpath = "//input[@name = 'targetPageName']")
67    private WebElement targetPageName;
68   
69    /**
70    * The copy button.
71    */
72    @FindBy(xpath = "//input[@class = 'button' and @value = 'Copy']")
73    private WebElement copyButton;
74   
75    /**
76    * @return the breadcrumb that specified the location of the source document
77    * @since 7.2M3
78    */
 
79  2 toggle public BreadcrumbElement getSourceLocation()
80    {
81  2 if (this.sourceBreadcrumb == null) {
82  2 this.sourceBreadcrumb = new BreadcrumbElement(this.sourceBreadcrumbElement);
83    }
84  2 return this.sourceBreadcrumb;
85    }
86   
87    /**
88    * @return the name of the space where the source page should be.
89    */
 
90  2 toggle public String getSourceSpaceName()
91    {
92  2 return this.sourceSpaceName.getAttribute(VALUE);
93    }
94   
95    /**
96    * @return the name of the source page.
97    */
 
98  2 toggle public String getSourcePageName()
99    {
100  2 return this.sourcePageName.getAttribute(VALUE);
101    }
102   
103    /**
104    * @return the current name of the space where the page should be copied.
105    */
 
106  3 toggle public String getTargetSpaceName()
107    {
108  3 return this.targetSpaceName.getAttribute(VALUE);
109    }
110   
111    /**
112    * Sets the name of the space where the page should be copied.
113    *
114    * @param targetSpaceName the name of the space where the page should be copied
115    */
 
116  0 toggle public void setTargetSpaceName(String targetSpaceName)
117    {
118  0 this.targetSpaceName.clear();
119  0 this.targetSpaceName.sendKeys(targetSpaceName);
120    }
121   
122    /**
123    * @return the current name of the target page.
124    */
 
125  3 toggle public String getTargetPageName()
126    {
127  3 return this.targetPageName.getAttribute(VALUE);
128    }
129   
130    /**
131    * Sets the name of the target page.
132    *
133    * @param targetPageName the name of the target page
134    */
 
135  0 toggle public void setTargetPageName(String targetPageName)
136    {
137  0 this.targetPageName.clear();
138  0 this.targetPageName.sendKeys(targetPageName);
139    }
140   
141    /**
142    * Submit the copy page form.
143    *
144    * @return the confirmation page
145    */
 
146  1 toggle public CopyOrRenameStatusPage clickCopyButton()
147    {
148  1 this.copyButton.submit();
149  1 return new CopyOrRenameStatusPage();
150    }
151   
152    /**
153    * Submit the copy page form and expect to receive an overwrite warning.
154    *
155    * @return the overwrite warning page
156    */
 
157  3 toggle public CopyOverwritePromptPage clickCopyButtonExpectingOverwritePrompt()
158    {
159  3 this.copyButton.submit();
160  3 return new CopyOverwritePromptPage();
161    }
162    }