public abstract class AbstractPageObject extends AbstractPrimefacesPageComponent
Abstract base class for all page objects of a Primefaces application
Copyright 2017 (C) by Martin Ganserer
| Modifier and Type | Field and Description |
|---|---|
static String |
BUTTON_ID_LOG_IN |
static String |
FORM_ID_PREFIX |
AJAX_POLLING_INTERVAL_MILLISECONDS, ATTR_NAME_CLASS, ATTR_NAME_SELECTED, ATTR_NAME_STYLE, ATTR_NAME_VALUE, driver, HTML_LIST_ITEM, ITEM_DELIMITER, logger, NEW_LINE, ROW_OFFSET_X, ROW_OFFSET_Y, testContext| Constructor and Description |
|---|
AbstractPageObject(SeleniumTestContext testContext)
Constructor
|
| Modifier and Type | Method and Description |
|---|---|
protected String |
buildPageURL(String baseURL,
String resourcePath)
Build the page URL using the given base URL and a resource path.
|
protected boolean |
getCheckBoxSelection(PageElementTestData testData)
Determine the selection of a checkbox field
|
void |
open(String resourcePath)
Open a page
|
void |
open(String resourcePath,
String objectId)
Open a page to display data for a specific object identified by the given ID
|
<T extends AbstractPageObject> |
openPageByNavigator(String navigationTarget,
Class<T> pageClass)
Navigate to a page by selecting a tree view item with the specified navigation target! As the page object is created via introspection it is necessary that the respective class provides an
appropriate constructor!
|
void |
openTabPage(String tabPageId)
Open a tab page identified by the given ID
|
void |
pressBackButton()
Press the 'Back' button
|
void |
pressButton(String id)
Press a button with a given ID
|
void |
pressLogoutButton()
Press the logout button
|
void |
pressSaveButton()
Press the 'Save' button
|
<T extends AbstractPageObject> |
pressSaveButton(Class<T> pageClass)
Press the 'Save' button
|
void |
selectAutoCompleteItem(PageElementTestData testData)
Select an item of an auto-complete field
|
void |
selectComboboxItem(PageElementTestData testData)
Select an item of a combobox field
|
protected boolean |
selectItem(org.openqa.selenium.WebElement element,
String itemValue)
Search for an existing list item with the given value and select it
|
void |
selectLoVItem(PageElementTestData testData)
Select an item by opening a list-of-values in a pop-up window
|
void |
setCheckBoxValue(PageElementTestData testData)
Change the selection of a checkbox
|
void |
uploadFile(String dialogId,
PageElementTestData testData)
Upload a file in a pop-up window
|
void |
validateAutoCompleteItem(PageElementTestData testData)
Validate the selected item of an auto-complete field
|
void |
validateCheckBoxValue(PageElementTestData testData)
Validate the selection of a checkbox field
|
void |
validateComboboxItem(PageElementTestData testData)
Validate the selected item of a combobox field
|
void |
validateLabelText(PageElementTestData testData)
Validate a label field by using the field's test data object
|
void |
validateLoVItem(PageElementTestData testData)
Validate the selected item of a list-of-values field
|
void |
validatePageTitle(PageElementTestData testData)
Compare the page title with the expected text provided by the test data object
|
MessageDialog |
waitForMessageDialog(PageActionResult actionResult)
Wait for a message dialog and perform a status validation check
|
void |
waitForNotificationMessage(PageActionResult actionResult)
Wait for a growl notification message and perform a status validation check
|
createPageObject, waitForPendingAjaxRequestsassertEquals, assertNotNull, assertTrue, delayPageLoad, doubleClickElement, fail, fail, findWebElement, findWebElement, findWebElementByXPath, findWebElementsByXPath, getDriver, getLogger, getTestContext, moveToElement, scrollTo, setInputFieldValue, setLogger, validateInputFieldValue, waitUntilVisiblepublic static final String FORM_ID_PREFIX
public static final String BUTTON_ID_LOG_IN
public AbstractPageObject(SeleniumTestContext testContext)
testContext - public void open(String resourcePath)
resourcePath - AssertionError - if the parameter is null public void open(String resourcePath, String objectId)
resourcePath - objectId - AssertionError - if the parameter is null public <T extends AbstractPageObject> T openPageByNavigator(String navigationTarget, Class<T> pageClass)
T - the type of the page object that should be returnednavigationTarget - pageClass - AssertionError - if the operation has failedpublic void pressLogoutButton()
AssertionError - if the button could not be foundpublic void pressSaveButton()
AssertionError - if the button could not be foundpublic <T extends AbstractPageObject> T pressSaveButton(Class<T> pageClass)
T - the type of the page object that should be returnedpageClass - AssertionError - if the button either could not be found, or the page object could not be createdpublic void pressBackButton()
AssertionError - if the button could not be foundpublic void pressButton(String id)
id - AssertionError - if the button could not be foundpublic void setCheckBoxValue(PageElementTestData testData)
testData - the field's test data object that provides necessary informationAssertionError - if changing of the checkbox selection has failedpublic void validateCheckBoxValue(PageElementTestData testData)
testData - the field's test data object that provides necessary informationAssertionError - if the validation has failedpublic void selectAutoCompleteItem(PageElementTestData testData)
testData - the field's test data object that provides necessary informationAssertionError - if an item could not be selectedpublic void validateAutoCompleteItem(PageElementTestData testData)
testData - the field's test data object that provides necessary informationAssertionError - if the validation has failedpublic void selectComboboxItem(PageElementTestData testData)
testData - the field's test data object that provides necessary informationAssertionError - if an item could not be selectedpublic void validateComboboxItem(PageElementTestData testData)
testData - the field's test data object that provides necessary informationAssertionError - if the validation has failedpublic void selectLoVItem(PageElementTestData testData)
testData - the field's test data object that provides necessary informationAssertionError - if an item could not be selectedpublic void validateLoVItem(PageElementTestData testData)
testData - the field's test data object that provides necessary informationAssertionError - if the validation has failedpublic void validateLabelText(PageElementTestData testData)
testData - the field's test data object that provides necessary informationAssertionError - if the validation has failedpublic void uploadFile(String dialogId, PageElementTestData testData)
dialogId - the ID of the pop-up windowtestData - the test data object that provides necessary informationAssertionError - if an element either could not be found, or test data is invalidpublic void openTabPage(String tabPageId)
tabPageId - AssertionError - if the tab page could not be foundpublic MessageDialog waitForMessageDialog(PageActionResult actionResult)
actionResult - AssertionError - if the status validation either has failed, or an element could not be foundpublic void waitForNotificationMessage(PageActionResult actionResult)
actionResult - AssertionError - if the status validation either has failed, or an element could not be foundpublic void validatePageTitle(PageElementTestData testData)
testData - the test data object that provides necessary informationAssertionError - if the validation either has failed, or the test data is invalidprotected boolean selectItem(org.openqa.selenium.WebElement element,
String itemValue)
element - itemValue - protected boolean getCheckBoxSelection(PageElementTestData testData)
testData - the field's test data object that provides necessary informationCopyright © 2019. All rights reserved.