1bf3bee65737df25bc61034839146bd47fc19e17
java/com.sap.sailing.selenium.test/local-test-environment-axel.xml
| ... | ... | @@ -0,0 +1,115 @@ |
| 1 | +<?xml version="1.0" encoding="UTF-8"?> |
|
| 2 | + |
|
| 3 | +<!-- |
|
| 4 | + Configuration file for the test environment. This file is used for the configuration of the environment for the |
|
| 5 | + executions of the integration tests. For the execution in a local environment you should make a copy of this file, |
|
| 6 | + change it accordingly to your local setup (eg. browser(s) to use for the tests) and adjust the property |
|
| 7 | + "parameters.integration-tests" in your user specific settings.xml to point to your local copy of this file. |
|
| 8 | +--> |
|
| 9 | +<test-environment xmlns="http://www.sapsailing.com/test-environment" |
|
| 10 | + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" |
|
| 11 | + xsi:schemaLocation="http://www.sapsailing.com/test-environment ./test-environment-configuration.xsd "> |
|
| 12 | + |
|
| 13 | + <!-- |
|
| 14 | + The context root (the server) against which the tests should be executed. |
|
| 15 | + --> |
|
| 16 | + <context-root>http://localhost:8888/</context-root> |
|
| 17 | + |
|
| 18 | + <screenshots-folder>./bin/surefire-reports/</screenshots-folder> |
|
| 19 | + |
|
| 20 | + <!-- |
|
| 21 | + In this section necessary system properties for the different web drivers can be provided if needed. For more |
|
| 22 | + information about available properties see the following sides: |
|
| 23 | + |
|
| 24 | + - http://code.google.com/p/selenium/wiki/ChromeDriver |
|
| 25 | + - http://code.google.com/p/selenium/wiki/FirefoxDriver |
|
| 26 | + - http://code.google.com/p/selenium/wiki/InternetExplorerDriver |
|
| 27 | + - http://code.google.com/p/selenium/wiki/OperaDriver |
|
| 28 | + - http://code.google.com/p/selenium/wiki/SafariDriver |
|
| 29 | + - http://code.google.com/p/selenium/wiki/RemoteWebDriverServer |
|
| 30 | + |
|
| 31 | + NOTE: For the Chrome, Firefox and InternetExplorer driver an additional "server", which acts as a bridge between the |
|
| 32 | + browser and the driver, is needed. |
|
| 33 | + --> |
|
| 34 | + <system-properties> |
|
| 35 | + <!-- |
|
| 36 | + You need chromedriver to be able to run Selenium tests on Chrome/Chromium. |
|
| 37 | + This is the path to chromedriver, not Chrome. |
|
| 38 | + The chromedriver download is linked on the official selenium download page: |
|
| 39 | + https://www.seleniumhq.org/download/ |
|
| 40 | + --> |
|
| 41 | + <system-property> |
|
| 42 | + <name>webdriver.chrome.driver</name> |
|
| 43 | + <value>/usr/bin/chromedriver</value> |
|
| 44 | + </system-property> |
|
| 45 | + <!-- |
|
| 46 | + You need geckodriver to be able to run Selenium tests on Firefox. |
|
| 47 | + This is the path to geckodriver, not Firefox. |
|
| 48 | + The geckodriver download is linked on the official selenium download page: |
|
| 49 | + https://www.seleniumhq.org/download/ |
|
| 50 | + --> |
|
| 51 | + <system-property> |
|
| 52 | + <name>webdriver.gecko.driver</name> |
|
| 53 | + <value>/usr/bin/geckodriver</value> |
|
| 54 | + </system-property> |
|
| 55 | + <!-- |
|
| 56 | + geckodriver automatically finds an installed version of Firefox. |
|
| 57 | + If no Firefox is installed on the system or another version should be used, |
|
| 58 | + the property "webdriver.firefox.bin" may be set to specify the path. |
|
| 59 | + The default on Windows is "C:\Program Files\Mozilla Firefox\firefox.exe" |
|
| 60 | + --> |
|
| 61 | + <!-- |
|
| 62 | + <system-property> |
|
| 63 | + <name>webdriver.firefox.bin</name> |
|
| 64 | + <value>/path/to/firefox.exe</value> |
|
| 65 | + </system-property> |
|
| 66 | + --> |
|
| 67 | + <!-- |
|
| 68 | + You need IEDriverServer.exe to successfully run selenium tests using IE 11. |
|
| 69 | + |
|
| 70 | + See selenium-ui-tests.md for details! |
|
| 71 | + --> |
|
| 72 | + <!-- |
|
| 73 | + <system-property> |
|
| 74 | + <name>webdriver.ie.driver</name> |
|
| 75 | + <value>C:\path\to\IEDriverServer.exe</value> |
|
| 76 | + </system-property> |
|
| 77 | + --> |
|
| 78 | + </system-properties> |
|
| 79 | + |
|
| 80 | + |
|
| 81 | + <!-- |
|
| 82 | + The driver definitions define all web drivers (browsers) which should be used for the execution of the tests. This |
|
| 83 | + means that each test will be executed once for each driver defined here. This allows to perform the tests with |
|
| 84 | + different browsers to validate the proper functionality of the application across different browsers. |
|
| 85 | + |
|
| 86 | + The capabilities section can be used for fine tuning of the driver (e.g. version). For more informations see the |
|
| 87 | + pages mentioned above. |
|
| 88 | + --> |
|
| 89 | + <!-- |
|
| 90 | + <driver-definition class="org.openqa.selenium.firefox.FirefoxDriver"> |
|
| 91 | + </driver-definition> |
|
| 92 | + --> |
|
| 93 | + <!-- |
|
| 94 | + <driver-definition class="org.openqa.selenium.chrome.ChromeDriver"> |
|
| 95 | + </driver-definition> |
|
| 96 | + --> |
|
| 97 | + <!-- --> |
|
| 98 | + <driver-definition class="com.sap.sailing.selenium.core.DockerChromeDriver"> |
|
| 99 | + </driver-definition> |
|
| 100 | + <!-- --> |
|
| 101 | + <!-- |
|
| 102 | + <driver-definition class="org.openqa.selenium.ie.InternetExplorerDriver"> |
|
| 103 | + <capabilities> |
|
| 104 | + <capability> |
|
| 105 | + <name>ignoreZoomSetting</name> |
|
| 106 | + <value>true</value> |
|
| 107 | + </capability> |
|
| 108 | + </capabilities> |
|
| 109 | + </driver-definition> |
|
| 110 | + --> |
|
| 111 | + <!-- <driver-definition class="com.sap.sailing.selenium.core.HeadlessFirefoxDriver"> |
|
| 112 | + </driver-definition> --> |
|
| 113 | + <!-- <driver-definition class="com.sap.sailing.selenium.core.HeadlessChromeDriver"> |
|
| 114 | + </driver-definition> --> |
|
| 115 | +</test-environment> |
java/com.sap.sailing.selenium.test/src/com/sap/sailing/selenium/core/DockerChromeDriver.java
| ... | ... | @@ -0,0 +1,29 @@ |
| 1 | +package com.sap.sailing.selenium.core; |
|
| 2 | + |
|
| 3 | +import org.openqa.selenium.Capabilities; |
|
| 4 | +import org.openqa.selenium.chrome.ChromeDriver; |
|
| 5 | +import org.openqa.selenium.chrome.ChromeDriverService; |
|
| 6 | +import org.openqa.selenium.chrome.ChromeOptions; |
|
| 7 | + |
|
| 8 | +/** |
|
| 9 | + * Specific {@link ChromeDriver} that is configured to start Chrome without GPU support and without extensions. |
|
| 10 | + * This is helpful when running, e.g., in a Docker environment where full-fledged UI support is not given. |
|
| 11 | + */ |
|
| 12 | +public class DockerChromeDriver extends ChromeDriver { |
|
| 13 | + |
|
| 14 | + public DockerChromeDriver(Capabilities capabilities) { |
|
| 15 | + super(ChromeDriverService.createDefaultService(), constructChromeOptions(capabilities)); |
|
| 16 | + } |
|
| 17 | + |
|
| 18 | + private static ChromeOptions constructChromeOptions(Capabilities capabilities) { |
|
| 19 | + final ChromeOptions chromeOptions = new ChromeOptions(); |
|
| 20 | + chromeOptions.merge(capabilities); |
|
| 21 | + chromeOptions.addArguments("--disable-gpu", "--disable-extensions", "--window-size=1440,900"); |
|
| 22 | + chromeOptions.addArguments("--no-sandbox"); |
|
| 23 | + chromeOptions.addArguments("--disable-dev-shm-usage"); |
|
| 24 | + chromeOptions.addArguments("--remote-debugging-address=0.0.0.0"); |
|
| 25 | + chromeOptions.addArguments("--remote-debugging-port=9222"); |
|
| 26 | + chromeOptions.setExperimentalOption("useAutomationExtension", false); |
|
| 27 | + return chromeOptions; |
|
| 28 | + } |
|
| 29 | +} |