1 |
|
|
2 |
|
|
3 |
|
|
4 |
|
|
5 |
|
|
6 |
|
|
7 |
|
|
8 |
|
|
9 |
|
|
10 |
|
|
11 |
|
|
12 |
|
|
13 |
|
|
14 |
|
|
15 |
|
|
16 |
|
|
17 |
|
|
18 |
|
|
19 |
|
|
20 |
|
package org.xwiki.administration.test.po; |
21 |
|
|
22 |
|
import java.net.URL; |
23 |
|
import java.util.ArrayList; |
24 |
|
import java.util.List; |
25 |
|
|
26 |
|
import org.openqa.selenium.By; |
27 |
|
import org.openqa.selenium.WebElement; |
28 |
|
import org.openqa.selenium.support.FindBy; |
29 |
|
import org.xwiki.test.ui.po.ConfirmationModal; |
30 |
|
import org.xwiki.test.ui.po.ViewPage; |
31 |
|
|
32 |
|
|
33 |
|
|
34 |
|
|
35 |
|
@version |
36 |
|
@since |
37 |
|
|
|
|
| 90.6% |
Uncovered Elements: 3 (32) |
Complexity: 9 |
Complexity Density: 0.39 |
|
38 |
|
public class ImportAdministrationSectionPage extends ViewPage |
39 |
|
{ |
40 |
|
@FindBy(id = "packagelistcontainer") |
41 |
|
private WebElement packageList; |
42 |
|
|
43 |
|
@FindBy(id = "xwikiuploadfile") |
44 |
|
private WebElement uploadFileInputField; |
45 |
|
|
46 |
|
@FindBy(xpath = "//*[@id='attachform']//input[@type='submit']") |
47 |
|
private WebElement uploadFileSubmit; |
48 |
|
|
49 |
|
@FindBy(xpath = "//input[@value='Import']") |
50 |
|
private WebElement importPackageLink; |
51 |
|
|
|
|
| 0% |
Uncovered Elements: 2 (2) |
Complexity: 1 |
Complexity Density: 0.5 |
|
52 |
0 |
public static ImportAdministrationSectionPage gotoPage()... |
53 |
|
{ |
54 |
0 |
getUtil().gotoPage("XWiki", "XWikiPreferences", "import", "editor=globaladmin§ion=Import"); |
55 |
0 |
return new ImportAdministrationSectionPage(); |
56 |
|
} |
57 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (2) |
Complexity: 1 |
Complexity Density: 0.5 |
|
58 |
4 |
public void attachPackage(URL file)... |
59 |
|
{ |
60 |
4 |
this.uploadFileInputField.sendKeys(file.getPath()); |
61 |
4 |
this.uploadFileSubmit.submit(); |
62 |
|
} |
63 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
64 |
15 |
public boolean isPackagePresent(String packageName)... |
65 |
|
{ |
66 |
15 |
return getPackageNames().contains(packageName); |
67 |
|
} |
68 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (4) |
Complexity: 1 |
Complexity Density: 0.25 |
|
69 |
16 |
public List<String> getPackageNames()... |
70 |
|
{ |
71 |
16 |
List<String> names = new ArrayList<String>(); |
72 |
16 |
for (WebElement element : getDriver().findElementsWithoutWaiting( |
73 |
|
By.xpath("//div[@id='packagelistcontainer']//a[@class='package']"))) |
74 |
|
{ |
75 |
6 |
names.add(element.getText()); |
76 |
|
} |
77 |
16 |
return names; |
78 |
|
} |
79 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (2) |
Complexity: 1 |
Complexity Density: 0.5 |
|
80 |
4 |
public void selectPackage(String packageName)... |
81 |
|
{ |
82 |
4 |
getDriver().findElement(By.linkText(packageName)).click(); |
83 |
4 |
getDriver().waitUntilElementIsVisible(By.id("packageDescription")); |
84 |
|
} |
85 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (6) |
Complexity: 1 |
Complexity Density: 0.17 |
|
86 |
3 |
public void deletePackage(String packageName)... |
87 |
|
{ |
88 |
3 |
String xpath = "//ul[@class='xlist']//a[@class='package' and contains(.,'%s')]/..//a[@class='deletelink']"; |
89 |
3 |
this.packageList.findElement(By.xpath(String.format(xpath, packageName))).click(); |
90 |
|
|
91 |
3 |
ConfirmationModal confirmationModal = new ConfirmationModal(); |
92 |
3 |
confirmationModal.clickOk(); |
93 |
3 |
getDriver().waitUntilElementIsVisible( |
94 |
|
By.xpath("//div[contains(@class,'xnotification-done') and text()='Done!']")); |
95 |
3 |
getDriver().findElement(By.xpath("//div[contains(@class,'xnotification-done') and text()='Done!']")).click(); |
96 |
|
} |
97 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (2) |
Complexity: 1 |
Complexity Density: 0.5 |
|
98 |
4 |
public void importPackage()... |
99 |
|
{ |
100 |
|
|
101 |
4 |
this.importPackageLink.click(); |
102 |
|
|
103 |
4 |
getDriver().waitUntilElementIsVisible(By.xpath("//div[@id='packagecontainer']/div[@class='infomessage']")); |
104 |
|
} |
105 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (3) |
Complexity: 1 |
Complexity Density: 0.33 |
|
106 |
4 |
public ViewPage clickImportedPage(String pageName)... |
107 |
|
{ |
108 |
4 |
getDriver().waitUntilElementIsVisible(By.linkText(pageName)); |
109 |
4 |
getDriver().findElement(By.linkText(pageName)).click(); |
110 |
4 |
return new ViewPage(); |
111 |
|
} |
112 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
113 |
1 |
public void selectReplaceHistoryOption()... |
114 |
|
{ |
115 |
1 |
getDriver().findElement(By.xpath("//input[@name='historyStrategy' and @value='replace']")).click(); |
116 |
|
} |
117 |
|
} |