From 962c2f0a2b8ec742e59ae174d77c3f4d8222ced5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pablo=20L=C3=B3pez=20//=20plopesc?= Date: Fri, 13 Mar 2015 16:36:10 +0100 Subject: [PATCH 1/9] Test travis integration: First step --- .travis.yml | 68 +++++++++++++++++++ tests/behat/behat.travis.yml | 18 +++++ tests/behat/composer.json | 14 ++++ {test => tests/behat}/default.behat.yml | 0 .../behat}/features/availability.feature | 0 .../features/availability_constraints.feature | 0 .../features/availability_reference.feature | 0 .../behat}/features/booking.feature | 0 .../features/bootstrap/FeatureContext.php | 0 .../behat}/features/installation.feature | 0 .../behat}/features/package.feature | 0 .../behat}/features/pricing.feature | 0 {test => tests/behat}/features/unit.feature | 0 .../behat}/features/unit_options.feature | 0 14 files changed, 100 insertions(+) create mode 100644 .travis.yml create mode 100644 tests/behat/behat.travis.yml create mode 100644 tests/behat/composer.json rename {test => tests/behat}/default.behat.yml (100%) rename {test => tests/behat}/features/availability.feature (100%) rename {test => tests/behat}/features/availability_constraints.feature (100%) rename {test => tests/behat}/features/availability_reference.feature (100%) rename {test => tests/behat}/features/booking.feature (100%) rename {test => tests/behat}/features/bootstrap/FeatureContext.php (100%) rename {test => tests/behat}/features/installation.feature (100%) rename {test => tests/behat}/features/package.feature (100%) rename {test => tests/behat}/features/pricing.feature (100%) rename {test => tests/behat}/features/unit.feature (100%) rename {test => tests/behat}/features/unit_options.feature (100%) diff --git a/.travis.yml b/.travis.yml new file mode 100644 index 0000000..6026861 --- /dev/null +++ b/.travis.yml @@ -0,0 +1,68 @@ +language: php + +php: + - 5.4 + +mysql: + database: drupal + username: root + encoding: utf8 + +matrix: + fast_finish: true + +before_install: + - sudo apt-get update > /dev/null + +install: + # install php packages required for running a web server from drush on php 5.3 + - sudo apt-get install -y --force-yes php5-cgi php5-mysql + - "mysql -e 'create database drupal;'" + + # add composer's global bin directory to the path + # see: https://github.com/drush-ops/drush#install---composer + - export PATH="$HOME/.composer/vendor/bin:$PATH" + + # install drush globally + - composer global require drush/drush:6.* + + # Build Behat dependencies + - cd ./tests/behat + - composer install --no-interaction --prefer-source + - cd ../../../ + + # Setting Behat environment + - DISTRO=`echo $TRAVIS_BUILD_DIR | sed -e "s/\/[^\/]*$//"` + - export BEHAT_PARAMS="{\"extensions\":{\"Drupal\\\DrupalExtension\":{\"drupal\":{\"drupal_root\":\"$DISTRO/drupal\"}}}}" + + - php -d sendmail_path=`which true` ~/.composer/vendor/bin/drush.php --yes core-quick-drupal --profile=standard --no-server --db-url=mysql://root:@127.0.0.1/drupal drupal + - mv rooms drupal/sites/all/modules + + # Setup files + - sudo chmod -R 777 drupal/sites/all + + # Setup display for Selenium + - export DISPLAY=:99.0 + - sh -e /etc/init.d/xvfb start + - sleep 5 + + # Get Selenium + - wget http://selenium-release.storage.googleapis.com/2.42/selenium-server-standalone-2.42.1.jar + - java -jar selenium-server-standalone-2.42.1.jar > /dev/null 2>&1 & + - until netstat -an 2>/dev/null | grep '4444.*LISTEN'; do true; done + + # Disable sendmail + - echo sendmail_path=`which true` >> ~/.phpenv/versions/$(phpenv version-name)/etc/php.ini + +before_script: + # Enable module and its dependencies + - drush --yes dl commerce date jquery_update addressfield + - drush --yes pm-enable rooms_booking_manager + # Start server + - drush runserver --server=builtin 8888 > /dev/null 2>&1 & + - until netstat -an 2>/dev/null | grep '8888.*LISTEN'; do true; done + - cd drupal/sites/all/modules/rooms/tests/behat + +script: + + - ./bin/behat --config behat.travis.yml \ No newline at end of file diff --git a/tests/behat/behat.travis.yml b/tests/behat/behat.travis.yml new file mode 100644 index 0000000..405e6c9 --- /dev/null +++ b/tests/behat/behat.travis.yml @@ -0,0 +1,18 @@ +default: + paths: + features: 'features' + extensions: + Behat\MinkExtension\Extension: + goutte: ~ + selenium2: + capabilities: {"browser": "firefox"} + base_url: 127.0.0.1:8888 + Drupal\DrupalExtension\Extension: + blackbox: ~ + api_driver: 'drupal' + drush: + alias: 'self' + selectors: + message_selector: '.messages' + error_message_selector: '.messages-error' + success_message_selector: '.messages.status' diff --git a/tests/behat/composer.json b/tests/behat/composer.json new file mode 100644 index 0000000..ebb1fc8 --- /dev/null +++ b/tests/behat/composer.json @@ -0,0 +1,14 @@ +{ + "require": { + "behat/behat": "2.5.*@stable", + "behat/mink": "*", + "behat/mink-extension": "*", + "behat/mink-selenium2-driver": "*", + "drupal/drupal-extension": "*", + "guzzlehttp/guzzle": "~3.8" + }, + + "config": { + "bin-dir": "bin/" + } +} diff --git a/test/default.behat.yml b/tests/behat/default.behat.yml similarity index 100% rename from test/default.behat.yml rename to tests/behat/default.behat.yml diff --git a/test/features/availability.feature b/tests/behat/features/availability.feature similarity index 100% rename from test/features/availability.feature rename to tests/behat/features/availability.feature diff --git a/test/features/availability_constraints.feature b/tests/behat/features/availability_constraints.feature similarity index 100% rename from test/features/availability_constraints.feature rename to tests/behat/features/availability_constraints.feature diff --git a/test/features/availability_reference.feature b/tests/behat/features/availability_reference.feature similarity index 100% rename from test/features/availability_reference.feature rename to tests/behat/features/availability_reference.feature diff --git a/test/features/booking.feature b/tests/behat/features/booking.feature similarity index 100% rename from test/features/booking.feature rename to tests/behat/features/booking.feature diff --git a/test/features/bootstrap/FeatureContext.php b/tests/behat/features/bootstrap/FeatureContext.php similarity index 100% rename from test/features/bootstrap/FeatureContext.php rename to tests/behat/features/bootstrap/FeatureContext.php diff --git a/test/features/installation.feature b/tests/behat/features/installation.feature similarity index 100% rename from test/features/installation.feature rename to tests/behat/features/installation.feature diff --git a/test/features/package.feature b/tests/behat/features/package.feature similarity index 100% rename from test/features/package.feature rename to tests/behat/features/package.feature diff --git a/test/features/pricing.feature b/tests/behat/features/pricing.feature similarity index 100% rename from test/features/pricing.feature rename to tests/behat/features/pricing.feature diff --git a/test/features/unit.feature b/tests/behat/features/unit.feature similarity index 100% rename from test/features/unit.feature rename to tests/behat/features/unit.feature diff --git a/test/features/unit_options.feature b/tests/behat/features/unit_options.feature similarity index 100% rename from test/features/unit_options.feature rename to tests/behat/features/unit_options.feature From 283975285d9b71a77de9d26639b91bbef0594edc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pablo=20L=C3=B3pez=20//=20plopesc?= Date: Fri, 13 Mar 2015 16:57:07 +0100 Subject: [PATCH 2/9] Round 2 --- .travis.yml | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/.travis.yml b/.travis.yml index 6026861..463396e 100644 --- a/.travis.yml +++ b/.travis.yml @@ -17,7 +17,7 @@ before_install: install: # install php packages required for running a web server from drush on php 5.3 - sudo apt-get install -y --force-yes php5-cgi php5-mysql - - "mysql -e 'create database drupal;'" + - mysql -e 'create database drupal;' # add composer's global bin directory to the path # see: https://github.com/drush-ops/drush#install---composer @@ -58,10 +58,20 @@ before_script: # Enable module and its dependencies - drush --yes dl commerce date jquery_update addressfield - drush --yes pm-enable rooms_booking_manager + + # Download required libraries + - cd drupal/sites/all/libraries + - mkdir moment + - wget http://momentjs.com/downloads/moment.min.js + - cd .. + - wget http://www.drupalrooms.com/sites/default/files/rooms_fullcalendar-2.1.1.zip + - unzip rooms_fullcalendar-2.1.1.zip + -cd .. + # Start server - drush runserver --server=builtin 8888 > /dev/null 2>&1 & - until netstat -an 2>/dev/null | grep '8888.*LISTEN'; do true; done - - cd drupal/sites/all/modules/rooms/tests/behat + - cd modules/rooms/tests/behat script: From f905b5d66ca6ebb10b7ce92291ef52e14043fce8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pablo=20L=C3=B3pez=20//=20plopesc?= Date: Fri, 13 Mar 2015 16:57:57 +0100 Subject: [PATCH 3/9] Silly typo --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 463396e..74fda7a 100644 --- a/.travis.yml +++ b/.travis.yml @@ -66,7 +66,7 @@ before_script: - cd .. - wget http://www.drupalrooms.com/sites/default/files/rooms_fullcalendar-2.1.1.zip - unzip rooms_fullcalendar-2.1.1.zip - -cd .. + - cd .. # Start server - drush runserver --server=builtin 8888 > /dev/null 2>&1 & From 4216c3206df1ff4d98bf90486e971da11fcfb3be Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pablo=20L=C3=B3pez=20//=20plopesc?= Date: Fri, 13 Mar 2015 17:10:08 +0100 Subject: [PATCH 4/9] LS --- .travis.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.travis.yml b/.travis.yml index 74fda7a..a494bfa 100644 --- a/.travis.yml +++ b/.travis.yml @@ -36,6 +36,7 @@ install: - export BEHAT_PARAMS="{\"extensions\":{\"Drupal\\\DrupalExtension\":{\"drupal\":{\"drupal_root\":\"$DISTRO/drupal\"}}}}" - php -d sendmail_path=`which true` ~/.composer/vendor/bin/drush.php --yes core-quick-drupal --profile=standard --no-server --db-url=mysql://root:@127.0.0.1/drupal drupal + - ls -la - mv rooms drupal/sites/all/modules # Setup files From 2c3182bdc7cf33cbd209e54b63b0c61f74def6dc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pablo=20L=C3=B3pez=20//=20plopesc?= Date: Fri, 13 Mar 2015 17:22:10 +0100 Subject: [PATCH 5/9] LS --- .travis.yml | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/.travis.yml b/.travis.yml index a494bfa..8f5e5ae 100644 --- a/.travis.yml +++ b/.travis.yml @@ -37,6 +37,11 @@ install: - php -d sendmail_path=`which true` ~/.composer/vendor/bin/drush.php --yes core-quick-drupal --profile=standard --no-server --db-url=mysql://root:@127.0.0.1/drupal drupal - ls -la + - cd drupal + - ls -la + - cd sites + - ls -la + - cd ../.. - mv rooms drupal/sites/all/modules # Setup files From 843c46d6fbaf52e50d153c454be8c7508e322d8c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pablo=20L=C3=B3pez=20//=20plopesc?= Date: Fri, 13 Mar 2015 18:02:22 +0100 Subject: [PATCH 6/9] LS --- .travis.yml | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) diff --git a/.travis.yml b/.travis.yml index 8f5e5ae..4792650 100644 --- a/.travis.yml +++ b/.travis.yml @@ -29,20 +29,14 @@ install: # Build Behat dependencies - cd ./tests/behat - composer install --no-interaction --prefer-source - - cd ../../../ + - cd ../../../.. # Setting Behat environment - DISTRO=`echo $TRAVIS_BUILD_DIR | sed -e "s/\/[^\/]*$//"` - export BEHAT_PARAMS="{\"extensions\":{\"Drupal\\\DrupalExtension\":{\"drupal\":{\"drupal_root\":\"$DISTRO/drupal\"}}}}" - - php -d sendmail_path=`which true` ~/.composer/vendor/bin/drush.php --yes core-quick-drupal --profile=standard --no-server --db-url=mysql://root:@127.0.0.1/drupal drupal - - ls -la - - cd drupal - - ls -la - - cd sites - - ls -la - - cd ../.. - - mv rooms drupal/sites/all/modules + - php -d sendmail_path=`which true` ~/.composer/vendor/bin/drush.php --yes core-quick-drupal --profile=standard --no-server --db-url=mysql://root:@127.0.0.1/drupal rooms + - ln -s $(readlink -e $(cd -)) rooms/drupal/sites/all/modules/rooms # Setup files - sudo chmod -R 777 drupal/sites/all From cd765c61174f7c8b505db7618b00ad433e1f6546 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pablo=20L=C3=B3pez=20//=20plopesc?= Date: Fri, 13 Mar 2015 18:10:45 +0100 Subject: [PATCH 7/9] LS --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 4792650..6020e1a 100644 --- a/.travis.yml +++ b/.travis.yml @@ -39,7 +39,7 @@ install: - ln -s $(readlink -e $(cd -)) rooms/drupal/sites/all/modules/rooms # Setup files - - sudo chmod -R 777 drupal/sites/all + - sudo chmod -R 777 rooms/drupal/sites/all # Setup display for Selenium - export DISPLAY=:99.0 From c8253784a2567542a7293b4d336a2bd2d7360b4f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pablo=20L=C3=B3pez=20//=20plopesc?= Date: Fri, 13 Mar 2015 18:22:48 +0100 Subject: [PATCH 8/9] LS --- .travis.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 6020e1a..a339a88 100644 --- a/.travis.yml +++ b/.travis.yml @@ -37,9 +37,10 @@ install: - php -d sendmail_path=`which true` ~/.composer/vendor/bin/drush.php --yes core-quick-drupal --profile=standard --no-server --db-url=mysql://root:@127.0.0.1/drupal rooms - ln -s $(readlink -e $(cd -)) rooms/drupal/sites/all/modules/rooms + - cd rooms/drupal # Setup files - - sudo chmod -R 777 rooms/drupal/sites/all + - sudo chmod -R 777 sites/all # Setup display for Selenium - export DISPLAY=:99.0 From c262634b24703c9e80df2a6f2aa347676bb7e117 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pablo=20L=C3=B3pez=20//=20plopesc?= Date: Fri, 13 Mar 2015 18:33:12 +0100 Subject: [PATCH 9/9] LS --- .travis.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index a339a88..f72506b 100644 --- a/.travis.yml +++ b/.travis.yml @@ -61,7 +61,8 @@ before_script: - drush --yes pm-enable rooms_booking_manager # Download required libraries - - cd drupal/sites/all/libraries + - mkdir sites/all/libraries + - cd sites/all/libraries - mkdir moment - wget http://momentjs.com/downloads/moment.min.js - cd ..