MDL-42299 course: management category expansion improvements

This commit is contained in:
Sam Hemelryk 2013-10-17 12:11:31 +13:00
parent d5de874727
commit df460b5a23
6 changed files with 73 additions and 8 deletions

View file

@ -1209,7 +1209,7 @@ class behat_course extends behat_base {
throw new ExpectationException("Could not find the actions for $listingtype", $this->getSession());
}
$actionnode = $actionsnode->find('css', '.action-'.$action);
if ($actionnode === null && $this->running_javascript()) {
if ($this->running_javascript() && !$actionnode->isVisible()) {
$actionsnode->find('css', 'a.toggle-display')->click();
if ($actionnode) {
$actionnode = $listingnode->find('css', '.action-'.$action);

View file

@ -735,6 +735,7 @@ Feature: Course category management interface performs as expected
And I should see "Cat 2-1-2-1" in the "#course-category-listings ul.ml" "css_element"
And I click on "Cat 1" "link"
# Redirect.
And I should see the "Course categories and courses" management page
And I should see "Cat 1" in the "#course-category-listings ul.ml" "css_element"
And I should see "Cat 2" in the "#course-category-listings ul.ml" "css_element"
And I should see "Cat 1-1" in the "#course-category-listings ul.ml" "css_element"
@ -743,4 +744,58 @@ Feature: Course category management interface performs as expected
And I should see "Cat 2-1-1" in the "#course-category-listings ul.ml" "css_element"
And I should see "Cat 2-1-2" in the "#course-category-listings ul.ml" "css_element"
And I should not see "Cat 2-1-1-1" in the "#course-category-listings ul.ml" "css_element"
And I should see "Cat 2-1-2-1" in the "#course-category-listings ul.ml" "css_element"
And I should see "Cat 2-1-2-1" in the "#course-category-listings ul.ml" "css_element"
And I click on "Re-sort subcategories" "link" in the ".category-listing-actions" "css_element"
And I click on "By idnumber" "link" in the ".category-listing-actions" "css_element"
# Redirect.
And I should see the "Course categories and courses" management page
And I should see "Cat 1" in the "#course-category-listings ul.ml" "css_element"
And I should see "Cat 2" in the "#course-category-listings ul.ml" "css_element"
And I should see "Cat 1-1" in the "#course-category-listings ul.ml" "css_element"
And I should see "Cat 1-2" in the "#course-category-listings ul.ml" "css_element"
And I should see "Cat 2-1" in the "#course-category-listings ul.ml" "css_element"
And I should see "Cat 2-1-1" in the "#course-category-listings ul.ml" "css_element"
And I should see "Cat 2-1-2" in the "#course-category-listings ul.ml" "css_element"
And I should not see "Cat 2-1-1-1" in the "#course-category-listings ul.ml" "css_element"
And I should see "Cat 2-1-2-1" in the "#course-category-listings ul.ml" "css_element"
@javascript
Scenario: Test category expansion after deletion
Given the following "categories" exists:
| name | category | idnumber |
| Cat A (1) | 0 | CAT1 |
| Cat B (2) | 0 | CAT2 |
| Cat C (1-1) | CAT1 | CAT3 |
| Cat D (2-1) | CAT2 | CAT4 |
| Cat E (2-1-1) | CAT4 | CAT5 |
And I log in as "admin"
And I go to the courses management page
And I should see the "Course categories" management page
And I should see "Cat A (1)" in the "#course-category-listings ul.ml" "css_element"
And I should see "Cat B (2)" in the "#course-category-listings ul.ml" "css_element"
And I should not see "Cat C (1-1)" in the "#course-category-listings ul.ml" "css_element"
And I should not see "Cat D (2-1)" in the "#course-category-listings ul.ml" "css_element"
And I should not see "Cat E (2-1-1)" in the "#course-category-listings ul.ml" "css_element"
And I click to expand category "CAT1" in the management interface
And I should see "Cat C (1-1)" in the "#course-category-listings ul.ml" "css_element"
# AJAX action - no redirect.
And I click to expand category "CAT2" in the management interface
And I should see "Cat D (2-1)" in the "#course-category-listings ul.ml" "css_element"
# AJAX action - no redirect.
And I click to expand category "CAT4" in the management interface
And I should see "Cat E (2-1-1)" in the "#course-category-listings ul.ml" "css_element"
# AJAX action - no redirect.
And I click on "delete" action for "Cat B (2)" in management category listing
# Redirect.
And I should see "Delete category: Cat B (2)"
And I should see "Contents of Cat B (2)"
And I press "Delete"
# Redirect
And I should see "Delete category: Cat B (2)"
And I should see "Deleted course category Cat B (2)"
And I press "Continue"
# Redirect.
And I should see the "Course categories and courses" management page
And I should see "Cat A (1)" in the "#course-category-listings ul.ml" "css_element"
And I should not see "Cat B (2)" in the "#course-category-listings ul.ml" "css_element"