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

[Tests] Always run Selenium tests

parent c7305c36
No related branches found
No related tags found
No related merge requests found
import sys
import pytest
if '--driver' not in sys.argv:
pytest.skip('Selenium driver not configured', allow_module_level=True)
from django.test import LiveServerTestCase
webdriver = pytest.importorskip('selenium.webdriver')
class SeleniumTests(LiveServerTestCase):
__test__ = False
@classmethod
def setUpClass(cls):
super().setUpClass()
cls.selenium.set_window_size(1920, 1080)
cls.selenium.implicitly_wait(10)
@classmethod
def tearDownClass(cls):
cls.selenium.quit()
super().tearDownClass()
def test_index(self):
self.selenium.get(self.live_server_url + '/')
assert 'BiscuIT' in self.selenium.title
self.selenium.save_screenshot('screenshots/index.png')
class SeleniumTestsChromium(SeleniumTests):
__test__ = True
@classmethod
def setUpClass(cls):
options = webdriver.ChromeOptions()
options.add_argument('--headless')
options.add_argument('--no-headless')
options.add_argument('--disable-shm-usage')
@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
cls.selenium = webdriver.Chrome(options=options)
def test_index(selenium):
selenium.get('http://app:8000/')
assert 'BiscuIT' in selenium.title
selenium.save_screenshot('screenshots/index.png')
super().setUpClass()
This diff is collapsed.
......@@ -70,6 +70,7 @@ pytest-django = "^3.7"
pytest-django-testing-postgresql = "^0.1"
tox = "^3.14"
pytest-cov = "^2.8"
selenium = "^3.141.0"
[build-system]
requires = ["poetry>=0.12"]
......
......@@ -6,13 +6,7 @@ envlist = default
whitelist_externals = poetry
pytest
skip_install = true
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/
commands = pytest --pylama --cov=biscuit 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