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 classAbstractOpenNMSSeleniumHelper.WaitForNodesInDatabaseprotected classAbstractOpenNMSSeleniumHelper.WaitForNodesInRequisition
-
Field Summary
Fields Modifier and Type Field Description static StringBASIC_AUTH_PASSWORDstatic StringBASIC_AUTH_USERNAMEstatic FileDOWNLOADS_FOLDERstatic StringGROUP_NAMEstatic longLOAD_TIMEOUTorg.junit.rules.TestWatcherm_watcherstatic longREQ_TIMEOUTstatic StringREQUISITION_NAMEorg.openqa.selenium.support.ui.WebDriverWaitrequisitionWaitstatic StringUSER_NAMEorg.openqa.selenium.support.ui.WebDriverWaitwait
-
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 voidadminPage()voidassertElementDoesNotExist(org.openqa.selenium.By by)protected voidassertElementDoesNotHaveText(org.openqa.selenium.By by, String text)protected voidassertElementHasText(org.openqa.selenium.By by, String text)protected StringbuildUrlExternal(String urlFragment)protected StringbuildUrlInternal(String urlFragment)voidcleanDownloadsFolder()Delete all files in the downloads directory.voidclearElement(org.openqa.selenium.By by)org.openqa.selenium.WebElementclickElement(org.openqa.selenium.By by)voidclickElementUntilElementDisappears(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 voidclickId(String id)protected voidclickId(String id, boolean refresh)protected voidclickMenuItem(String menuItemText, String submenuItemText, String submenuItemHref)protected voidclickMenuItem(String menuItemText, String submenuItemText, String submenuItemHref, int timeout)voidclickUntilVaadinPopupAppears(org.openqa.selenium.By by, String title)voidclickUntilVaadinPopupDisappears(org.openqa.selenium.By by, String title)intcountElementsMatchingCss(String css)protected voidcreateForeignSource(String foreignSource, String xml)protected voidcreateRequisition(String foreignSource)protected voidcreateRequisition(String foreignSource, String xml, int expectedNodes)protected voidcreateTestForeignSource(String xml)protected voidcreateTestRequisition()protected voiddeleteExistingForeignSource(String foreignSource)voiddeleteExistingRequisition(String foreignSource)protected voiddeleteTestForeignSource()protected voiddeleteTestGroup()protected voiddeleteTestRequisition()protected voiddeleteTestUser()protected IntegerdoRequest(org.apache.http.client.methods.HttpRequestBase request)voidenterAutocompleteText(org.openqa.selenium.By textInput, String text)org.openqa.selenium.WebElemententerText(org.openqa.selenium.By selector, CharSequence... text)CAUTION: There are a variety of Firefox-specific bugs related to usingWebElement.sendKeys(CharSequence...).org.openqa.selenium.WebElementfindElementByCss(String css)org.openqa.selenium.WebElementfindElementById(String id)org.openqa.selenium.WebElementfindElementByLink(String link)org.openqa.selenium.WebElementfindElementByName(String name)org.openqa.selenium.WebElementfindElementByXpath(String xpath)voidfocusElement(org.openqa.selenium.By by)protected voidfrontPage()abstract StringgetBaseUrlExternal()abstract StringgetBaseUrlInternal()protected static List<Integer>getBoundedRectangleOfElement(org.openqa.selenium.WebDriver driver, org.openqa.selenium.WebElement we)FilegetDownloadsFolder()abstract org.openqa.selenium.WebDrivergetDriver()org.openqa.selenium.WebElementgetElementImmediately(org.openqa.selenium.By by)protected org.openqa.selenium.WebElementgetElementWithoutWaiting(org.openqa.selenium.By by)protected org.openqa.selenium.WebElementgetForeignSourceElement(String requisitionName)Deprecated.longgetNodesInDatabase(String foreignSource)protected longgetNodesInDatabase(org.openqa.selenium.WebElement element)Deprecated.protected longgetNodesInRequisition(String foreignSource)protected longgetNodesInRequisition(org.openqa.selenium.WebElement element)Deprecated.protected ResponseDatagetRequest(org.apache.http.client.methods.HttpRequestBase request)org.openqa.selenium.support.ui.SelectgetSelect(String id)Vaadin usually wraps the select elements around a div element.org.openqa.selenium.WebElementgetVaadinPopup(String title)protected voidgoBack()protected StringhandleAlert()protected StringhandleAlert(String expectedText)protected booleaninVaadin()voidlogin()protected voidlogout()protected voidnodePage()protected voidnotificationsPage()protected voidoutagePage()protected org.openqa.selenium.support.ui.ExpectedCondition<Boolean>pageContainsText(String text)protected voidprovisioningPage()protected voidreportsPage()booleanrequisitionExists(String foreignSource)protected org.openqa.selenium.WebElementscrollToElement(org.openqa.selenium.By by)protected org.openqa.selenium.WebElementscrollToElement(org.openqa.selenium.By by, boolean waitForElement)protected static org.openqa.selenium.WebElementscrollToElement(org.openqa.selenium.WebDriver driver, org.openqa.selenium.WebElement element)Deprecated.UsescrollToElement(By)instead.protected org.openqa.selenium.WebElementscrollToElement(org.openqa.selenium.WebElement element)Deprecated.UsescrollToElement(By)instead.protected voidsearchPage()voidselectByVisibleText(String id, String text)protected voidselectDefaultFrame()protected voidselectVaadinFrame()protected voidsendDelete(String urlFragment)protected voidsendDelete(String urlFragment, Integer expectedResponse)protected voidsendPost(String urlFragment, String body)voidsendPost(String urlFragment, String body, Integer expectedResponse)protected voidsendPut(String urlFragment, String body)protected voidsendPut(String urlFragment, String body, Integer expectedResponse)protected voidsetChecked(org.openqa.selenium.By by)org.openqa.selenium.WebDriver.TimeoutssetImplicitWait()org.openqa.selenium.WebDriver.TimeoutssetImplicitWait(long time, TimeUnit unit)protected voidsetUnchecked(org.openqa.selenium.By by)protected voidsleep(int millis)voidsleepQuietly(int millis)protected voidsupportPage()static voidtakeScreenshot(org.openqa.selenium.WebDriver driver, String filename)protected org.openqa.selenium.support.ui.WebDriverWaitwaitFor(long seconds)protected voidwaitForClose(org.openqa.selenium.By selector)org.openqa.selenium.WebElementwaitForElement(org.openqa.selenium.By by)org.openqa.selenium.WebElementwaitForElement(org.openqa.selenium.support.ui.WebDriverWait w, org.openqa.selenium.By by)protected voidwaitForValue(org.openqa.selenium.By selector, String expectedValue)<T> TwaitUntil(Long implicitWait, org.openqa.selenium.support.ui.WebDriverWait w, Callable<T> callable)<T> TwaitUntil(Long implicitWait, org.openqa.selenium.support.ui.WebDriverWait w, org.openqa.selenium.support.ui.ExpectedCondition<T> condition)<T> TwaitUntil(Callable<T> callable)<T> TwaitUntil(org.openqa.selenium.support.ui.ExpectedCondition<T> condition)<T> TwaitUntil(org.openqa.selenium.support.ui.WebDriverWait w, Callable<T> callable)<T> TwaitUntil(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.ClientProtocolExceptionIOExceptionInterruptedException
-
getRequest
protected ResponseData getRequest(org.apache.http.client.methods.HttpRequestBase request) throws org.apache.http.client.ClientProtocolException, IOException, InterruptedException
- Throws:
org.apache.http.client.ClientProtocolExceptionIOExceptionInterruptedException
-
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.ClientProtocolExceptionIOExceptionInterruptedException
-
sendPost
public void sendPost(String urlFragment, String body, Integer expectedResponse) throws org.apache.http.client.ClientProtocolException, IOException, InterruptedException
- Throws:
org.apache.http.client.ClientProtocolExceptionIOExceptionInterruptedException
-
sendPut
protected void sendPut(String urlFragment, String body) throws org.apache.http.client.ClientProtocolException, IOException, InterruptedException
- Throws:
org.apache.http.client.ClientProtocolExceptionIOExceptionInterruptedException
-
sendPut
protected void sendPut(String urlFragment, String body, Integer expectedResponse) throws org.apache.http.client.ClientProtocolException, IOException, InterruptedException
- Throws:
org.apache.http.client.ClientProtocolExceptionIOExceptionInterruptedException
-
sendDelete
protected void sendDelete(String urlFragment) throws org.apache.http.client.ClientProtocolException, IOException, InterruptedException
- Throws:
org.apache.http.client.ClientProtocolExceptionIOExceptionInterruptedException
-
sendDelete
protected void sendDelete(String urlFragment, Integer expectedResponse) throws org.apache.http.client.ClientProtocolException, IOException, InterruptedException
- Throws:
org.apache.http.client.ClientProtocolExceptionIOExceptionInterruptedException
-
getDownloadsFolder
public File getDownloadsFolder()
-
cleanDownloadsFolder
public void cleanDownloadsFolder()
Delete all files in the downloads directory.
-
-