Skip to content

Commit

Permalink
MDL-56614 behat: add navigation block when required
Browse files Browse the repository at this point in the history
Most of these hacks have links to corresponding MDL issues
marinaglancy committed Dec 6, 2016
1 parent 44f460c commit 7a12a02
Showing 16 changed files with 116 additions and 19 deletions.
Original file line number Diff line number Diff line change
@@ -8,6 +8,8 @@ Feature: Manage availability conditions
Scenario: Display list of availability conditions
# Check the report doesn't show when not enabled.
Given I log in as "admin"
And I press "Customise this page"
And I add the "Administration" block if not present
And the following config values are set as admin:
| enableavailability | 0 |
And I expand "Site administration" node
11 changes: 8 additions & 3 deletions admin/tool/recyclebin/tests/behat/basic_functionality.feature
Original file line number Diff line number Diff line change
@@ -42,16 +42,21 @@ Feature: Basic recycle bin functionality
And I should see "Test assign" in the "Topic 1" "section"

Scenario: Restore a deleted course
# TODO MDL-57250 remove extra category.
Given the following "categories" exist:
| name | idnumber |
| There is a bug with navigation and we need an extra category | CAT1 |
Given I log in as "admin"
And I go to the courses management page
And I click on "delete" action for "Course 2" in management course listing
And I press "Delete"
And I should see "Deleting C2"
And I should see "C2 has been completely deleted"
And I press "Continue"
And I go to the courses management page
And I should not see "Course 2" in the "#course-listing" "css_element"
When I navigate to "Recycle bin" node in "Category: Miscellaneous"
And I am on course index
And I follow "Miscellaneous"
And I should not see "Course 2"
When I navigate to "Recycle bin" in current page administration
Then I should see "Course 2"
And I should see "Contents will be permanently deleted after 14 days"
And I click on "Restore" "link" in the "region-main" "region"
4 changes: 4 additions & 0 deletions badges/tests/behat/add_badge.feature
Original file line number Diff line number Diff line change
@@ -14,12 +14,16 @@ Feature: Add badges to the system
And I set the field "Default badge issuer name" to "Test Badge Site"
And I set the field "Default badge issuer contact details" to "[email protected]"
And I press "Save changes"
And I follow "Badges"
When I follow "Add a new badge"
Then the field "issuercontact" matches value "[email protected]"
And the field "issuername" matches value "Test Badge Site"

@javascript
Scenario: Accessing the badges
And I press "Customise this page"
# TODO MDL-57120 site "Badges" link not accessible without navigation block.
And I add the "Navigation" block if not present
Given I navigate to "Site badges" node in "Site pages"
Then I should see "There are no badges available."

Original file line number Diff line number Diff line change
@@ -12,6 +12,8 @@ Feature: Feature: Students can use the recent blog entries block to view recent
And I am on site homepage
And I navigate to "Turn editing on" node in "Front page settings"
And I add the "Recent blog entries" block
# TODO MDL-57120 site "Blogs" link not accessible without navigation block.
And I add the "Navigation" block if not present
And I log out

Scenario: Students use the recent blog entries block to view blogs
8 changes: 6 additions & 2 deletions blocks/blog_tags/tests/behat/blogtag.feature
Original file line number Diff line number Diff line change
@@ -24,8 +24,11 @@ Feature: Adding blog tag block
And I follow "Course 1"
And I turn editing mode on
And I add the "Blog tags" block
# TODO MDL-57120 site "Blogs" link not accessible without navigation block.
And I add the "Navigation" block if not present

