1. Project Clover database Tue Dec 20 2016 21:24:09 CET
  2. Package org.xwiki.test.selenium

File PanelsTest.java

 

Code metrics

0
18
2
1
86
37
2
0.11
9
2
1

Classes

Class Line # Actions
PanelsTest 32 18 0% 2 0
1.0100%
 

Contributing tests

This file is covered by 2 tests. .

Source view

1    /*
2    * See the NOTICE file distributed with this work for additional
3    * information regarding copyright ownership.
4    *
5    * This is free software; you can redistribute it and/or modify it
6    * under the terms of the GNU Lesser General Public License as
7    * published by the Free Software Foundation; either version 2.1 of
8    * the License, or (at your option) any later version.
9    *
10    * This software is distributed in the hope that it will be useful,
11    * but WITHOUT ANY WARRANTY; without even the implied warranty of
12    * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13    * Lesser General Public License for more details.
14    *
15    * You should have received a copy of the GNU Lesser General Public
16    * License along with this software; if not, write to the Free
17    * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
18    * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
19    */
20    package org.xwiki.test.selenium;
21   
22    import org.junit.Test;
23    import org.xwiki.test.selenium.framework.AbstractXWikiTestCase;
24   
25    /**
26    * Test the Panel feature. Note that some panels tests are also done by the
27    * {@link PanelWizardTest} test case class.
28    *
29    * @version $Id: 8208f7cc5b0f7403f173337b61013415f3eab0b8 $
30    * @since 1.6M1
31    */
 
32    public class PanelsTest extends AbstractXWikiTestCase
33    {
34    /**
35    * This method makes the following tests:
36    * <ul>
37    * <li>Opens the Panels page for XWiki instance.</li>
38    * <li>Creates a panel - setting the title.</li>
39    * <li>Completes the form with details for the newly created panel.</li>
40    * <li>Goes to preview and pushes the button save and continue.</li>
41    * <li>Completes the form and pushes the save&view button.</li>
42    * <li>Goes back to panels list and check for the presence of the newly created panel.</li>
43    * </ul>
44    */
 
45  1 toggle @Test
46    public void testCreatePanel()
47    {
48  1 try {
49  1 open("Panels", "WebHome");
50  1 setFieldValue("panelTitle", "Thesecondpaneltobecreated");
51  1 clickLinkWithXPath("//input[@value='Create']");
52  1 setFieldValue("Panels.PanelClass_0_description", "Tester panel");
53  1 setFieldValue("Panels.PanelClass_0_content",
54    "{{velocity}}\n#panelheader(\"Test panel\")\nTest Panel\n#panelfooter()\n{{/velocity}}");
55  1 clickEditSaveAndView();
56  1 open("Panels", "WebHome");
57  1 assertElementPresent("//a[. = 'Thesecondpaneltobecreated']");
58    } finally {
59  1 deletePage("Panels", "Thesecondpaneltobecreated");
60    }
61    }
62   
63    /**
64    * This method makes the following tests:
65    * <ul>
66    * <li>Opens the Panels page for XWiki instance.</li>
67    * <li>Creates a panel - setting a title with special characters ('$&/\?#).</li>
68    * <li>...Checking that no error occurred</li>
69    * <li>Goes back to panels list and check for the presence of the newly created panel.</li>
70    * </ul>
71    */
 
72  1 toggle @Test
73    public void testCreatePanelWithSpecialSymbols()
74    {
75  1 String title = "Is # & \u0163 'triky\"? c:\\windows /root $util";
76  1 try {
77  1 open("Panels", "WebHome");
78  1 setFieldValue("panelTitle", title);
79  1 clickLinkWithXPath("//input[@value='Create']");
80  1 clickEditSaveAndView();
81  1 assertTextPresent(title);
82    } finally {
83  1 deletePage("Panels", title);
84    }
85    }
86    }