Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/develop'
Browse files Browse the repository at this point in the history
Conflicts:
	pom.xml


pom.xml: version was changed from 1.0.1-SNAPSHOT to 1.1.0
  • Loading branch information
Marcus Kaufmann committed Jul 4, 2018
2 parents 1038817 + 07d712c commit fe6e3c6
Show file tree
Hide file tree
Showing 91 changed files with 1,739 additions and 205 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -24,3 +24,4 @@ hs_err_pid*
/.classpath
/.project
/.settings/
build
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ If you are still impatient, here is the quickest way to get Neodymium added to y
<url>https://lab.xceptance.de/nexus/content/groups/public</url>
</repository>
</repositories>
...

<dependency>
<groupId>com.xceptance</groupId>
<artifactId>neodymium-library</artifactId>
Expand Down
2 changes: 1 addition & 1 deletion config/ai.properties
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
#########################################################################

# Global flag to turn visual asserations off, nothing will be done, all code is skipped
neodymium.ai.enabled = true
neodymium.ai.enabled = false

# Result directory for the image output, relative to the test suite
# main directory
Expand Down
24 changes: 19 additions & 5 deletions config/browser.properties
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

## 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.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
Expand Down Expand Up @@ -107,10 +107,10 @@ neodymium.webDriver.keepBrowserOpenOnFailure = false
# .deviceOrientation: defines the screen orientation.
# only for mobile/tablet device emulation valid values: portrait, landscape
#
# .testEnvironment: determines where the testcase will be executed. possible
# .testEnvironment: determines where the test case will be executed. possible
# values are local and saucelabs.
# note: you only need to set this property if you want to use
# saucelabs as testenvironment. by default the value 'local' is assumed.
# saucelabs as test environment. by default the value 'local' is assumed.
#
# .chromeEmulationProfile: A special property that contains a device name that should
# be emulated. This property is for chrome only. See chrome
Expand All @@ -122,11 +122,19 @@ neodymium.webDriver.keepBrowserOpenOnFailure = false
# eager : returns when DOMContentLoaded event was fired
# none : returns immediately
#
# .headless: A boolean propertey that defines if the browser should run in headless mode. Default value is false
# .headless: A boolean property that defines if the browser should run in headless mode. Default value is false
# NOTE: Currently only implemented for Firefox and Chrome
# true: start browser in headless mode
# false: (default) start browser normal
# false: (default) start browser normal
#
# .acceptInsecureCertificates: A boolean property that decides whether the web driver accepts insecure certificate or not.
# The default behavior is the one of the used web driver.
# true: the browser accepts insecure certificates
# false: the browser does not accepts insecure certificates
#
# .arguments: Additional command line arguments for the browser to apply.
# As you can specify only on 'arguments' property for a browser at a time you need to chain multiple arguments.
# Multiple arguments are chained by semicolon (";") e.g.: `-window-position=0,0 ; -window-size=400,300`
################################################################################
# A local Chrome with a small window size
browserprofile.Chrome_1024x768.name = Chrome 1024x768
Expand All @@ -138,6 +146,12 @@ browserprofile.Chrome_1500x1000.name = Chrome 1500x1000
browserprofile.Chrome_1500x1000.browser = chrome
browserprofile.Chrome_1500x1000.browserResolution = 1500x1000

# Local headless Chrome
browserprofile.Chrome_headless.name = Headless Google Chrome
browserprofile.Chrome_headless.browser = chrome
browserprofile.Chrome_headless.browserResolution = 1024x768
browserprofile.Chrome_headless.headless = true

# Small Firefox
browserprofile.FF_1024x768.name = Firefox 1024x768
browserprofile.FF_1024x768.browser = firefox
Expand Down
92 changes: 74 additions & 18 deletions pom.xml
Original file line number Diff line number Diff line change
@@ -1,9 +1,32 @@
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.xceptance</groupId>
<artifactId>neodymium-library</artifactId>
<version>1.0.0</version>
<version>1.1.0</version>

<name>neodymium-library</name>
<url>https://github.com/Xceptance/neodymium-library</url>
<description>A test automation library based on common other best practice open source libraries. It adds missing functionalities but does not reinvent the wheel. Just glues stuff together nicely and adds some sprinkles.</description>

<organization>
<name>Xceptance Software Technologies GmbH</name>
<url>https://www.xceptance.com</url>
</organization>

<licenses>
<license>
<name>MIT License</name>
<url>http://www.opensource.org/licenses/mit-license.php</url>
</license>
</licenses>

<scm>
<connection>scm:git:git://github.com/Xceptance/neodymium-library.git</connection>
<developerConnection>scm:git:ssh://github.com/Xceptance/neodymium-library.git</developerConnection>
<url>https://github.com/Xceptance/neodymium-library/tree/master</url>
</scm>

<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
Expand All @@ -28,27 +51,16 @@

<distributionManagement>
<repository>
<id>xceptance-releases</id>
<url>https://lab.xceptance.de/nexus/content/repositories/releases/</url>
<id>ossrh</id>
<url>https://oss.sonatype.org/service/local/staging/deploy/maven2/</url>
</repository>
<snapshotRepository>
<uniqueVersion>false</uniqueVersion>
<id>xceptance-snapshots</id>
<url>https://lab.xceptance.de/nexus/content/repositories/snapshots/</url>
<id>ossrh</id>
<url>https://oss.sonatype.org/content/repositories/snapshots</url>
</snapshotRepository>
</distributionManagement>