And I navigate to "Course blogs" node in "My courses > c1 > Participants"
And I navigate to course participants
And I click on "Course blogs" "link" in the "Navigation" "block"
And I follow "Blog about this Course"
And I set the following fields to these values:
| Entry title | Blog post from teacher |
@@ -35,7 +38,8 @@ Feature: Adding blog tag block
And I log out
And I log in as "student1"
And I follow "Course 1"
And I navigate to "Course blogs" node in "My courses > c1 > Participants"
And I navigate to course participants
And I click on "Course blogs" "link" in the "Navigation" "block"
And I follow "Blog about this Course"
And I set the following fields to these values:
| Entry title | Blog post from student |
22 changes: 14 additions & 8 deletions blog/tests/behat/comment.feature
Original file line number Diff line number Diff line change
@@ -9,9 +9,18 @@ Feature: Comment on a blog entry
| username | firstname | lastname | email |
| testuser | Test | User | moodle@example.com |
| testuser2 | Test2 | User2 | moodle2@example.com |
And I log in as "admin"
And I am on site homepage
And I turn editing mode on
# TODO MDL-57120 "Site blogs" link not accessible without navigation block.
And I add the "Navigation" block if not present
And I configure the "Navigation" block
And I set the following fields to these values:
| Page contexts | Display throughout the entire site |
And I press "Save changes"
And I log out
And I log in as "testuser"
And I expand "Site pages" node
And I follow "Site blogs"
And I navigate to "Site blogs" node in "Site pages"
And I follow "Add a new entry"
And I set the following fields to these values:
| Entry title | Blog post from user 1 |
@@ -23,8 +32,7 @@ Feature: Comment on a blog entry
Scenario: Commenting on my own blog entry
Given I am on site homepage
And I log in as "testuser"
And I expand "Site pages" node
And I follow "Site blogs"
And I navigate to "Site blogs" node in "Site pages"
And I follow "Blog post from user 1"
And I should see "User 1 blog post content"
And I follow "Comments (0)"
@@ -39,8 +47,7 @@ Feature: Comment on a blog entry
Scenario: Deleting my own comment
Given I am on site homepage
And I log in as "testuser"
And I expand "Site pages" node
And I follow "Site blogs"
And I navigate to "Site blogs" node in "Site pages"
And I follow "Blog post from user 1"
And I should see "User 1 blog post content"
And I follow "Comments (0)"
@@ -60,8 +67,7 @@ Feature: Comment on a blog entry
Given I am on site homepage
And I log in as "testuser2"
And I am on site homepage
And I expand "Site pages" node
And I follow "Site blogs"
And I navigate to "Site blogs" node in "Site pages"
And I follow "Blog post from user 1"
When I follow "Comments (0)"
And I set the field "content" to "$My own >nasty< \"string\"!"
16 changes: 12 additions & 4 deletions blog/tests/behat/delete.feature
Original file line number Diff line number Diff line change
@@ -8,9 +8,18 @@ Feature: Delete a blog entry
Given the following "users" exist:
| username | firstname | lastname | email |
| testuser | Test | User | moodle@example.com |
And I log in as "admin"
And I am on site homepage
And I turn editing mode on
# TODO MDL-57120 "Site blogs" link not accessible without navigation block.
And I add the "Navigation" block if not present
And I configure the "Navigation" block
And I set the following fields to these values:
| Page contexts | Display throughout the entire site |
And I press "Save changes"
And I log out
And I log in as "testuser"
And I expand "Site pages" node
And I follow "Site blogs"
And I navigate to "Site blogs" node in "Site pages"
And I follow "Add a new entry"
And I set the following fields to these values:
| Entry title | Blog post one |
@@ -22,8 +31,7 @@ Feature: Delete a blog entry
| Blog entry body | User 1 blog post content |
And I press "Save changes"
And I am on site homepage
And I expand "Site pages" node
And I follow "Site blogs"
And I navigate to "Site blogs" node in "Site pages"

Scenario: Delete blog post results in post deleted
Given I follow "Blog post one"
6 changes: 6 additions & 0 deletions course/tests/behat/coursetags.feature
Original file line number Diff line number Diff line change
@@ -48,6 +48,9 @@ Feature: Tagging courses
And I press "Save and display"
And I log out
And I log in as "user1"
And I press "Customise this page"
# TODO MDL-57120 "Tags" link not accessible without navigation block.
And I add the "Navigation" block if not present
And I navigate to "Tags" node in "Site pages"
And I follow "Mathematics"
Then I should see "Course 1"
@@ -82,6 +85,9 @@ Feature: Tagging courses
And I press "Save changes"
And I log out
And I log in as "user1"
And I press "Customise this page"
# TODO MDL-57120 "Tags" link not accessible without navigation block.
And I add the "Navigation" block if not present
And I navigate to "Tags" node in "Site pages"
And I follow "Mathematics"
Then I should see "Course 1"
9 changes: 9 additions & 0 deletions course/tests/behat/navigate_course_list.feature
Original file line number Diff line number Diff line change
@@ -32,6 +32,15 @@ Feature: Browse course list and return back from enrolment page

