Merge pull request #10413 from edx/register-dropdown

Add custom fields to registration menu.
This commit is contained in:
Kelketek
2016-01-05 13:44:11 -06:00
11 changed files with 295 additions and 24 deletions

View File

@@ -168,7 +168,10 @@ class CombinedLoginAndRegisterPage(PageObject):
"Finish toggling to the other form"
).fulfill()
def register(self, email="", password="", username="", full_name="", country="", terms_of_service=False):
def register(
self, email="", password="", username="", full_name="", country="", favorite_movie="",
terms_of_service=False
):
"""Fills in and submits the registration form.
Requires that the "register" form is visible.
@@ -197,6 +200,8 @@ class CombinedLoginAndRegisterPage(PageObject):
self.q(css="#register-password").fill(password)
if country:
self.q(css="#register-country option[value='{country}']".format(country=country)).click()
if favorite_movie:
self.q(css="#register-favorite_movie").fill(favorite_movie)
if terms_of_service:
self.q(css="#register-honor_code").click()

View File

@@ -262,6 +262,7 @@ class RegisterFromCombinedPageTest(UniqueCourseTest):
username=username,
full_name="Test User",
country="US",
favorite_movie="Mad Max: Fury Road",
terms_of_service=True
)
@@ -276,6 +277,7 @@ class RegisterFromCombinedPageTest(UniqueCourseTest):
# Enter a blank for the username field, which is required
# Don't agree to the terms of service / honor code.
# Don't specify a country code, which is required.
# Don't specify a favorite movie.
username = "test_{uuid}".format(uuid=self.unique_id[0:6])
email = "{user}@example.com".format(user=username)
self.register_page.register(
@@ -291,6 +293,7 @@ class RegisterFromCombinedPageTest(UniqueCourseTest):
self.assertIn(u'Please enter your Public username.', errors)
self.assertIn(u'You must agree to the edX Terms of Service and Honor Code.', errors)
self.assertIn(u'Please select your Country.', errors)
self.assertIn(u'Please tell us your favorite movie.', errors)
def test_toggle_to_login_form(self):
self.register_page.visit().toggle_form()
@@ -317,7 +320,7 @@ class RegisterFromCombinedPageTest(UniqueCourseTest):
self.assertIn("Galactica1", self.register_page.username_value)
# Set country, accept the terms, and submit the form:
self.register_page.register(country="US", terms_of_service=True)
self.register_page.register(country="US", favorite_movie="Battlestar Galactica", terms_of_service=True)
# Expect that we reach the dashboard and we're auto-enrolled in the course
course_names = self.dashboard_page.wait_for_page().available_courses