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

File ObjectEditPane.java

 

Coverage histogram

../../../../../../img/srcFileCovDistChart10.png
0% of files have more coverage

Code metrics

0
7
4
1
91
28
4
0.57
1.75
4
1

Classes

Class Line # Actions
ObjectEditPane 32 7 0% 4 0
1.0100%
 

Contributing tests

This file is covered by 14 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.ui.po.editor;
21   
22    import org.openqa.selenium.By;
23    import org.openqa.selenium.WebElement;
24    import org.xwiki.test.ui.po.FormElement;
25   
26    /**
27    * Represents a group of form fields that are used to edit an object of a specific type.
28    *
29    * @version $Id: bb1522b8226237a97728365a82e9bebf6241cfc6 $
30    * @since 5.1RC1
31    */
 
32    public class ObjectEditPane extends FormElement
33    {
34    /**
35    * The object type.
36    */
37    private String className;
38   
39    /**
40    * The object number (identifies the object in the set of objects of the same type).
41    */
42    private int objectNumber;
43   
44    /**
45    * Creates a new edit pane for an object of the specified type. The form fields from the given container should
46    * correspond to properties of the specified type.
47    *
48    * @param container the element that wraps the form fields used to edit the object
49    * @param className the object type
50    * @param objectNumber the object number (identifies the object in the set of objects of the same type)
51    */
 
52  40 toggle public ObjectEditPane(WebElement container, String className, int objectNumber)
53    {
54  40 super(container);
55   
56  40 this.className = className;
57  40 this.objectNumber = objectNumber;
58    }
59   
60    /**
61    * Opens the date picker for the specified date property of the edited object.
62    *
63    * @param datePropertyName the name of a date property of the edited object
64    * @return the date picker
65    */
 
66  2 toggle public DatePicker openDatePicker(String datePropertyName)
67    {
68  2 getDriver().findElementWithoutWaiting(getForm(), byPropertyName(datePropertyName)).click();
69  2 return new DatePicker();
70    }
71   
72    /**
73    * @param userPropertyName the name of a property of type List of Users
74    * @return a user picker for a property of type List of Users
75    */
 
76  2 toggle public UserPicker getUserPicker(String userPropertyName)
77    {
78  2 return new UserPicker(getDriver().findElementWithoutWaiting(getForm(), byPropertyName(userPropertyName)));
79    }
80   
81    /**
82    * Creates a locator for the input fields corresponding to the given object property.
83    *
84    * @param propertyName the name of an object property
85    * @return the locator for the input field corresponding to the specified property
86    */
 
87  16 toggle public By byPropertyName(String propertyName)
88    {
89  16 return By.id(this.className + "_" + this.objectNumber + "_" + propertyName);
90    }
91    }