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

File DeletePageOutcomePage.java

 

Coverage histogram

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

Code metrics

6
19
6
1
128
56
9
0.47
3.17
6
1.5

Classes

Class Line # Actions
DeletePageOutcomePage 34 19 0% 9 5
0.8387096583.9%
 

Contributing tests

This file is covered by 3 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 java.util.List;
23   
24    import org.apache.commons.lang3.StringUtils;
25    import org.openqa.selenium.WebElement;
26    import org.openqa.selenium.support.FindBy;
27   
28    /**
29    * Represents the common actions possible after a page has been deleted.
30    *
31    * @version $Id: e0c24332d79ddfd76a1931f4531f483e9dfd3ba6 $
32    * @since 3.2M3
33    */
 
34    public class DeletePageOutcomePage extends ViewPage
35    {
36    /**
37    * The Deleter is found in the first cell of the first column of the table listing past deletions.
38    * Note that when the user has no profile (as with superadmin for example or if a user's profile has been
39    * removed) then the deleted is not wrapped in an A tag and thus we shouldn't use that as a way to locate
40    * the deleter.
41    */
42    @FindBy(xpath = "//table[@class='centered']/tbody/tr/td")
43    private WebElement deleter;
44   
45    @FindBy(xpath = "//p[@class='xwikimessage']")
46    private WebElement message;
47   
48    @FindBy(xpath = "//*[@id = 'mainContentArea']//a[. = 'Restore']")
49    private WebElement restoreLink;
50   
51    /**
52    * @since 3.2M3
53    */
 
54  1 toggle public String getPageDeleter()
55    {
56  1 return this.deleter.getText();
57    }
58   
59    /**
60    * @since 4.0M2
61    */
 
62  1 toggle public String getMessage()
63    {
64  1 return this.message.getText();
65    }
66   
67    /**
68    * Clicks on the link to restore the deleted page from the recycle bin.
69    *
70    * @return the restored view page
71    * @since 5.2M2
72    */
 
73  0 toggle public ViewPage clickRestore()
74    {
75  0 this.restoreLink.click();
76  0 return new ViewPage();
77    }
78   
79    /**
80    * @return if there are terminal pages in the recycle bin
81    *
82    * @since 7.2RC1
83    */
 
84  2 toggle public boolean hasTerminalPagesInRecycleBin()
85    {
86  2 List<WebElement> messages = getDriver().findElementsByClassName("recyclebin-message");
87  2 for (WebElement message : messages) {
88  3 if (StringUtils.equals(message.getText(),
89    "The following versions of terminal pages are in the recycle bin:")) {
90  1 return true;
91    }
92    }
93   
94  1 return false;
95    }
96   
97    /**
98    * Clicks on the link to restore the deleted page from the recycle bin.
99    *
100    * @return the restored view page
101    * @since 7.2RC1
102    */
 
103  1 toggle public DeletePageOutcomePage clickDeletePage()
104    {
105  1 List<WebElement> elements = getDriver().findElementsByCssSelector(".docs .action-delete");
106  1 if (!elements.isEmpty()) {
107  1 getDriver().makeConfirmDialogSilent(true);
108  1 elements.get(0).click();
109    }
110  1 return new DeletePageOutcomePage();
111    }
112   
113    /**
114    * Clicks on the link to restore the deleted terminal page from the recycle bin.
115    *
116    * @return the restored view page
117    * @since 7.2RC1
118    */
 
119  1 toggle public DeletePageOutcomePage clickDeleteTerminalPage()
120    {
121  1 List<WebElement> elements = getDriver().findElementsByCssSelector(".terminal-docs .action-delete");
122  1 if (!elements.isEmpty()) {
123  1 getDriver().makeConfirmDialogSilent(true);
124  1 elements.get(0).click();
125    }
126  1 return new DeletePageOutcomePage();
127    }
128    }