Package org.opennms.smoketest.selenium
Class AbstractOpenNMSSeleniumHelper
- java.lang.Object
-
- org.opennms.smoketest.selenium.AbstractOpenNMSSeleniumHelper
-
public abstract class AbstractOpenNMSSeleniumHelper extends Object
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description protected class
AbstractOpenNMSSeleniumHelper.WaitForNodesInDatabase
protected class
AbstractOpenNMSSeleniumHelper.WaitForNodesInRequisition
-
Field Summary
Fields Modifier and Type Field Description static String
BASIC_AUTH_PASSWORD
static String
BASIC_AUTH_USERNAME
static File
DOWNLOADS_FOLDER
static String
GROUP_NAME
static long
LOAD_TIMEOUT
org.junit.rules.TestWatcher
m_watcher
static long
REQ_TIMEOUT
static String
REQUISITION_NAME
org.openqa.selenium.support.ui.WebDriverWait
requisitionWait
static String
USER_NAME
org.openqa.selenium.support.ui.WebDriverWait
wait
-
Constructor Summary
Constructors Constructor Description AbstractOpenNMSSeleniumHelper()
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Deprecated Methods Modifier and Type Method Description void
adminPage()
void
assertElementDoesNotExist(org.openqa.selenium.By by)
protected void
assertElementDoesNotHaveText(org.openqa.selenium.By by, String text)
protected void
assertElementHasText(org.openqa.selenium.By by, String text)
protected String
buildUrlExternal(String urlFragment)
protected String
buildUrlInternal(String urlFragment)
void
cleanDownloadsFolder()
Delete all files in the downloads directory.void
clearElement(org.openqa.selenium.By by)
org.openqa.selenium.WebElement
clickElement(org.openqa.selenium.By by)
void
clickElementUntilElementDisappears(org.openqa.selenium.By click, org.openqa.selenium.By disappears)
In some cases, Vaadin doesn't register our clicks, so this method keeps click until the given element is no longer found.protected void
clickId(String id)
protected void
clickId(String id, boolean refresh)
protected void
clickMenuItem(String menuItemText, String submenuItemText, String submenuItemHref)
protected void
clickMenuItem(String menuItemText, String submenuItemText, String submenuItemHref, int timeout)
void
clickUntilVaadinPopupAppears(org.openqa.selenium.By by, String title)
void
clickUntilVaadinPopupDisappears(org.openqa.selenium.By by, String title)
int
countElementsMatchingCss(String css)
protected void
createForeignSource(String foreignSource, String xml)
protected void
createRequisition(String foreignSource)
protected void
createRequisition(String foreignSource, String xml, int expectedNodes)
protected void
createTestForeignSource(String xml)
protected void
createTestRequisition()
protected void
deleteExistingForeignSource(String foreignSource)
void
deleteExistingRequisition(String foreignSource)
protected void
deleteTestForeignSource()
protected void
deleteTestGroup()
protected void
deleteTestRequisition()
protected void
deleteTestUser()
protected Integer
doRequest(org.apache.http.client.methods.HttpRequestBase request)
void
enterAutocompleteText(org.openqa.selenium.By textInput, String text)
org.openqa.selenium.WebElement
enterText(org.openqa.selenium.By selector, CharSequence... text)
CAUTION: There are a variety of Firefox-specific bugs related to usingWebElement.sendKeys(CharSequence...)
.org.openqa.selenium.WebElement
findElementByCss(String css)
org.openqa.selenium.WebElement
findElementById(String id)
org.openqa.selenium.WebElement
findElementByLink(String link)
org.openqa.selenium.WebElement
findElementByName(String name)
org.openqa.selenium.WebElement
findElementByXpath(String xpath)
void
focusElement(org.openqa.selenium.By by)
protected void
frontPage()
abstract String
getBaseUrlExternal()
abstract String
getBaseUrlInternal()
protected static List<Integer>
getBoundedRectangleOfElement(org.openqa.selenium.WebDriver driver, org.openqa.selenium.WebElement we)
File
getDownloadsFolder()
abstract org.openqa.selenium.WebDriver
getDriver()
org.openqa.selenium.WebElement
getElementImmediately(org.openqa.selenium.By by)
protected org.openqa.selenium.WebElement
getElementWithoutWaiting(org.openqa.selenium.By by)
protected org.openqa.selenium.WebElement
getForeignSourceElement(String requisitionName)
Deprecated.long
getNodesInDatabase(String foreignSource)
protected long
getNodesInDatabase(org.openqa.selenium.WebElement element)
Deprecated.protected long
getNodesInRequisition(String foreignSource)
protected long
getNodesInRequisition(org.openqa.selenium.WebElement element)
Deprecated.protected ResponseData
getRequest(org.apache.http.client.methods.HttpRequestBase request)
org.openqa.selenium.support.ui.Select
getSelect(String id)
Vaadin usually wraps the select elements around a div element.org.openqa.selenium.WebElement
getVaadinPopup(String title)
protected void
goBack()
protected String
handleAlert()
protected String
handleAlert(String expectedText)
protected boolean
inVaadin()
void
login()
protected void
logout()
protected void
nodePage()
protected void
notificationsPage()
protected void
outagePage()
protected org.openqa.selenium.support.ui.ExpectedCondition<Boolean>
pageContainsText(String text)
protected void
provisioningPage()
protected void
reportsPage()
boolean
requisitionExists(String foreignSource)
protected org.openqa.selenium.WebElement
scrollToElement(org.openqa.selenium.By by)
protected org.openqa.selenium.WebElement
scrollToElement(org.openqa.selenium.By by, boolean waitForElement)
protected static org.openqa.selenium.WebElement
scrollToElement(org.openqa.selenium.WebDriver driver, org.openqa.selenium.WebElement element)
Deprecated.UsescrollToElement(By)
instead.protected org.openqa.selenium.WebElement
scrollToElement(org.openqa.selenium.WebElement element)
Deprecated.UsescrollToElement(By)
instead.protected void
searchPage()
void
selectByVisibleText(String id, String text)
protected void
selectDefaultFrame()
protected void
selectVaadinFrame()
protected void
sendDelete(String urlFragment)
protected void
sendDelete(String urlFragment, Integer expectedResponse)
protected void
sendPost(String urlFragment, String body)
void
sendPost(String urlFragment, String body, Integer expectedResponse)
protected void
sendPut(String urlFragment, String body)
protected void
sendPut(String urlFragment, String body, Integer expectedResponse)
protected void
setChecked(org.openqa.selenium.By by)
org.openqa.selenium.WebDriver.Timeouts
setImplicitWait()
org.openqa.selenium.WebDriver.Timeouts
setImplicitWait(long time, TimeUnit unit)
protected void
setUnchecked(org.openqa.selenium.By by)
protected void
sleep(int millis)
void
sleepQuietly(int millis)
protected void
supportPage()
static void
takeScreenshot(org.openqa.selenium.WebDriver driver, String filename)
protected org.openqa.selenium.support.ui.WebDriverWait
waitFor(long seconds)
protected void
waitForClose(org.openqa.selenium.By selector)
org.openqa.selenium.WebElement
waitForElement(org.openqa.selenium.By by)
org.openqa.selenium.WebElement
waitForElement(org.openqa.selenium.support.ui.WebDriverWait w, org.openqa.selenium.By by)
protected void
waitForValue(org.openqa.selenium.By selector, String expectedValue)
<T> T
waitUntil(Long implicitWait, org.openqa.selenium.support.ui.WebDriverWait w, Callable<T> callable)
<T> T
waitUntil(Long implicitWait, org.openqa.selenium.support.ui.WebDriverWait w, org.openqa.selenium.support.ui.ExpectedCondition<T> condition)
<T> T
waitUntil(Callable<T> callable)
<T> T
waitUntil(org.openqa.selenium.support.ui.ExpectedCondition<T> condition)
<T> T
waitUntil(org.openqa.selenium.support.ui.WebDriverWait w, Callable<T> callable)
<T> T
waitUntil(org.openqa.selenium.support.ui.WebDriverWait w, org.openqa.selenium.support.ui.ExpectedCondition<T> condition)
-
-
-
Field Detail
-
LOAD_TIMEOUT
public static final long LOAD_TIMEOUT
-
REQ_TIMEOUT
public static final long REQ_TIMEOUT
-
BASIC_AUTH_USERNAME
public static final String BASIC_AUTH_USERNAME
- See Also:
- Constant Field Values
-
BASIC_AUTH_PASSWORD
public static final String BASIC_AUTH_PASSWORD
- See Also:
- Constant Field Values
-
REQUISITION_NAME
public static final String REQUISITION_NAME
- See Also:
- Constant Field Values
-
USER_NAME
public static final String USER_NAME
- See Also:
- Constant Field Values
-
GROUP_NAME
public static final String GROUP_NAME
- See Also:
- Constant Field Values
-
DOWNLOADS_FOLDER
public static final File DOWNLOADS_FOLDER
-
wait
public org.openqa.selenium.support.ui.WebDriverWait wait
-
requisitionWait
public org.openqa.selenium.support.ui.WebDriverWait requisitionWait
-
m_watcher
public org.junit.rules.TestWatcher m_watcher
-
-
Method Detail
-
getDriver
public abstract org.openqa.selenium.WebDriver getDriver()
-
getBaseUrlInternal
public abstract String getBaseUrlInternal()
-
getBaseUrlExternal
public abstract String getBaseUrlExternal()
-
takeScreenshot
public static void takeScreenshot(org.openqa.selenium.WebDriver driver, String filename)
-
setImplicitWait
public org.openqa.selenium.WebDriver.Timeouts setImplicitWait()
-
setImplicitWait
public org.openqa.selenium.WebDriver.Timeouts setImplicitWait(long time, TimeUnit unit)
-
waitFor
protected org.openqa.selenium.support.ui.WebDriverWait waitFor(long seconds)
-
waitForClose
protected void waitForClose(org.openqa.selenium.By selector)
-
login
public void login()
-
logout
protected void logout()
-
pageContainsText
protected org.openqa.selenium.support.ui.ExpectedCondition<Boolean> pageContainsText(String text)
-
focusElement
public void focusElement(org.openqa.selenium.By by)
-
clearElement
public void clearElement(org.openqa.selenium.By by)
-
assertElementDoesNotExist
public void assertElementDoesNotExist(org.openqa.selenium.By by)
-
getElementImmediately
public org.openqa.selenium.WebElement getElementImmediately(org.openqa.selenium.By by)
-
getElementWithoutWaiting
protected org.openqa.selenium.WebElement getElementWithoutWaiting(org.openqa.selenium.By by)
-
assertElementDoesNotHaveText
protected void assertElementDoesNotHaveText(org.openqa.selenium.By by, String text)
-
assertElementHasText
protected void assertElementHasText(org.openqa.selenium.By by, String text)
-
handleAlert
protected String handleAlert()
-
setChecked
protected void setChecked(org.openqa.selenium.By by)
-
setUnchecked
protected void setUnchecked(org.openqa.selenium.By by)
-
clickMenuItem
protected void clickMenuItem(String menuItemText, String submenuItemText, String submenuItemHref)
-
clickMenuItem
protected void clickMenuItem(String menuItemText, String submenuItemText, String submenuItemHref, int timeout)
-
frontPage
protected void frontPage()
-
adminPage
public void adminPage()
-
nodePage
protected void nodePage()
-
notificationsPage
protected void notificationsPage()
-
outagePage
protected void outagePage()
-
provisioningPage
protected void provisioningPage()
-
reportsPage
protected void reportsPage()
-
searchPage
protected void searchPage()
-
supportPage
protected void supportPage()
-
goBack
protected void goBack()
-
clickElement
public org.openqa.selenium.WebElement clickElement(org.openqa.selenium.By by)
-
waitForElement
public org.openqa.selenium.WebElement waitForElement(org.openqa.selenium.By by)
-
waitForElement
public org.openqa.selenium.WebElement waitForElement(org.openqa.selenium.support.ui.WebDriverWait w, org.openqa.selenium.By by)
-
enterAutocompleteText
public void enterAutocompleteText(org.openqa.selenium.By textInput, String text)
-
clickUntilVaadinPopupAppears
public void clickUntilVaadinPopupAppears(org.openqa.selenium.By by, String title)
-
clickUntilVaadinPopupDisappears
public void clickUntilVaadinPopupDisappears(org.openqa.selenium.By by, String title)
-
inVaadin
protected boolean inVaadin()
-
selectVaadinFrame
protected void selectVaadinFrame()
-
selectDefaultFrame
protected void selectDefaultFrame()
-
getVaadinPopup
public org.openqa.selenium.WebElement getVaadinPopup(String title)
-
getSelect
public org.openqa.selenium.support.ui.Select getSelect(String id)
Vaadin usually wraps the select elements around a div element. This method considers this.
-
findElementById
public org.openqa.selenium.WebElement findElementById(String id)
-
findElementByLink
public org.openqa.selenium.WebElement findElementByLink(String link)
-
findElementByName
public org.openqa.selenium.WebElement findElementByName(String name)
-
findElementByCss
public org.openqa.selenium.WebElement findElementByCss(String css)
-
findElementByXpath
public org.openqa.selenium.WebElement findElementByXpath(String xpath)
-
countElementsMatchingCss
public int countElementsMatchingCss(String css) throws InstantiationException, IllegalAccessException, ClassNotFoundException
-
enterText
public org.openqa.selenium.WebElement enterText(org.openqa.selenium.By selector, CharSequence... text)
CAUTION: There are a variety of Firefox-specific bugs related to usingWebElement.sendKeys(CharSequence...)
. We're doing this bizarre sequence of operations to try and work around them.
-
sleep
protected void sleep(int millis)
-
sleepQuietly
public void sleepQuietly(int millis)
-
waitForValue
protected void waitForValue(org.openqa.selenium.By selector, String expectedValue)
-
scrollToElement
protected org.openqa.selenium.WebElement scrollToElement(org.openqa.selenium.WebElement element)
Deprecated.UsescrollToElement(By)
instead.
-
scrollToElement
protected static org.openqa.selenium.WebElement scrollToElement(org.openqa.selenium.WebDriver driver, org.openqa.selenium.WebElement element)
Deprecated.UsescrollToElement(By)
instead.
-
scrollToElement
protected org.openqa.selenium.WebElement scrollToElement(org.openqa.selenium.By by)
-
scrollToElement
protected org.openqa.selenium.WebElement scrollToElement(org.openqa.selenium.By by, boolean waitForElement)
-
clickElementUntilElementDisappears
public void clickElementUntilElementDisappears(org.openqa.selenium.By click, org.openqa.selenium.By disappears)
In some cases, Vaadin doesn't register our clicks, so this method keeps click until the given element is no longer found.
-
getBoundedRectangleOfElement
protected static List<Integer> getBoundedRectangleOfElement(org.openqa.selenium.WebDriver driver, org.openqa.selenium.WebElement we)
-
clickId
protected void clickId(String id) throws InterruptedException
- Throws:
InterruptedException
-
clickId
protected void clickId(String id, boolean refresh) throws InterruptedException
- Throws:
InterruptedException
-
waitUntil
public <T> T waitUntil(Callable<T> callable)
-
waitUntil
public <T> T waitUntil(org.openqa.selenium.support.ui.WebDriverWait w, Callable<T> callable)
-
waitUntil
public <T> T waitUntil(Long implicitWait, org.openqa.selenium.support.ui.WebDriverWait w, Callable<T> callable)
-
waitUntil
public <T> T waitUntil(org.openqa.selenium.support.ui.ExpectedCondition<T> condition)
-
waitUntil
public <T> T waitUntil(org.openqa.selenium.support.ui.WebDriverWait w, org.openqa.selenium.support.ui.ExpectedCondition<T> condition)
-
waitUntil
public <T> T waitUntil(Long implicitWait, org.openqa.selenium.support.ui.WebDriverWait w, org.openqa.selenium.support.ui.ExpectedCondition<T> condition)
-
doRequest
protected Integer doRequest(org.apache.http.client.methods.HttpRequestBase request) throws org.apache.http.client.ClientProtocolException, IOException, InterruptedException
- Throws:
org.apache.http.client.ClientProtocolException
IOException
InterruptedException
-
getRequest
protected ResponseData getRequest(org.apache.http.client.methods.HttpRequestBase request) throws org.apache.http.client.ClientProtocolException, IOException, InterruptedException
- Throws:
org.apache.http.client.ClientProtocolException
IOException
InterruptedException
-
getNodesInDatabase
public long getNodesInDatabase(String foreignSource)
-
requisitionExists
public boolean requisitionExists(String foreignSource)
-
deleteExistingRequisition
public void deleteExistingRequisition(String foreignSource)
-
getForeignSourceElement
@Deprecated protected org.openqa.selenium.WebElement getForeignSourceElement(String requisitionName)
Deprecated.
-
createTestRequisition
protected void createTestRequisition()
-
createRequisition
protected void createRequisition(String foreignSource)
-
createRequisition
protected void createRequisition(String foreignSource, String xml, int expectedNodes)
-
createTestForeignSource
protected void createTestForeignSource(String xml)
-
deleteTestForeignSource
protected void deleteTestForeignSource()
-
deleteExistingForeignSource
protected void deleteExistingForeignSource(String foreignSource)
-
getNodesInRequisition
protected long getNodesInRequisition(String foreignSource)
-
getNodesInRequisition
@Deprecated protected long getNodesInRequisition(org.openqa.selenium.WebElement element)
Deprecated.
-
getNodesInDatabase
@Deprecated protected long getNodesInDatabase(org.openqa.selenium.WebElement element)
Deprecated.
-
sendPost
protected void sendPost(String urlFragment, String body) throws org.apache.http.client.ClientProtocolException, IOException, InterruptedException
- Throws:
org.apache.http.client.ClientProtocolException
IOException
InterruptedException
-
sendPost
public void sendPost(String urlFragment, String body, Integer expectedResponse) throws org.apache.http.client.ClientProtocolException, IOException, InterruptedException
- Throws:
org.apache.http.client.ClientProtocolException
IOException
InterruptedException
-
sendPut
protected void sendPut(String urlFragment, String body) throws org.apache.http.client.ClientProtocolException, IOException, InterruptedException
- Throws:
org.apache.http.client.ClientProtocolException
IOException
InterruptedException
-
sendPut
protected void sendPut(String urlFragment, String body, Integer expectedResponse) throws org.apache.http.client.ClientProtocolException, IOException, InterruptedException
- Throws:
org.apache.http.client.ClientProtocolException
IOException
InterruptedException
-
sendDelete
protected void sendDelete(String urlFragment) throws org.apache.http.client.ClientProtocolException, IOException, InterruptedException
- Throws:
org.apache.http.client.ClientProtocolException
IOException
InterruptedException
-
sendDelete
protected void sendDelete(String urlFragment, Integer expectedResponse) throws org.apache.http.client.ClientProtocolException, IOException, InterruptedException
- Throws:
org.apache.http.client.ClientProtocolException
IOException
InterruptedException
-
getDownloadsFolder
public File getDownloadsFolder()
-
cleanDownloadsFolder
public void cleanDownloadsFolder()
Delete all files in the downloads directory.
-
-