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

File DocumentsMacroTest.java

 

Code metrics

0
7
1
1
61
20
1
0.14
7
1
1

Classes

Class Line # Actions
DocumentsMacroTest 34 7 0% 1 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.index.test.ui;
21   
22    import org.junit.Assert;
23    import org.junit.Test;
24    import org.xwiki.index.test.po.DocumentsMacroPage;
25    import org.xwiki.test.ui.AbstractGuestTest;
26    import org.xwiki.test.ui.po.LiveTableElement;
27   
28    /**
29    * Tests for the DocumentsMacro page.
30    *
31    * @version $Id: 760fc64999e4e29b9881a517d882d305cbf778fb $
32    * @since 4.2M3
33    */
 
34    public class DocumentsMacroTest extends AbstractGuestTest
35    {
36    /**
37    * Verify that the {{documents}} macro works by going to the page defining this wiki macro since it contains
38    * an example usage and we can verify it displays the expected result.
39    */
 
40  1 toggle @Test
41    public void testDocumentsMacro() throws Exception
42    {
43    // Create a dummy page in the Main space and having Main.WebHome as its parent so that it appears in the
44    // Documents Macro livetable (since the example lists pages in the Main space having Main.WebHome as their
45    // parent).
46  1 getUtil().createPage("Main", getTestMethodName(), "", "Test Title", "xwiki/2.1", "Main.WebHome");
47   
48  1 DocumentsMacroPage dmp = DocumentsMacroPage.gotoPage();
49  1 LiveTableElement livetable = dmp.getDocumentsExampleLiveTable();
50   
51    // Verify that we have a Page column
52  1 Assert.assertTrue("No Title column found", livetable.hasColumn("Title"));
53   
54    // Verify there are several rows displayed
55  1 Assert.assertTrue(livetable.getRowCount() > 0);
56   
57    // Verify that page titles are displayed by filtering on one page for which we know the title
58  1 livetable.filterColumn("xwiki-livetable-example-filter-2", getTestMethodName());
59  1 Assert.assertTrue(livetable.hasRow("Title", "Test Title"));
60    }
61    }