Self hosted FLOSS fitness/workout, nutrition and weight tracker
Add a general testcase for use with selenium webdrive
Roland Geider4684ef242eea
diff --git a/manager/tests/testcase.py b/manager/tests/testcase.pyindex 6ad778326..6221081db 100644--- a/manager/tests/testcase.py+++ b/manager/tests/testcase.py@@ -12,7 +12,13 @@## You should have received a copy of the GNU Affero General Public License+from django.core.urlresolvers import reverse+from django.test import TestCase+from django.test import LiveServerTestCase++from selenium import webdriver+from selenium.webdriver.common.keys import Keysclass WorkoutManagerTestCase(TestCase):fixtures = ['tests-user-data', 'test-exercises', ]@@ -26,3 +32,50 @@ class WorkoutManagerTestCase(TestCase):"""Visit the logout page"""self.client.logout()+++class WorkoutManagerLiveServerTestCase(LiveServerTestCase):+ """+ Live server test case, will be used with the selenium webdriver+ """++ fixtures = ['tests-user-data', 'test-exercises', ]+++ def setUp(self):+ """+ Set up out testing browser+ """++ self.browser = webdriver.Firefox()+ self.browser.implicitly_wait(3)+++ def tearDown(self):+ """+ Quit the browser+ """++ self.browser.quit()+++ def user_login(self, user='admin'):+ """+ Login the user+ """++ self.browser.get(self.live_server_url + reverse('manager.views.login'))+ username_field = self.browser.find_element_by_id('id_username')+ username_field.send_keys('admin')++ password_field = self.browser.find_element_by_id('id_password')+ password_field.send_keys('%(user)s%(user)s' % {'user': user})+ password_field.send_keys(Keys.RETURN)++ def user_logout(self, user='admin'):+ """+ Logout the user+ """++ self.browser.get(self.live_server_url + reverse('manager.views.logout'))+\ No newline at end of file