Skip to content

Commit

Permalink
Technical Debt #2257 Настроить Travis CI.
Browse files Browse the repository at this point in the history
Необходимо настроить Travis CI на работу с селениум-тестами.
  • Loading branch information
vintorez committed Oct 23, 2014
1 parent 9a80034 commit 9086436
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 13 deletions.
9 changes: 7 additions & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
language: python
python:
- "2.7"
install: "pip install -r exmo/requirements.txt"
script: cd exmo && ./manage.py test
before_install:
- "export DISPLAY=:99.0"
- "sh -e /etc/init.d/xvfb start"
install:
- "pip install -r exmo/requirements.txt"
script:
- "cd exmo && ./manage.py test"
8 changes: 4 additions & 4 deletions exmo/core/test_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ def setUpClass(cls):
if not getattr(cls, '__unittest_skip__', False):
webdriver_type = getattr(settings, 'SELENIUM_WEBDRIVER', 'FALLBACK')
if webdriver_type == 'FALLBACK':
for webdriver_type in 'PhantomJS Firefox Chrome Opera'.split():
for webdriver_type in 'Firefox PhantomJS Chrome Opera'.split():
try:
cls.webdrv = getattr(webdriver, webdriver_type)()
except Exception:
Expand Down Expand Up @@ -90,9 +90,9 @@ def findall(self, selector):

def _assertWebElementMethod(self, selector, method, expected_result, wait_timeout=TIMEOUT):
def condition(*args):
element = self.find(selector)
if element:
return method(element) == expected_result
elements = self.findall(selector)
if elements:
return all(item == expected_result for item in map(method, elements))
WebDriverWait(self.webdrv, wait_timeout).until(condition)

def assertVisible(self, selector, wait_timeout=TIMEOUT):
Expand Down
7 changes: 6 additions & 1 deletion exmo/exmo/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,11 @@
'django.contrib.auth.hashers.MD5PasswordHasher',
)

import logging
logging.getLogger('south').setLevel(logging.WARNING)
logging.getLogger('configuration').setLevel(logging.WARNING)
logging.getLogger('selenium.webdriver.remote.remote_connection').setLevel(logging.WARNING)

TEST_RUNNER = 'django_nose.NoseTestSuiteRunner'

# A secret key for this particular Django installation. Used in secret-key hashing algorithms.
Expand All @@ -108,7 +113,7 @@
USE_I18N = True

# MODELTRANSLATION_FALLBACK_LANGUAGES will be used as fallback language if some model does not
# have transalted field to other language.
# have translated field to other language.
MODELTRANSLATION_FALLBACK_LANGUAGES = ('en', 'ru', 'ka', 'az')

USE_ETAGS = True
Expand Down
12 changes: 6 additions & 6 deletions exmo/monitorings/test_selenium.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
from django.contrib.auth.models import Group, User
from django.contrib.auth.models import User
from django.core.urlresolvers import reverse
from model_mommy import mommy
from nose.plugins.attrib import attr
Expand All @@ -29,17 +29,17 @@

@attr('selenium')
class OpennessInitialColumnTestCase(BaseSeleniumTestCase):
# Scenario: Check if initial openness column is display
# Check if initial openness column is display
modal_window = '.modal-open'
init_openness = '.init-openness'

def setUp(self):
# GIVEN expert B account
expertB = User.objects.create_user('expertB', 'expertB@svobodainfo.org', 'password')
expertB = User.objects.create_user('expertB', 'usr@svobodainfo.org', 'password')
expertB.profile.is_expertB = True
# AND published monitoring
self.monitoring = mommy.make(Monitoring, status=MONITORING_PUBLISHED)
# AND organzation at this monitoring
# AND organization at this monitoring
self.organization = mommy.make(Organization, monitoring=self.monitoring)
# AND task for expert B
self.task = mommy.make(
Expand Down Expand Up @@ -75,12 +75,12 @@ def test_users(self):
self.find(self.modal_window).click()
# THEN checkboxes should become visible
self.assertVisible('#id_rt_initial_openness')
# WHEN i click initial openness checkbox
# WHEN I click initial openness checkbox
self.find('#id_rt_initial_openness').click()
# AND submit my changes
self.find('#modal_window input[type="submit"]').click()
# THEN initial openness column should be displayed
self.assertEqual(self.find(self.init_openness).is_displayed(), True)
self.assertVisible(self.init_openness)


@attr('selenium')
Expand Down

0 comments on commit 9086436

Please sign in to comment.