-
Notifications
You must be signed in to change notification settings - Fork 235
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Add additional build targets for travis CI to also run our chrome and firefox suites locally. - Also moved the "deploy" step to phantom target. - Reduced the number of threads in some test suites - Added a custom test capabilityprovider for setting browser options - Need to add "--no-sandbox" for chrome execution to work around chrome on OpenVZ. - Also add firefox in travis CI using Firefox-suite - Other minor test updates - Keep all temporary test files in target folder
- Loading branch information
Sherif Ebady
authored and
Doug Simmons
committed
Nov 2, 2016
1 parent
f6d29fb
commit 78af14d
Showing
9 changed files
with
166 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -66,4 +66,4 @@ xcuserdata | |
*.hmap | ||
*.ipa | ||
|
||
Carthage/Build | ||
Carthage/Build |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
45 changes: 45 additions & 0 deletions
45
client/src/test/java/com/paypal/selion/TestCapabilityBuilder.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
package com.paypal.selion; | ||
|
||
import com.paypal.selion.configuration.Config; | ||
import com.paypal.selion.configuration.Config.ConfigProperty; | ||
import com.paypal.selion.internal.platform.grid.BrowserFlavors; | ||
import com.paypal.selion.internal.platform.grid.WebTestSession; | ||
import com.paypal.selion.platform.grid.Grid; | ||
import com.paypal.selion.platform.grid.browsercapabilities.DefaultCapabilitiesBuilder; | ||
import org.apache.commons.lang3.StringUtils; | ||
import org.openqa.selenium.chrome.ChromeOptions; | ||
import org.openqa.selenium.remote.DesiredCapabilities; | ||
|
||
import java.util.HashMap; | ||
import java.util.Map; | ||
|
||
/** | ||
* A custom capabilitiesBuilder used during test executions to establish custom browser paths and options. | ||
*/ | ||
public class TestCapabilityBuilder extends DefaultCapabilitiesBuilder { | ||
|
||
@Override | ||
public DesiredCapabilities getCapabilities(DesiredCapabilities capabilities) { | ||
String browserPath = System.getProperty("BROWSER_PATH"); | ||
WebTestSession session = Grid.getWebTestSession(); | ||
if (StringUtils.isEmpty(browserPath) || session == null) { | ||
return capabilities; | ||
} | ||
|
||
String browser = session.getBrowser(); | ||
if (browser.equals(BrowserFlavors.CHROME.getBrowser())) { | ||
ChromeOptions options = new ChromeOptions(); | ||
options.setBinary(browserPath); | ||
// To run chrome on virtualized openVZ environments | ||
options.addArguments("--no-sandbox"); | ||
capabilities.setCapability(ChromeOptions.CAPABILITY, options); | ||
} else if (browser.equals(BrowserFlavors.FIREFOX.getBrowser())) { | ||
Map<String, String> firefoxOptions = new HashMap<>(); | ||
firefoxOptions.put("binary", browserPath); | ||
String key = Config.getBoolConfigProperty(ConfigProperty.SELENIUM_USE_GECKODRIVER) ? | ||
"moz:firefoxOptions" : "firefox_binary"; | ||
capabilities.setCapability(key, firefoxOptions); | ||
} | ||
return capabilities; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
#!/bin/bash | ||
set -e | ||
|
||
############################################################# | ||
# This script updates travis CI with chromedriver and starts | ||
# the selion chrome suite locally | ||
############################################################# | ||
if [ -n "${SAUCE_USERNAME}" ]; then | ||
echo { \"sauceUserName\": \"${SAUCE_USERNAME}\", \"sauceApiKey\": \"${SAUCE_ACCESS_KEY}\", \"tunnel-identifier\": \"__string__${TRAVIS_JOB_NUMBER}\", \"build\": \"${TRAVIS_BUILD_NUMBER}\", \"idle-timeout\": 120, \"tags\": [\"commit ${TRAVIS_COMMIT}\", \"branch ${TRAVIS_BRANCH}\", \"pull request ${TRAVIS_PULL_REQUEST}\"] } > client/src/test/resources/sauceConfig.json | ||
fi | ||
|
||
mkdir -p target | ||
cd target | ||
if [ ! -f "./google-chrome" ]; then | ||
export CHROME_REVISION=`curl -s http://commondatastorage.googleapis.com/chromium-browser-snapshots/Linux_x64/LAST_CHANGE` | ||
curl -L -O "http://commondatastorage.googleapis.com/chromium-browser-snapshots/Linux_x64/${CHROME_REVISION}/chrome-linux.zip" | ||
unzip -o chrome-linux.zip | ||
ln -sf $PWD/chrome-linux/chrome-wrapper google-chrome | ||
fi | ||
|
||
./google-chrome -version | ||
|
||
if [ ! -f "./chromedriver" ]; then | ||
export CHROMEDRIVER_VERSION=2.24 | ||
curl -L -O "http://chromedriver.storage.googleapis.com/${CHROMEDRIVER_VERSION}/chromedriver_linux64.zip" | ||
unzip -o chromedriver_linux64.zip && chmod +x chromedriver | ||
fi | ||
cd .. | ||
|
||
export PATH=$PWD/target:$PATH | ||
mvn test -pl client -DsuiteXmlFile=Chrome-Suite.xml \ | ||
-DSELION_SELENIUM_RUN_LOCALLY=true \ | ||
-DSELION_SELENIUM_CHROMEDRIVER_PATH=$PWD/target/chromedriver \ | ||
-DSELION_SELENIUM_CUSTOM_CAPABILITIES_PROVIDER=com.paypal.selion.TestCapabilityBuilder \ | ||
-DBROWSER_PATH=$PWD/target/google-chrome -B -V |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
#!/bin/bash | ||
set -e | ||
|
||
############################################################# | ||
# This script updates travis with firefox and | ||
# geckodriver and starts the selion firefox suites locally | ||
############################################################# | ||
|
||
if [ -n "${SAUCE_USERNAME}" ]; then | ||
echo { \"sauceUserName\": \"${SAUCE_USERNAME}\", \"sauceApiKey\": \"${SAUCE_ACCESS_KEY}\", \"tunnel-identifier\": \"__string__${TRAVIS_JOB_NUMBER}\", \"build\": \"${TRAVIS_BUILD_NUMBER}\", \"idle-timeout\": 120, \"tags\": [\"commit ${TRAVIS_COMMIT}\", \"branch ${TRAVIS_BRANCH}\", \"pull request ${TRAVIS_PULL_REQUEST}\"] } > client/src/test/resources/sauceConfig.json | ||
fi | ||
|
||
# Remove any existing firefox data | ||
if [[ $TRAVIS == "true" ]] | ||
then | ||
rm -fr ~/.mozilla | ||
fi | ||
|
||
mkdir -p target | ||
cd target | ||
if [ ! -f "./firefox/firefox" ] | ||
then | ||
export FIREFOX_VERSION=49.0.1 | ||
export FIREFOX_URL=http://download.cdn.mozilla.net/pub/firefox/releases/${FIREFOX_VERSION}/linux-x86_64/en-US/firefox-${FIREFOX_VERSION}.tar.bz2 | ||
wget -O firefox-${FIREFOX_VERSION}.tar.bz2 ${FIREFOX_URL} | ||
# and install downloaded firefox | ||
tar -xjf firefox-${FIREFOX_VERSION}.tar.bz2 | ||
fi | ||
|
||
if [ ! -f "./geckodriver" ] | ||
then | ||
export GECKODRIVER_VERSION=v0.11.1 | ||
curl -L -o geckodriver.tar.gz https://github.com/mozilla/geckodriver/releases/download/${GECKODRIVER_VERSION}/geckodriver-${GECKODRIVER_VERSION}-linux64.tar.gz | ||
gunzip -c geckodriver.tar.gz | tar xopf - | ||
chmod +x geckodriver | ||
fi | ||
cd .. | ||
|
||
export PATH="$PWD/target/firefox:$PATH" | ||
mvn test -pl client -B -V -DsuiteXmlFile=Firefox-Suite.xml -DSELION_SELENIUM_RUN_LOCALLY=true \ | ||
-DSELION_SELENIUM_USE_GECKODRIVER=true -DSELION_SELENIUM_GECKODRIVER_PATH=$PWD/target/geckodriver \ | ||
-DSELION_SELENIUM_CUSTOM_CAPABILITIES_PROVIDER=com.paypal.selion.TestCapabilityBuilder \ | ||
-DBROWSER_PATH=$PWD/target/firefox/firefox |