public abstract class AbstractTest extends Object
Modifier and Type | Field and Description |
---|---|
static int |
AJAX_SHORT_TIMEOUT_SECONDS |
static int |
AJAX_TIMEOUT_SECONDS |
static String |
CHROME_DRIVER_DEFAULT_EXECUTABLE_NAME |
static String |
CHROME_DRIVER_DEFAULT_PATH_LINUX |
static String |
CHROME_DRIVER_DEFAULT_PATH_MAC |
static String |
CHROME_DRIVER_DEFAULT_PATH_WINVISTA |
static String |
CHROME_DRIVER_DEFAULT_PATH_WINXP |
static String |
CHROME_DRIVER_WINDOWS_EXECUTABLE_NAME |
static int |
LOAD_SHORT_TIMEOUT_SECONDS |
static int |
LOAD_TIMEOUT_SECONDS |
static String |
NUXEO_URL |
static int |
POLLING_FREQUENCY_SECONDS |
static String |
SYSPROP_CHROME_DRIVER_PATH |
org.junit.rules.MethodRule |
watchman
Logger method to follow what's being run on server logs and take a
screenshot of the last page in case of failure
|
Constructor and Description |
---|
AbstractTest() |
Modifier and Type | Method and Description |
---|---|
static <T> T |
asPage(Class<T> pageClassToProxy) |
static <T> T |
fillElement(Class<T> pageClassToProxy,
T page)
Fills an instantiated page/form/widget attributes
|
static org.openqa.selenium.WebElement |
findElementAndWaitUntilEnabled(org.openqa.selenium.By by)
Finds the first
WebElement using the given method, with the
default timeout. |
static org.openqa.selenium.WebElement |
findElementAndWaitUntilEnabled(org.openqa.selenium.By by,
int findElementTimeout,
int waitUntilEnabledTimeout)
Finds the first
WebElement using the given method, with a
findElementTimeout . |
static List<org.openqa.selenium.WebElement> |
findElementsWithTimeout(org.openqa.selenium.By by) |
static void |
findElementWaitUntilEnabledAndClick(org.openqa.selenium.By by)
Finds the first
WebElement using the given method, with the
default timeout. |
static void |
findElementWaitUntilEnabledAndClick(org.openqa.selenium.By by,
int findElementTimeout,
int waitUntilEnabledTimeout)
Finds the first
WebElement using the given method, with a
findElementTimeout . |
static org.openqa.selenium.WebElement |
findElementWithTimeout(org.openqa.selenium.By by)
Finds the first
WebElement using the given method, with a
timeout. |
static org.openqa.selenium.WebElement |
findElementWithTimeout(org.openqa.selenium.By by,
int timeout)
Finds the first
WebElement using the given method, with a
timeout. |
static org.openqa.selenium.WebElement |
findElementWithTimeout(org.openqa.selenium.By by,
int timeout,
org.openqa.selenium.WebElement parentElement)
Finds the first
WebElement using the given method, with a
timeout. |
static org.openqa.selenium.WebElement |
findElementWithTimeout(org.openqa.selenium.By by,
org.openqa.selenium.WebElement parentElement)
Finds the first
WebElement using the given method, with a
timeout. |
static <T> T |
get(String url,
Class<T> pageClassToProxy) |
LoginPage |
getLoginPage() |
static <T extends WebFragment> |
getWebFragment(org.openqa.selenium.By by,
Class<T> webFragmentClass) |
static <T extends WebFragment> |
getWebFragment(org.openqa.selenium.WebElement element,
Class<T> webFragmentClass) |
boolean |
hasElement(org.openqa.selenium.By by)
Returns true if corresponding element is found in the test page.
|
static void |
initDriver() |
static boolean |
isTextPresent(org.openqa.selenium.By by,
String text)
Returns true if
text is present in the element retrieved with
the given method. |
static boolean |
isTextPresent(org.openqa.selenium.WebElement element,
String text)
Returns true if
text is present in the given element. |
DocumentBasePage |
login()
Login as Administrator
|
DocumentBasePage |
login(String username,
String password) |
LoginPage |
loginInvalid(String username,
String password)
Login using an invalid credential.
|
LoginPage |
logout() |
<T extends AbstractPage> |
nav(Class<T> pageClass,
String linkText)
navigate to a link text.
|
void |
navToUrl(String urlString)
Navigate to a specified url
|
static void |
quitDriver() |
static void |
waitForTextNotPresent(org.openqa.selenium.WebElement element,
String text)
Fluent wait for text to be not present in the given element.
|
static void |
waitForTextPresent(org.openqa.selenium.By locator,
String text)
Fluent wait for text to be present in the element retrieved with the
given method.
|
static void |
waitForTextPresent(org.openqa.selenium.WebElement element,
String text)
Fluent wait for text to be present in the given element.
|
static void |
waitUntilElementNotPresent(org.openqa.selenium.By locator)
Fluent wait for an element not to be present, checking every 5 seconds.
|
static org.openqa.selenium.WebElement |
waitUntilElementPresent(org.openqa.selenium.By locator)
Fluent wait for an element to be present, checking every 5 seconds
|
static void |
waitUntilEnabled(org.openqa.selenium.WebElement element)
Waits until an element is enabled, with a timeout.
|
static void |
waitUntilEnabled(org.openqa.selenium.WebElement element,
int timeout)
Waits until an element is enabled, with a timeout.
|
public static final String CHROME_DRIVER_DEFAULT_PATH_LINUX
public static final String CHROME_DRIVER_DEFAULT_PATH_MAC
public static final String CHROME_DRIVER_DEFAULT_PATH_WINVISTA
public static final String CHROME_DRIVER_DEFAULT_PATH_WINXP
public static final String CHROME_DRIVER_DEFAULT_EXECUTABLE_NAME
public static final String CHROME_DRIVER_WINDOWS_EXECUTABLE_NAME
public static final String NUXEO_URL
public static final int LOAD_TIMEOUT_SECONDS
public static final int LOAD_SHORT_TIMEOUT_SECONDS
public static final int AJAX_TIMEOUT_SECONDS
public static final int AJAX_SHORT_TIMEOUT_SECONDS
public static final int POLLING_FREQUENCY_SECONDS
public static final String SYSPROP_CHROME_DRIVER_PATH
public org.junit.rules.MethodRule watchman
public static void quitDriver() throws InterruptedException
InterruptedException
public static <T> T asPage(Class<T> pageClassToProxy)
public static <T extends WebFragment> T getWebFragment(org.openqa.selenium.By by, Class<T> webFragmentClass)
public static <T extends WebFragment> T getWebFragment(org.openqa.selenium.WebElement element, Class<T> webFragmentClass)
public static <T> T fillElement(Class<T> pageClassToProxy, T page)
public boolean hasElement(org.openqa.selenium.By by)
public static org.openqa.selenium.WebElement findElementWithTimeout(org.openqa.selenium.By by, int timeout) throws org.openqa.selenium.NoSuchElementException
WebElement
using the given method, with a
timeout.by
- the locating mechanismtimeout
- the timeout in millisecondsorg.openqa.selenium.NoSuchElementException
- when not foundpublic static org.openqa.selenium.WebElement findElementWithTimeout(org.openqa.selenium.By by, int timeout, org.openqa.selenium.WebElement parentElement) throws org.openqa.selenium.NoSuchElementException
WebElement
using the given method, with a
timeout.by
- the locating mechanismtimeout
- the timeout in millisecondsparentElement
- find from the elementorg.openqa.selenium.NoSuchElementException
- when not foundpublic static org.openqa.selenium.WebElement findElementWithTimeout(org.openqa.selenium.By by) throws org.openqa.selenium.NoSuchElementException
WebElement
using the given method, with a
timeout.by
- the locating mechanismtimeout
- the timeout in millisecondsorg.openqa.selenium.NoSuchElementException
- when not foundpublic static List<org.openqa.selenium.WebElement> findElementsWithTimeout(org.openqa.selenium.By by) throws org.openqa.selenium.NoSuchElementException
org.openqa.selenium.NoSuchElementException
public static org.openqa.selenium.WebElement waitUntilElementPresent(org.openqa.selenium.By locator)
public static void waitUntilElementNotPresent(org.openqa.selenium.By locator)
public static void waitForTextPresent(org.openqa.selenium.By locator, String text)
public static void waitForTextPresent(org.openqa.selenium.WebElement element, String text)
public static void waitForTextNotPresent(org.openqa.selenium.WebElement element, String text)
public static boolean isTextPresent(org.openqa.selenium.By by, String text)
text
is present in the element retrieved with
the given method.public static boolean isTextPresent(org.openqa.selenium.WebElement element, String text)
text
is present in the given element.public static org.openqa.selenium.WebElement findElementWithTimeout(org.openqa.selenium.By by, org.openqa.selenium.WebElement parentElement) throws org.openqa.selenium.NoSuchElementException
WebElement
using the given method, with a
timeout.by
- the locating mechanismtimeout
- the timeout in millisecondsparentElement
- find from the elementorg.openqa.selenium.NoSuchElementException
- when not foundpublic static void waitUntilEnabled(org.openqa.selenium.WebElement element, int timeout) throws org.openqa.selenium.NotFoundException
element
- the elementtimeout
- the timeout in millisecondsorg.openqa.selenium.NotFoundException
public static void waitUntilEnabled(org.openqa.selenium.WebElement element) throws org.openqa.selenium.NotFoundException
element
- the elementorg.openqa.selenium.NotFoundException
public static org.openqa.selenium.WebElement findElementAndWaitUntilEnabled(org.openqa.selenium.By by, int findElementTimeout, int waitUntilEnabledTimeout) throws org.openqa.selenium.NotFoundException
WebElement
using the given method, with a
findElementTimeout
. Then waits until the element is enabled,
with a waitUntilEnabledTimeout
.by
- the locating mechanismfindElementTimeout
- the find element timeout in millisecondswaitUntilEnabledTimeout
- the wait until enabled timeout in
millisecondsorg.openqa.selenium.NotFoundException
- if the element is not found or not enabledpublic static org.openqa.selenium.WebElement findElementAndWaitUntilEnabled(org.openqa.selenium.By by) throws org.openqa.selenium.NotFoundException
WebElement
using the given method, with the
default timeout. Then waits until the element is enabled, with the
default timeout.by
- the locating mechanismorg.openqa.selenium.NotFoundException
- if the element is not found or not enabledpublic static void findElementWaitUntilEnabledAndClick(org.openqa.selenium.By by, int findElementTimeout, int waitUntilEnabledTimeout) throws org.openqa.selenium.NotFoundException
WebElement
using the given method, with a
findElementTimeout
. Then waits until the element is enabled,
with a waitUntilEnabledTimeout
. Then clicks on the element.by
- the locating mechanismfindElementTimeout
- the find element timeout in millisecondswaitUntilEnabledTimeout
- the wait until enabled timeout in
millisecondsorg.openqa.selenium.NotFoundException
- if the element is not found or not enabledpublic static void findElementWaitUntilEnabledAndClick(org.openqa.selenium.By by) throws org.openqa.selenium.NotFoundException
WebElement
using the given method, with the
default timeout. Then waits until the element is enabled, with the
default timeout. Then clicks on the element.by
- the locating mechanismorg.openqa.selenium.NotFoundException
- if the element is not found or not enabledpublic LoginPage getLoginPage()
public LoginPage logout()
public <T extends AbstractPage> T nav(Class<T> pageClass, String linkText)
public void navToUrl(String urlString) throws MalformedURLException
urlString
- urlMalformedURLException
public DocumentBasePage login() throws DocumentBasePage.UserNotConnectedException
DocumentBasePage.UserNotConnectedException
public DocumentBasePage login(String username, String password) throws DocumentBasePage.UserNotConnectedException
Copyright © 2013 Nuxeo SA. All Rights Reserved.