Skip to content

Commit

Permalink
Add script for running MTF locally via Docker.
Browse files Browse the repository at this point in the history
  • Loading branch information
colinmollenhour committed May 5, 2020
1 parent 4444884 commit 7c35cee
Show file tree
Hide file tree
Showing 2 changed files with 59 additions and 0 deletions.
37 changes: 37 additions & 0 deletions dev/tests/functional/docker/run.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
#!/bin/bash

set -ex

TEST_SUITE=functional
FUNCTIONAL_DIR=$(dirname $(dirname $BASH_SOURCE[0]))
MAGENTO_HOST_NAME="mtf_php"
COMPOSER_CACHE=$HOME/.composer/cache

echo "Starting test environment"
cd $FUNCTIONAL_DIR/docker
docker-compose -p mtf up -d

echo "Installing Composer dependencies"
docker run --rm \
--volume $FUNCTIONAL_DIR:/app --volume ${COMPOSER_HOME:-$HOME/.composer}:/tmp \
--user $(id -u):$(id -g) \
composer --ignore-platform-reqs install --no-interaction

echo "Installing Magento"
docker exec mtf_mysql mysql -uroot -e 'CREATE DATABASE magento;'
docker exec mtf_php php -f install.php -- \
--license_agreement_accepted yes \
--locale en_US --timezone "America/Los_Angeles" --default_currency USD \
--db_host 127.0.0.1 --db_name magento --db_user root --db_pass "" \
--url "http://${MAGENTO_HOST_NAME}/" --use_rewrites yes --use_secure no \
--secure_base_url "http://${MAGENTO_HOST_NAME}/" --use_secure_admin no \
--admin_lastname Owner --admin_firstname Store --admin_email "[email protected]" \
--admin_username admin --admin_password asd123#2*53515523 \
--encryption_key "I2V7t7fiCIRKw9FWz4m3CStgeBG1T+ATZ0Us+W8jAIk="

echo "Launching PHPUnit runner"
docker exec -it mtf_php dev/tests/functional/run_functional.sh

echo "Stopping test environment"
cd $FUNCTIONAL_DIR/docker
docker-compose -p mtf down
22 changes: 22 additions & 0 deletions dev/tests/functional/docker/run_functional.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
#!/bin/bash

set -ex

export TEST_SUITE=functional


# Before Install
#./dev/travis/before_install.sh
/sbin/start-stop-daemon --start --quiet --pidfile /tmp/custom_xvfb_99.pid --make-pidfile --background --exec /usr/bin/Xvfb -- :1 -screen 0 1280x1024x24

export DISPLAY=:1.0
sh ./vendor/se/selenium-server-standalone/bin/selenium-server-standalone -port 4444 -host 127.0.0.1 \
-Dwebdriver.firefox.bin=$(which firefox) -trustAllSSLCertificate &> ~/selenium.log &

cp ./phpunit.xml.dist ./phpunit.xml
#sed -e "s?127.0.0.1?${MAGENTO_HOST_NAME}?g" --in-place ./phpunit.xml
#sed -e "s?basic?travis_acceptance?g" --in-place ./phpunit.xml

php -f utils/generate.php

dev/tests/functional/vendor/phpunit/phpunit/phpunit -c dev/tests/$TEST_SUITE

0 comments on commit 7c35cee

Please sign in to comment.