Skip to content
Snippets Groups Projects
Verified Commit e38ea1ff authored by Nik | Klampfradler's avatar Nik | Klampfradler
Browse files

[CI] Introduce Selenium tests against Docker

parent 5d60a8d2
No related branches found
No related tags found
No related merge requests found
......@@ -62,19 +62,26 @@ build_docker:
--cache=true
--cleanup
test_docker:
test_docker_selenium:
stage: test_integrated
image:
name: debian:buster-slim
name: registry.edugit.org/teckids/docker-images/python-pimped:master
services:
- name: postgres:12
alias: db
- name: memcached:latest
- name: memcached
alias: memcached
- name: registry.edugit.org/biscuit/biscuit-ng:${CI_COMMIT_REF_NAME}
alias: app
before_script:
- apt-get -y update && eatmydata apt-get -y install chromium-driver
- eatmydata pip install selenium pytest-selenium
- adduser --disabled-password --gecos "Test User" testuser
script:
- echo true
- sudo -u testuser eatmydata tox -e selenium
artifacts:
paths:
- screenshots/
deploy_demo-master:
stage: deploy
......
import sys
import pytest
if '--driver' not in sys.argv:
pytest.skip('Selenium driver not configured', allow_module_level=True)
@pytest.fixture
def chrome_options(chrome_options):
chrome_options.add_argument('--headless')
chrome_options.add_argument('--no-sandbox')
chrome_options.add_argument('--disable-dev-shm-usage')
return chrome_options
def test_index(selenium):
selenium.get('http://app:8000/')
selenium.save_screenshot('screenshots/index.png')
[tox]
skipsdist = True
envlist = default
[testenv]
[testenv:default]
whitelist_externals = poetry
pytest
skip_install = true
commands = pytest --pylama --cov=biscuit biscuit/core/
commands = pytest -p no:selenium --pylama --cov=biscuit biscuit/core/
[testenv:selenium]
whitelist_externals = poetry
pytest
skip_install = true
commands = pytest --driver {env:SELENIUM_DRIVER:Chrome} biscuit/core/
[pylama]
linters = pycodestyle,pyflakes,radon
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment