Class | Line # | Actions | |||||
---|---|---|---|---|---|---|---|
UnusedPagesPane | 32 | 4 | 0% | 2 | 0 |
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.extension.test.po; | |
21 | ||
22 | import org.openqa.selenium.By; | |
23 | import org.openqa.selenium.WebElement; | |
24 | import org.xwiki.test.ui.po.BaseElement; | |
25 | ||
26 | /** | |
27 | * The confirmation to delete the unused wiki pages after uninstalling or upgrading a XAR extension. | |
28 | * | |
29 | * @version $Id: 1598375a2d3e88695889dd127ae840487ed64aa9 $ | |
30 | * @since 5.4.3 | |
31 | */ | |
32 | public class UnusedPagesPane extends BaseElement | |
33 | { | |
34 | /** | |
35 | * The tree of unused wiki pages. | |
36 | */ | |
37 | private WebElement documentTree; | |
38 | ||
39 | /** | |
40 | * Wraps the document tree found inside the given job question container. | |
41 | * | |
42 | * @param question the job question that contains this confirmation | |
43 | */ | |
44 | 2 | public UnusedPagesPane(WebElement question) |
45 | { | |
46 | 2 | this.documentTree = getDriver().findElementWithoutWaiting(question, By.className("document-tree")); |
47 | } | |
48 | ||
49 | /** | |
50 | * @param space the space name | |
51 | * @param page the page name | |
52 | * @return {@code true} if the tree of unused pages contains the specified document | |
53 | */ | |
54 | 4 | public boolean contains(String space, String page) |
55 | { | |
56 | 4 | String reference = String.format("xwiki:%s.%s", space, page); |
57 | 4 | String xpath = "//input[@type = 'checkbox' and @name = '" + reference + "' and @value = '']"; |
58 | 4 | return getDriver().findElementsWithoutWaiting(this.documentTree, By.xpath(xpath)).size() > 0; |
59 | } | |
60 | } |