Commit aeae3534 by polesye

Merge pull request #1294 from edx/anton/fix-multiple-lti-per-page

LTI: Add possibility to use multiple LTI tools per page.
parents 8e9c48c2 a0417c6b
...@@ -5,6 +5,8 @@ These are notable changes in edx-platform. This is a rolling list of changes, ...@@ -5,6 +5,8 @@ These are notable changes in edx-platform. This is a rolling list of changes,
in roughly chronological order, most recent first. Add your entries at or near in roughly chronological order, most recent first. Add your entries at or near
the top. Include a label indicating the component affected. the top. Include a label indicating the component affected.
Blades: Add possibility to use multiple LTI tools per page.
LMS: Disable data download buttons on the instructor dashboard for large courses LMS: Disable data download buttons on the instructor dashboard for large courses
LMS: Ported bulk emailing to the beta instructor dashboard. LMS: Ported bulk emailing to the beta instructor dashboard.
......
...@@ -92,10 +92,10 @@ class LTIModule(LTIFields, XModule): ...@@ -92,10 +92,10 @@ class LTIModule(LTIFields, XModule):
<form <form
action="${launch_url}" action="${launch_url}"
name="ltiLaunchForm" name="ltiLaunchForm-${element_id}"
class="ltiLaunchForm" class="ltiLaunchForm"
method="post" method="post"
target="ltiLaunchFrame" target="ltiLaunchFrame-${element_id}"
encType="application/x-www-form-urlencoded" encType="application/x-www-form-urlencoded"
> >
<input name="launch_presentation_return_url" value="" /> <input name="launch_presentation_return_url" value="" />
......
...@@ -19,8 +19,11 @@ def lti_is_not_rendered(_step): ...@@ -19,8 +19,11 @@ def lti_is_not_rendered(_step):
# iframe is not visible # iframe is not visible
assert not world.css_visible('iframe') assert not world.css_visible('iframe')
location = world.scenario_dict['LTI'].location.html_id()
iframe_name = 'ltiLaunchFrame-' + location
#inside iframe test content is not presented #inside iframe test content is not presented
with world.browser.get_iframe('ltiLaunchFrame') as iframe: with world.browser.get_iframe(iframe_name) as iframe:
# iframe does not contain functions from terrain/ui_helpers.py # iframe does not contain functions from terrain/ui_helpers.py
world.browser.driver.implicitly_wait(1) world.browser.driver.implicitly_wait(1)
try: try:
...@@ -31,6 +34,19 @@ def lti_is_not_rendered(_step): ...@@ -31,6 +34,19 @@ def lti_is_not_rendered(_step):
world.browser.driver.implicitly_wait(world.IMPLICIT_WAIT) world.browser.driver.implicitly_wait(world.IMPLICIT_WAIT)
def check_lti_ifarme_content(text):
#inside iframe test content is presented
location = world.scenario_dict['LTI'].location.html_id()
iframe_name = 'ltiLaunchFrame-' + location
with world.browser.get_iframe(iframe_name) as iframe:
# iframe does not contain functions from terrain/ui_helpers.py
assert iframe.is_element_present_by_css('.result', wait_time=5)
assert (text == world.retry_on_exception(
lambda: iframe.find_by_css('.result')[0].text,
max_attempts=5
))
@step('I view the LTI and it is rendered$') @step('I view the LTI and it is rendered$')
def lti_is_rendered(_step): def lti_is_rendered(_step):
# lti div has class rendered # lti div has class rendered
...@@ -41,15 +57,7 @@ def lti_is_rendered(_step): ...@@ -41,15 +57,7 @@ def lti_is_rendered(_step):
# iframe is visible # iframe is visible
assert world.css_visible('iframe') assert world.css_visible('iframe')
check_lti_ifarme_content("This is LTI tool. Success.")
#inside iframe test content is presented
with world.browser.get_iframe('ltiLaunchFrame') as iframe:
# iframe does not contain functions from terrain/ui_helpers.py
assert iframe.is_element_present_by_css('.result', wait_time=5)
assert ("This is LTI tool. Success." == world.retry_on_exception(
lambda: iframe.find_by_css('.result')[0].text,
max_attempts=5
))
@step('I view the LTI but incorrect_signature warning is rendered$') @step('I view the LTI but incorrect_signature warning is rendered$')
...@@ -62,15 +70,7 @@ def incorrect_lti_is_rendered(_step): ...@@ -62,15 +70,7 @@ def incorrect_lti_is_rendered(_step):
# iframe is visible # iframe is visible
assert world.css_visible('iframe') assert world.css_visible('iframe')
check_lti_ifarme_content("Wrong LTI signature")
#inside iframe test content is presented
with world.browser.get_iframe('ltiLaunchFrame') as iframe:
# iframe does not contain functions from terrain/ui_helpers.py
assert iframe.is_element_present_by_css('.result', wait_time=5)
assert ("Wrong LTI signature" == world.retry_on_exception(
lambda: iframe.find_by_css('.result')[0].text,
max_attempts=5
))
@step('the course has correct LTI credentials$') @step('the course has correct LTI credentials$')
...@@ -100,7 +100,7 @@ def set_incorrect_lti_passport(_step): ...@@ -100,7 +100,7 @@ def set_incorrect_lti_passport(_step):
@step('the course has an LTI component filled with correct fields$') @step('the course has an LTI component filled with correct fields$')
def add_correct_lti_to_course(_step): def add_correct_lti_to_course(_step):
category = 'lti' category = 'lti'
world.ItemFactory.create( world.scenario_dict['LTI'] = world.ItemFactory.create(
# parent_location=section_location(course), # parent_location=section_location(course),
parent_location=world.scenario_dict['SEQUENTIAL'].location, parent_location=world.scenario_dict['SEQUENTIAL'].location,
category=category, category=category,
...@@ -128,7 +128,7 @@ def add_correct_lti_to_course(_step): ...@@ -128,7 +128,7 @@ def add_correct_lti_to_course(_step):
@step('the course has an LTI component with incorrect fields$') @step('the course has an LTI component with incorrect fields$')
def add_incorrect_lti_to_course(_step): def add_incorrect_lti_to_course(_step):
category = 'lti' category = 'lti'
world.ItemFactory.create( world.scenario_dict['LTI'] = world.ItemFactory.create(
parent_location=world.scenario_dict['SEQUENTIAL'].location, parent_location=world.scenario_dict['SEQUENTIAL'].location,
category=category, category=category,
display_name='LTI', display_name='LTI',
......
...@@ -5,10 +5,10 @@ ...@@ -5,10 +5,10 @@
## result will be rendered to the below iFrame. ## result will be rendered to the below iFrame.
<form <form
action="${launch_url}" action="${launch_url}"
name="ltiLaunchForm" name="ltiLaunchForm-${element_id}"
class="ltiLaunchForm" class="ltiLaunchForm"
method="post" method="post"
target="ltiLaunchFrame" target="ltiLaunchFrame-${element_id}"
encType="application/x-www-form-urlencoded" encType="application/x-www-form-urlencoded"
> >
...@@ -26,7 +26,7 @@ ...@@ -26,7 +26,7 @@
## The result of the form submit will be rendered here. ## The result of the form submit will be rendered here.
<iframe <iframe
name="ltiLaunchFrame" name="ltiLaunchFrame-${element_id}"
class="ltiLaunchFrame" class="ltiLaunchFrame"
src="" src=""
></iframe> ></iframe>
......
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