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

File CreateWikiPage.java

 

Coverage histogram

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

Code metrics

4
22
10
1
118
77
12
0.55
2.2
10
1.2

Classes

Class Line # Actions
CreateWikiPage 29 22 0% 12 2
0.944444494.4%
 

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.wiki.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    public class CreateWikiPage extends ExtendedViewPage
30    {
31    @FindBy(name = "wikiprettyname")
32    private WebElement prettyNameField;
33   
34    @FindBy(name = "wikiname")
35    private WebElement wikiNameField;
36   
37    @FindBy(name = "description")
38    private WebElement descriptionField;
39   
40    @FindBy(name = "template")
41    private WebElement templateField;
42   
43    @FindBy(name = "set_as_template")
44    private WebElement setAsTemplateField;
45   
46    @FindBy(id = "wizard-next")
47    private WebElement nextStepButton;
48   
 
49  3 toggle public void setPrettyName(String prettyName)
50    {
51  3 prettyNameField.clear();
52  3 prettyNameField.sendKeys(prettyName);
53    }
54   
 
55  3 toggle public String getName()
56    {
57  3 return wikiNameField.getAttribute("value");
58    }
59   
60    /**
61    * @since 6.0M1
62    */
 
63  3 toggle public String getComputedName()
64    {
65  3 getDriver().waitUntilElementHasNonEmptyAttributeValue(By.name("wikiname"), "value");
66  3 return getName();
67    }
68   
 
69  3 toggle public void setDescription(String description)
70    {
71  3 descriptionField.clear();
72  3 descriptionField.sendKeys(description);
73    }
74   
 
75  3 toggle public void setIsTemplate(boolean template)
76    {
77  3 if (template != setAsTemplateField.isSelected()) {
78  1 setAsTemplateField.click();
79    }
80    }
81   
 
82  2 toggle public void setTemplate(String templateId)
83    {
84  2 List<WebElement> elements = templateField.findElements(By.tagName("option"));
85  2 for (WebElement element : elements) {
86  4 if (element.getAttribute("value").equals(templateId)) {
87  2 element.click();
88    }
89    }
90    }
91   
 
92  1 toggle public List<String> getTemplateList()
93    {
94  1 List<String> list = new ArrayList<String>();
95  1 List<WebElement> elements = templateField.findElements(By.tagName("option"));
96  1 for (WebElement element : elements) {
97  2 list.add(element.getAttribute("value"));
98    }
99  1 return list;
100    }
101   
 
102  1 toggle public boolean isNextStepEnabled()
103    {
104  1 return nextStepButton.isEnabled();
105    }
106   
 
107  3 toggle public CreateWikiPageStepUser goUserStep()
108    {
109  3 nextStepButton.click();
110  3 return new CreateWikiPageStepUser().waitUntilPageIsLoaded();
111    }
112   
 
113  0 toggle public void goNextStep()
114    {
115  0 nextStepButton.click();
116    }
117   
118    }