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.junit.Assert; |
23 |
|
import org.junit.Rule; |
24 |
|
import org.junit.Test; |
25 |
|
import org.openqa.selenium.Keys; |
26 |
|
import org.xwiki.appwithinminutes.test.po.ApplicationCreatePage; |
27 |
|
import org.xwiki.test.ui.AbstractTest; |
28 |
|
import org.xwiki.test.ui.AdminAuthenticationRule; |
29 |
|
import org.xwiki.test.ui.browser.IgnoreBrowser; |
30 |
|
import org.xwiki.test.ui.browser.IgnoreBrowsers; |
31 |
|
import org.xwiki.test.ui.po.ViewPage; |
32 |
|
|
33 |
|
|
34 |
|
|
35 |
|
|
36 |
|
@version |
37 |
|
@since |
38 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (43) |
Complexity: 3 |
Complexity Density: 0.08 |
|
39 |
|
public class ApplicationNameTest extends AbstractTest |
40 |
|
{ |
41 |
|
@Rule |
42 |
|
public AdminAuthenticationRule adminAuthenticationRule = new AdminAuthenticationRule(getUtil()); |
43 |
|
|
44 |
|
|
45 |
|
|
46 |
|
|
47 |
|
private static final String EMPTY_APP_NAME_ERROR_MESSAGE = "Please enter the application name."; |
48 |
|
|
49 |
|
|
50 |
|
|
51 |
|
|
52 |
|
public static final String APP_NAME_USED_WARNING_MESSAGE = "This application already exists."; |
53 |
|
|
54 |
|
|
55 |
|
|
56 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (17) |
Complexity: 1 |
Complexity Density: 0.06 |
1PASS
|
|
57 |
1 |
@Test... |
58 |
|
@IgnoreBrowsers({ |
59 |
|
@IgnoreBrowser(value = "internet.*", version = "8\\.*", reason="See http://jira.xwiki.org/browse/XE-1146"), |
60 |
|
@IgnoreBrowser(value = "internet.*", version = "9\\.*", reason="See http://jira.xwiki.org/browse/XE-1177") |
61 |
|
}) |
62 |
|
public void testEmptyAppNameWithNextStepButton() |
63 |
|
{ |
64 |
1 |
ApplicationCreatePage appCreatePage = ApplicationCreatePage.gotoPage(); |
65 |
1 |
Assert.assertFalse(appCreatePage.getContent().contains(EMPTY_APP_NAME_ERROR_MESSAGE)); |
66 |
|
|
67 |
|
|
68 |
1 |
String urlBeforeClick = getDriver().getCurrentUrl(); |
69 |
1 |
appCreatePage.clickNextStepButton(); |
70 |
1 |
Assert.assertEquals(urlBeforeClick, getDriver().getCurrentUrl()); |
71 |
|
|
72 |
|
|
73 |
1 |
appCreatePage.setApplicationName("A"); |
74 |
1 |
appCreatePage.waitForApplicationNamePreview(); |
75 |
1 |
Assert.assertFalse(appCreatePage.getContent().contains(EMPTY_APP_NAME_ERROR_MESSAGE)); |
76 |
|
|
77 |
|
|
78 |
1 |
appCreatePage.getApplicationNameInput().sendKeys(Keys.BACK_SPACE); |
79 |
1 |
appCreatePage.waitForApplicationNameError(); |
80 |
1 |
Assert.assertTrue(appCreatePage.getContent().contains(EMPTY_APP_NAME_ERROR_MESSAGE)); |
81 |
|
|
82 |
|
|
83 |
1 |
urlBeforeClick = getDriver().getCurrentUrl(); |
84 |
1 |
appCreatePage.clickNextStepButton(); |
85 |
1 |
Assert.assertEquals(urlBeforeClick, getDriver().getCurrentUrl()); |
86 |
|
|
87 |
|
|
88 |
1 |
appCreatePage.setApplicationName(getTestMethodName()); |
89 |
1 |
appCreatePage.waitForApplicationNamePreview(); |
90 |
1 |
Assert.assertEquals(getTestMethodName() + " Structure", appCreatePage.clickNextStep().getDocumentTitle()); |
91 |
|
} |
92 |
|
|
93 |
|
|
94 |
|
|
95 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (17) |
Complexity: 1 |
Complexity Density: 0.06 |
1PASS
|
|
96 |
1 |
@Test... |
97 |
|
@IgnoreBrowsers({ |
98 |
|
@IgnoreBrowser(value = "internet.*", version = "8\\.*", reason="See http://jira.xwiki.org/browse/XE-1146"), |
99 |
|
@IgnoreBrowser(value = "internet.*", version = "9\\.*", reason="See http://jira.xwiki.org/browse/XE-1177") |
100 |
|
}) |
101 |
|
public void testEmptyAppNameWithEnter() |
102 |
|
{ |
103 |
1 |
ApplicationCreatePage appCreatePage = ApplicationCreatePage.gotoPage(); |
104 |
1 |
Assert.assertFalse(appCreatePage.getContent().contains(EMPTY_APP_NAME_ERROR_MESSAGE)); |
105 |
|
|
106 |
|
|
107 |
1 |
appCreatePage.getApplicationNameInput().sendKeys(Keys.RETURN); |
108 |
1 |
appCreatePage.waitForApplicationNameError(); |
109 |
1 |
Assert.assertTrue(appCreatePage.getContent().contains(EMPTY_APP_NAME_ERROR_MESSAGE)); |
110 |
|
|
111 |
|
|
112 |
1 |
appCreatePage.setApplicationName("B"); |
113 |
1 |
appCreatePage.waitForApplicationNamePreview(); |
114 |
1 |
Assert.assertFalse(appCreatePage.getContent().contains(EMPTY_APP_NAME_ERROR_MESSAGE)); |
115 |
|
|
116 |
|
|
117 |
1 |
appCreatePage.getApplicationNameInput().sendKeys(Keys.BACK_SPACE); |
118 |
1 |
appCreatePage.waitForApplicationNameError(); |
119 |
1 |
Assert.assertTrue(appCreatePage.getContent().contains(EMPTY_APP_NAME_ERROR_MESSAGE)); |
120 |
|
|
121 |
|
|
122 |
1 |
appCreatePage.getApplicationNameInput().sendKeys(Keys.RETURN); |
123 |
1 |
Assert.assertTrue(appCreatePage.getContent().contains(EMPTY_APP_NAME_ERROR_MESSAGE)); |
124 |
|
|
125 |
|
|
126 |
1 |
appCreatePage.setApplicationName(getTestMethodName()); |
127 |
1 |
appCreatePage.waitForApplicationNamePreview(); |
128 |
1 |
appCreatePage.getApplicationNameInput().sendKeys(Keys.RETURN); |
129 |
1 |
Assert.assertEquals(getTestMethodName() + " Structure", new ViewPage().getDocumentTitle()); |
130 |
|
} |
131 |
|
|
132 |
|
|
133 |
|
|
134 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (6) |
Complexity: 1 |
Complexity Density: 0.17 |
1PASS
|
|
135 |
1 |
@Test... |
136 |
|
@IgnoreBrowsers({ |
137 |
|
@IgnoreBrowser(value = "internet.*", version = "8\\.*", reason="See http://jira.xwiki.org/browse/XE-1146"), |
138 |
|
@IgnoreBrowser(value = "internet.*", version = "9\\.*", reason="See http://jira.xwiki.org/browse/XE-1177") |
139 |
|
}) |
140 |
|
public void testExistingAppName() |
141 |
|
{ |
142 |
1 |
ApplicationCreatePage appCreatePage = ApplicationCreatePage.gotoPage(); |
143 |
1 |
Assert.assertFalse(appCreatePage.getContent().contains(APP_NAME_USED_WARNING_MESSAGE)); |
144 |
|
|
145 |
|
|
146 |
1 |
appCreatePage.setApplicationName("Blog"); |
147 |
1 |
appCreatePage.waitForApplicationNamePreview(); |
148 |
1 |
Assert.assertTrue(appCreatePage.getContent().contains(APP_NAME_USED_WARNING_MESSAGE)); |
149 |
|
|
150 |
|
|
151 |
1 |
Assert.assertEquals("/Blog/Code/Blog Structure", appCreatePage.clickNextStep().getBreadcrumbContent()); |
152 |
|
} |
153 |
|
} |