Ravi Kumar Ravi Kumar - 5 months ago 123
Python Question

Running selenium tests for Django in gitlab-ci

Iam using latest firefox, xvfb

Django==1.8.2
selenium==2.45.0


and my gitlab-ci job script

virtualenv env
source env/bin/activate
pip install -r requirements.txt
python manage.py test


before adding selenium tests django testcases passed without any error.
when i added selenium testcases to my project ci shell prompts for below error

raise WebDriverException("The browser appears to have exited "
WebDriverException: Message: The browser appears to have exited before we could connect. If you specified a log_file in the FirefoxBinary constructor, check it for details.


In my local system i can run both test without error. i think i am missing something in jobscript.

Thanks..

Answer

Now GitLab CI is part of GitLab. So, No to gitlab-ci job script. just adding ".gitlab-ci.yml" will be enough

.gitlab-ci.yml file for my project:

Python 2.7:
    script:
    - export PY_EXE=python2.7
    - virtualenv env
    - source env/bin/activate
    - pip install -r requirements.txt
    - export DISPLAY=:10
    - python manage.py test
    except:
    - tags
Comments