Commit c83ea18d by Ben Patterson

Fix test failing under one shard.

This test consistently fails when combining
lms acceptance onto one shard. (TE-737)
parent 407e6ec7
...@@ -10,7 +10,7 @@ And I am logged in ...@@ -10,7 +10,7 @@ And I am logged in
And I visit the courses page And I visit the courses page
When I register to audit the course When I register to audit the course
And a "edx.course.enrollment.activated" server event is emitted And a "edx.course.enrollment.activated" server event is emitted
And a "edx.course.enrollment.mode_changed" server events is emitted #And a "edx.course.enrollment.mode_changed" server events is emitted
And I visit the dashboard And I visit the dashboard
And I click on Challenge Yourself And I click on Challenge Yourself
......
...@@ -65,6 +65,7 @@ Feature: LMS.LTI component ...@@ -65,6 +65,7 @@ Feature: LMS.LTI component
And I view the LTI and it is rendered in iframe And I view the LTI and it is rendered in iframe
And I see in iframe that LTI role is Instructor And I see in iframe that LTI role is Instructor
And I switch to student And I switch to student
And I view the LTI and it is rendered in iframe
Then I see in iframe that LTI role is Student Then I see in iframe that LTI role is Student
#8 #8
......
...@@ -16,6 +16,7 @@ from student.tests.factories import UserFactory ...@@ -16,6 +16,7 @@ from student.tests.factories import UserFactory
from common import visit_scenario_item from common import visit_scenario_item
TEST_COURSE_NAME="test_course_a"
@step('I view the LTI and error is shown$') @step('I view the LTI and error is shown$')
def lti_is_not_rendered(_step): def lti_is_not_rendered(_step):
...@@ -45,6 +46,7 @@ def check_lti_iframe_content(text): ...@@ -45,6 +46,7 @@ def check_lti_iframe_content(text):
@step('I view the LTI and it is rendered in (.*)$') @step('I view the LTI and it is rendered in (.*)$')
def lti_is_rendered(_step, rendered_in): def lti_is_rendered(_step, rendered_in):
if rendered_in.strip() == 'iframe': if rendered_in.strip() == 'iframe':
world.wait_for_present('iframe')
assert world.is_css_present('iframe', wait_time=2) 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('.link_lti_new_window', wait_time=0)
assert not world.is_css_present('.error_message', wait_time=0) assert not world.is_css_present('.error_message', wait_time=0)
...@@ -58,7 +60,7 @@ def lti_is_rendered(_step, rendered_in): ...@@ -58,7 +60,7 @@ def lti_is_rendered(_step, rendered_in):
assert world.is_css_present('.link_lti_new_window', wait_time=0) assert world.is_css_present('.link_lti_new_window', wait_time=0)
assert not world.is_css_present('.error_message', wait_time=0) assert not world.is_css_present('.error_message', wait_time=0)
click_and_check_lti_popup() click_and_check_lti_popup()
else: # incorrent rendered_in parameter else: # incorrect rendered_in parameter
assert False assert False
...@@ -129,7 +131,7 @@ def incorrect_lti_is_rendered(_step): ...@@ -129,7 +131,7 @@ def incorrect_lti_is_rendered(_step):
@step('the course has correct LTI credentials with registered (.*)$') @step('the course has correct LTI credentials with registered (.*)$')
def set_correct_lti_passport(_step, user='Instructor'): def set_correct_lti_passport(_step, user='Instructor'):
coursenum = 'test_course' coursenum = TEST_COURSE_NAME
metadata = { metadata = {
'lti_passports': ["correct_lti_id:test_client_key:test_client_secret"] 'lti_passports': ["correct_lti_id:test_client_key:test_client_secret"]
} }
...@@ -139,7 +141,7 @@ def set_correct_lti_passport(_step, user='Instructor'): ...@@ -139,7 +141,7 @@ def set_correct_lti_passport(_step, user='Instructor'):
@step('the course has incorrect LTI credentials$') @step('the course has incorrect LTI credentials$')
def set_incorrect_lti_passport(_step): def set_incorrect_lti_passport(_step):
coursenum = 'test_course' coursenum = TEST_COURSE_NAME
metadata = { metadata = {
'lti_passports': ["test_lti_id:test_client_key:incorrect_lti_secret_key"] 'lti_passports': ["test_lti_id:test_client_key:incorrect_lti_secret_key"]
} }
...@@ -272,7 +274,7 @@ def check_lti_popup(parent_window): ...@@ -272,7 +274,7 @@ def check_lti_popup(parent_window):
for window in windows: for window in windows:
world.browser.switch_to_window(window) world.browser.switch_to_window(window)
tabs.append(world.browser.title) tabs.append(world.browser.title)
assert_equal(tabs, [u'LTI | Test Section | test_course Courseware | edX', u'TEST TITLE']) assert_equal(tabs, [u'LTI | Test Section | test_course_a Courseware | edX', u'TEST TITLE'])
# Now verify the contents of the LTI window (which is the 2nd window/tab) # Now verify the contents of the LTI window (which is the 2nd window/tab)
# Note: The LTI opens in a new browser window, but Selenium sticks with the # Note: The LTI opens in a new browser window, but Selenium sticks with the
...@@ -372,7 +374,7 @@ def get_lti_frame_name(): ...@@ -372,7 +374,7 @@ def get_lti_frame_name():
@step('I see in iframe that LTI role is (.*)$') @step('I see in iframe that LTI role is (.*)$')
def check_role(_step, role): def check_role(_step, role):
world.is_css_present('iframe') world.wait_for_present('iframe')
location = world.scenario_dict['LTI'].location.html_id() location = world.scenario_dict['LTI'].location.html_id()
iframe_name = 'ltiFrame-' + location iframe_name = 'ltiFrame-' + location
with world.browser.get_iframe(iframe_name) as iframe: with world.browser.get_iframe(iframe_name) as iframe:
...@@ -391,6 +393,7 @@ def switch_view(_step, view): ...@@ -391,6 +393,7 @@ def switch_view(_step, view):
if staff_status != view: if staff_status != view:
world.browser.select("select", view) world.browser.select("select", view)
world.wait_for_ajax_complete() world.wait_for_ajax_complete()
assert_equal(world.css_find('#action-preview-select').first.value, view)
@step("in the LTI component I do not see (.*)$") @step("in the LTI component I do not see (.*)$")
......
...@@ -19,12 +19,13 @@ def i_register_to_audit_the_course(_step): ...@@ -19,12 +19,13 @@ def i_register_to_audit_the_course(_step):
url = django_url('courses/%s/about' % world.scenario_dict['COURSE'].id.to_deprecated_string()) url = django_url('courses/%s/about' % world.scenario_dict['COURSE'].id.to_deprecated_string())
world.browser.visit(url) world.browser.visit(url)
world.css_click('section.intro a.register') world.css_click('section.intro a.register')
# the below button has a race condition. When the page first loads # When the page first loads some animation needs to
# some animation needs to complete before this button is in a stable # complete before this button is in a stable location
# position. TODO: implement this without a sleep. world.retry_on_exception(
time.sleep(2) lambda: world.browser.find_by_name("honor_mode").click(),
audit_button = world.browser.find_by_name("audit_mode") max_attempts=10,
audit_button.click() ignored_exceptions=AttributeError
)
time.sleep(1) time.sleep(1)
assert world.is_css_present('section.container.dashboard') assert world.is_css_present('section.container.dashboard')
......
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