Commit acc743ee by JonahStanley

Added functionality to bypass alerts

This is done with the following steps:
'I confirm all alerts' means that all alert and confirm windows are returned and returned true respectively
'I dismiss all alerts' means that all confirm windows are returned false
'I answer all prompts with "([^"]*)"' means that all prompts are returned with the given string

Please note that these settings are on a PER PAGE basis.  This means that for best results, the step must be given right before the alert is generated.
parent b312944d
......@@ -5,29 +5,27 @@ Feature: Overview Toggle Section
Scenario: The default layout for the overview page is to show sections in expanded view
Given I have a course with multiple sections
When I navigate to the course overview page
Then I see the "Collapse All Sections" link
And all sections are expanded
When I navigate to the course overview page
Then I see the "Collapse All Sections" link
And all sections are expanded
Scenario: Expand /collapse for a course with no sections
Given I have a course with no sections
When I navigate to the course overview page
Then I do not see the "Collapse All Sections" link
When I navigate to the course overview page
Then I do not see the "Collapse All Sections" link
Scenario: Collapse link appears after creating first section of a course
Given I have a course with no sections
When I navigate to the course overview page
And I add a section
Then I see the "Collapse All Sections" link
And all sections are expanded
When I navigate to the course overview page
And I add a section
Then I see the "Collapse All Sections" link
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
Given I have a course with 1 section
And I navigate to the course overview page
When I press the "section" delete icon
And I confirm the alert
And I navigate to the course overview page
When I confirm all alerts
And I press the "section" delete icon
Then I see the "Collapse All Sections" link
Scenario: Collapsing all sections when all sections are expanded
......
......@@ -159,3 +159,18 @@ def registered_edx_user(step, uname):
@step(u'All dialogs should be closed$')
def dialogs_are_closed(step):
assert world.dialogs_closed()
@step('I confirm all alerts')
def i_confirm_with_ok(step):
world.browser.execute_script('window.confirm = function(){return true;} ; window.alert = function(){return;}')
@step('I dismiss all alerts')
def i_dismiss_with_ok(step):
world.browser.execute_script('window.confirm = function(){return false;}')
@step('I answer all prompts with "([^"]*)"')
def i_answer_prompts_with(step, prompt):
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