Class | Line # | Actions | |||||
---|---|---|---|---|---|---|---|
PreviewEditPage | 31 | 4 | 0% | 3 | 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.test.ui.po.editor; | |
21 | ||
22 | import org.openqa.selenium.WebElement; | |
23 | import org.openqa.selenium.support.FindBy; | |
24 | ||
25 | /** | |
26 | * Models the preview edit page. | |
27 | * | |
28 | * @version $Id: 7c9bfdb72878c8200fe24c0ba7ae55d825727a37 $ | |
29 | * @since 3.2M3 | |
30 | */ | |
31 | public class PreviewEditPage extends EditPage | |
32 | { | |
33 | /** | |
34 | * The edited page. | |
35 | */ | |
36 | private PreviewableEditPage editedPage; | |
37 | ||
38 | @FindBy(id = "xwikicontent") | |
39 | private WebElement content; | |
40 | ||
41 | /** | |
42 | * The button used to return to edit. We don't use the top button because its position in preview mode coincides | |
43 | * with the position of the edit menu in edit mode and since the mouse remains in the same position the edit menu is | |
44 | * opened as soon as we get back to edit (because it opens on hover). | |
45 | */ | |
46 | @FindBy(xpath = "//*[@class = 'bottombuttons']//*[@name = 'action_edit']") | |
47 | private WebElement backToEdit; | |
48 | ||
49 | /** | |
50 | * Creates a new preview page that holds a reference to the edited page. | |
51 | * | |
52 | * @param editedPage the edited page | |
53 | */ | |
54 | 4 | public PreviewEditPage(PreviewableEditPage editedPage) |
55 | { | |
56 | 4 | this.editedPage = editedPage; |
57 | } | |
58 | ||
59 | /** | |
60 | * Clicks on the back to edit button. | |
61 | * | |
62 | * @return the edited page | |
63 | */ | |
64 | 2 | public PreviewableEditPage clickBackToEdit() |
65 | { | |
66 | 2 | backToEdit.click(); |
67 | 2 | return editedPage; |
68 | } | |
69 | ||
70 | /** | |
71 | * @return the page's main content as text (no HTML) | |
72 | */ | |
73 | 3 | public String getContent() |
74 | { | |
75 | 3 | return this.content.getText(); |
76 | } | |
77 | } |