Added a check for the phantomjs binary to the skip-selenium tests in ietf/meeting/tests_js.py, in order to be able to add selenium to requirements.txt. This will make the selenium tests run if phantomjs is available on the system, without manually having to install the selenium module. This should make the buildbot run the selenium tests, too.
- Legacy-Id: 11456
This commit is contained in:
commit
d01d3c2912
|
@ -11,6 +11,7 @@ from ietf.group import colors
|
||||||
from ietf.meeting.test_data import make_meeting_test_data
|
from ietf.meeting.test_data import make_meeting_test_data
|
||||||
from ietf.meeting.models import SchedTimeSessAssignment
|
from ietf.meeting.models import SchedTimeSessAssignment
|
||||||
from ietf.utils.test_utils import set_coverage_checking
|
from ietf.utils.test_utils import set_coverage_checking
|
||||||
|
from ietf.utils.pipe import pipe
|
||||||
from ietf import settings
|
from ietf import settings
|
||||||
|
|
||||||
skip_selenium = getattr(settings,'SKIP_SELENIUM',None)
|
skip_selenium = getattr(settings,'SKIP_SELENIUM',None)
|
||||||
|
@ -23,7 +24,13 @@ else:
|
||||||
from selenium.webdriver.common.action_chains import ActionChains
|
from selenium.webdriver.common.action_chains import ActionChains
|
||||||
except ImportError as e:
|
except ImportError as e:
|
||||||
skip_selenium = True
|
skip_selenium = True
|
||||||
skip_message = str(e)
|
skip_message = " Skipping selenium tests: %s" % e
|
||||||
|
code, out, err = pipe('phantomjs -v')
|
||||||
|
if not code == 0:
|
||||||
|
skip_selenium = True
|
||||||
|
skip_message = " Skipping selenium tests: 'phantomjs' executable not found."
|
||||||
|
if skip_selenium:
|
||||||
|
sys.stderr.write(skip_message+'\n')
|
||||||
|
|
||||||
def condition_data():
|
def condition_data():
|
||||||
make_meeting_test_data()
|
make_meeting_test_data()
|
||||||
|
@ -40,6 +47,7 @@ class ScheduleEditTests(StaticLiveServerTestCase):
|
||||||
self.driver.set_window_size(1024,768)
|
self.driver.set_window_size(1024,768)
|
||||||
|
|
||||||
def tearDown(self):
|
def tearDown(self):
|
||||||
|
self.driver.close()
|
||||||
set_coverage_checking(True)
|
set_coverage_checking(True)
|
||||||
|
|
||||||
def debugSnapshot(self,filename='debug_this.png'):
|
def debugSnapshot(self,filename='debug_this.png'):
|
||||||
|
@ -77,29 +85,6 @@ class ScheduleEditTests(StaticLiveServerTestCase):
|
||||||
time.sleep(0.1) # The API that modifies the database runs async
|
time.sleep(0.1) # The API that modifies the database runs async
|
||||||
self.assertEqual(SchedTimeSessAssignment.objects.filter(session__meeting__number=42,session__group__acronym='mars').count(),0)
|
self.assertEqual(SchedTimeSessAssignment.objects.filter(session__meeting__number=42,session__group__acronym='mars').count(),0)
|
||||||
|
|
||||||
@skipIf(skip_selenium, skip_message)
|
|
||||||
class InterimRequestTests(StaticLiveServerTestCase):
|
|
||||||
def setUp(self):
|
|
||||||
set_coverage_checking(False)
|
|
||||||
condition_data()
|
|
||||||
self.driver = webdriver.PhantomJS(service_log_path=settings.TEST_GHOSTDRIVER_LOG_PATH)
|
|
||||||
self.driver.set_window_size(1024,768)
|
|
||||||
|
|
||||||
def tearDown(self):
|
|
||||||
set_coverage_checking(True)
|
|
||||||
|
|
||||||
def absreverse(self,*args,**kwargs):
|
|
||||||
return '%s%s'%(self.live_server_url,urlreverse(*args,**kwargs))
|
|
||||||
|
|
||||||
def testInterimRequest(self):
|
|
||||||
url = self.absreverse('ietf.meeting.views.interim_request')
|
|
||||||
self.driver.get(url)
|
|
||||||
element = self.driver.find_element_by_id('id_form-0-date')
|
|
||||||
self.assertTrue(element)
|
|
||||||
|
|
||||||
def testJustSitThere(self):
|
|
||||||
time.sleep(10000)
|
|
||||||
|
|
||||||
# The following are useful debugging tools
|
# The following are useful debugging tools
|
||||||
|
|
||||||
# If you add this to a LiveServerTestCase and run just this test, you can browse
|
# If you add this to a LiveServerTestCase and run just this test, you can browse
|
||||||
|
|
|
@ -29,6 +29,7 @@ python-dateutil>=2.2
|
||||||
python-magic>=0.4.6
|
python-magic>=0.4.6
|
||||||
python-memcached>=1.48 # for django.core.cache.backends.memcached
|
python-memcached>=1.48 # for django.core.cache.backends.memcached
|
||||||
pytz>=2014.7
|
pytz>=2014.7
|
||||||
|
selenium>=2.42
|
||||||
six>=1.8.0
|
six>=1.8.0
|
||||||
tqdm>=3.5.0
|
tqdm>=3.5.0
|
||||||
Unidecode>=0.4.18
|
Unidecode>=0.4.18
|
||||||
|
|
Loading…
Reference in a new issue