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

File ApplicationsPanelEntryTest.java

 

Code metrics

0
14
2
1
84
41
2
0.14
7
2
1

Classes

Class Line # Actions
ApplicationsPanelEntryTest 43 14 0% 2 0
1.0100%
 

Contributing tests

This file is covered by 1 test. .

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.ui.appwithinminutes;
21   
22    import java.util.HashMap;
23    import java.util.Map;
24   
25    import org.junit.Assert;
26    import org.junit.Before;
27    import org.junit.Rule;
28    import org.junit.Test;
29    import org.xwiki.appwithinminutes.test.po.ApplicationHomeEditPage;
30    import org.xwiki.panels.test.po.ApplicationsPanel;
31    import org.xwiki.test.ui.AbstractTest;
32    import org.xwiki.test.ui.AdminAuthenticationRule;
33    import org.xwiki.test.ui.po.ViewPage;
34   
35    /**
36    * Tests the applications panel entry. This test needs its own class because it needs to be in a separated space in the
37    * wiki. In the other test classes we create one application per method, in the same space, which leads to duplicate
38    * entries in the panel.
39    *
40    * @version $Id: 0f5a32b39ee152da07b8da821efb87836808e830 $
41    * @since 4.3RC1
42    */
 
43    public class ApplicationsPanelEntryTest extends AbstractTest
44    {
45    @Rule
46    public AdminAuthenticationRule adminAuthenticationRule = new AdminAuthenticationRule(getUtil());
47   
48    /**
49    * The page being tested.
50    */
51    private ApplicationHomeEditPage editPage;
52   
53    /**
54    * The query string parameters passed to the edit action.
55    */
56    private final Map<String, String> editQueryStringParameters = new HashMap<String, String>();
57   
 
58  1 toggle @Before
59    public void setUp() throws Exception
60    {
61  1 getUtil().rest().deletePage(getTestClassName(), getTestMethodName());
62  1 editQueryStringParameters.put("editor", "inline");
63  1 editQueryStringParameters.put("template", "AppWithinMinutes.LiveTableTemplate");
64  1 editQueryStringParameters.put("AppWithinMinutes.LiveTableClass_0_class", "XWiki.XWikiUsers");
65  1 getUtil().gotoPage(getTestClassName(), getTestMethodName(), "edit", editQueryStringParameters);
66  1 editPage = new ApplicationHomeEditPage().waitUntilPageIsLoaded();
67    }
68   
 
69  1 toggle @Test
70    public void testApplicationPanelEntry()
71    {
72    // Test the icon remains the same between edits
73  1 editPage.setIcon("icon:bell");
74  1 editPage.clickSaveAndView();
75  1 getUtil().gotoPage(getTestClassName(), getTestMethodName(), "edit");
76  1 Assert.assertEquals("icon:bell", editPage.getIcon());
77   
78  1 ApplicationsPanel panel = ApplicationsPanel.gotoPage();
79  1 ViewPage page = panel.clickApplication(getTestClassName());
80    // Verify we're on the right page!
81  1 Assert.assertEquals(getTestClassName(), page.getMetaDataValue("space"));
82  1 Assert.assertEquals(getTestMethodName(), page.getMetaDataValue("page"));
83    }
84    }