Skip to content

Instantly share code, notes, and snippets.

@racinmat
Last active February 27, 2018 10:13
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save racinmat/f31f5b2fcb261be54bde7e7e7d358d07 to your computer and use it in GitHub Desktop.
Save racinmat/f31f5b2fcb261be54bde7e7e7d358d07 to your computer and use it in GitHub Desktop.

Example for sandboxed testing in Gitlab CI

https://gitlab.com/racinmat/ZKS_gitlab_ci_selenium

codeception example repo

https://github.com/racinmat/workshop-codeception

How to run selenium server

windows: java -Dwebdriver.chrome.driver="%cd%\chromedriver.exe" -jar "%cd%\selenium-server-standalone-2.47.1.jar" linux: java -Dwebdriver.chrome.driver="./chromedriver" -jar "./selenium-server-standalone-2.47.1.jar"

Warming up initially

.\vendor\bin\codecept bootstrap

Building generated files

.\vendor\bin\codecept build

Generating cept file

.\vendor\bin\codecept generate:cept acceptance <name>

Running tests

.\vendor\bin\codecept run acceptance <fileName>

In gitlab CI:

variables:
    GITLAB_SELENIUM_SERVER_IMAGE_NAME: registry.gitlab.com/gitlab-org/gitlab-selenium-server

selenium_test:
    stage: selenium_test
    image: <váš image>
    before_script:
        - "composer install --prefer-dist --no-interaction --no-progress --no-suggest --no-scripts --optimize-autoloader"
        - "cp app/config/parameters_test.yml app/config/parameters.yml"
        - "cp codeception.parameters.yml.gitlab codeception.parameters.yml"
    script:
        - "vendor/bin/codecept run acceptance"
    artifacts:
        paths:
            - var/logs
            - tests/_output
        when: on_failure
    services:
        - name: $GITLAB_SELENIUM_SERVER_IMAGE_NAME:test
          alias: gitlab-selenium-server
    only:
        - schedules
        - web
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment