Skip to content

Commit

Permalink
Merge branch 'MDL-70152-311' of https://github.com/andelacruz/moodle
Browse files Browse the repository at this point in the history
…into MOODLE_311_STABLE
  • Loading branch information
ilyatregubov committed Jun 14, 2023
2 parents bfbae65 + df762bf commit 17c8d16
Show file tree
Hide file tree
Showing 73 changed files with 613 additions and 1,235 deletions.
8 changes: 2 additions & 6 deletions admin/tool/behat/tests/behat/edit_permissions.feature
Expand Up @@ -48,16 +48,12 @@ Feature: Edit capabilities
And "mod/forum:addquestion" capability has "Allow" permission

Scenario: Module capabilities overrides
Given I log in as "teacher1"
And the following "activity" exists:
Given the following "activity" exists:
| activity | forum |
| course | C1 |
| idnumber | 00001 |
| name | I'm the name |
| intro | I'm the introduction |
| section | 1 |
And I am on "Course 1" course homepage with editing mode on
And I follow "I'm the name"
And I am on the "I'm the name" "forum activity" page logged in as teacher1
And I navigate to "Permissions" in current page administration
And I override the system permissions of "Student" role with:
| mod/forum:deleteanypost | Prohibit |
Expand Down
10 changes: 3 additions & 7 deletions admin/tool/usertours/tests/behat/tour_filter.feature
Expand Up @@ -153,14 +153,10 @@ Feature: Apply tour filters to a tour
| Course 1 | C1 | topics | 1 |
| Course 2 | C2 | topics | 1 |
And the following "activities" exist:
| activity | course | name | firstpagetitle | wikimode |
| wiki | C1 | Test wiki name | First page | collaborative |
| activity | course | name | firstpagetitle | wikimode | idnumber | intro | type |
| wiki | C1 | Test wiki name | First page | collaborative | | | |
| forum | C2 | Test forum name | | | 001 | Test forum description | general |
And I log in as "admin"
And I am on "Course 2" course homepage with editing mode on
And I add a "Forum" to section "1" and I fill the form with:
| Forum name | Test forum name |
| Forum type | Standard forum for general use |
| Description | Test forum description |
And I add a new user tour with:
| Name | Wiki tour |
| Description | A tour with both matches |
Expand Down
15 changes: 6 additions & 9 deletions availability/tests/behat/edit_availability.feature
Expand Up @@ -27,6 +27,10 @@ Feature: edit_availability
| user | course | role |
| teacher1 | C1 | editingteacher |
| student1 | C1 | student |
And the following "activity" exists:
| activity | forum |
| course | C1 |
| name | MyForum |

Scenario: Confirm the 'enable availability' option is working
Given the following config values are set as admin:
Expand Down Expand Up @@ -178,9 +182,7 @@ Feature: edit_availability
# Button does not exist when conditional access restrictions are turned off.
Given the following config values are set as admin:
| enableavailability | 0 |
And I log in as "admin"
And I am on "Course 1" course homepage with editing mode on
And I add a "Forum" to section "1"
And I am on the "MyForum" "forum activity editing" page logged in as admin
When I expand all fieldsets
Then "Add group/grouping access restriction" "button" should not exist

Expand All @@ -190,12 +192,7 @@ Feature: edit_availability
Given the following "groupings" exist:
| name | course | idnumber |
| GX1 | C1 | GXI1 |
And I log in as "admin"
And I am on "Course 1" course homepage with editing mode on
And I add a "Forum" to section "1"
And I set the following fields to these values:
| Forum name | MyForum |
| Description | x |
And I am on the "MyForum" "forum activity editing" page logged in as admin
When I expand all fieldsets
Then the "Add group/grouping access restriction" "button" should be disabled

Expand Down
20 changes: 10 additions & 10 deletions backup/util/ui/tests/behat/restore_moodle2_courses.feature
Expand Up @@ -12,15 +12,13 @@ Feature: Restore Moodle 2 course backups
| Course 3 | C3 | 0 | topics | 2 | 0 |
| Course 4 | C4 | 0 | topics | 20 | 0 |
And the following "activities" exist:
| activity | course | idnumber | name | intro | section | externalurl |
| assign | C3 | assign1 | Test assign name | Assign description | 1 | |
| data | C3 | data1 | Test database name | Database description | 2 | |
| url | C1 | url1 | Test URL name | Test URL description | 3 | http://www.moodle.org |
| activity | course | idnumber | name | intro | section | externalurl |
| assign | C3 | assign1 | Test assign name | Assign description | 1 | |
| data | C3 | data1 | Test database name | Database description | 2 | |
| forum | C1 | 0001 | Test forum name | | 1 | |
| url | C1 | url1 | Test URL name | Test URL description | 3 | http://www.moodle.org |
And I log in as "admin"
And I am on "Course 1" course homepage with editing mode on
And I add a "Forum" to section "1" and I fill the form with:
| Forum name | Test forum name |
| Description | Test forum description |
And I add the "Activities" block

@javascript
Expand Down Expand Up @@ -63,10 +61,12 @@ Feature: Restore Moodle 2 course backups
Scenario: Restore a backup into the same course removing it's contents before that
When I backup "Course 1" course using this options:
| Confirmation | Filename | test_backup.mbz |
And the following "activity" exists:
| activity | forum |
| course | C1 |
| section | 1 |
| name | Test forum post backup name |
And I am on "Course 1" course homepage
And I add a "Forum" to section "1" and I fill the form with:
| Forum name | Test forum post backup name |
| Description | Test forum post backup description |
And I navigate to "Restore" in current page administration
And I merge "test_backup.mbz" backup into the current course after deleting it's contents using this options:
| Schema | Section 3 | 0 |
Expand Down
13 changes: 5 additions & 8 deletions blocks/navigation/tests/behat/participants_link.feature
Expand Up @@ -37,19 +37,17 @@ Feature: Displaying the link to the Participants page

@javascript
Scenario: Course participants link is displayed to users depending on role permissions settings
And the following "activities" exist:
| activity | course | name |
| forum | C1 | Test forum name |
And I log in as "admin"
And I am on "Course1" course homepage with editing mode on
And I add a "Forum" to section "1" and I fill the form with:
| Forum name | Test forum name |
| Description | Test forum description |
And I navigate to "Users > Enrolment methods" in current page administration
And I click on "Edit" "link" in the "Guest access" "table_row"
And I set the following fields to these values:
| Allow guest access | Yes |
And I press "Save changes"
And I log out
When I log in as "guest"
And I am on "Course1" course homepage
When I am on the "Course1" course page logged in as guest
Then I should not see "Participants" in the "Navigation" "block"
And I am on the "Test forum name" "forum activity" page
And I should not see "Participants" in the "Navigation" "block"
Expand All @@ -58,8 +56,7 @@ Feature: Displaying the link to the Participants page
And I set the following system permissions of "Guest" role:
| capability | permission |
| moodle/course:viewparticipants | Allow |
And I log in as "guest"
And I am on "Course1" course homepage
And I am on the "Course1" course page logged in as guest
And I should see "Participants" in the "Navigation" "block"
And I am on the "Test forum name" "forum activity" page
And I should see "Participants" in the "Navigation" "block"
Expand Down
72 changes: 24 additions & 48 deletions blocks/recent_activity/tests/behat/structural_changes.feature
Expand Up @@ -47,38 +47,32 @@ Feature: View structural changes in recent activity block

Scenario: Check that Added module information is displayed respecting view capability
Given the following "activities" exist:
| activity | course | section | name | idnumber | description | groupmode | grouping | visible |
| forum | C1 | 1 | ForumVisibleGroups | forum1 | No description | 2 | | 1 |
| forum | C1 | 1 | ForumSeparateGroups | forum2 | No description | 1 | | 1 |
| forum | C1 | 1 | ForumHidden | forum3 | No description | 1 | | 0 |
| forum | C1 | 1 | ForumNoGroups | forum4 | No description | 0 | | 1 |
| forum | C1 | 2 | ForumVisibleGroupsG1 | forum5 | No description | 2 | GG1 | 1 |
| forum | C1 | 2 | ForumSeparateGroupsG1 | forum6 | No description | 1 | GG1 | 1 |
| forum | C1 | 3 | ForumVisibleGroupsG2 | forum7 | No description | 2 | GG2 | 1 |
| forum | C1 | 3 | ForumSeparateGroupsG2 | forum8 | No description | 1 | GG2 | 1 |
And I log in as "teacher1"

