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

File ThemeApplicationWebHomePage.java

 

Coverage histogram

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

Code metrics

0
18
7
1
91
60
7
0.39
2.57
7
1

Classes

Class Line # Actions
ThemeApplicationWebHomePage 29 18 0% 7 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.flamingo.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 ThemeApplicationWebHomePage extends CSSGetterPage
30    {
31    @FindBy(xpath = "//div[contains(@class, 'current-theme')]//div[@class='theme-info']//h3")
32    private WebElement currentTheme;
33   
34    @FindBy(id = "newThemeName")
35    private WebElement newThemeNameInput;
36   
37    @FindBy(xpath = "//div[@class='theme-creation-form']//input[@type='submit']")
38    private WebElement createNewThemeButton;
39   
 
40  1 toggle public static ThemeApplicationWebHomePage gotoPage()
41    {
42  1 getUtil().gotoPage("FlamingoThemes", "WebHome");
43  1 return new ThemeApplicationWebHomePage();
44    }
45   
 
46  2 toggle public String getCurrentTheme()
47    {
48  2 return currentTheme.getText();
49    }
50   
 
51  1 toggle public List<String> getOtherThemes()
52    {
53  1 List<String> otherThemes = new ArrayList<>();
54  1 List<WebElement> elements = getDriver().findElements(By.xpath("//div[contains(@class, 'theme')"
55    + "and not(contains(@class, 'current-theme'))]/div[@class='theme-info']//h3"));
56  1 for (WebElement elem: elements) {
57  3 otherThemes.add(elem.getText());
58    }
59  1 return otherThemes;
60    }
61   
 
62  2 toggle public void useTheme(String themeName)
63    {
64  2 WebElement elem = getDriver().findElement(By.xpath("//div[@class='theme-info']"
65    + "//h3/span/span/a[contains(text(), '"+themeName+"')]"
66    + "/../../../..//a[contains(text(), 'Use this Theme')]"));
67  2 elem.click();
68    }
69   
 
70  1 toggle public EditThemePage createNewTheme(String themeName)
71    {
72  1 newThemeNameInput.sendKeys(themeName);
73  1 createNewThemeButton.click();
74  1 return new EditThemePage();
75    }
76   
 
77  1 toggle public ViewThemePage seeTheme(String themeName)
78    {
79  1 WebElement elem = getDriver().findElement(By.xpath("//div[@class='theme-info']"
80    + "//h3/span/span/a[contains(text(), '"+themeName+"')]"));
81  1 elem.click();
82  1 return new ViewThemePage();
83    }
84   
 
85  3 toggle @Override
86    protected String getElementCSSValue(final By locator, String attribute)
87    {
88  3 WebElement element = getDriver().findElement(locator);
89  3 return element.getCssValue(attribute);
90    }
91    }