Package org.xwiki.test.ui.po
Class BasePage
- java.lang.Object
-
- org.xwiki.test.ui.po.BaseElement
-
- org.xwiki.test.ui.po.BasePage
-
- Direct Known Subclasses:
AbstractRegistrationPage
,ChildrenViewer
,CopyOrRenameOrDeleteStatusPage
,DocumentDoesNotExistPage
,EditPage
,ResubmissionPage
,ViewPage
public class BasePage extends BaseElement
Represents the common actions possible on all Pages.- Since:
- 3.2M3
- Version:
- $Id: 26544b7fc7f4ec7244f25efed824daac5b2de923 $
-
-
Field Summary
Fields Modifier and Type Field Description protected org.openqa.selenium.WebElement
logo
Used to scroll the page to the top before accessing the floating menu.
-
Constructor Summary
Constructors Constructor Description BasePage()
Note: when reusing instances of BasePage, the constructor is not doing the work anymore and theBaseElement.waitUntilPageIsReady()
method needs to be executed manually, when needed.
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description boolean
canDelete()
void
clickAdminActionsSubMenuEntry(String id)
Deprecated.useclickMoreActionsSubMenuEntry(String)
instead which has a better nameprotected void
clickEditSubMenuEntry(String id)
Perform a click on a "edit menu" sub-menu entry.ViewPage
clickLocale(Locale locale)
void
clickMoreActionsSubMenuEntry(String id)
CopyPage
copy()
protected <T extends InlinePage>
TcreateInlinePage()
Can be overridden to return extendedInlinePage
.CreatePagePage
createPage()
ConfirmationPage
delete()
DeletePageConfirmationPage
deletePage()
Specific delete action when the delete action is performed on a page.void
edit()
Performs a click on the "edit" button.ClassEditPage
editClass()
Performs a click on the "edit class" entry of the content menu.<T extends InlinePage>
TeditInline()
Performs a click on the "edit inline" entry of the content menu.ObjectEditPage
editObjects()
Performs a click on the "edit objects" entry of the content menu.RightsEditPage
editRights()
Performs a click on the "edit acces rights" entry of the content menu.WikiEditPage
editWiki()
Performs a click on the "edit wiki" entry of the content menu.WYSIWYGEditPage
editWYSIWYG()
Performs a click on the "edit wysiwyg" entry of the content menu.String
getCurrentUser()
String
getDocumentTitle()
DrawerMenu
getDrawerMenu()
String
getEditURL()
Gets a string representation of the URL for editing the page.String
getErrorContent()
String
getHTMLMetaDataValue(String metaName)
List<Locale>
getLocales()
String
getMetaDataValue(String metaName)
String
getPageTitle()
String
getPageURL()
String
getXWikiMessageContent()
boolean
hasLeftPanel(String panelTitle)
boolean
hasLoginLink()
boolean
hasNotificationsMenu()
Says if the notifications menu is present (it is displayed only if it has some content).boolean
hasRenderingError()
boolean
isAuthenticated()
boolean
isForbidden()
boolean
isNewDocument()
Determine if the current page is a new document.boolean
isNotificationsMenuOpen()
LoginPage
login()
void
logout()
RegistrationPage
register()
BasePage
reloadPage()
Refresh the page and wait for the javascript to be also loaded.RenamePage
rename()
void
sendKeys(CharSequence... keys)
void
toggleActionMenu()
void
toggleNotificationsMenu()
Open/Close the notifications menu.ClassEditPage
useShortcutKeyForClassEditing()
Use keyboard shortcuts to go to class edit page.EditPage
useShortcutKeyForEditing()
Use keyboard shortcuts to go to edit page.InlinePage
useShortcutKeyForInlineEditing()
Use keyboard shortcuts to go to Inline Form edit page.ObjectEditPage
useShortcutKeyForObjectEditing()
Use keyboard shortcuts to go to object edit page.ConfirmationPage
useShortcutKeyForPageDeletion()
Use keyboard shortcuts to go to delete page.RenamePage
useShortcutKeyForPageRenaming()
Use keyboard shortcuts to go to rename page.BasePage
useShortcutKeyForRightsEditing()
Use keyboard shortcuts to go to rights edit page.ViewPage
useShortcutKeyForSourceViewer()
Use keyboard shortcuts to go to the source view of a page.WikiEditPage
useShortcutKeyForWikiEditing()
Use keyboard shortcuts to go to wiki edit page.WYSIWYGEditPage
useShortcutKeyForWysiwygEditing()
Use keyboard shortcuts to go to WYSIWYG edit page.void
validateWCAG()
Execute WCAG tests on the current base page.void
validateWCAG(WCAGContext wcagContext)
Execute WCAG tests on the current base page.void
validateWCAG(WCAGContext wcagContext, boolean checkCache)
Execute WCAG tests on the current base page.ChildrenViewer
viewChildren()
Opens the viewer that lists the children of the current page.void
watchDocument()
void
watchSpace()
void
watchWiki()
-
Methods inherited from class org.xwiki.test.ui.po.BaseElement
getDriver, getUtil, isElementVisible, setContext, waitForNotificationErrorMessage, waitForNotificationInProgressMessage, waitForNotificationSuccessMessage, waitForNotificationWarningMessage, waitUntilPageIsReady
-
-
-
-
Constructor Detail
-
BasePage
public BasePage()
Note: when reusing instances of BasePage, the constructor is not doing the work anymore and theBaseElement.waitUntilPageIsReady()
method needs to be executed manually, when needed.Note2: Never call the constructor before navigating to the page you need to test first.
-
-
Method Detail
-
getPageTitle
public String getPageTitle()
-
getPageURL
public String getPageURL()
-
getMetaDataValue
public String getMetaDataValue(String metaName)
- Parameters:
metaName
- the name of the XWiki document metadata- Returns:
- the value of the specified XWiki document metadata for the current XWiki document
- See Also:
getHTMLMetaDataValue(String)
-
getHTMLMetaDataValue
public String getHTMLMetaDataValue(String metaName)
- Parameters:
metaName
- the name of the HTML meta field- Returns:
- the value of the requested HTML meta field with from the current page
- Since:
- 7.2RC1
-
isAuthenticated
public boolean isAuthenticated()
- Returns:
- true if we are currently logged in, false otherwise
-
isNewDocument
public boolean isNewDocument()
Determine if the current page is a new document.- Returns:
- true if the document is new, false otherwise
-
clickEditSubMenuEntry
protected void clickEditSubMenuEntry(String id)
Perform a click on a "edit menu" sub-menu entry.- Parameters:
id
- The id of the entry to follow
-
edit
public void edit()
Performs a click on the "edit" button.
-
getEditURL
public String getEditURL()
Gets a string representation of the URL for editing the page.
-
editWiki
public WikiEditPage editWiki()
Performs a click on the "edit wiki" entry of the content menu.
-
editWYSIWYG
public WYSIWYGEditPage editWYSIWYG()
Performs a click on the "edit wysiwyg" entry of the content menu.
-
editInline
public <T extends InlinePage> T editInline()
Performs a click on the "edit inline" entry of the content menu.
-
createInlinePage
protected <T extends InlinePage> T createInlinePage()
Can be overridden to return extendedInlinePage
.
-
editRights
public RightsEditPage editRights()
Performs a click on the "edit acces rights" entry of the content menu.
-
editObjects
public ObjectEditPage editObjects()
Performs a click on the "edit objects" entry of the content menu.
-
editClass
public ClassEditPage editClass()
Performs a click on the "edit class" entry of the content menu.
-
sendKeys
public void sendKeys(CharSequence... keys)
- Since:
- 3.2M3
-
reloadPage
public BasePage reloadPage()
Refresh the page and wait for the javascript to be also loaded.- Since:
- 14.1
-
getDrawerMenu
public DrawerMenu getDrawerMenu()
- Returns:
- the PO for the Drawer Menu
- Since:
- 15.2RC1
-
toggleActionMenu
public void toggleActionMenu()
- Since:
- 7.2M3
-
clickMoreActionsSubMenuEntry
public void clickMoreActionsSubMenuEntry(String id)
- Since:
- 7.0RC1
-
clickAdminActionsSubMenuEntry
@Deprecated public void clickAdminActionsSubMenuEntry(String id)
Deprecated.useclickMoreActionsSubMenuEntry(String)
instead which has a better name- Since:
- 7.3M2
-
createPage
public CreatePagePage createPage()
- Since:
- 4.5M1
-
copy
public CopyPage copy()
- Since:
- 4.5M1
-
rename
public RenamePage rename()
-
delete
public ConfirmationPage delete()
- Since:
- 4.5M1
-
deletePage
public DeletePageConfirmationPage deletePage()
Specific delete action when the delete action is performed on a page.- Returns:
- a specialized confirmation page for page deletion
- Since:
- 12.8RC1
-
canDelete
public boolean canDelete()
- Since:
- 4.5M1
-
watchDocument
public void watchDocument()
- Since:
- 4.5M1
-
hasLoginLink
public boolean hasLoginLink()
- Since:
- 4.5M1
-
login
public LoginPage login()
- Since:
- 4.5M1
-
getCurrentUser
public String getCurrentUser()
- Since:
- 4.5M1
-
logout
public void logout()
- Since:
- 4.5M1
-
register
public RegistrationPage register()
- Since:
- 4.5M1
-
getDocumentTitle
public String getDocumentTitle()
- Since:
- 4.5M1
-
watchSpace
public void watchSpace()
- Since:
- 4.5M1
-
watchWiki
public void watchWiki()
- Since:
- 6.0M1
-
viewChildren
public ChildrenViewer viewChildren()
Opens the viewer that lists the children of the current page.- Returns:
- the viewer that lists the child pages
- Since:
- 7.3RC1
-
hasNotificationsMenu
public boolean hasNotificationsMenu()
Says if the notifications menu is present (it is displayed only if it has some content).- Returns:
- either or not the notifications menu is present
- Since:
- 7.4M1
-
toggleNotificationsMenu
public void toggleNotificationsMenu()
Open/Close the notifications menu.- Since:
- 7.4M1
-
isNotificationsMenuOpen
public boolean isNotificationsMenuOpen()
- Returns:
- true if the notifications menu is open
- Since:
- 7.4M1
-
getErrorContent
public String getErrorContent()
- Returns:
- the text of uncaught errors
- Since:
- 8.0M1
-
hasLeftPanel
public boolean hasLeftPanel(String panelTitle)
- Parameters:
panelTitle
- the panel displayed title- Returns:
- true if the panel is visible in the left panels or false otherwise
- Since:
- 10.6RC1
-
isForbidden
public boolean isForbidden()
-
getXWikiMessageContent
public String getXWikiMessageContent()
- Returns:
- the full text of an
xwikimessage
box displayed in the full content (e.g. in case of error). - Since:
- 15.1RC1, 14.10.6
-
validateWCAG
public void validateWCAG()
Execute WCAG tests on the current base page. Test results are cached using a key of current URL + PO class name.- Since:
- 15.2RC1
-
validateWCAG
public void validateWCAG(WCAGContext wcagContext)
Execute WCAG tests on the current base page. Test results are cached using a key of current URL + PO class name.- Parameters:
wcagContext
- the current WCAG context- Since:
- 15.2RC1
-
validateWCAG
public void validateWCAG(WCAGContext wcagContext, boolean checkCache)
Execute WCAG tests on the current base page.- Parameters:
wcagContext
- the current WCAG contextcheckCache
- if set to true, the WCAGContext cache will be checked before starting the validation and it'll be cancelled if the key (current URL + PO class name) is found in the cache.- Since:
- 15.2RC1
-
useShortcutKeyForEditing
public EditPage useShortcutKeyForEditing()
Use keyboard shortcuts to go to edit page.- Returns:
- a new
EditPage
- Since:
- 11.9RC1
-
useShortcutKeyForWikiEditing
public WikiEditPage useShortcutKeyForWikiEditing()
Use keyboard shortcuts to go to wiki edit page.- Returns:
- a new
WikiEditPage
- Since:
- 11.9RC1
-
useShortcutKeyForWysiwygEditing
public WYSIWYGEditPage useShortcutKeyForWysiwygEditing()
Use keyboard shortcuts to go to WYSIWYG edit page.- Returns:
- a new
WYSIWYGEditPage
- Since:
- 11.9RC1
-
useShortcutKeyForInlineEditing
public InlinePage useShortcutKeyForInlineEditing()
Use keyboard shortcuts to go to Inline Form edit page.- Returns:
- a new
InlinePage
- Since:
- 11.9RC1
-
useShortcutKeyForRightsEditing
public BasePage useShortcutKeyForRightsEditing()
Use keyboard shortcuts to go to rights edit page.- Returns:
- a new
BasePage
: it can be actually either aRightsEditPage
or an AdministrationPage depending if the page is terminal or not. - Since:
- 11.9RC1
-
useShortcutKeyForObjectEditing
public ObjectEditPage useShortcutKeyForObjectEditing()
Use keyboard shortcuts to go to object edit page.- Returns:
- a new
ObjectEditPage
- Since:
- 11.9RC1
-
useShortcutKeyForClassEditing
public ClassEditPage useShortcutKeyForClassEditing()
Use keyboard shortcuts to go to class edit page.- Returns:
- a new
ClassEditPage
- Since:
- 11.9RC1
-
useShortcutKeyForPageDeletion
public ConfirmationPage useShortcutKeyForPageDeletion()
Use keyboard shortcuts to go to delete page.- Returns:
- a new
ConfirmationPage
- Since:
- 11.9RC1
-
useShortcutKeyForPageRenaming
public RenamePage useShortcutKeyForPageRenaming()
Use keyboard shortcuts to go to rename page.- Returns:
- a new
RenamePage
- Since:
- 11.9RC1
-
useShortcutKeyForSourceViewer
public ViewPage useShortcutKeyForSourceViewer()
Use keyboard shortcuts to go to the source view of a page.- Returns:
- a new
ViewPage
- Since:
- 11.9RC1
-
hasRenderingError
public boolean hasRenderingError()
- Returns:
- true if there's a rendering error on the page (i.e. an element with the class
xwikirenderingerror
) - Since:
- 13.3RC1
-
-