Skip to content

Make Behat work again (quick workaround) #110

Description

@kabalin

Most moodle-plugin-ci users are experiencing issues with Behat tests which stopped working at some point last year. While PR #107 is under consideration, this is a quick workaround to make it work again:

language: php

addons:
  postgresql: "9.4"

services:
- mysql
- postgresql
- docker

cache:
  directories:
  - $HOME/.composer/cache
  - $HOME/.npm

php:
- 7.1
- 7.2
- 7.3

env:
  global:
  # Set PROFILE to either chrome or firefox depending on your preference.
  - PROFILE=chrome
  # This prevents starting selenium and php servers using moodle-plugin-ci in-built functionality.
  - MOODLE_START_BEHAT_SERVERS=NO
  matrix:
  - DB=pgsql
  - DB=mysqli

before_install:
- phpenv config-rm xdebug.ini
- nvm install 8.9
- nvm use 8.9
- cd ../..
- composer create-project -n --no-dev --prefer-dist blackboard-open-source/moodle-plugin-ci ci ^2
- export PATH="$(cd ci/bin; pwd):$(cd ci/vendor/bin; pwd):$PATH"

install:
- moodle-plugin-ci install -vvv
# Start Selenuim Standalone server using docker.
- docker run -d -p 127.0.0.1:4444:4444 --net=host -v /dev/shm:/dev/shm -v $HOME/build/moodle:$HOME/build/moodle selenium/standalone-${PROFILE}:3
# Start php built-in server.
- php -S localhost:8000 -t $HOME/build/moodle > /dev/null 2>&1 &
# Wait to make sure docker container is fully running.
- sleep 10

script:
- moodle-plugin-ci phplint
- moodle-plugin-ci phpcpd
- moodle-plugin-ci phpmd
- moodle-plugin-ci codechecker
- moodle-plugin-ci validate
- moodle-plugin-ci savepoints
- moodle-plugin-ci mustache
- moodle-plugin-ci grunt
- moodle-plugin-ci phpdoc
- moodle-plugin-ci phpunit
- moodle-plugin-ci behat --profile $PROFILE

To sum up, we use MOODLE_START_BEHAT_SERVERS=NO to disable built-in selenium and php server initialisation, and then start respective services in install stage after installation step. Selenuim server is initialised using docker image.

Please note, this requires Ubuntu Xenial build environment (currently default one in Travis).

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions