Skip to content

Commit 24ef02a

Browse files
authored
MAGETWO-69367: Configure Travis CI to run functional tests #9697
2 parents e0e9ed0 + c65058e commit 24ef02a

File tree

9 files changed

+248
-2
lines changed

9 files changed

+248
-2
lines changed

.travis.yml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,9 @@ addons:
77
- mysql-client-core-5.6
88
- mysql-client-5.6
99
- postfix
10+
firefox: "46.0"
11+
hosts:
12+
- magento2.travis
1013
language: php
1114
php:
1215
- 7.0
@@ -16,19 +19,26 @@ env:
1619
- COMPOSER_BIN_DIR=~/bin
1720
- INTEGRATION_SETS=3
1821
- NODE_JS_VERSION=6
22+
- MAGENTO_HOST_NAME="magento2.travis"
1923
matrix:
2024
- TEST_SUITE=unit
2125
- TEST_SUITE=integration INTEGRATION_INDEX=1
2226
- TEST_SUITE=integration INTEGRATION_INDEX=2
2327
- TEST_SUITE=integration INTEGRATION_INDEX=3
2428
- TEST_SUITE=static
2529
- TEST_SUITE=js
30+
- TEST_SUITE=functional ACCEPTANCE_INDEX=1
31+
- TEST_SUITE=functional ACCEPTANCE_INDEX=2
2632
matrix:
2733
exclude:
2834
- php: 7.0
2935
env: TEST_SUITE=static
3036
- php: 7.0
3137
env: TEST_SUITE=js
38+
- php: 7.0
39+
env: TEST_SUITE=functional ACCEPTANCE_INDEX=1
40+
- php: 7.0
41+
env: TEST_SUITE=functional ACCEPTANCE_INDEX=2
3242
cache:
3343
apt: true
3444
directories:

dev/tests/functional/phpunit.xml.dist

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,8 @@
2929
</listeners>
3030