<build>
<resources>
<resource>
<!-- copy all none java files from src/test/java to target/test-classes -->
<excludes>
<exclude>**/*.java</exclude>
</excludes>
<directory>${project.build.testSourceDirectory}</directory>
<targetPath>${project.build.testOutputDirectory}</targetPath>
</resource>
</resources>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
Expand All @@ -68,6 +80,7 @@
<reuseForks>false</reuseForks>
<includes>
<include>com/xceptance/neodymium/tests/**/*Test.java</include>
<include>com/xceptance/neodymium/util/**/*Test.java</include>
</includes>
</configuration>
</plugin>
Expand Down Expand Up @@ -108,6 +121,42 @@
</plugins>
</build>

<profiles>
<profile>
<id>release-neodymium</id>
<activation>
<property>
<name>signArtifacts</name>
<value>true</value>
</property>
</activation>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-gpg-plugin</artifactId>
<version>1.6</version>
<configuration>
<gpgArguments>
<arg>--pinentry-mode</arg>
<arg>loopback</arg>
</gpgArguments>
</configuration>
<executions>
<execution>
<id>sign-artifacts</id>
<phase>verify</phase>
<goals>
<goal>sign</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile>
</profiles>

<reporting>
<plugins>
<plugin>
Expand Down Expand Up @@ -162,10 +211,17 @@
<version>${allure.version}</version>
</dependency>

<!-- pinned dependency since it was not not available in all life cycle steps anymore -->
<dependency>
<groupId>com.google.guava</groupId>
<artifactId>guava</artifactId>
<version>25.1-jre</version>
</dependency>

<dependency>
<groupId>com.codeborne</groupId>
<artifactId>selenide</artifactId>
<version>4.10.01</version>
<version>4.12.2</version>
</dependency>
<dependency>
<groupId>org.apache.commons</groupId>
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
package com.xceptance.neodymium;

import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.support.events.AbstractWebDriverEventListener;

import com.xceptance.neodymium.util.HighlightAndWait;

public class NeodymiumWebDriverListener extends AbstractWebDriverEventListener
{
@Override
public void beforeFindBy(By by, WebElement element, WebDriver driver)
{
HighlightAndWait.injectHighlightingJs();
HighlightAndWait.highlightAllElements(by, driver);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ public static <T extends StatementBuilder> T instantiate(Class<T> clazz)
}
}

@SuppressWarnings("unchecked")
public static <T extends Annotation> List<T> getAnnotations(AnnotatedElement object, Class<T> annotationClass)
{
List<T> annotations = new LinkedList<>();
Expand Down Expand Up @@ -72,6 +73,7 @@ public static <T extends Annotation> List<T> getAnnotations(AnnotatedElement obj
return annotations;
}

@SuppressWarnings("unchecked")
public static <T extends Annotation> List<T> getDeclaredAnnotations(AnnotatedElement object, Class<T> annotationClass)
{
List<T> annotations = new LinkedList<>();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,13 @@
import org.junit.runners.model.TestClass;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.firefox.FirefoxDriver;
import org.openqa.selenium.support.events.EventFiringWebDriver;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import com.codeborne.selenide.Configuration;
import com.codeborne.selenide.WebDriverRunner;
import com.xceptance.neodymium.NeodymiumWebDriverListener;
import com.xceptance.neodymium.module.StatementBuilder;
import com.xceptance.neodymium.module.statement.browser.multibrowser.Browser;
import com.xceptance.neodymium.module.statement.browser.multibrowser.BrowserRunnerHelper;
Expand Down Expand Up @@ -150,7 +152,8 @@ public void setUpTest(String browserTag)
if (webdriver == null)
{
LOGGER.debug("Create new browser instance");
webdriver = BrowserRunnerHelper.createWebdriver(browserConfiguration);
webdriver = new EventFiringWebDriver(BrowserRunnerHelper.createWebdriver(browserConfiguration));
((EventFiringWebDriver) webdriver).register(new NeodymiumWebDriverListener());
}
else
{
Expand Down Expand Up @@ -339,4 +342,13 @@ public String getCategoryName(Object data)
{
return getTestName(data);
}

public List<String> getBrowserTags()
{
// make a copy of all available browser tags
List<String> tags = new LinkedList<>();
tags.addAll(multibrowserConfiguration.getBrowserProfiles().keySet());

return tags;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -279,21 +279,34 @@ public static WebDriver createWebdriver(final BrowserConfiguration config) throw
}
options.setHeadless(config.isHeadless());

if (config.getArguments() != null && config.getArguments().size() > 0)
options.addArguments(config.getArguments());

return new ChromeDriver(options);
}
else if (firefoxBrowsers.contains(browserName))
{
FirefoxOptions firefoxOptions = new FirefoxOptions();
firefoxOptions.setBinary(createFirefoxBinary(driverServerPath.getFirefoxBrowserPath()));
firefoxOptions.merge(capabilities);
firefoxOptions.setHeadless(config.isHeadless());
FirefoxOptions options = new FirefoxOptions();
options.setBinary(createFirefoxBinary(driverServerPath.getFirefoxBrowserPath()));
options.merge(capabilities);
options.setHeadless(config.isHeadless());
if (config.getArguments() != null && config.getArguments().size() > 0)
options.addArguments(config.getArguments());

return new FirefoxDriver(firefoxOptions);
return new FirefoxDriver(options);
}
else if (internetExplorerBrowsers.contains(browserName))
{
InternetExplorerOptions options = new InternetExplorerOptions();
options.merge(capabilities);
if (config.getArguments() != null && config.getArguments().size() > 0)
{
for (String argument : config.getArguments())
{
options.addCommandSwitches(argument);
}
}

return new InternetExplorerDriver(options);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,4 +19,9 @@ public org.openqa.selenium.remote.http.HttpClient createClient(URL url)
{
return new ApacheHttpClient(httpClient, url);
}

@Override
public void cleanupIdleClients()
{
}
}
Loading

0 comments on commit fe6e3c6

Please sign in to comment.