Merge pull request #17652 from edx/feanil/remove_flaky_lti_tests

Feanil/remove flaky lti tests
This commit is contained in:
Feanil Patel
2018-03-08 13:17:43 -05:00
committed by GitHub
2 changed files with 9 additions and 133 deletions

View File

@@ -26,12 +26,6 @@ Feature: LMS.LTI component
| False |
Then I view the LTI but incorrect_signature warning is rendered
#4
Scenario: LTI component in LMS is correctly rendered in new page
Given the course has correct LTI credentials with registered Instructor
And the course has an LTI component with correct fields
Then I view the LTI and it is rendered in new page
#5
Scenario: LTI component in LMS is correctly rendered in iframe
Given the course has correct LTI credentials with registered Instructor
@@ -154,57 +148,3 @@ Feature: LMS.LTI component
| description |
| Application description |
Then I see LTI component description with text "Application description"
#15
Scenario: LTI component requests permission for username and is rejected
Given the course has correct LTI credentials with registered Instructor
And the course has an LTI component with correct fields:
| ask_to_send_username |
| True |
Then I view the permission alert
Then I reject the permission alert and do not view the LTI
#16
Scenario: LTI component requests permission for username and displays LTI when accepted
Given the course has correct LTI credentials with registered Instructor
And the course has an LTI component with correct fields:
| ask_to_send_username |
| True |
Then I view the permission alert
Then I accept the permission alert and view the LTI
#17
Scenario: LTI component requests permission for email and is rejected
Given the course has correct LTI credentials with registered Instructor
And the course has an LTI component with correct fields:
| ask_to_send_email |
| True |
Then I view the permission alert
Then I reject the permission alert and do not view the LTI
#18
Scenario: LTI component requests permission for email and displays LTI when accepted
Given the course has correct LTI credentials with registered Instructor
And the course has an LTI component with correct fields:
| ask_to_send_email |
| True |
Then I view the permission alert
Then I accept the permission alert and view the LTI
#19
Scenario: LTI component requests permission for email and username and is rejected
Given the course has correct LTI credentials with registered Instructor
And the course has an LTI component with correct fields:
| ask_to_send_email | ask_to_send_username |
| True | True |
Then I view the permission alert
Then I reject the permission alert and do not view the LTI
#20
Scenario: LTI component requests permission for email and username and displays LTI when accepted
Given the course has correct LTI credentials with registered Instructor
And the course has an LTI component with correct fields:
| ask_to_send_email | ask_to_send_username |
| True | True |
Then I view the permission alert
Then I accept the permission alert and view the LTI

View File

@@ -44,80 +44,16 @@ def check_lti_iframe_content(text):
))
@step('I view the LTI and it is rendered in (.*)$')
def lti_is_rendered(_step, rendered_in):
if rendered_in.strip() == 'iframe':
world.wait_for_present('iframe')
assert world.is_css_present('iframe', wait_time=2)
assert not world.is_css_present('.link_lti_new_window', wait_time=0)
assert not world.is_css_present('.error_message', wait_time=0)
@step('I view the LTI and it is rendered in iframe$')
def lti_is_rendered_iframe(_step):
world.wait_for_present('iframe') # pylint: disable=no-member
assert world.is_css_present('iframe', wait_time=2) # pylint: disable=no-member
assert not world.is_css_present('.link_lti_new_window', wait_time=0) # pylint: disable=no-member
assert not world.is_css_present('.error_message', wait_time=0) # pylint: disable=no-member
# iframe is visible
assert world.css_visible('iframe')
check_lti_iframe_content("This is LTI tool. Success.")
elif rendered_in.strip() == 'new page':
assert not world.is_css_present('iframe', wait_time=2)
assert world.is_css_present('.link_lti_new_window', wait_time=0)
assert not world.is_css_present('.error_message', wait_time=0)
click_and_check_lti_popup()
else: # incorrect rendered_in parameter
assert False
@step('I view the permission alert$')
def view_lti_permission_alert(_step):
assert not world.is_css_present('iframe', wait_time=2)
assert world.is_css_present('.link_lti_new_window', wait_time=0)
assert not world.is_css_present('.error_message', wait_time=0)
world.css_find('.link_lti_new_window').first.click()
alert = world.browser.get_alert()
assert alert is not None
assert len(world.browser.windows) == 1
def check_no_alert():
"""
Make sure the alert has gone away.
Note that the splinter documentation indicates that
get_alert should return None if no alert is present,
however that is not the case. Instead a
NoAlertPresentException is raised.
"""
try:
assert_is_none(world.browser.get_alert())
except NoAlertPresentException:
pass
@step('I accept the permission alert and view the LTI$')
def accept_lti_permission_alert(_step):
parent_window = world.browser.current_window # Save the parent window
# To start with you should only have one window/tab
assert len(world.browser.windows) == 1
alert = world.browser.get_alert()
alert.accept()
check_no_alert()
# Give it a few seconds for the LTI window to appear
world.wait_for(
lambda _: len(world.browser.windows) == 2,
timeout=5,
timeout_msg="Timed out waiting for the LTI window to appear."
)
# Verify the LTI window
check_lti_popup(parent_window)
@step('I reject the permission alert and do not view the LTI$')
def reject_lti_permission_alert(_step):
alert = world.browser.get_alert()
alert.dismiss()
check_no_alert()
assert len(world.browser.windows) == 1
# iframe is visible
assert world.css_visible('iframe') # pylint: disable=no-member
check_lti_iframe_content("This is LTI tool. Success.")
@step('I view the LTI but incorrect_signature warning is rendered$')