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

File AddEntryTest.java

 

Code metrics

0
18
2
1
93
53
2
0.11
9
2
1

Classes

Class Line # Actions
AddEntryTest 46 18 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.apache.commons.lang3.RandomStringUtils;
26    import org.junit.Assert;
27    import org.junit.Before;
28    import org.junit.Rule;
29    import org.junit.Test;
30    import org.xwiki.appwithinminutes.test.po.ApplicationHomeEditPage;
31    import org.xwiki.appwithinminutes.test.po.ApplicationHomePage;
32    import org.xwiki.appwithinminutes.test.po.EntryEditPage;
33    import org.xwiki.appwithinminutes.test.po.EntryNamePane;
34    import org.xwiki.test.ui.AbstractTest;
35    import org.xwiki.test.ui.AdminAuthenticationRule;
36    import org.xwiki.test.ui.browser.IgnoreBrowser;
37    import org.xwiki.test.ui.browser.IgnoreBrowsers;
38    import org.xwiki.test.ui.po.LiveTableElement;
39   
40    /**
41    * Tests the process of adding new application entries.
42    *
43    * @version $Id: c877e4cab63f2a163b18b14eef34b9089041aed4 $
44    * @since 4.0M1
45    */
 
46    public class AddEntryTest extends AbstractTest
47    {
48    @Rule
49    public AdminAuthenticationRule adminAuthenticationRule = new AdminAuthenticationRule(getUtil());
50   
51    /**
52    * The page being tested.
53    */
54    private ApplicationHomePage homePage;
55   
 
56  1 toggle @Before
57    public void setUp() throws Exception
58    {
59  1 getUtil().rest().deletePage(getTestClassName(), getTestMethodName());
60  1 Map<String, String> editQueryStringParameters = new HashMap<String, String>();
61  1 editQueryStringParameters.put("editor", "inline");
62  1 editQueryStringParameters.put("template", "AppWithinMinutes.LiveTableTemplate");
63  1 editQueryStringParameters.put("AppWithinMinutes.LiveTableClass_0_class", "Panels.PanelClass");
64  1 getUtil().gotoPage(getTestClassName(), getTestMethodName(), "edit", editQueryStringParameters);
65    // Wait for the page to load before clicking on the save button to make sure the page layout is stable.
66  1 homePage = new ApplicationHomeEditPage().waitUntilPageIsLoaded().clickSaveAndView();
67    }
68   
69    /**
70    * Tests that entry name is URL encoded.
71    */
 
72  1 toggle @Test
73    @IgnoreBrowsers({
74    @IgnoreBrowser(value = "internet.*", version = "8\\.*", reason="See http://jira.xwiki.org/browse/XE-1146"),
75    @IgnoreBrowser(value = "internet.*", version = "9\\.*", reason="See http://jira.xwiki.org/browse/XE-1177")
76    })
77    public void testEntryNameWithURLSpecialCharacters()
78    {
79  1 EntryNamePane entryNamePane = homePage.clickAddNewEntry();
80  1 String entryName = "A?b=c&d#" + RandomStringUtils.randomAlphanumeric(3);
81  1 entryNamePane.setName(entryName);
82  1 EntryEditPage entryEditPage = entryNamePane.clickAdd();
83  1 entryEditPage.setValue("description", "This is a test panel.");
84  1 entryEditPage.clickSaveAndView();
85   
86  1 getUtil().gotoPage(getTestClassName(), getTestMethodName());
87  1 homePage = new ApplicationHomePage();
88  1 LiveTableElement entriesLiveTable = homePage.getEntriesLiveTable();
89  1 entriesLiveTable.waitUntilReady();
90    // The column header is not translated because we haven't generated the document translation bundle.
91  1 Assert.assertTrue(entriesLiveTable.hasRow("panel.livetable.doc.title", entryName));
92    }
93    }