diff --git a/.drone.yml b/.drone.yml index c1461664..d9216d2a 100644 --- a/.drone.yml +++ b/.drone.yml @@ -83,7 +83,7 @@ pipeline: slow-test: <<: *test commands: - - python manage.py test --liveserver=slow-test:8021-8029 --parallel --tag slow -k -v 3 + - python manage.py test --parallel --tag slow -k -v 3 lint-coala: <<: *lint diff --git a/README.md b/README.md index 0ea14f57..daf8613c 100644 --- a/README.md +++ b/README.md @@ -69,8 +69,7 @@ dc exec app python manage.py price make test # запускаем один тест -dc exec app python manage.py test -v 3 --liveserver=app:8021-8029 \ - stroyprombeton.tests.tests_selenium.CartTestCase.buy_on_product_page +dc exec app python manage.py test shopelectro.tests.tests_selenium.TestClass.test_method ``` #### Fixtures diff --git a/docker/Makefile b/docker/Makefile index e518bbd2..dacd3019 100644 --- a/docker/Makefile +++ b/docker/Makefile @@ -46,7 +46,7 @@ collectstatic: test: build-static $(dc) up -d app selenium - $(dc) exec app python manage.py test -v 3 --liveserver=app-server:8020-8030 --parallel + $(dc) exec app python manage.py test -v 3 --parallel $(dc) stop lint-code: diff --git a/docker/docker-compose.yml b/docker/docker-compose.yml index ad76b254..ae073102 100644 --- a/docker/docker-compose.yml +++ b/docker/docker-compose.yml @@ -17,7 +17,6 @@ x-app-base: &app-base - PYTHONUNBUFFERED=0 ports: - $VIRTUAL_HOST_EXPOSE_PORT:$VIRTUAL_HOST_PORT - - $VIRTUAL_HOST_LIVESERVER_PORT networks: se-backend: aliases: diff --git a/docker/drone_env/ports b/docker/drone_env/ports index da9f3b83..18b414a9 100644 --- a/docker/drone_env/ports +++ b/docker/drone_env/ports @@ -1,6 +1,5 @@ # Exposed ports VIRTUAL_HOST_PORT=8000 VIRTUAL_HOST_EXPOSE_PORT=8012 -VIRTUAL_HOST_LIVESERVER_PORT=8020-8030 VIRTUAL_HOST_STAGE_PORT=8001 VIRTUAL_HOST_STAGE_EXPOSE_PORT=8011 diff --git a/docker/env_files/ports.dist b/docker/env_files/ports.dist index 93d62153..296faba3 100644 --- a/docker/env_files/ports.dist +++ b/docker/env_files/ports.dist @@ -1,6 +1,5 @@ # Exposed ports VIRTUAL_HOST_PORT=8000 VIRTUAL_HOST_EXPOSE_PORT=8010 -VIRTUAL_HOST_LIVESERVER_PORT=8020-8030 VIRTUAL_HOST_STAGE_PORT=8001 VIRTUAL_HOST_STAGE_EXPOSE_PORT=8011 diff --git a/requirements.txt b/requirements.txt index 97386d55..f785ef5c 100644 --- a/requirements.txt +++ b/requirements.txt @@ -5,7 +5,7 @@ beautifulsoup4 # celery==4.2.2 git+https://github.com/celery/celery.git@1c3a15938d0b9dde674d4666689d6a6c733d64e4#egg=celery -Django==1.10 +Django==1.11.17 django-debug-toolbar==1.10.1 django-extensions django-redis==4.8.0 diff --git a/shopelectro/settings/base.py b/shopelectro/settings/base.py index 8dccd1cc..4923b608 100644 --- a/shopelectro/settings/base.py +++ b/shopelectro/settings/base.py @@ -11,6 +11,7 @@ """ import os +import socket from datetime import datetime # Build paths inside the project like this: os.path.join(BASE_DIR, ...) @@ -221,6 +222,9 @@ } TEST_RUNNER = 'refarm_test_utils.runners.RefarmTestRunner' +# address for selenium-based tests +# host name doesn't resolve at CI, so we have to use host address +LIVESERVER_HOST = socket.gethostbyname(socket.gethostname()) SITE_CREATED = datetime(2013, 1, 1) diff --git a/shopelectro/tests/helpers.py b/shopelectro/tests/helpers.py index 8372eb7c..c4dc856e 100644 --- a/shopelectro/tests/helpers.py +++ b/shopelectro/tests/helpers.py @@ -60,6 +60,7 @@ class SeleniumTestCase(LiveServerTestCase): """Common superclass for running selenium-based tests.""" fixtures = ['dump.json'] + host = settings.LIVESERVER_HOST @classmethod def setUpClass(cls): @@ -89,7 +90,7 @@ def setUpClass(cls): def tearDownClass(cls): """Close selenium session.""" cls.browser.quit() - super(SeleniumTestCase, cls).tearDownClass() + super().tearDownClass() @contextmanager def screen_fail(self, filename=''): diff --git a/shopelectro/tests/tests_selenium_mobile.py b/shopelectro/tests/tests_selenium_mobile.py index 73ddfe41..2530cdb1 100644 --- a/shopelectro/tests/tests_selenium_mobile.py +++ b/shopelectro/tests/tests_selenium_mobile.py @@ -19,6 +19,7 @@ class MobileSeleniumTestCase(LiveServerTestCase): """Common superclass for running selenium-based tests.""" fixtures = ['dump.json'] + host = settings.LIVESERVER_HOST @classmethod def setUpClass(cls): diff --git a/templates/ecommerce/order/payment_types.html b/templates/ecommerce/order/payment_types.html index d88dafe0..49097d40 100644 --- a/templates/ecommerce/order/payment_types.html +++ b/templates/ecommerce/order/payment_types.html @@ -3,6 +3,6 @@ {% for radio in form.payment_type %}