public class TestSetup extends Object
Constructor and Description |
---|
TestSetup()
A constructor which sets up the default empty desired capabilities
|
Modifier and Type | Method and Description |
---|---|
static boolean |
areBrowserDetailsSet()
determines if the browser information provided has details, or just the
browser name
|
static String |
capitalizeFirstLetters(String word)
Capitalizes the first letter of each word in the provided string
|
org.openqa.selenium.remote.DesiredCapabilities |
getDesiredCapabilities()
returns the classes defined desired capabilities
|
static String |
getRandomString(int length)
Generates a random string of alpha-numeric characters
|
static String |
getTestName(Method method,
Object... dataProvider)
Determines the unique test name, based on the parameters passed in
|
static String |
getTestName(String packageName,
String className,
String methodName,
Object... dataProvider)
Determines the unique test name, based on the parameters passed in
|
static Map<String,String> |
parseMap(String input)
Breaks up a string, and places it into a map.
|
static String |
removeNonWordCharacters(String value)
Removes all non alphanumeric characters from a provided string
|
static List<Browser> |
setBrowser()
looks at the browser information passed in, and loads that data into a
list
|
void |
setupBrowserCapability(Browser browser)
Sets the device capabilities based on the browser selection
|
void |
setupBrowserDetails(Map<String,String> browserDetails)
sets the browser details (name, version, device, orientation, os) into
the device capabilities
|
static org.openqa.selenium.WebDriver |
setupDriver(Browser browser,
org.openqa.selenium.remote.DesiredCapabilities capabilities)
this creates the webdriver object, which will be used to interact with
for all browser web tests
|
void |
setupProxy()
Obtains the set system values for the proxy, and adds them to the desired
capabilities
|
public TestSetup()
public org.openqa.selenium.remote.DesiredCapabilities getDesiredCapabilities()
public void setupProxy()
public static boolean areBrowserDetailsSet()
public static List<Browser> setBrowser() throws InvalidBrowserException
InvalidBrowserException
- If a browser that is not one specified in the
Selenium.Browser class is used, this exception will be thrownpublic void setupBrowserDetails(Map<String,String> browserDetails)
browserDetails
- - a map containing all of the browser detailspublic void setupBrowserCapability(Browser browser) throws InvalidBrowserException
browser
- - which browser are we running withInvalidBrowserException
- If a browser that is not one specified in the
Selenium.Browser class is used, this exception will be thrownpublic static org.openqa.selenium.WebDriver setupDriver(Browser browser, org.openqa.selenium.remote.DesiredCapabilities capabilities) throws InvalidBrowserException
browser
- - what browser is being tested oncapabilities
- - what capabilities are being tested withInvalidBrowserException
- If a browser that is not one specified in the
Selenium.Browser class is used, this exception will be thrownpublic static String getRandomString(int length)
length
- the length of the random stringpublic static String removeNonWordCharacters(String value)
value
- - the string to cleanuppublic static String getTestName(Method method, Object... dataProvider)
method
- - the method under test to extract the name fromdataProvider
- - an array of objects being passed to the test as data
providerspublic static String getTestName(String packageName, String className, String methodName, Object... dataProvider)
packageName
- - the package name of the test method as a stringclassName
- - the class name of the test method as a stringmethodName
- - the method name of the test as a stringdataProvider
- - an array of objects being passed to the test as data
providerspublic static String capitalizeFirstLetters(String word)
word
- - the string to be capitalized onpublic static Map<String,String> parseMap(String input)
input
- - a string, with key and values separated by an equals (=) and
pairs separated by an ampersand (&)Copyright © 2017. All rights reserved.