From 14f5b2d26fff3718970d82f9433409882531835c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thomas=20Leichtfu=C3=9F?= Date: Sat, 5 Sep 2020 14:10:37 +0200 Subject: [PATCH] [tests] setup selenium for travis ci --- .travis.yml | 3 ++- tests/testapp/tests/test_live_filters.py | 6 +++++- tox.ini | 1 + 3 files changed, 8 insertions(+), 2 deletions(-) diff --git a/.travis.yml b/.travis.yml index ac2e09e..c0c8cb1 100644 --- a/.travis.yml +++ b/.travis.yml @@ -44,7 +44,8 @@ matrix: - python: "3.8" env: REQ="Django>=3.0,<3.1" install: - - pip install -U pip setuptools coveralls + - apt-get install firefox-geckodriver + - pip install -U pip setuptools coveralls selenium - pip install $REQ - pip install --editable . script: "coverage run --source more_admin_filters/ tests/manage.py test testapp" diff --git a/tests/testapp/tests/test_live_filters.py b/tests/testapp/tests/test_live_filters.py index 36f2156..b8ab220 100644 --- a/tests/testapp/tests/test_live_filters.py +++ b/tests/testapp/tests/test_live_filters.py @@ -4,6 +4,7 @@ from django.contrib.auth.models import User from django.urls import reverse from django.contrib.staticfiles.testing import StaticLiveServerTestCase from selenium.webdriver.firefox.webdriver import WebDriver +from selenium.webdriver.firefox.options import Options from ..management.commands.createtestdata import create_test_data @@ -12,7 +13,10 @@ class LiveFilterTest(StaticLiveServerTestCase): @classmethod def setUpClass(cls): super().setUpClass() - cls.selenium = WebDriver() + + options = Options() + options.headless = True + cls.selenium = WebDriver(options=options) cls.selenium.implicitly_wait(10) @classmethod diff --git a/tox.ini b/tox.ini index ac171aa..c265a92 100644 --- a/tox.ini +++ b/tox.ini @@ -19,6 +19,7 @@ deps = django21: Django>=2.1,<2.2 django22: Django>=2.2,<3.0 django30: Django>=3.0,<3.1 + selenium commands = {envpython} tests/manage.py test testapp {posargs} setenv = PYTHONPATH = .:{toxworkdir}