forked from jayesh92/vms
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #690 from systers/gsoc18-infra
Selenium Integration on travis.
- Loading branch information
Showing
5 changed files
with
113 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,20 +1,38 @@ | ||
language: python | ||
|
||
env: | ||
- MOZ_HEADLESS=1 | ||
|
||
addons: | ||
firefox: "55.0" | ||
|
||
python: | ||
- "2.7" | ||
|
||
services: postgresql | ||
|
||
before_install: | ||
- wget https://github.com/mozilla/geckodriver/releases/download/v0.20.1/geckodriver-v0.20.1-linux64.tar.gz | ||
- tar -xzvf geckodriver-v0.20.1-linux64.tar.gz | ||
- sudo mv geckodriver /usr/local/bin | ||
|
||
install: | ||
- pip install -r requirements.txt | ||
|
||
before_script: | ||
- psql -c "create role vmsadmin with createrole createdb login password '0xdeadbeef';" -U postgres | ||
- psql -c "CREATE DATABASE vms;" -U postgres | ||
- "export DISPLAY=:99.0" | ||
- "sh -e /etc/init.d/xvfb start" | ||
- sleep 3 | ||
- export DJANGO_SECRET_KEY=foobarbaz | ||
|
||
script: | ||
- cd vms | ||
- python manage.py syncdb --noinput | ||
- python manage.py migrate --noinput --traceback --settings=vms.settings | ||
- coverage run --source='.' manage.py test | ||
- coverage run --source='.' manage.py test -v 2 | ||
- coverage report -m | ||
|
||
after_success: | ||
coveralls --rcfile=.coveragerc |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
# Third Party Imports | ||
from selenium import webdriver | ||
|
||
# Django imports | ||
from django.contrib.staticfiles.testing import LiveServerTestCase | ||
|
||
# Local Project Imports | ||
from selenium.webdriver.common.keys import Keys | ||
|
||
|
||
class DummyTesting(LiveServerTestCase): | ||
""" | ||
Dummy Test Class to check the selenium is working correctly. | ||
Delete this file after uncommenting the selenium tests | ||
currently present. | ||
""" | ||
|
||
@classmethod | ||
def setUpClass(cls): | ||
cls.driver = webdriver.Firefox() | ||
cls.driver.implicitly_wait(5) | ||
cls.driver.maximize_window() | ||
super(DummyTesting, cls).setUpClass() | ||
|
||
@classmethod | ||
def tearDownClass(cls): | ||
cls.driver.quit() | ||
super(DummyTesting, cls).tearDownClass() | ||
|
||
def test_working(self): | ||
""" | ||
Dummy Test function to check working of selenium | ||
Delete this function after the first test for this | ||
Class is added. | ||
""" | ||
self.driver.get("http://www.python.org") | ||
self.assertIn('Python', self.driver.title) | ||
element = self.driver.find_element_by_name('q') | ||
element.clear() | ||
element.send_keys('pycon') | ||
element.send_keys(Keys.RETURN) | ||
self.assertNotIn('No results found.', self.driver.page_source) | ||
|