public abstract class GalenJavaTestBase extends Object
ThreadLocal so that the tests could be run in parallel
without any race condition. It also quits the WebDriver at the end of the test.
It has checkLayout(java.lang.String, java.util.List<java.lang.String>) method which als takes care of storing the layout report in reports container.| Modifier and Type | Field and Description |
|---|---|
protected ThreadLocal<org.openqa.selenium.WebDriver> |
driver |
protected ThreadLocal<TestReport> |
report |
protected ThreadLocal<GalenTestInfo> |
testInfo |
| Constructor and Description |
|---|
GalenJavaTestBase() |
| Modifier and Type | Method and Description |
|---|---|
void |
checkLayout(String specPath,
List<String> includedTags)
Checks layout of the page that is currently open in current thread.
|
void |
checkLayout(String specPath,
SectionFilter sectionFilter,
Properties properties,
Map<String,Object> vars)
Checks layout of the page that is currently open in current thread.
|
abstract org.openqa.selenium.WebDriver |
createDriver(Object[] args)
Used in order to initialize a
WebDriver |
GalenTestInfo |
createTestInfo(Method method,
Object[] arguments) |
org.openqa.selenium.WebDriver |
getDriver()
Returns
WebDriver instance for current test thread |
TestReport |
getReport()
Returns the report for current test thread
|
void |
initDriver(Object[] args)
Initializes the WebDriver instance and stores it in
ThreadLocal |
void |
inject(String javaScript)
Injects the given javaScript expression in current driver for current test thread
|
void |
load(String url)
Loads the given url in the current driver for current test thread
|
void |
load(String url,
int width,
int height)
Loads the given url in the current driver for current test thread and changes the browser window size
|
void |
quitDriver() |
void |
resize(int width,
int height)
Changes the size of current browser for current test thread
|
protected ThreadLocal<org.openqa.selenium.WebDriver> driver
protected ThreadLocal<TestReport> report
protected ThreadLocal<GalenTestInfo> testInfo
public TestReport getReport()
public GalenTestInfo createTestInfo(Method method, Object[] arguments)
public void load(String url)
url - The website url that should be loaded in the current driverpublic void load(String url, int width, int height)
url - The website url that should be loaded in the current driverwidth - The width of browser windowheight - The height of browser windowpublic void inject(String javaScript)
javaScript - A JavaScript code that should be executed in the current browserpublic void resize(int width,
int height)
width - The width of browser windowheight - The height of browser windowpublic void checkLayout(String specPath, List<String> includedTags) throws IOException
ThreadLocalspecPath - a path to galen spec fileincludedTags - a list of tags that should be included in specIOExceptionpublic void checkLayout(String specPath, SectionFilter sectionFilter, Properties properties, Map<String,Object> vars) throws IOException
specPath - a path to galen spec filesectionFilter - a filter that is used for "@on" filtering in specsproperties - a set of properties that will be accessible in special galen spec expressions.vars - JavaScript variables that will be available in special galen spec expressionsIOExceptionpublic void initDriver(Object[] args)
ThreadLocalargs - the arguments of current testpublic abstract org.openqa.selenium.WebDriver createDriver(Object[] args)
WebDriverargs - the arguments of current testpublic void quitDriver()
public org.openqa.selenium.WebDriver getDriver()
WebDriver instance for current test threadWebDriver instance for current test threadCopyright © 2016. All rights reserved.