@javascript
Scenario: A user can return to the previous page from enrolment page by clicking navigation links
Given I log in as "admin"
And I am on site homepage
And I turn editing mode on
And I add the "Navigation" block if not present
And I configure the "Navigation" block
And I set the following fields to these values:
| Page contexts | Display throughout the entire site |
And I press "Save changes"
And I log out
When I log in as "user2"
And I follow "Preferences" in the user menu
And I click on "Edit profile" "link" in the "region-main" "region"
10 changes: 10 additions & 0 deletions notes/tests/behat/participants_notes.feature
Original file line number Diff line number Diff line change
@@ -20,6 +20,16 @@ Feature: Add notes to course participants
| student1 | C1 | student |
| student2 | C1 | student |
| student3 | C1 | student |
# TODO MDL-57120 "Notes" and site "Participants" links are not accessible without navigation block.
Given I log in as "admin"
And I am on site homepage
And I turn editing mode on
And I add the "Navigation" block if not present
And I configure the "Navigation" block
And I set the following fields to these values:
| Page contexts | Display throughout the entire site |
And I press "Save changes"
And I log out
And I log in as "teacher1"
And I follow "Course 1"
And I follow "Participants"
3 changes: 3 additions & 0 deletions tag/tests/behat/collections.feature
Original file line number Diff line number Diff line change
@@ -117,6 +117,9 @@ Feature: Managers can create and manage tag collections
| Searchable | 0 |
And I press "Create"
And "Yes" "text" should not exist in the "//table[contains(@class,'tag-collections-table')]//tr[contains(.,'Hiddencoll')]" "xpath_element"
And I press "Blocks editing on"
# TODO MDL-57120 "Tags" link not accessible without navigation block.
And I add the "Navigation" block if not present
And I navigate to "Tags" node in "Site pages"
Then the "Select tag collection" select box should contain "Default collection"
And the "Select tag collection" select box should contain "Hobbies"
9 changes: 9 additions & 0 deletions tag/tests/behat/edit_tag.feature
Original file line number Diff line number Diff line change
@@ -31,6 +31,9 @@ Feature: Users can edit tags to add description or rename
| moodle/user:viewdetails | Allow |
And I log out
When I log in as "editor1"
And I press "Customise this page"
# TODO MDL-57120 site "Participants" link not accessible without navigation block.
And I add the "Navigation" block if not present
And I navigate to "Participants" node in "Site pages"
And I follow "User 1"
And I follow "Cat"
@@ -52,6 +55,9 @@ Feature: Users can edit tags to add description or rename
@javascript
Scenario: Manager can change tag description, related tags and rename the tag from tag view page
When I log in as "manager1"
And I press "Customise this page"
# TODO MDL-57120 site "Participants" link not accessible without navigation block.
And I add the "Navigation" block if not present
And I navigate to "Participants" node in "Site pages"
And I follow "User 1"
And I follow "Cat"
@@ -81,6 +87,9 @@ Feature: Users can edit tags to add description or rename

