Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 11 additions & 2 deletions common/test/acceptance/pages/lms/problem.py
Original file line number Diff line number Diff line change
Expand Up @@ -71,11 +71,20 @@ def mathjax_present():
description="MathJax rendered in hint"
)

def fill_answer(self, text):
def fill_answer(self, text, input_num=None):
"""
Fill in the answer to the problem.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you update the docstring with a description of input_num?


args:
text: String to fill the input with.

kwargs:
input_num: If provided, fills only the input_numth field. Else, all
input fields will be filled.
"""
self.q(css='div.problem div.capa_inputtype.textline input').fill(text)
fields = self.q(css='div.problem div.capa_inputtype.textline input')
fields = fields.nth(input_num) if input_num is not None else fields
fields.fill(text)

def fill_answer_numerical(self, text):
"""
Expand Down
15 changes: 8 additions & 7 deletions common/test/acceptance/tests/lms/test_lms_problems.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,14 @@ class ProblemsTest(UniqueCourseTest):
"""
Base class for tests of problems in the LMS.
"""
USERNAME = "joe_student"
EMAIL = "joe@example.com"
PASSWORD = "keep it secret; keep it safe."

def setUp(self):
super(ProblemsTest, self).setUp()

self.username = "test_student_{uuid}".format(uuid=self.unique_id[0:8])

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@benpatterson I've updated this so that the user checked for in the events validation part of the tests is unique.

self.email = "{username}@example.com".format(username=self.username)
self.password = "keep it secret; keep it safe."

self.xqueue_grade_response = None

self.courseware_page = CoursewarePage(self.browser, self.course_id)
Expand All @@ -46,9 +47,9 @@ def setUp(self):
# Auto-auth register for the course.
AutoAuthPage(
self.browser,
username=self.USERNAME,
email=self.EMAIL,
password=self.PASSWORD,
username=self.username,
email=self.email,
password=self.password,
course_id=self.course_id,
staff=False
).visit()
Expand Down Expand Up @@ -382,7 +383,7 @@ def test_logout_after_click_redirect(self):
login_page = CombinedLoginAndRegisterPage(self.browser)
login_page.wait_for_page()

login_page.login(self.EMAIL, self.PASSWORD)
login_page.login(self.email, self.password)

problem_page.wait_for_page()
self.assertEqual(problem_page.problem_name, 'TEST PROBLEM')
Expand Down
Loading