mirror of
https://github.com/Sylius/Sylius.git
synced 2026-07-14 09:02:12 +00:00
64 lines
2.5 KiB
Bash
Executable file
64 lines
2.5 KiB
Bash
Executable file
#!/usr/bin/env bash
|
|
|
|
source "$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)/../../../../bash/common.lib.sh"
|
|
|
|
prepare_for_behat_with_js() {
|
|
# Prepare Behat configuration
|
|
run_command "cp \"$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)/../assets/behat-javascript.yml\" ./behat.yml"
|
|
|
|
# Configure display
|
|
run_command "/sbin/start-stop-daemon --start --quiet --pidfile /tmp/xvfb_99.pid --make-pidfile --background --exec /usr/bin/Xvfb -- :99 -ac -screen 0 1680x1050x16"
|
|
run_command "export DISPLAY=:99"
|
|
|
|
# Download and configure ChromeDriver
|
|
if [ ! -f $SYLIUS_CACHE_DIR/chromedriver ]; then
|
|
# Using ChromeDriver 2.12 which supports Chrome 36-40, we're using Chromium 37
|
|
run_command "curl http://chromedriver.storage.googleapis.com/2.12/chromedriver_linux64.zip > chromedriver.zip"
|
|
run_command "unzip chromedriver.zip"
|
|
run_command "mv chromedriver $SYLIUS_CACHE_DIR"
|
|
fi
|
|
|
|
# Run Selenium with ChromeDriver
|
|
run_command "bin/selenium-server-standalone -Dwebdriver.chrome.driver=$SYLIUS_CACHE_DIR/chromedriver > $SYLIUS_BUILD_DIR/selenium.log 2>&1 &"
|
|
|
|
# Run webserver
|
|
run_command "app/console server:run 127.0.0.1:8080 --env=test_cached --router=app/config/router_test_cached.php --no-debug > $SYLIUS_BUILD_DIR/webserver.log 2>&1 &"
|
|
}
|
|
|
|
run_brand_new_behat() {
|
|
local code=0
|
|
|
|
print_header "Testing (Behat - brand new, javascript scenarios; @javascript && ~@legacy && ~@todo && ~@cli)" "Sylius"
|
|
run_command "bin/behat --strict -f progress -p cached --tags=\"@javascript && ~@legacy && ~@todo && ~@cli\"" || code=$?
|
|
if [[ ${code} = 1 ]]; then
|
|
run_command "bin/behat --strict -f progress -p cached --tags=\"@javascript && ~@legacy && ~@todo && ~@cli\" --rerun" ; code=$?
|
|
fi
|
|
|
|
return ${code}
|
|
}
|
|
|
|
run_legacy_behat() {
|
|
local code=0
|
|
|
|
print_header "Testing (Behat - legacy, javascript scenarios; @javascript && @legacy && ~@todo && ~@cli)" "Sylius"
|
|
run_command "bin/behat --strict -f progress -p cached --tags=\"@javascript && @legacy && ~@todo && ~@cli\"" || code=$?
|
|
if [[ ${code} = 1 ]]; then
|
|
run_command "bin/behat --strict -f progress -p cached --tags=\"@javascript && @legacy && ~@todo && ~@cli\" --rerun" ; code=$?
|
|
fi
|
|
|
|
return ${code}
|
|
}
|
|
|
|
run_behat() {
|
|
local code=0
|
|
|
|
run_brand_new_behat || code=$?
|
|
run_legacy_behat || code=$?
|
|
|
|
return ${code}
|
|
}
|
|
|
|
print_header "Preparing for testing (Behat - javascript scenarios; @javascript)" "Sylius"
|
|
prepare_for_behat_with_js
|
|
|
|
run_behat
|