Scenario: Renaming the tag from tag view page
When I log in as "manager1"
And I press "Customise this page"
# TODO MDL-57120 site "Participants" link not accessible without navigation block.
And I add the "Navigation" block if not present
And I navigate to "Participants" node in "Site pages"
And I follow "User 1"
And I follow "Cat"
7 changes: 7 additions & 0 deletions tag/tests/behat/flag_tags.feature
Original file line number Diff line number Diff line change
@@ -24,18 +24,25 @@ Feature: Users can flag tags and manager can reset flags
| moodle/user:viewdetails | Allow |
And I log out
And I log in as "user2"
And I press "Customise this page"
# TODO MDL-57120 site "Participants" link not accessible without navigation block.
And I add the "Navigation" block if not present
And I navigate to "Participants" node in "Site pages"
And I follow "User 1"
And I follow "Badtag"
And I follow "Flag as inappropriate"
And I should see "The person responsible will be notified"
And I am on homepage
And I navigate to "Participants" node in "Site pages"
And I follow "User 1"
And I follow "Sweartag"
And I follow "Flag as inappropriate"
And I should see "The person responsible will be notified"
And I log out
And I log in as "user3"
And I press "Customise this page"
# TODO MDL-57120 site "Participants" link not accessible without navigation block.
And I add the "Navigation" block if not present
And I navigate to "Participants" node in "Site pages"
And I follow "User 1"
And I follow "Sweartag"
6 changes: 6 additions & 0 deletions tag/tests/behat/tagindex.feature
Original file line number Diff line number Diff line change
@@ -22,6 +22,9 @@ Feature: Browsing tagged items

Scenario: Browse tag index with javascript disabled
When I log in as "user1"
And I press "Customise this page"
# TODO MDL-57120 "Tags" link not accessible without navigation block.
And I add the "Navigation" block if not present
And I navigate to "Tags" node in "Site pages"
And I follow "Cat"
Then I should see "Courses" in the ".tag-index-items h3" "css_element"
@@ -66,6 +69,9 @@ Feature: Browsing tagged items
@javascript
Scenario: Browse tag index with javascript enabled
When I log in as "user1"
And I press "Customise this page"
# TODO MDL-57120 "Tags" link not accessible without navigation block.
And I add the "Navigation" block if not present
And I navigate to "Tags" node in "Site pages"
And I follow "Cat"
Then I should see "Courses" in the "#tagarea-core-course" "css_element"
12 changes: 11 additions & 1 deletion user/tests/behat/set_default_homepage.feature
Original file line number Diff line number Diff line change
@@ -8,10 +8,20 @@ Feature: Set the site home page and dashboard as the default home page
Given the following "courses" exist:
| fullname | shortname | category | groupmode |
| Course 1 | C1 | 0 | 1 |
# TODO MDL-57208 this functionality does not work without administration block.
And I log in as "admin"
And I am on site homepage
And I turn editing mode on
And I add the "Administration" block if not present
And I configure the "Administration" block
And I set the following fields to these values:
| Page contexts | Display throughout the entire site |
And I press "Save changes"
And I log out

Scenario: Admin sets the site page and then the dashboard as the default home page
Given I log in as "admin"
And I navigate to "Navigation" node in "Site administration > Appearance"
And I navigate to "Appearance > Navigation" in site administration
And I set the field "Default home page for users" to "User preference"
And I press "Save changes"
And I am on site homepage
8 changes: 7 additions & 1 deletion user/tests/behat/user_grade_navigation.feature
Original file line number Diff line number Diff line change
@@ -66,6 +66,12 @@ Feature: The student can navigate to their grades page and user grade report.
And I am on site homepage
And I turn editing mode on
And I add the "Mentees" block
# TODO MDL-57216 this functionality should work without navigation block.
And I add the "Navigation" block if not present
And I configure the "Navigation" block
And I set the following fields to these values:
| Page contexts | Display throughout the entire site |
And I press "Save changes"
And I navigate to "Define roles" node in "Site administration > Users > Permissions"
And I click on "Add a new role" "button"
And I click on "Continue" "button"
@@ -89,7 +95,7 @@ Feature: The student can navigate to their grades page and user grade report.
And I log in as "parent1"
And I am on site homepage
And I follow "Student 1"
And I navigate to "Grades" node in "Users > Student 1"
And I click on "Grades" "link" in the "Navigation" "block"
Then the following should exist in the "overview-grade" table:
| Course name | Grade |
| Course 2 | - |

0 comments on commit 7a12a02

Please sign in to comment.