Commit 5b7f48c5 by sanfordstudent Committed by GitHub

Merge pull request #13495 from edx/beryl/test-explicit-graded

tests for changing grade policy
and moving progress page tests into separate file
parents 4f28b81f a98e33af
......@@ -162,7 +162,7 @@ class ProblemPage(PageObject):
"""
Click the choice input(radio, checkbox or option) where value matches `choice_value` in choice group.
"""
self.q(css='div.problem .choicegroup input[value="' + choice_value + '"]').click()
self.q(css='div.problem .choicegroup input[value="' + choice_value + '"]').first.click()
self.wait_for_ajax()
def is_correct(self):
......
......@@ -67,6 +67,13 @@ class ProgressPage(CoursePage):
# Retrieve the scores for the section
return self._section_scores(chapter_index, section_index)
def text_on_page(self, text):
"""
Return whether the given text appears
on the page.
"""
return text in self.q(css=".view-in-course").html[0]
def _chapter_index(self, title):
"""
Return the CSS index of the chapter with `title`.
......
......@@ -17,6 +17,9 @@ from bok_choy.javascript import js_defined
from bok_choy.web_app_test import WebAppTest
from bok_choy.promise import EmptyPromise, Promise
from bok_choy.page_object import XSS_INJECTION
from capa.tests.response_xml_factory import MultipleChoiceResponseXMLFactory
from common.test.acceptance.pages.studio.auto_auth import AutoAuthPage
from common.test.acceptance.fixtures.course import XBlockFixtureDesc
from opaque_keys.edx.locator import CourseLocator
from pymongo import MongoClient, ASCENDING
from openedx.core.lib.tests.assertions.events import assert_event_matches, is_matching_event, EventMatchTolerates
......@@ -350,6 +353,32 @@ def is_404_page(browser):
return 'Page not found (404)' in browser.find_element_by_tag_name('h1').text
def create_multiple_choice_problem(problem_name):
"""
Return the Multiple Choice Problem Descriptor, given the name of the problem.
"""
factory = MultipleChoiceResponseXMLFactory()
xml_data = factory.build_xml(
question_text='The correct answer is Choice 2',
choices=[False, False, True, False],
choice_names=['choice_0', 'choice_1', 'choice_2', 'choice_3']
)
return XBlockFixtureDesc(
'problem',
problem_name,
data=xml_data,
metadata={'rerandomize': 'always'}
)
def auto_auth(browser, username, email, staff, course_id):
"""
Logout and login with given credentials.
"""
AutoAuthPage(browser, username=username, email=email, course_id=course_id, staff=staff).visit()
class EventsTestMixin(TestCase):
"""
Helpers and setup for running tests that evaluate events emitted
......
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