Merge pull request #5072 from edx/ammar/tooltip-test
Tooltip Acceptance Test
This commit is contained in:
@@ -3,6 +3,7 @@ Courseware page.
|
||||
"""
|
||||
|
||||
from .course_page import CoursePage
|
||||
from selenium.webdriver.common.action_chains import ActionChains
|
||||
|
||||
|
||||
class CoursewarePage(CoursePage):
|
||||
@@ -61,3 +62,14 @@ class CoursewarePage(CoursePage):
|
||||
|
||||
"""
|
||||
return self.q(css=self.xblock_component_selector).attrs('innerHTML')[index].strip()
|
||||
|
||||
def tooltips_displayed(self):
|
||||
"""
|
||||
Verify if sequence navigation bar tooltips are being displayed upon mouse hover.
|
||||
"""
|
||||
for index, tab in enumerate(self.q(css='#sequence-list > li')):
|
||||
ActionChains(self.browser).move_to_element(tab).perform()
|
||||
if not self.q(css='#tab_{index} > p'.format(index=index)).visible:
|
||||
return False
|
||||
|
||||
return True
|
||||
|
||||
@@ -503,3 +503,47 @@ class VisibleToStaffOnlyTest(UniqueCourseTest):
|
||||
|
||||
self.course_nav.go_to_section("Test Section", "Unlocked Subsection")
|
||||
self.assertEqual(["Html Child in visible unit"], self.course_nav.sequence_items)
|
||||
|
||||
|
||||
class TooltipTest(UniqueCourseTest):
|
||||
"""
|
||||
Tests that tooltips are displayed
|
||||
"""
|
||||
|
||||
def setUp(self):
|
||||
"""
|
||||
Initialize pages and install a course fixture.
|
||||
"""
|
||||
super(TooltipTest, self).setUp()
|
||||
|
||||
self.course_info_page = CourseInfoPage(self.browser, self.course_id)
|
||||
self.tab_nav = TabNavPage(self.browser)
|
||||
|
||||
course_fix = CourseFixture(
|
||||
self.course_info['org'], self.course_info['number'],
|
||||
self.course_info['run'], self.course_info['display_name']
|
||||
)
|
||||
|
||||
course_fix.add_children(
|
||||
XBlockFixtureDesc('static_tab', 'Test Static Tab'),
|
||||
XBlockFixtureDesc('chapter', 'Test Section').add_children(
|
||||
XBlockFixtureDesc('sequential', 'Test Subsection').add_children(
|
||||
XBlockFixtureDesc('problem', 'Test Problem 1', data=load_data_str('multiple_choice.xml')),
|
||||
XBlockFixtureDesc('problem', 'Test Problem 2', data=load_data_str('formula_problem.xml')),
|
||||
XBlockFixtureDesc('html', 'Test HTML'),
|
||||
)
|
||||
)
|
||||
).install()
|
||||
|
||||
self.courseware_page = CoursewarePage(self.browser, self.course_id)
|
||||
# Auto-auth register for the course
|
||||
AutoAuthPage(self.browser, course_id=self.course_id).visit()
|
||||
|
||||
def test_tooltip(self):
|
||||
"""
|
||||
Verify that tooltips are displayed when you hover over the sequence nav bar.
|
||||
"""
|
||||
self.course_info_page.visit()
|
||||
self.tab_nav.go_to_tab('Courseware')
|
||||
|
||||
self.assertTrue(self.courseware_page.tooltips_displayed())
|
||||
|
||||
Reference in New Issue
Block a user