diff --git a/.travis.yml b/.travis.yml new file mode 100644 index 0000000..f72506b --- /dev/null +++ b/.travis.yml @@ -0,0 +1,80 @@ +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 rooms + - ln -s $(readlink -e $(cd -)) rooms/drupal/sites/all/modules/rooms + - cd rooms/drupal + + # Setup files + - sudo chmod -R 777 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 + + # Download required libraries + - mkdir sites/all/libraries + - cd 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 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