Commit a3a7d1d5 by Jonah Stanley

Merge pull request #77 from edx/jonahstanley/fix-alert-tests

Jonahstanley/fix alert tests
parents 228b5014 477f29d5
...@@ -26,11 +26,9 @@ Feature: Create Section ...@@ -26,11 +26,9 @@ Feature: Create Section
And I save a new section release date And I save a new section release date
Then the section release date is updated Then the section release date is updated
# Skipped because Ubuntu ChromeDriver hangs on alert
@skip
Scenario: Delete section Scenario: Delete section
Given I have opened a new course in Studio Given I have opened a new course in Studio
And I have added a new section And I have added a new section
When I press the "section" delete icon When I will confirm all alerts
And I confirm the alert And I press the "section" delete icon
Then the section does not exist Then the section does not exist
...@@ -69,8 +69,8 @@ def i_see_complete_section_name_with_quote_in_editor(step): ...@@ -69,8 +69,8 @@ def i_see_complete_section_name_with_quote_in_editor(step):
@step('the section does not exist$') @step('the section does not exist$')
def section_does_not_exist(step): def section_does_not_exist(step):
css = 'span.section-name-span' css = 'h3[data-name="My Section"]'
assert world.browser.is_element_not_present_by_css(css) assert world.is_css_not_present(css)
@step('I see a release date for my section$') @step('I see a release date for my section$')
......
...@@ -21,13 +21,11 @@ Feature: Overview Toggle Section ...@@ -21,13 +21,11 @@ Feature: Overview Toggle Section
Then I see the "Collapse All Sections" link Then I see the "Collapse All Sections" link
And all sections are expanded And all sections are expanded
# Skipped because Ubuntu ChromeDriver hangs on alert
@skip
Scenario: Collapse link is not removed after last section of a course is deleted Scenario: Collapse link is not removed after last section of a course is deleted
Given I have a course with 1 section Given I have a course with 1 section
And I navigate to the course overview page And I navigate to the course overview page
When I press the "section" delete icon When I will confirm all alerts
And I confirm the alert And I press the "section" delete icon
Then I see the "Collapse All Sections" link Then I see the "Collapse All Sections" link
Scenario: Collapsing all sections when all sections are expanded Scenario: Collapsing all sections when all sections are expanded
......
...@@ -32,12 +32,10 @@ Feature: Create Subsection ...@@ -32,12 +32,10 @@ Feature: Create Subsection
And I reload the page And I reload the page
Then I see the correct dates Then I see the correct dates
# Skipped because Ubuntu ChromeDriver hangs on alert
@skip
Scenario: Delete a subsection Scenario: Delete a subsection
Given I have opened a new course section in Studio Given I have opened a new course section in Studio
And I have added a new subsection And I have added a new subsection
And I see my subsection on the Courseware page And I see my subsection on the Courseware page
When I press the "subsection" delete icon When I will confirm all alerts
And I confirm the alert And I press the "subsection" delete icon
Then the subsection does not exist Then the subsection does not exist
...@@ -159,3 +159,33 @@ def registered_edx_user(step, uname): ...@@ -159,3 +159,33 @@ def registered_edx_user(step, uname):
@step(u'All dialogs should be closed$') @step(u'All dialogs should be closed$')
def dialogs_are_closed(step): def dialogs_are_closed(step):
assert world.dialogs_closed() assert world.dialogs_closed()
@step('I will confirm all alerts')
def i_confirm_all_alerts(step):
"""
Please note: This method must be called RIGHT BEFORE an expected alert
Window variables are page local and thus all changes are removed upon navigating to a new page
In addition, this method changes the functionality of ONLY future alerts
"""
world.browser.execute_script('window.confirm = function(){return true;} ; window.alert = function(){return;}')
@step('I will cancel all alerts')
def i_cancel_all_alerts(step):
"""
Please note: This method must be called RIGHT BEFORE an expected alert
Window variables are page local and thus all changes are removed upon navigating to a new page
In addition, this method changes the functionality of ONLY future alerts
"""
world.browser.execute_script('window.confirm = function(){return false;} ; window.alert = function(){return;}')
@step('I will answer all prompts with "([^"]*)"')
def i_answer_prompts_with(step, prompt):
"""
Please note: This method must be called RIGHT BEFORE an expected alert
Window variables are page local and thus all changes are removed upon navigating to a new page
In addition, this method changes the functionality of ONLY future alerts
"""
world.browser.execute_script('window.prompt = function(){return %s;}') % prompt
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