Skip to content

Commit

Permalink
Merge branch 'phantomjs-tests'
Browse files Browse the repository at this point in the history
  • Loading branch information
stefanw committed Feb 20, 2013
2 parents 2a6c91a + 2198497 commit 323d5cc
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 12 deletions.
3 changes: 2 additions & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,11 @@ before_install:
- export PIP_USE_MIRRORS=true
- export PIP_INDEX_URL=https://simple.crate.io/
- phantomjs --version
- phantomjs --webdriver= &
install:
- pip install https://github.com/stefanw/terrarium/archive/develop.zip boto
- terrarium key requirements-test.txt
- terrarium --target froideenv --remote-key-format "u/stwe/froideenv/%(arch)s-%(python_vmajor)s.%(python_vminor)s-%(digest)s" install requirements-test.txt || (wget "http://resources.opendatalabs.org.s3.amazonaws.com/u/stwe/froideenv/`terrarium key requirements-test.txt`" ; terrarium --no-upload --s3-bucket "" --target froideenv --storage-dir . install requirements-test.txt)
- terrarium --virtualenv-log-level 20 --pip-log-level 20 --target froideenv --remote-key-format "u/stwe/froideenv/%(arch)s-%(python_vmajor)s.%(python_vminor)s-%(digest)s" install requirements-test.txt || (wget "http://resources.opendatalabs.org.s3.amazonaws.com/u/stwe/froideenv/`terrarium key requirements-test.txt`" ; terrarium --pip-log-level 20 --virtualenv-log-level 20 --no-upload --s3-bucket "" --target froideenv --storage-dir . install requirements-test.txt)
- source froideenv/bin/activate
- which python
- pip install -e .
Expand Down
8 changes: 0 additions & 8 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,14 +1,6 @@
export DJANGO_SETTINGS_MODULE=froide.test_settings

test:
pep8 --ignore=E501,E124,E126,E127,E128 --exclude=migrations froide
coverage run --branch --source=froide `which django-admin.py` test froide.account.tests froide.foirequest.tests froide.foirequestfollower.tests froide.frontpage.tests froide.publicbody.tests
coverage report --omit="*/migrations/*"

testall:
pep8 --ignore=E501,E124,E126,E127,E128 --exclude=migrations froide
coverage run --branch --source=froide `which django-admin.py` test froide
coverage report --omit="*/migrations/*"

live:
coverage run --branch --source=froide `which django-admin.py` test froide.tests.live
1 change: 1 addition & 0 deletions froide/test_settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -247,6 +247,7 @@

TEST_RUNNER = 'discover_runner.DiscoverRunner'

TEST_SELENIUM_DRIVER = 'phantomjs'
# south settings

SOUTH_TESTS_MIGRATE = False
Expand Down
17 changes: 15 additions & 2 deletions froide/tests/live/test_request.py
Original file line number Diff line number Diff line change
@@ -1,22 +1,35 @@
import time

from django.conf import settings
from django.core.urlresolvers import reverse
from django.test import LiveServerTestCase
from django.contrib.auth.models import User

from selenium.webdriver.chrome.webdriver import WebDriver
from selenium.webdriver.support.wait import WebDriverWait

from froide.foirequest.tests import factories
from froide.foirequest.models import FoiRequest
from froide.publicbody.models import PublicBody


def get_selenium():
driver = getattr(settings, 'TEST_SELENIUM_DRIVER', 'firefox')
if driver == 'firefox':
from selenium.webdriver.firefox.webdriver import WebDriver as FirefoxDriver
return FirefoxDriver()
elif driver == 'chrome':
from selenium.webdriver.chrome.webdriver import WebDriver as ChromeDriver
return ChromeDriver()
elif driver == 'phantomjs':
from selenium.webdriver import PhantomJS
return PhantomJS()


class TestMakingRequest(LiveServerTestCase):

@classmethod
def setUpClass(cls):
cls.selenium = WebDriver()
cls.selenium = get_selenium()
cls.selenium.implicitly_wait(5)
super(TestMakingRequest, cls).setUpClass()

Expand Down
2 changes: 1 addition & 1 deletion requirements-test.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
-r requirements.txt
django-discover-runner==0.2.2
pyelasticsearch==0.2
selenium==2.25.0
selenium==2.29.0

0 comments on commit 323d5cc

Please sign in to comment.