-
Notifications
You must be signed in to change notification settings - Fork 4.2k
Jonahstanley/fix alert tests #77
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
acc743e
0548b11
d147103
260659c
f652a5d
d226a21
477f29d
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,61 +1,59 @@ | ||
| Feature: Overview Toggle Section | ||
| In order to quickly view the details of a course's section or to scan the inventory of sections | ||
| In order to quickly view the details of a course's section or to scan the inventory of sections | ||
| As a course author | ||
| I want to toggle the visibility of each section's subsection details in the overview listing | ||
|
|
||
| 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 | ||
|
|
||
| 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 | ||
|
|
||
| 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 | ||
|
|
||
| # 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 | ||
| Then I see the "Collapse All Sections" link | ||
|
|
||
| Scenario: Collapsing all sections when all sections are expanded | ||
| Given I navigate to the courseware page of a course with multiple sections | ||
| And all sections are expanded | ||
| When I click the "Collapse All Sections" link | ||
| Then I see the "Expand All Sections" link | ||
| And all sections are collapsed | ||
|
|
||
| Scenario: Collapsing all sections when 1 or more sections are already collapsed | ||
| Given I navigate to the courseware page of a course with multiple sections | ||
| And all sections are expanded | ||
| When I collapse the first section | ||
| And I click the "Collapse All Sections" link | ||
| Then I see the "Expand All Sections" link | ||
| And all sections are collapsed | ||
|
|
||
| Scenario: Expanding all sections when all sections are collapsed | ||
| Given I navigate to the courseware page of a course with multiple sections | ||
| And I click the "Collapse All Sections" link | ||
| When I click the "Expand All Sections" link | ||
| Then I see the "Collapse All Sections" link | ||
| And all sections are expanded | ||
|
|
||
| Scenario: Expanding all sections when 1 or more sections are already expanded | ||
| Given I navigate to the courseware page of a course with multiple sections | ||
| And I click the "Collapse All Sections" link | ||
| When I expand the first section | ||
| And I click the "Expand All Sections" link | ||
| Then I see the "Collapse All Sections" link | ||
| And all sections are expanded | ||
| 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 | ||
|
|
||
| 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 | ||
|
|
||
| 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 | ||
|
|
||
| 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 will 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 | ||
| Given I navigate to the courseware page of a course with multiple sections | ||
| And all sections are expanded | ||
| When I click the "Collapse All Sections" link | ||
| Then I see the "Expand All Sections" link | ||
| And all sections are collapsed | ||
|
|
||
| Scenario: Collapsing all sections when 1 or more sections are already collapsed | ||
| Given I navigate to the courseware page of a course with multiple sections | ||
| And all sections are expanded | ||
| When I collapse the first section | ||
| And I click the "Collapse All Sections" link | ||
| Then I see the "Expand All Sections" link | ||
| And all sections are collapsed | ||
|
|
||
| Scenario: Expanding all sections when all sections are collapsed | ||
| Given I navigate to the courseware page of a course with multiple sections | ||
| And I click the "Collapse All Sections" link | ||
| When I click the "Expand All Sections" link | ||
| Then I see the "Collapse All Sections" link | ||
| And all sections are expanded | ||
|
|
||
| Scenario: Expanding all sections when 1 or more sections are already expanded | ||
| Given I navigate to the courseware page of a course with multiple sections | ||
| And I click the "Collapse All Sections" link | ||
| When I expand the first section | ||
| And I click the "Expand All Sections" link | ||
| Then I see the "Collapse All Sections" link | ||
| And all sections are expanded | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -159,3 +159,33 @@ def registered_edx_user(step, uname): | |
| @step(u'All dialogs should be closed$') | ||
| def dialogs_are_closed(step): | ||
| 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;}') | ||
|
|
||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Since the wording of this is necessarily a bit awkward because of the way it needs to be used, can you please include docstrings for these three "I will" methods? Something about how you need to put the statements about the behavior wanted when dismissing alerts before the statement that will trigger an alert to be popped up? |
||
|
|
||
| @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 | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks like some indenting issues. Perhaps the file needs to be reindented to remove tabs?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thats weird... the file looks fine on my local version and git is telling me that I don't have any more changes to commit so I am not sure how to fix that
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Have you verified the file does not have a mix of tabs and spaces? We don't want tabs.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For some reason it loaded as tabs. Changing that now and recommitting