And I am on "Course 1" course homepage
And I click on "ForumVisibleGroupsG1" "link"
And I click on "Edit settings" "link"
| activity | course | name | idnumber | groupmode | grouping | visible |
| forum | C1 | ForumVisibleGroups | forum1 | 2 | | 1 |
| forum | C1 | ForumSeparateGroups | forum2 | 1 | | 1 |
| forum | C1 | ForumHidden | forum3 | 1 | | 0 |
| forum | C1 | ForumNoGroups | forum4 | 0 | | 1 |
| forum | C1 | ForumVisibleGroupsG1 | forum5 | 2 | GG1 | 1 |
| forum | C1 | ForumSeparateGroupsG1 | forum6 | 1 | GG1 | 1 |
| forum | C1 | ForumVisibleGroupsG2 | forum7 | 2 | GG2 | 1 |
| forum | C1 | ForumSeparateGroupsG2 | forum8 | 1 | GG2 | 1 |

And I am on the "ForumVisibleGroupsG1" "forum activity editing" page logged in as teacher1
And I set the following fields to these values:
| Access restrictions | Grouping: Grouping 1 |
And I press "Save and return to course"

And I click on "ForumSeparateGroupsG1" "link"
And I click on "Edit settings" "link"
And I am on the "ForumSeparateGroupsG1" "forum activity editing" page
And I set the following fields to these values:
| Access restrictions | Grouping: Grouping 1 |
And I press "Save and return to course"

And I click on "ForumVisibleGroupsG2" "link"
And I click on "Edit settings" "link"
And I am on the "ForumVisibleGroupsG2" "forum activity editing" page
And I set the following fields to these values:
| Access restrictions | Grouping: Grouping 2 |
And I press "Save and return to course"

And I click on "ForumSeparateGroupsG2" "link"
And I click on "Edit settings" "link"
And I am on the "ForumSeparateGroupsG2" "forum activity editing" page
And I set the following fields to these values:
| Access restrictions | Grouping: Grouping 2 |
And I press "Save and return to course"
Expand All @@ -94,10 +88,8 @@ Feature: View structural changes in recent activity block
And I should see "ForumSeparateGroupsG1" in the "Recent activity" "block"
And I should see "ForumVisibleGroupsG2" in the "Recent activity" "block"
And I should see "ForumSeparateGroupsG2" in the "Recent activity" "block"
And I log out

And I log in as "student1"
And I am on "Course 1" course homepage
And I am on the "Course 1" course page logged in as student1
And I should see "ForumVisibleGroups" in the "Recent activity" "block"
And I should see "ForumSeparateGroups" in the "Recent activity" "block"
And I should see "ForumNoGroups" in the "Recent activity" "block"
Expand All @@ -106,10 +98,8 @@ Feature: View structural changes in recent activity block
And I should see "ForumSeparateGroupsG1" in the "Recent activity" "block"
And I should not see "ForumVisibleGroupsG2" in the "Recent activity" "block"
And I should not see "ForumSeparateGroupsG2" in the "Recent activity" "block"
And I log out

And I log in as "student2"
And I am on "Course 1" course homepage
And I am on the "Course 1" course page logged in as student2
And I should see "ForumVisibleGroups" in the "Recent activity" "block"
And I should see "ForumSeparateGroups" in the "Recent activity" "block"
And I should see "ForumNoGroups" in the "Recent activity" "block"
Expand All @@ -118,10 +108,8 @@ Feature: View structural changes in recent activity block
And I should not see "ForumSeparateGroupsG1" in the "Recent activity" "block"
And I should see "ForumVisibleGroupsG2" in the "Recent activity" "block"
And I should see "ForumSeparateGroupsG2" in the "Recent activity" "block"
And I log out

And I log in as "student3"
And I am on "Course 1" course homepage
And I am on the "Course 1" course page logged in as student3
And I should see "ForumVisibleGroups" in the "Recent activity" "block"
And I should see "ForumSeparateGroups" in the "Recent activity" "block"
And I should see "ForumNoGroups" in the "Recent activity" "block"
Expand All @@ -130,25 +118,21 @@ Feature: View structural changes in recent activity block
And I should see "ForumSeparateGroupsG1" in the "Recent activity" "block"
And I should see "ForumVisibleGroupsG2" in the "Recent activity" "block"
And I should see "ForumSeparateGroupsG2" in the "Recent activity" "block"
And I log out

# Teachers have capability to see all groups and hidden activities
And I log in as "assistant1"
And I am on "Course 1" course homepage
And I am on the "Course 1" course page logged in as assistant1
And I should see "ForumHidden" in the "Recent activity" "block"
And I should see "ForumVisibleGroupsG1" in the "Recent activity" "block"
And I should see "ForumSeparateGroupsG1" in the "Recent activity" "block"
And I should see "ForumVisibleGroupsG2" in the "Recent activity" "block"
And I should see "ForumSeparateGroupsG2" in the "Recent activity" "block"
And I log out

