MDL-70152 behat: Forum behat generators use UI

Behat cleanup and optimisation
This commit is contained in:
Angelia Dela Cruz
2023-05-29 10:30:44 +08:00
parent 0f11899e33
commit 865ca1d6a2
80 changed files with 470 additions and 1016 deletions
@@ -58,21 +58,18 @@ Feature: availability_completion
@javascript
Scenario: Test completion and course cache rebuild
Given the following "activities" exist:
| activity | name | intro | course | idnumber |
| forum | forum 1 | forum 1 | C1 | forum1 |
And I log in as "teacher1"
And I am on "Course 1" course homepage with editing mode on
And I open "forum 1" actions menu
And I click on "Edit settings" "link" in the "forum 1" activity
| activity | name | course | idnumber |
| forum | forum 1 | C1 | forum1 |
And the following forum discussions exist in course "Course 1":
| user | forum | name | message |
| student1 | forum 1 | Forum posst 1 | This is the body |
And I am on the "forum 1" "forum activity editing" page logged in as teacher1
And I set the following fields to these values:
| Completion tracking | Show activity as complete when conditions are met |
| completionview | 1 |
| completionpostsenabled | 1 |
| completionposts | 2 |
And I press "Save and return to course"
And I add a new discussion to "forum 1" forum with:
| Subject | Forum post 1 |
| Message | This is the body |
And I am on "Course 1" course homepage with editing mode on
And I add a "Page" to section "2"
And I set the following fields to these values:
@@ -87,25 +84,18 @@ Feature: availability_completion
| Required completion status | must be marked complete |
| cm | forum 1 |
And I press "Save and return to course"
And I log out
And I log in as "student1"
When I am on "Course 1" course homepage
When I am on the "Course 1" course page logged in as student1
# Page 2 should not appear yet.
Then I should not see "Page 2" in the "region-main" "region"
And I click on "forum 1" "link" in the "region-main" "region"
# Page 2 should not appear yet.
And I should not see "Page 2" in the "region-main" "region"
And I log out
And I log in as "teacher1"
And I am on "Course 1" course homepage
And I am on the "forum 1" "forum activity editing" page
And I am on the "forum 1" "forum activity editing" page logged in as teacher1
And I expand all fieldsets
And I set the following fields to these values:
| completionpostsenabled | 0 |
And I press "Save and display"
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 click on "forum 1" "link" in the "region-main" "region"
And I am on "Course 1" course homepage
And I should see "Page 2" in the "region-main" "region"
@@ -30,9 +30,7 @@ Feature: edit_availability
And the following "activity" exists:
| activity | forum |
| course | C1 |
| section | 1 |
| name | MyForum |
| intro | x |
Scenario: Confirm the 'enable availability' option is working
Given the following config values are set as admin:
@@ -184,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 am on the "MyForum" "forum activity editing" page
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
@@ -196,9 +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 am on the "MyForum" "forum activity editing" page
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