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

File DataTypesPage.java

 

Coverage histogram

../../../../../img/srcFileCovDistChart9.png
38% of files have more coverage

Code metrics

0
13
5
1
106
43
5
0.38
2.6
5
1

Classes

Class Line # Actions
DataTypesPage 35 13 0% 5 2
0.888888988.9%
 

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.xclass.test.po;
21   
22    import org.openqa.selenium.WebElement;
23    import org.openqa.selenium.support.FindBy;
24    import org.xwiki.test.ui.po.DocumentPicker;
25    import org.xwiki.test.ui.po.LiveTableElement;
26    import org.xwiki.test.ui.po.ViewPage;
27    import org.xwiki.test.ui.po.editor.WikiEditPage;
28   
29    /**
30    * Represents the page that lists the available data types (XClasses) and allows us to create a new type.
31    *
32    * @version $Id: 5c62f77f0aeb36ea9f3aef73cce75b875852791c $
33    * @since 4.5
34    */
 
35    public class DataTypesPage extends ViewPage
36    {
37    /**
38    * The widget used to specify the class to create.
39    */
40    private DocumentPicker documentPicker = new DocumentPicker();
41   
42    /**
43    * The button used to create a new class.
44    */
45    @FindBy(xpath = "//*[@class = 'button' and @value = 'Create this Class']")
46    private WebElement createClassButton;
47   
48    /**
49    * The live table that lists the existing classes.
50    */
51    private LiveTableElement classesLiveTable = new LiveTableElement("classes");
52   
53    /**
54    * Opens the page that list the available data types.
55    *
56    * @return the page that lists the available data types
57    */
 
58  1 toggle public static DataTypesPage gotoPage()
59    {
60  1 getUtil().gotoPage("XWiki", "XWikiClasses");
61  1 return new DataTypesPage();
62    }
63   
64    /**
65    * Starts the process of creating a new XClass.
66    *
67    * @param spaceName the name of the space where to create the class
68    * @param className the class name
69    * @return the wiki edit mode for the specified class
70    */
 
71  1 toggle public ClassSheetPage createClass(String spaceName, String className)
72    {
73  1 this.documentPicker.setParent(spaceName);
74  1 this.documentPicker.setName(className);
75  1 this.createClassButton.click();
76  1 new WikiEditPage().clickSaveAndView();
77  1 return new ClassSheetPage();
78    }
79   
80    /**
81    * @return the button used to create a new class
82    */
 
83  0 toggle public WebElement getCreateClassButton()
84    {
85  0 return createClassButton;
86    }
87   
88    /**
89    * @param spaceName the name of the space were the class document is
90    * @param className the name of the class document
91    * @return {@code true} if the specified class is listed, {@code false} otherwise
92    */
 
93  2 toggle public boolean isClassListed(String spaceName, String className)
94    {
95  2 String classReference = spaceName + "." + className;
96  2 this.classesLiveTable.filterColumn("xwiki-livetable-classes-filter-2", classReference);
97  2 return this.classesLiveTable.getRowCount() > 0;
98    }
99   
 
100  1 toggle @Override
101    public DataTypesPage waitUntilPageIsLoaded()
102    {
103  1 this.classesLiveTable.waitUntilReady();
104  1 return this;
105    }
106    }