1 |
|
|
2 |
|
|
3 |
|
|
4 |
|
|
5 |
|
|
6 |
|
|
7 |
|
|
8 |
|
|
9 |
|
|
10 |
|
|
11 |
|
|
12 |
|
|
13 |
|
|
14 |
|
|
15 |
|
|
16 |
|
|
17 |
|
|
18 |
|
|
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 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (25) |
Complexity: 7 |
Complexity Density: 0.39 |
|
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 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (2) |
Complexity: 1 |
Complexity Density: 0.5 |
|
40 |
1 |
public static ThemeApplicationWebHomePage gotoPage()... |
41 |
|
{ |
42 |
1 |
getUtil().gotoPage("FlamingoThemes", "WebHome"); |
43 |
1 |
return new ThemeApplicationWebHomePage(); |
44 |
|
} |
45 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
46 |
2 |
public String getCurrentTheme()... |
47 |
|
{ |
48 |
2 |
return currentTheme.getText(); |
49 |
|
} |
50 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (5) |
Complexity: 1 |
Complexity Density: 0.2 |
|
51 |
1 |
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 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (2) |
Complexity: 1 |
Complexity Density: 0.5 |
|
62 |
2 |
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 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (3) |
Complexity: 1 |
Complexity Density: 0.33 |
|
70 |
1 |
public EditThemePage createNewTheme(String themeName)... |
71 |
|
{ |
72 |
1 |
newThemeNameInput.sendKeys(themeName); |
73 |
1 |
createNewThemeButton.click(); |
74 |
1 |
return new EditThemePage(); |
75 |
|
} |
76 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (3) |
Complexity: 1 |
Complexity Density: 0.33 |
|
77 |
1 |
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 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (2) |
Complexity: 1 |
Complexity Density: 0.5 |
|
85 |
3 |
@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 |
|
} |