Skip to content

Commit

Permalink
Merge branch 'develop'
Browse files Browse the repository at this point in the history
# Conflicts:
#	README.md
#	pom.xml
  • Loading branch information
Marcel Pfotenhauer committed Oct 23, 2018
2 parents aa6bce0 + e8316b6 commit b5e412e
Show file tree
Hide file tree
Showing 35 changed files with 971 additions and 405 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[![Maven Central](https://img.shields.io/maven-central/v/com.xceptance/neodymium-library.svg?label=Maven%20Central)](https://search.maven.org/search?q=g:%22com.xceptance%22%20AND%20a:%22neodymium-library%22)

# Neodymium 2.1.0
# Neodymium 3.0.0
Neodymium tries to solve your typical and most pressing UI test automation problems by combining JUnit, WebDriver, BDD/Cucumber, and proper reporting. It gives you ready to use templates, assembles well-known open source projects, and enhances this all with additional functionality that is often missing.

Neodymium is basically the combination of state of the art open source test libraries with additionally glue to make it stick reliably together.
Expand Down
38 changes: 0 additions & 38 deletions config/browser.properties
Original file line number Diff line number Diff line change
@@ -1,41 +1,3 @@
################################################################################

## The path to the driver server executable, if the respective driver requires
## one. If you do not specify a path, the driver server must be in your PATH.
#neodymium.webDriver.chrome.pathToDriverServer = /path/to/chromedriver
#neodymium.webDriver.edge.pathToDriverServer = c:/path/to/MicrosoftWebDriver.exe
#neodymium.webDriver.firefox.pathToDriverServer = /path/to/geckodriver
#neodymium.webDriver.ie.pathToDriverServer = c:/path/to/IEDriverServer.exe
#neodymium.webDriver.opera.pathToDriverServer = /path/to/operadriver
#neodymium.webDriver.phantomjs.pathToDriverServer = /path/to/phantomjs

## The path to the browser executable to use. Specify the path in case you
## don't want to use the default browser executable, but an alternative version.
#neodymium.webDriver.chrome.pathToBrowser = /path/to/google-chrome
#neodymium.webDriver.firefox.pathToBrowser = /path/to/firefox
#neodymium.webDriver.opera.pathToBrowser = /path/to/opera

## Whether to run Firefox webdrivers in "legacy" mode
## which means that an add-on is used to drive the browser instead of GeckoDriver.
## Note: The legacy mode does not work with Firefox 48+. Use Firefox 45 ESR
neodymium.webDriver.firefox.legacyMode = false

## The desired dimension of the browser window. If not specified, the driver's
## defaults will be used.
#neodymium.webDriver.window.width = 1200
#neodymium.webDriver.window.height = 900

## Whether to use a single driver instance for all tests (defaults to false).
neodymium.webDriver.reuseDriver = false

## Whether to keep browser open after test has finished
# Warning: The webdriver process might stay alive even if you close the browser afterwards
neodymium.webDriver.keepBrowserOpen = false

## Whether to keep the browser instance open only if the test fails
# Warning: The webdriver process might stay alive even if you close the browser afterwards
neodymium.webDriver.keepBrowserOpenOnFailure = false

################################################################################
#
# See also https://wiki.saucelabs.com/display/DOCS/Platform+Configurator
Expand Down
40 changes: 38 additions & 2 deletions config/neodymium.properties
Original file line number Diff line number Diff line change
Expand Up @@ -82,8 +82,8 @@
# The following setting reassemble responsive design breakpoints. They determine at which page width a site is considered to be displayed on a small, medium, large oder extra large device.
# You can use the by calling e.g. Neodymium.isSmallDesktop()
#
# neodymium.context.device.breakpoint.small = 544
# neodymium.context.device.breakpoint.medium = 769
# neodymium.context.device.breakpoint.small = 576
# neodymium.context.device.breakpoint.medium = 768
# neodymium.context.device.breakpoint.large = 992
# neodymium.context.device.breakpoint.xlarge = 1200
#
Expand Down Expand Up @@ -193,3 +193,39 @@
# The socket version of the proxy
# neodymium.proxy.socket.version =
#
## The path to the driver server executable, if the respective driver requires
## one. If you do not specify a path, the driver server must be in your PATH.
#neodymium.webDriver.chrome.pathToDriverServer = /path/to/chromedriver
#neodymium.webDriver.edge.pathToDriverServer = c:/path/to/MicrosoftWebDriver.exe
#neodymium.webDriver.firefox.pathToDriverServer = /path/to/geckodriver
#neodymium.webDriver.ie.pathToDriverServer = c:/path/to/IEDriverServer.exe
#neodymium.webDriver.opera.pathToDriverServer = /path/to/operadriver
#neodymium.webDriver.phantomjs.pathToDriverServer = /path/to/phantomjs

## The path to the browser executable to use. Specify the path in case you
## don't want to use the default browser executable, but an alternative version.
#neodymium.webDriver.chrome.pathToBrowser = /path/to/google-chrome
#neodymium.webDriver.firefox.pathToBrowser = /path/to/firefox
#neodymium.webDriver.opera.pathToBrowser = /path/to/opera

## Whether to run Firefox webdrivers in "legacy" mode
## which means that an add-on is used to drive the browser instead of GeckoDriver.
## Note: The legacy mode does not work with Firefox 48+. Use Firefox 45 ESR
neodymium.webDriver.firefox.legacyMode = false

## The desired dimension of the browser window. If not specified, the driver's
## defaults will be used.
#neodymium.webDriver.window.width = 1200
#neodymium.webDriver.window.height = 900

## Whether to use a single driver instance for all tests (defaults to false).
neodymium.webDriver.reuseDriver = false

## Whether to keep browser open after test has finished
# Warning: The webdriver process might stay alive even if you close the browser afterwards
neodymium.webDriver.keepBrowserOpen = false

## Whether to keep the browser instance open only if the test fails
# Warning: The webdriver process might stay alive even if you close the browser afterwards
neodymium.webDriver.keepBrowserOpenOnFailure = false

11 changes: 9 additions & 2 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<modelVersion>4.0.0</modelVersion>
<groupId>com.xceptance</groupId>
<artifactId>neodymium-library</artifactId>
<version>2.1.0</version>
<version>3.0.0-SNASHOT</version>

<name>neodymium-library</name>
<url>https://github.com/Xceptance/neodymium-library</url>
Expand Down Expand Up @@ -142,6 +142,13 @@
</activation>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<configuration>
<forkCount>1</forkCount>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-gpg-plugin</artifactId>
Expand Down Expand Up @@ -231,7 +238,7 @@
<dependency>
<groupId>com.codeborne</groupId>
<artifactId>selenide</artifactId>
<version>4.12.3</version>
<version>5.0.0</version>
<exclusions>
<exclusion>
<groupId>org.junit.jupiter</groupId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,7 @@
import com.xceptance.neodymium.module.statement.browser.multibrowser.SuppressBrowsers;
import com.xceptance.neodymium.module.statement.browser.multibrowser.WebDriverCache;
import com.xceptance.neodymium.module.statement.browser.multibrowser.configuration.BrowserConfiguration;
import com.xceptance.neodymium.module.statement.browser.multibrowser.configuration.DriverServerPath;
import com.xceptance.neodymium.module.statement.browser.multibrowser.configuration.MultibrowserConfiguration;
import com.xceptance.neodymium.module.statement.browser.multibrowser.configuration.WebDriverProperties;
import com.xceptance.neodymium.util.Neodymium;

public class BrowserStatement extends StatementBuilder
Expand All @@ -46,8 +44,6 @@ public class BrowserStatement extends StatementBuilder

private static final String SYSTEM_PROPERTY_BROWSERDEFINITION = "browserdefinition";

private static final String BROWSER_PROFILE_FILE = "./config/browser.properties";

private List<String> browserDefinitions = new LinkedList<>();

private MultibrowserConfiguration multibrowserConfiguration = MultibrowserConfiguration.getInstance();
Expand All @@ -58,17 +54,14 @@ public BrowserStatement()
{
// that is like a dirty hack to provide testing ability
if (multibrowserConfiguration == null)
multibrowserConfiguration = MultibrowserConfiguration.getInstance(BROWSER_PROFILE_FILE);

DriverServerPath driverServerPath = multibrowserConfiguration.getDriverServerPath();
WebDriverProperties webDriverProperties = multibrowserConfiguration.getWebDriverProperties();
multibrowserConfiguration = MultibrowserConfiguration.getInstance();

final String ieDriverPath = driverServerPath.getIeDriverPath();
final String chromeDriverPath = driverServerPath.getChromeDriverPath();
final String geckoDriverPath = driverServerPath.getFirefoxDriverPath();
final String ieDriverPath = Neodymium.configuration().getIeDriverPath();
final String chromeDriverPath = Neodymium.configuration().getChromeDriverPath();
final String geckoDriverPath = Neodymium.configuration().getFirefoxDriverPath();

// shall we run old school firefox?
final boolean firefoxLegacy = webDriverProperties.useFirefoxLegacy();
final boolean firefoxLegacy = Neodymium.configuration().useFirefoxLegacy();
System.setProperty(FirefoxDriver.SystemProperty.DRIVER_USE_MARIONETTE, Boolean.toString(!firefoxLegacy));

if (!StringUtils.isEmpty(ieDriverPath))
Expand Down Expand Up @@ -140,7 +133,7 @@ public void setUpTest(String browserTag)
try
{
// try to find appropriate web driver in cache before create a new instance
if (MultibrowserConfiguration.getInstance().getWebDriverProperties().reuseWebDriver())
if (Neodymium.configuration().reuseWebDriver())
{
webdriver = WebDriverCache.instance.getRemoveWebDriver(browserConfiguration.getConfigTag());
if (webdriver != null)
Expand Down Expand Up @@ -174,7 +167,6 @@ public void setUpTest(String browserTag)

// set our default timeout
Configuration.timeout = Neodymium.configuration().selenideTimeout();
Configuration.collectionsTimeout = Configuration.timeout * 2;
}
else
{
Expand All @@ -185,10 +177,9 @@ public void setUpTest(String browserTag)

public void teardown(boolean testFailed)
{
WebDriverProperties webDriverProperties = multibrowserConfiguration.getWebDriverProperties();
BrowserConfiguration browserConfiguration = multibrowserConfiguration.getBrowserProfiles().get(Neodymium.getBrowserProfileName());

if (testFailed && webDriverProperties.keepBrowserOpenOnFailure() && !browserConfiguration.isHeadless())
if (testFailed && Neodymium.configuration().keepBrowserOpenOnFailure() && !browserConfiguration.isHeadless())
{
// test failed and we want to leave the browser instance open
// don't quit the webdriver, just remove references
Expand All @@ -198,14 +189,14 @@ public void teardown(boolean testFailed)
return;
}

if (webDriverProperties.reuseWebDriver())
if (Neodymium.configuration().reuseWebDriver())
{
LOGGER.debug("Put browser into cache");
WebDriverCache.instance.putWebDriver(browserTag, webdriver);
}
else
{
if (browserConfiguration.isHeadless() || !webDriverProperties.keepBrowserOpen())
if (browserConfiguration.isHeadless() || !Neodymium.configuration().keepBrowserOpen())
{
LOGGER.debug("Teardown browser");
if (webdriver != null)
Expand All @@ -218,8 +209,7 @@ public void teardown(boolean testFailed)

public static void quitCachedBrowser()
{
WebDriverProperties webDriverProperties = MultibrowserConfiguration.getInstance().getWebDriverProperties();
if (!webDriverProperties.keepBrowserOpen())
if (!Neodymium.configuration().keepBrowserOpen())
{
Collection<WebDriver> allWebdriver = WebDriverCache.instance.getAllWebdriver();

Expand Down
Loading

0 comments on commit b5e412e

Please sign in to comment.