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

File ConfirmationPage.java

 

Coverage histogram

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

Code metrics

2
7
5
1
92
38
6
0.86
1.4
5
1.2

Classes

Class Line # Actions
ConfirmationPage 33 7 0% 6 0
1.0100%
 

Contributing tests

This file is covered by 9 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;
21   
22    import org.openqa.selenium.By;
23    import org.openqa.selenium.WebElement;
24    import org.openqa.selenium.support.FindBy;
25   
26    /**
27    * Represents a confirmation page that allows the user cancel or confirm the current action (e.g. delete a page, delete
28    * a space, etc.).
29    *
30    * @version $Id: abc19291ccb67b57803ae2cdb6d57fa73ab13764 $
31    * @since 4.0M2
32    */
 
33    public class ConfirmationPage extends ViewPage
34    {
35    @FindBy(xpath = "//*[(contains(@class, 'btn') or contains(@class, 'button')) "
36    + "and (contains(@value, 'Yes') or contains(text(), 'Yes'))]")
37    private WebElement yesButton;
38   
39    @FindBy(xpath = "//*[(contains(@class, 'btn') or contains(@class, 'button')) "
40    + "and (contains(@value, 'No') or contains(text(), 'No'))]")
41    private WebElement noButton;
42   
43    @FindBy(id = "affectChildren")
44    private WebElement affectChildren;
45   
46    /**
47    * Clicks on the Yes button to confirm the current action.
48    */
 
49  11 toggle public void clickYes()
50    {
51  11 this.yesButton.click();
52    }
53   
54    /**
55    * Clicks on the No button to cancel the current action.
56    */
 
57  2 toggle public void clickNo()
58    {
59  2 this.noButton.click();
60    }
61   
62    /**
63    * @return if the "affect children" option is present or not
64    * @since 7.2RC1
65    */
 
66  3 toggle public boolean hasAffectChildrenOption()
67    {
68  3 return getDriver().hasElementWithoutWaiting(By.id("affectChildren"));
69    }
70   
71    /**
72    * Check or un-check the "affect children" option.
73    * @param value either or the option should be enabled
74    * @since 7.2RC1
75    */
 
76  2 toggle public void setAffectChildren(boolean value)
77    {
78  2 if (affectChildren.isSelected() != value) {
79  1 affectChildren.click();
80    }
81    }
82   
83    /**
84    * Confirm the deletion of the page
85    * @return an object representing the UI displayed when a page is deleted
86    */
 
87  3 toggle public DeletingPage confirmDeletePage()
88    {
89  3 clickYes();
90  3 return new DeletingPage();
91    }
92    }