Commit 05537540 by Julia Hansbrough

Fix acceptance tests

Fixed bok-choy acceptance tests
parent b61649f9
......@@ -29,7 +29,8 @@ class UserPreferenceModelTest(TestCase):
)
def test_get_set_preference(self):
# tests for the getters and setters of preferences
# Checks that you can set a preference and get that preference later
# Also, tests that no preference is returned for keys that are not set
user = UserFactory.create()
key = 'testkey'
......
......@@ -19,6 +19,14 @@ class DashboardPage(PageObject):
return self.is_css_present('section.my-courses')
@property
def current_courses_text(self):
text_items = self.css_text('section#my-courses')
if len(text_items) > 0:
return text_items[0]
else:
return ""
@property
def available_courses(self):
"""
Return list of the names of available courses (e.g. "999 edX Demonstration Course")
......
......@@ -6,7 +6,7 @@ E2E tests for the LMS.
from unittest import skip
from bok_choy.web_app_test import WebAppTest
from bok_choy.promise import EmptyPromise, fulfill_before
from bok_choy.promise import EmptyPromise, fulfill_before, fulfill, Promise
from .helpers import UniqueCourseTest, load_data_str
from ..pages.studio.auto_auth import AutoAuthPage
......@@ -74,6 +74,15 @@ class LanguageTest(UniqueCourseTest):
"""
Tests that the change language functionality on the dashboard works
"""
@property
def _changed_lang_promise(self):
def _check_func():
text = self.dashboard_page.current_courses_text
return (len(text) > 0, text)
return Promise(_check_func, "language changed")
def setUp(self):
"""
......@@ -84,6 +93,8 @@ class LanguageTest(UniqueCourseTest):
self.test_new_lang = 'eo'
# This string is unicode for "ÇÜRRÉNT ÇØÜRSÉS", which should appear in our Dummy Esperanto page
# We store the string this way because Selenium seems to try and read in strings from
# the HTML in this format. Ideally we could just store the raw ÇÜRRÉNT ÇØÜRSÉS string here
self.current_courses_text = u'\xc7\xdcRR\xc9NT \xc7\xd6\xdcRS\xc9S'
self.username = "test"
......@@ -113,9 +124,10 @@ class LanguageTest(UniqueCourseTest):
auto_auth_page.visit()
self.dashboard_page.visit()
changed_text = fulfill(self._changed_lang_promise)
# We should see the dummy-language text on the page
self.browser.is_text_present(self.current_courses_text)
self.assertTrue(self.browser.is_text_present(self.current_courses_text))
self.assertIn(self.current_courses_text, changed_text)
class HighLevelTabTest(UniqueCourseTest):
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment