1 |
|
|
2 |
|
|
3 |
|
|
4 |
|
|
5 |
|
|
6 |
|
|
7 |
|
|
8 |
|
|
9 |
|
|
10 |
|
|
11 |
|
|
12 |
|
|
13 |
|
|
14 |
|
|
15 |
|
|
16 |
|
|
17 |
|
|
18 |
|
|
19 |
|
|
20 |
|
package org.xwiki.webjars.test.ui; |
21 |
|
|
22 |
|
import org.junit.Rule; |
23 |
|
import org.junit.Test; |
24 |
|
import org.openqa.selenium.By; |
25 |
|
import org.openqa.selenium.WebElement; |
26 |
|
import org.xwiki.test.ui.AbstractTest; |
27 |
|
import org.xwiki.test.ui.SuperAdminAuthenticationRule; |
28 |
|
import org.xwiki.test.ui.po.ViewPage; |
29 |
|
|
30 |
|
import static org.junit.Assert.*; |
31 |
|
|
32 |
|
|
33 |
|
|
34 |
|
|
35 |
|
@version |
36 |
|
@since |
37 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (8) |
Complexity: 1 |
Complexity Density: 0.14 |
|
38 |
|
public class WebJarsTest extends AbstractTest |
39 |
|
{ |
40 |
|
@Rule |
41 |
|
public SuperAdminAuthenticationRule superAdminAuthenticationRule = new SuperAdminAuthenticationRule(getUtil()); |
42 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (7) |
Complexity: 1 |
Complexity Density: 0.14 |
1PASS
|
|
43 |
1 |
@Test... |
44 |
|
public void testWebJars() throws Exception |
45 |
|
{ |
46 |
|
|
47 |
1 |
getUtil().rest().deletePage(getTestClassName(), getTestMethodName()); |
48 |
|
|
49 |
|
|
50 |
|
|
51 |
|
|
52 |
|
|
53 |
|
|
54 |
|
|
55 |
|
|
56 |
|
|
57 |
1 |
String content = "{{velocity}}\n" |
58 |
|
+ "#set ($job = $services.extension.install('org.webjars:AjaxQ', '0.0.2', 'wiki:mywiki'))\n" |
59 |
|
+ "#set ($discard = $job.join())\n" |
60 |
|
+ "installed: $services.extension.installed.getInstalledExtension('org.webjars:AjaxQ', 'wiki:mywiki').id\n" |
61 |
|
+ "[[AjaxQ>>path:$services.webjars.url('org.webjars:AjaxQ', 'ajaxq.js', {'wiki' : 'mywiki'})]]\n" |
62 |
|
+ "{{/velocity}}"; |
63 |
1 |
ViewPage vp = getUtil().createPage(getTestClassName(), getTestMethodName(), content, "WebJars Test"); |
64 |
|
|
65 |
1 |
assertTrue(vp.getContent().contains("installed: org.webjars:AjaxQ-0.0.2")); |
66 |
|
|
67 |
|
|
68 |
|
|
69 |
1 |
WebElement link = getDriver().findElementWithoutWaiting( |
70 |
|
By.xpath("//a[@href = '/xwiki/webjars/wiki%3Amywiki/AjaxQ/0.0.2/ajaxq.js?r=1']")); |
71 |
1 |
link.click(); |
72 |
|
|
73 |
|
|
74 |
1 |
assertTrue(getDriver().getPageSource().contains("// AjaxQ jQuery Plugin")); |
75 |
|
} |
76 |
|
} |