1 |
|
|
2 |
|
|
3 |
|
|
4 |
|
|
5 |
|
|
6 |
|
|
7 |
|
|
8 |
|
|
9 |
|
|
10 |
|
|
11 |
|
|
12 |
|
|
13 |
|
|
14 |
|
|
15 |
|
|
16 |
|
|
17 |
|
|
18 |
|
|
19 |
|
|
20 |
|
package org.xwiki.test.ui.appwithinminutes; |
21 |
|
|
22 |
|
import org.apache.commons.lang.RandomStringUtils; |
23 |
|
import org.junit.Assert; |
24 |
|
import org.junit.Before; |
25 |
|
import org.junit.Test; |
26 |
|
import org.xwiki.appwithinminutes.test.po.AppWithinMinutesHomePage; |
27 |
|
import org.xwiki.appwithinminutes.test.po.ApplicationClassEditPage; |
28 |
|
import org.xwiki.appwithinminutes.test.po.ApplicationCreatePage; |
29 |
|
import org.xwiki.appwithinminutes.test.po.ApplicationHomeEditPage; |
30 |
|
import org.xwiki.appwithinminutes.test.po.ApplicationHomePage; |
31 |
|
import org.xwiki.appwithinminutes.test.po.ApplicationsLiveTableElement; |
32 |
|
import org.xwiki.appwithinminutes.test.po.ClassFieldEditPane; |
33 |
|
import org.xwiki.test.ui.AbstractTest; |
34 |
|
import org.xwiki.test.ui.browser.IgnoreBrowser; |
35 |
|
import org.xwiki.test.ui.browser.IgnoreBrowsers; |
36 |
|
|
37 |
|
|
38 |
|
|
39 |
|
|
40 |
|
@version |
41 |
|
@since |
42 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (68) |
Complexity: 5 |
Complexity Density: 0.08 |
|
43 |
|
public class AppsLiveTableTest extends AbstractTest |
44 |
|
{ |
45 |
|
|
46 |
|
|
47 |
|
|
48 |
|
private AppWithinMinutesHomePage homePage; |
49 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (4) |
Complexity: 1 |
Complexity Density: 0.25 |
|
50 |
3 |
@Before... |
51 |
|
public void setUp() |
52 |
|
{ |
53 |
|
|
54 |
3 |
String userName = RandomStringUtils.randomAlphanumeric(5); |
55 |
3 |
String password = RandomStringUtils.randomAlphanumeric(6); |
56 |
3 |
getUtil().createUserAndLogin(userName, password); |
57 |
3 |
homePage = AppWithinMinutesHomePage.gotoPage(); |
58 |
|
} |
59 |
|
|
60 |
|
|
61 |
|
|
62 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (18) |
Complexity: 1 |
Complexity Density: 0.06 |
1PASS
|
|
63 |
1 |
@Test... |
64 |
|
@IgnoreBrowsers({ |
65 |
|
@IgnoreBrowser(value = "internet.*", version = "8\\.*", reason="See http://jira.xwiki.org/browse/XE-1146"), |
66 |
|
@IgnoreBrowser(value = "internet.*", version = "9\\.*", reason="See http://jira.xwiki.org/browse/XE-1177") |
67 |
|
}) |
68 |
|
public void testDeleteApplication() |
69 |
|
{ |
70 |
|
|
71 |
1 |
String appName = RandomStringUtils.randomAlphabetic(6); |
72 |
1 |
createApplication(appName); |
73 |
|
|
74 |
|
|
75 |
1 |
ApplicationsLiveTableElement appsLiveTable = homePage.getAppsLiveTable(); |
76 |
1 |
appsLiveTable.waitUntilReady(); |
77 |
1 |
Assert.assertTrue(appsLiveTable.hasColumn("Actions")); |
78 |
1 |
appsLiveTable.filterApplicationName(appName.substring(0, 3)); |
79 |
1 |
Assert.assertTrue(appsLiveTable.isApplicationListed(appName)); |
80 |
|
|
81 |
|
|
82 |
1 |
appsLiveTable.clickDeleteApplication(appName).clickNo(); |
83 |
|
|
84 |
1 |
homePage = new AppWithinMinutesHomePage(); |
85 |
1 |
appsLiveTable = homePage.getAppsLiveTable(); |
86 |
1 |
appsLiveTable.waitUntilReady(); |
87 |
|
|
88 |
1 |
Assert.assertEquals(appName.substring(0, 3), appsLiveTable.getApplicationNameFilter()); |
89 |
|
|
90 |
|
|
91 |
1 |
appsLiveTable.clickDeleteApplication(appName).clickYes(); |
92 |
|
|
93 |
1 |
homePage = new AppWithinMinutesHomePage(); |
94 |
1 |
appsLiveTable = homePage.getAppsLiveTable(); |
95 |
1 |
appsLiveTable.waitUntilReady(); |
96 |
|
|
97 |
1 |
Assert.assertEquals(appName.substring(0, 3), appsLiveTable.getApplicationNameFilter()); |
98 |
|
|
99 |
1 |
Assert.assertFalse(appsLiveTable.isApplicationListed(appName)); |
100 |
|
} |
101 |
|
|
102 |
|
|
103 |
|
|
104 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (13) |
Complexity: 1 |
Complexity Density: 0.08 |
1PASS
|
|
105 |
1 |
@Test... |
106 |
|
@IgnoreBrowsers({ |
107 |
|
@IgnoreBrowser(value = "internet.*", version = "8\\.*", reason="See http://jira.xwiki.org/browse/XE-1146"), |
108 |
|
@IgnoreBrowser(value = "internet.*", version = "9\\.*", reason="See http://jira.xwiki.org/browse/XE-1177") |
109 |
|
}) |
110 |
|
public void testEditApplication() |
111 |
|
{ |
112 |
|
|
113 |
1 |
String appName = RandomStringUtils.randomAlphabetic(6); |
114 |
1 |
createApplication(appName); |
115 |
|
|
116 |
|
|
117 |
1 |
ApplicationsLiveTableElement appsLiveTable = homePage.getAppsLiveTable(); |
118 |
1 |
appsLiveTable.waitUntilReady(); |
119 |
1 |
ApplicationClassEditPage classEditor = appsLiveTable.clickEditApplication(appName); |
120 |
|
|
121 |
|
|
122 |
1 |
ClassFieldEditPane fieldEditPane = new ClassFieldEditPane("shortText1"); |
123 |
1 |
fieldEditPane.setPrettyName("City Name"); |
124 |
1 |
fieldEditPane.openConfigPanel(); |
125 |
1 |
fieldEditPane.setName("cityName"); |
126 |
|
|
127 |
|
|
128 |
1 |
ApplicationHomeEditPage homeEditPage = classEditor.clickNextStep().clickNextStep(); |
129 |
1 |
homeEditPage.setDescription("demo"); |
130 |
|
|
131 |
|
|
132 |
1 |
ApplicationHomePage homePage = homeEditPage.clickFinish(); |
133 |
1 |
Assert.assertTrue(homePage.getContent().contains("demo")); |
134 |
|
} |
135 |
|
|
136 |
|
|
137 |
|
|
138 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (21) |
Complexity: 1 |
Complexity Density: 0.05 |
1PASS
|
|
139 |
1 |
@Test... |
140 |
|
@IgnoreBrowsers({ |
141 |
|
@IgnoreBrowser(value = "internet.*", version = "8\\.*", reason="See http://jira.xwiki.org/browse/XE-1146"), |
142 |
|
@IgnoreBrowser(value = "internet.*", version = "9\\.*", reason="See http://jira.xwiki.org/browse/XE-1177") |
143 |
|
}) |
144 |
|
public void testActionRights() |
145 |
|
{ |
146 |
|
|
147 |
1 |
String appName = RandomStringUtils.randomAlphabetic(6); |
148 |
1 |
createApplication(appName); |
149 |
|
|
150 |
|
|
151 |
1 |
ApplicationsLiveTableElement appsLiveTable = homePage.getAppsLiveTable(); |
152 |
1 |
appsLiveTable.waitUntilReady(); |
153 |
1 |
appsLiveTable.filterApplicationName(appName); |
154 |
1 |
Assert.assertTrue(appsLiveTable.canEditApplication(appName)); |
155 |
1 |
Assert.assertTrue(appsLiveTable.canDeleteApplication(appName)); |
156 |
|
|
157 |
|
|
158 |
1 |
homePage.logout(); |
159 |
1 |
getUtil().recacheSecretToken(); |
160 |
1 |
homePage = new AppWithinMinutesHomePage(); |
161 |
1 |
appsLiveTable = homePage.getAppsLiveTable(); |
162 |
1 |
appsLiveTable.waitUntilReady(); |
163 |
1 |
appsLiveTable.filterApplicationName(appName); |
164 |
1 |
Assert.assertFalse(appsLiveTable.canEditApplication(appName)); |
165 |
1 |
Assert.assertFalse(appsLiveTable.canDeleteApplication(appName)); |
166 |
|
|
167 |
|
|
168 |
1 |
getUtil().createUserAndLogin("someOtherUser", "somePassword"); |
169 |
1 |
appsLiveTable = AppWithinMinutesHomePage.gotoPage().getAppsLiveTable(); |
170 |
1 |
appsLiveTable.waitUntilReady(); |
171 |
1 |
appsLiveTable.filterApplicationName(appName); |
172 |
1 |
Assert.assertTrue(appsLiveTable.canEditApplication(appName)); |
173 |
1 |
Assert.assertFalse(appsLiveTable.canDeleteApplication(appName)); |
174 |
|
} |
175 |
|
|
176 |
|
|
177 |
|
|
178 |
|
|
179 |
|
@param |
180 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (7) |
Complexity: 1 |
Complexity Density: 0.14 |
|
181 |
3 |
private void createApplication(String appName)... |
182 |
|
{ |
183 |
3 |
ApplicationCreatePage appCreatePage = homePage.clickCreateApplication(); |
184 |
3 |
appCreatePage.setApplicationName(appName); |
185 |
3 |
appCreatePage.waitForApplicationNamePreview(); |
186 |
3 |
ApplicationClassEditPage classEditPage = appCreatePage.clickNextStep(); |
187 |
3 |
classEditPage.addField("Short Text"); |
188 |
|
|
189 |
3 |
classEditPage.clickNextStep().clickNextStep().waitUntilPageIsLoaded().clickFinish(); |
190 |
3 |
homePage = AppWithinMinutesHomePage.gotoPage(); |
191 |
|
} |
192 |
|
} |