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

File InvitationMessageDisplayElement.java

 

Coverage histogram

../../../../../img/srcFileCovDistChart4.png
78% of files have more coverage

Code metrics

2
12
8
1
85
48
9
0.75
1.5
8
1.12

Classes

Class Line # Actions
InvitationMessageDisplayElement 36 12 0% 9 13
0.409090940.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.invitation.test.po;
21   
22    import java.util.List;
23   
24    import org.openqa.selenium.By;
25    import org.openqa.selenium.WebElement;
26    import org.openqa.selenium.WebDriverException;
27    import org.xwiki.test.ui.po.BaseElement;
28   
29    /**
30    * Represents the actions possible on the section of a page which allows the user to previw an unsent message or
31    * view an old sent message.
32    *
33    * @version $Id: a6ab998e30e118f6eda0857c31f9182ed232a287 $
34    * @since 4.2M1
35    */
 
36    public class InvitationMessageDisplayElement extends BaseElement
37    {
38    private WebElement displayElement;
39   
 
40  1 toggle public InvitationMessageDisplayElement(WebElement displayElement)
41    {
42  1 super();
43  1 this.displayElement = displayElement;
44    }
45   
 
46  0 toggle public List<WebElement> getAllRecipients()
47    {
48  0 return displayElement.findElement(By.id("preview-to-field")).findElements(By.tagName("span"));
49    }
50   
 
51  1 toggle public List<WebElement> getValidRecipients()
52    {
53  1 return displayElement.findElement(By.id("preview-to-field")).findElements(By.className("valid-address"));
54    }
55   
 
56  0 toggle public List<WebElement> getInvalidRecipients()
57    {
58  0 return displayElement.findElement(By.id("preview-to-field")).findElements(By.className("invalid-address"));
59    }
60   
 
61  0 toggle public boolean isRecipientValid(String email)
62    {
63  0 for(WebElement recip : getAllRecipients()) {
64  0 if (recip.getText().contains(email)) {
65  0 return recip.getAttribute("class").contains("valid-address");
66    }
67    }
68  0 throw new WebDriverException("Recipient name (" + email + ") not found.");
69    }
70   
 
71  0 toggle public String getInvalidAddressMessage()
72    {
73  0 return displayElement.findElement(By.id("invalid-address-message")).getText();
74    }
75   
 
76  1 toggle public String getSubjectLine()
77    {
78  1 return displayElement.findElement(By.id("preview-subjectline-field")).getText();
79    }
80   
 
81  1 toggle public String getMessageBody()
82    {
83  1 return displayElement.findElement(By.id("preview-messagebody-field")).getText();
84    }
85    }