Scenario: Updates and deletes in recent activity block
Given the following "activity" exists:
| activity | forum |
| course | C1 |
| idnumber | forum1 |
| name | ForumNew |
| description | No description |
When I log in as "teacher1"
And I am on "Course 1" course homepage with editing mode on
And I add the "Recent activity" block
Expand All @@ -158,28 +142,23 @@ Feature: View structural changes in recent activity block

# Update forum as a teacher after a second to ensure we have a new timestamp for recent activity.
And I wait "1" seconds
And I log in as "student1"
And I am on "Course 1" course homepage
And I am on the "Course 1" course page logged in as student1
And I should see "Added Forum" in the "Recent activity" "block"
And I should see "ForumNew" in the "Recent activity" "block"
And I log out
# Update forum as a teacher after a second to ensure we have a new timestamp for recent activity.
And I wait "1" seconds

# Update forum as a teacher
And I log in as "teacher1"
And I am on "Course 1" course homepage
And I follow "ForumNew"
And I navigate to "Edit settings" in current page administration
And I am on the "ForumNew" "forum activity editing" page logged in as teacher1
And I set the following fields to these values:
| name | ForumUpdated |
And I press "Save and return to course"
And I log out
And I wait "1" seconds
# Student 1 already saw that forum was created, now he can see that forum was updated

And I log in as "student1"
And I am on "Course 1" course homepage
And I am on the "Course 1" course page logged in as student1
And I should not see "Added Forum" in the "Recent activity" "block"
And I should not see "ForumNew" in the "Recent activity" "block"
And I should see "Updated Forum" in the "Recent activity" "block"
Expand All @@ -188,8 +167,7 @@ Feature: View structural changes in recent activity block
And I wait "1" seconds
# Student 2 has bigger interval and he can see one entry that forum was created but with the new name

And I log in as "student2"
And I am on "Course 1" course homepage
And I am on the "Course 1" course page logged in as student2
And I should see "Added Forum" in the "Recent activity" "block"
And I should not see "ForumNew" in the "Recent activity" "block"
And I should not see "Updated Forum" in the "Recent activity" "block"
Expand All @@ -206,8 +184,7 @@ Feature: View structural changes in recent activity block
And I wait "1" seconds
# Students 1 and 2 see that forum was deleted

And I log in as "student1"
And I am on "Course 1" course homepage
And I am on the "Course 1" course page logged in as student1
And I should not see "Added Forum" in the "Recent activity" "block"
And I should not see "ForumNew" in the "Recent activity" "block"
And I should not see "Updated Forum" in the "Recent activity" "block"
Expand All @@ -217,8 +194,7 @@ Feature: View structural changes in recent activity block
And I wait "1" seconds
# Student 3 never knew that forum was created, so he does not see anything

And I log in as "student3"
And I am on "Course 1" course homepage
And I am on the "Course 1" course page logged in as student3
And I should not see "Added Forum" in the "Recent activity" "block"
And I should not see "ForumNew" in the "Recent activity" "block"
And I should not see "Updated Forum" in the "Recent activity" "block"
Expand Down
12 changes: 7 additions & 5 deletions blocks/site_main_menu/tests/behat/edit_activities.feature
Expand Up @@ -26,14 +26,16 @@ Feature: Edit activities in main menu block
Scenario: Activities in main menu block can be made available but not visible on a course page
Given the following config values are set as admin:
| allowstealth | 1 |
And the following "blocks" exist:
| blockname | contextlevel | reference | pagetypepattern | defaultregion |
| site_main_menu | System | 1 | site-index | side-post |
And the following "activities" exist:
| activity | course | section | name |
| forum | Acceptance test site | 0 | Visible forum |
| forum | Acceptance test site | 0 | My forum name |
And I log in as "admin"
And I am on site homepage
And I navigate to "Turn editing on" in current page administration
And I add the "Main menu" block
When I add a "Forum" to section "0" and I fill the form with:
| Forum name | Visible forum |
When I add a "Forum" to section "0" and I fill the form with:
| Forum name | My forum name |
And "My forum name" activity in site main menu block should have "Hide" editing icon
And "My forum name" activity in site main menu block should not have "Show" editing icon
And "My forum name" activity in site main menu block should not have "Make available" editing icon
Expand Down

0 comments on commit 17c8d16

Please sign in to comment.