This is an old revision of the document!
Codeception covers unit-, functional-, and acceptance tests To use it together with Gitlab is kinda tricky due to the need of selenium for acceptance testing.
Most important part is that the selenium server can call urls in your docker webapp container. For Details see https://cappers.ca/web-application-acceptance-tests-in-gitlab-ci-using-codeception-and-selenium/
stages: - test .run_webserver: &run_webserver image: composer:1 before_script: # Get ip of your webapp container and export it as $WEB_APP_IP env var for use in codeception config - export WEB_APP_IP="$(ifconfig | grep -A 1 'eth0' | tail -1 | cut -d ':' -f 2 | cut -d ' ' -f 1)" - composer install - ./flow server:run --host 0.0.0.0 --port 8081 & # Wait for webserver to get ready - sleep 10 codeception: <<: *run_webserver stage: test services: - name: selenium/standalone-chrome alias: selenium variables: SELENIUM_HOST: 'selenium' dependencies: - build script: - echo $WEB_APP_IP - composer install - echo "Run acceptance tests" - bin/codecept run acceptance - echo "Run api tests" - bin/codecept run api artifacts: paths: - tests/_output/ expire_in: 2 weeks
class_name: ApiTester modules: enabled: - REST: url: 'http://%WEB_APP_IP%:8081/api/v1' depends: PhpBrowser part: Json
actor: AcceptanceTester modules: enabled: - \Helper\Acceptance - WebDriver: host: '%SELENIUM_HOST%' url: 'http://%WEB_APP_IP%:8081' browser: chrome