3131
<php>
32-
<env name="app_frontend_url" value="http://localhost/" />
33-
<env name="app_backend_url" value="http://localhost/backend/" />
32+
<env name="app_frontend_url" value="http://127.0.0.1/" />
33+
<env name="app_backend_url" value="http://127.0.0.1/backend/" />
3434
<env name="testsuite_rule" value="basic" />
3535
<env name="testsuite_rule_path" value="Magento/Mtf/TestSuite/InjectableTests" />
3636
<env name="log_directory" value="var/log" />
Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
<?xml version="1.0"?>
2+
<!--
3+
/**
4+
* Copyright © Magento, Inc. All rights reserved.
5+
* See COPYING.txt for license details.
6+
*/
7+
-->
8+
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
9+
xsi:noNamespaceSchemaLocation="../../../../../vendor/magento/mtf/Magento/Mtf/TestRunner/etc/testRunner.xsd">
10+
<rule scope="testsuite">
11+
<allow>
12+
<module value="Magento_AdminNotification" strict="1" />
13+
<module value="Magento_AdvancedPricingImportExport" strict="1" />
14+
<module value="Magento_Analytics" strict="1" />
15+
<module value="Magento_Authorizenet" strict="1" />
16+
<module value="Magento_Backend" strict="1" />
17+
<module value="Magento_Backup" strict="1" />
18+
<module value="Magento_Braintree" strict="1" />
19+
<module value="Magento_Bundle" strict="1" />
20+
<module value="Magento_BundleImportExport" strict="1" />
21+
<module value="Magento_Captcha" strict="1" />
22+
<module value="Magento_Catalog" strict="1" />
23+
<module value="Magento_CatalogImportExport" strict="1" />
24+
<module value="Magento_CatalogInventory" strict="1" />
25+
<module value="Magento_CatalogInventoryConfigurableProduct" strict="1" />
26+
<module value="Magento_CatalogRule" strict="1" />
27+
<module value="Magento_CatalogRuleConfigurable" strict="1" />
28+
<module value="Magento_CatalogSearch" strict="1" />
29+
<module value="Magento_CatalogUrlRewrite" strict="1" />
30+
<module value="Magento_CheckoutAgreements" strict="1" />
31+
<module value="Magento_Cms" strict="1" />
32+
<module value="Magento_Config" strict="1" />
33+
<module value="Magento_ConfigurableImportExport" strict="1" />
34+
<module value="Magento_Contact" strict="1" />
35+
<module value="Magento_CurrencySymbol" strict="1" />
36+
<module value="Magento_Customer" strict="1" />
37+
<module value="Magento_CustomerImportExport" strict="1" />
38+
<module value="Magento_Dhl" strict="1" />
39+
<module value="Magento_Directory" strict="1" />
40+
<module value="Magento_Downloadable" strict="1" />
41+
<module value="Magento_Email" strict="1" />
42+
<module value="Magento_Fedex" strict="1" />
43+
<module value="Magento_GiftMessage" strict="1" />
44+
<module value="Magento_GroupedImportExport" strict="1" />
45+
<module value="Magento_GroupedProduct" strict="1" />
46+
<module value="Magento_ImportExport" strict="1" />
47+
<module value="Magento_Indexer" strict="1" />
48+
<module value="Magento_Install" strict="1" />
49+
<module value="Magento_Integration" strict="1" />
50+
</allow>
51+
</rule>
52+
<rule scope="testcase">
53+
<allow>
54+
<tag group="test_type" value="acceptance_test" />
55+
</allow>
56+
<deny>
57+
<tag group="stable" value="no" />
58+
</deny>
59+
</rule>
60+
<rule scope="variation">
61+
<allow>
62+
<tag group="test_type" value="acceptance_test" />
63+
</allow>
64+
<deny>
65+
<tag group="stable" value="no" />
66+
</deny>
67+
</rule>
68+
</config>
Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
<?xml version="1.0"?>
2+
<!--
3+
/**
4+
* Copyright © Magento, Inc. All rights reserved.
5+
* See COPYING.txt for license details.
6+
*/
7+
-->
8+
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
9+
xsi:noNamespaceSchemaLocation="../../../../../vendor/magento/mtf/Magento/Mtf/TestRunner/etc/testRunner.xsd">
10+
<rule scope="testsuite">
11+
<allow>
12+
<module value="Magento_ConfigurableProduct" strict="1" />
13+
<module value="Magento_Checkout" strict="1" />
14+
<module value="Magento_LayeredNavigation" strict="1" />
15+
<module value="Magento_Msrp" strict="1" />
16+
<module value="Magento_Multishipping" strict="1" />
17+
<module value="Magento_Newsletter" strict="1" />
18+
<module value="Magento_OfflinePayments" strict="1" />
19+
<module value="Magento_OfflineShipping" strict="1" />
20+
<module value="Magento_PageCache" strict="1" />
21+
<module value="Magento_Payment" strict="1" />
22+
<module value="Magento_Paypal" strict="1" />
23+
<module value="Magento_Persistent" strict="1" />
24+
<module value="Magento_ProductVideo" strict="1" />
25+
<module value="Magento_Reports" strict="1" />
26+
<module value="Magento_Review" strict="1" />
27+
<module value="Magento_Sales" strict="1" />
28+
<module value="Magento_SalesRule" strict="1" />
29+
<module value="Magento_Search" strict="1" />
30+
<module value="Magento_Security" strict="1" />
31+
<module value="Magento_Setup" strict="1" />
32+
<module value="Magento_Shipping" strict="1" />
33+
<module value="Magento_Sitemap" strict="1" />
34+
<module value="Magento_Store" strict="1" />
35+
<module value="Magento_Swagger" strict="1" />
36+
<module value="Magento_Swatches" strict="1" />
37+
<module value="Magento_Tax" strict="1" />
38+
<module value="Magento_Theme" strict="1" />
39+
<module value="Magento_Ui" strict="1" />
40+
<module value="Magento_Ups" strict="1" />
41+
<module value="Magento_UrlRewrite" strict="1" />
42+
<module value="Magento_User" strict="1" />
43+
<module value="Magento_Usps" strict="1" />
44+
<module value="Magento_Variable" strict="1" />
45+
<module value="Magento_Vault" strict="1" />
46+
<module value="Magento_Weee" strict="1" />
47+
<module value="Magento_Widget" strict="1" />
48+
<module value="Magento_Wishlist" strict="1" />
49+
</allow>
50+
</rule>
51+
<rule scope="testcase">
52+
<allow>
53+
<tag group="test_type" value="acceptance_test" />
54+
</allow>
55+
<deny>
56+
<tag group="stable" value="no" />
57+
</deny>
58+
</rule>
59+
<rule scope="variation">
60+
<allow>
61+
<tag group="test_type" value="acceptance_test" />
62+
</allow>
63+
<deny>
64+
<tag group="stable" value="no" />
65+
</deny>
66+
</rule>
67+
</config>

dev/travis/before_install.sh

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,3 +33,31 @@ if [ $TEST_SUITE = "static" ] || [ test $TEST_SUITE == "js" ]; then
3333
npm install -g yarn
3434
yarn global add grunt-cli
3535
fi
36+
37+
if [ $TEST_SUITE = "functional" ]; then
38+
# Install apache
39+
sudo apt-get update
40+
sudo apt-get install apache2 libapache2-mod-fastcgi
41+
if [ ${TRAVIS_PHP_VERSION:0:1} == "7" ]; then
42+
sudo cp ${TRAVIS_BUILD_DIR}/dev/travis/config/www.conf ~/.phpenv/versions/$(phpenv version-name)/etc/php-fpm.d/
43+
fi
44+
45+
# Enable php-fpm
46+
sudo cp ~/.phpenv/versions/$(phpenv version-name)/etc/php-fpm.conf.default ~/.phpenv/versions/$(phpenv version-name)/etc/php-fpm.conf
47+
sudo a2enmod rewrite actions fastcgi alias
48+
echo "cgi.fix_pathinfo = 1" >> ~/.phpenv/versions/$(phpenv version-name)/etc/php.ini
49+
~/.phpenv/versions/$(phpenv version-name)/sbin/php-fpm
50+
51+
# Configure apache virtual hosts
52+
sudo cp -f ${TRAVIS_BUILD_DIR}/dev/travis/config/apache_virtual_host /etc/apache2/sites-available/000-default.conf
53+
sudo sed -e "s?%TRAVIS_BUILD_DIR%?$(pwd)?g" --in-place /etc/apache2/sites-available/000-default.conf
54+
sudo sed -e "s?%MAGENTO_HOST_NAME%?${MAGENTO_HOST_NAME}?g" --in-place /etc/apache2/sites-available/000-default.conf
55+
56+
sudo usermod -a -G www-data travis
57+
sudo usermod -a -G travis www-data
58+
59+
phpenv config-rm xdebug.ini
60+
sudo service apache2 restart
61+
62+
/sbin/start-stop-daemon --start --quiet --pidfile /tmp/custom_xvfb_99.pid --make-pidfile --background --exec /usr/bin/Xvfb -- :1 -screen 0 1280x1024x24
63+
fi

dev/travis/before_script.sh

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,4 +92,39 @@ case $TEST_SUITE in
9292
echo "Deploying Static Content"
9393
php bin/magento setup:static-content:deploy -f -q -j=2 --no-css --no-less --no-images --no-fonts --no-misc --no-html-minify
9494
;;
95+
functional)
96+
echo "Installing Magento"
97+
mysql -uroot -e 'CREATE DATABASE magento2;'
98+
php bin/magento setup:install -q \
99+
--language="en_US" \
100+
--timezone="UTC" \
101+
--currency="USD" \
102+
--base-url="http://${MAGENTO_HOST_NAME}/" \
103+
--admin-firstname="John" \
104+
--admin-lastname="Doe" \
105+
--backend-frontname="backend" \
106+
--admin-email="admin@example.com" \
107+
--admin-user="admin" \
108+
--use-rewrites=1 \
109+
--admin-use-security-key=0 \
110+
--admin-password="123123q"
111+
112+
echo "Enabling production mode"
113+
php bin/magento deploy:mode:set production
114+
115+
echo "Prepare functional tests for running"
116+
cd dev/tests/functional
117+
118+
composer install && composer require se/selenium-server-standalone:2.53.1
119+
export DISPLAY=:1.0
120+
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 &
121+
cp ./phpunit.xml.dist ./phpunit.xml
122+
sed -e "s?127.0.0.1?${MAGENTO_HOST_NAME}?g" --in-place ./phpunit.xml
123+
sed -e "s?basic?travis_acceptance_${ACCEPTANCE_INDEX}?g" --in-place ./phpunit.xml
124+
cp ./.htaccess.sample ./.htaccess
125+
cd ./utils
126+
php -f mtf troubleshooting:check-all
127+
128+
cd ../../..
129+
;;
95130
esac

dev/travis/config/apache_virtual_host

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
<VirtualHost *:80>
2+
DocumentRoot %TRAVIS_BUILD_DIR%
3+
ServerName %MAGENTO_HOST_NAME%
4+
5+
<Directory "%TRAVIS_BUILD_DIR%">
6+
Options FollowSymLinks MultiViews ExecCGI
7+
AllowOverride All
8+
Require all granted
9+
</Directory>
10+
11+
<IfModule mod_fastcgi.c>
12+
AddHandler php7-fcgi .php
13+
Action php7-fcgi /php7-fcgi
14+
Alias /php7-fcgi /usr/lib/cgi-bin/php7-fcgi
15+
FastCgiExternalServer /usr/lib/cgi-bin/php7-fcgi -host 127.0.0.1:9000 -pass-header Authorization
16+
<Directory /usr/lib/cgi-bin>
17+
Require all granted
18+
</Directory>
19+
</IfModule>
20+
</VirtualHost>

dev/travis/config/www.conf

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
[www]
2+
3+
user = www-data
4+
group = www-data
5+
6+
listen = 127.0.0.1:9000
7+
8+
pm = dynamic
9+
pm.max_children = 10
10+
pm.start_servers = 4
11+
pm.min_spare_servers = 2
12+
pm.max_spare_servers = 6
13+
14+
chdir = /

dev/travis/script.sh

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,10 @@ case $TEST_SUITE in
1212
js)
1313
grunt spec
1414
;;
15+
functional)
16+
cd dev/tests/functional
17+
vendor/phpunit/phpunit/phpunit -c phpunit.xml --debug testsuites/Magento/Mtf/TestSuite/InjectableTests.php
18+
;;
1519
*)
1620
phpunit -c dev/tests/$TEST_SUITE $TEST_FILTER;
1721
;;

0 commit comments

Comments
 (0)