Commit a9b308e5 by Christine Lytwynec

Convert some problem type tests to bok choy and add a11y test

parent 44eaca08
...@@ -71,11 +71,20 @@ class ProblemPage(PageObject): ...@@ -71,11 +71,20 @@ class ProblemPage(PageObject):
description="MathJax rendered in hint" 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. Fill in the answer to the problem.
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): def fill_answer_numerical(self, text):
""" """
......
...@@ -19,13 +19,14 @@ class ProblemsTest(UniqueCourseTest): ...@@ -19,13 +19,14 @@ class ProblemsTest(UniqueCourseTest):
""" """
Base class for tests of problems in the LMS. 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): def setUp(self):
super(ProblemsTest, self).setUp() super(ProblemsTest, self).setUp()
self.username = "test_student_{uuid}".format(uuid=self.unique_id[0:8])
self.email = "{username}@example.com".format(username=self.username)
self.password = "keep it secret; keep it safe."
self.xqueue_grade_response = None self.xqueue_grade_response = None
self.courseware_page = CoursewarePage(self.browser, self.course_id) self.courseware_page = CoursewarePage(self.browser, self.course_id)
...@@ -46,9 +47,9 @@ class ProblemsTest(UniqueCourseTest): ...@@ -46,9 +47,9 @@ class ProblemsTest(UniqueCourseTest):
# Auto-auth register for the course. # Auto-auth register for the course.
AutoAuthPage( AutoAuthPage(
self.browser, self.browser,
username=self.USERNAME, username=self.username,
email=self.EMAIL, email=self.email,
password=self.PASSWORD, password=self.password,
course_id=self.course_id, course_id=self.course_id,
staff=False staff=False
).visit() ).visit()
...@@ -382,7 +383,7 @@ class LogoutDuringAnswering(ProblemsTest): ...@@ -382,7 +383,7 @@ class LogoutDuringAnswering(ProblemsTest):
login_page = CombinedLoginAndRegisterPage(self.browser) login_page = CombinedLoginAndRegisterPage(self.browser)
login_page.wait_for_page() login_page.wait_for_page()
login_page.login(self.EMAIL, self.PASSWORD) login_page.login(self.email, self.password)
problem_page.wait_for_page() problem_page.wait_for_page()
self.assertEqual(problem_page.problem_name, 'TEST PROBLEM') self.assertEqual(problem_page.problem_name, 'TEST PROBLEM')
......
...@@ -4,73 +4,6 @@ Feature: LMS.Answer problems ...@@ -4,73 +4,6 @@ Feature: LMS.Answer problems
In order to test my understanding of the material In order to test my understanding of the material
I want to answer problems I want to answer problems
Scenario: I can answer a problem correctly
Given External graders respond "correct"
And I am viewing a "<ProblemType>" problem
When I answer a "<ProblemType>" problem "correctly"
Then my "<ProblemType>" answer is marked "correct"
And The "<ProblemType>" problem displays a "correct" answer
And a "problem_check" server event is emitted
And a "problem_check" browser event is emitted
Examples:
| ProblemType |
| drop down |
| multiple choice |
| checkbox |
| radio |
#| string |
| numerical |
| formula |
| script |
| code |
| radio_text |
| checkbox_text |
| image |
Scenario: I can answer a problem incorrectly
Given External graders respond "incorrect"
And I am viewing a "<ProblemType>" problem
When I answer a "<ProblemType>" problem "incorrectly"
Then my "<ProblemType>" answer is marked "incorrect"
And The "<ProblemType>" problem displays a "incorrect" answer
Examples:
| ProblemType |
| drop down |
| multiple choice |
| checkbox |
| radio |
#| string |
| numerical |
| formula |
| script |
| code |
| radio_text |
| checkbox_text |
| image |
Scenario: I can submit a blank answer
Given I am viewing a "<ProblemType>" problem
When I check a problem
Then my "<ProblemType>" answer is marked "incorrect"
And The "<ProblemType>" problem displays a "blank" answer
Examples:
| ProblemType |
| drop down |
| multiple choice |
| checkbox |
| radio |
#| string |
| numerical |
| formula |
| script |
| radio_text |
| checkbox_text |
| image |
Scenario: I can reset a problem Scenario: I can reset a problem
Given I am viewing a randomization "<Randomization>" "<ProblemType>" problem with reset button on Given I am viewing a randomization "<Randomization>" "<ProblemType>" problem with reset button on
And I answer a "<ProblemType>" problem "<Correctness>ly" And I answer a "<ProblemType>" problem "<Correctness>ly"
......
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