MDL-85597 behat: adapt tests to new activity chooser

This commit is contained in:
ferran
2025-07-21 16:59:12 +02:00
parent f54d7eefcd
commit 96c1f995ef
10 changed files with 31 additions and 59 deletions
@@ -1,5 +1,5 @@
@core @core_completion @javascript
Feature: Allow teachers to edit the default activity completion rules in a course.
Feature: Allow teachers to edit the default activity completion rules in a course
In order to set the activity completion defaults for new activities
As a teacher
I need to be able to edit the completion rules for a group of activities.
@@ -42,10 +42,7 @@ Feature: Allow teachers to edit the default activity completion rules in a cours
And I set the following fields to these values:
| completionview_assign | 0 |
And I click on "Save changes" "button" in the "[data-region='activitycompletion-assign']" "css_element"
And I am on "Course 1" course homepage with editing mode on
And I click on "Add content" "button" in the "New section" "section"
And I click on "Activity or resource" "button" in the "New section" "section"
And I click on "Add a new Assignment" "link" in the "Add an activity or resource" "dialogue"
And I add an assign activity to course "Course 1" section "New section"
And I expand all fieldsets
# Completion tracking 2 = Add requirements.
And the field "Add requirements" matches value "1"
@@ -83,10 +80,7 @@ Feature: Allow teachers to edit the default activity completion rules in a cours
| completionreplies_forum | 3 |
And I click on "Save changes" "button" in the "[data-region='activitycompletion-forum']" "css_element"
Then I should see "Changes saved"
And I am on "Course 1" course homepage with editing mode on
And I click on "Add content" "button" in the "New section" "section"
And I click on "Activity or resource" "button" in the "New section" "section"
And I click on "Add a new Forum" "link" in the "Add an activity or resource" "dialogue"
And I add a forum activity to course "Course 1" section "New section"
And I expand all fieldsets
# Completion tracking 2 = Add requirements.
And the field "Add requirements" matches value "1"
@@ -123,10 +117,7 @@ Feature: Allow teachers to edit the default activity completion rules in a cours
| completionentries_glossary | 2 |
And I click on "Save changes" "button" in the "[data-region='activitycompletion-glossary']" "css_element"
Then I should see "Changes saved"
And I am on "Course 1" course homepage with editing mode on
And I click on "Add content" "button" in the "New section" "section"
And I click on "Activity or resource" "button" in the "New section" "section"
And I click on "Add a new Glossary" "link" in the "Add an activity or resource" "dialogue"
And I add a glossary activity to course "Course 1" section "New section"
And I expand all fieldsets
# Completion tracking 2 = Add requirements.
And the field "Add requirements" matches value "1"
@@ -29,6 +29,7 @@ Feature: Display and choose from the available activities in course
Scenario: The teacher can choose to add an activity from the activity items in the activity chooser
Given I open the activity chooser
When I click on "Add a new Assignment" "link" in the "Add an activity or resource" "dialogue"
And I click on "Add selected activity" "button" in the "Add an activity or resource" "dialogue"
Then I should see "New Assignment"
And I set the following fields to these values:
| Assignment name | Test Assignment |
@@ -38,7 +39,7 @@ Feature: Display and choose from the available activities in course
Scenario: The teacher can choose to add an activity from the activity summary in the activity chooser
Given I open the activity chooser
When I click on "Information about the Assignment activity" "button" in the "Add an activity or resource" "dialogue"
When I click on "Add a new Assignment" "link" in the "help" "core_course > Activity chooser screen"
And I click on "Add selected activity" "button" in the "Add an activity or resource" "dialogue"
Then I should see "New Assignment"
Scenario: Show summary
@@ -58,18 +59,17 @@ Feature: Display and choose from the available activities in course
Given I open the activity chooser
When I click on "Information about the Assignment activity" "button" in the "modules" "core_course > Activity chooser screen"
And I should see "The assignment activity module enables a teacher to communicate tasks, collect work and provide grades and feedback." in the "help" "core_course > Activity chooser screen"
And I should see "Back" in the "help" "core_course > Activity chooser screen"
When I click on "Back" "button" in the "help" "core_course > Activity chooser screen"
And I click on "Back" "button" in the "Add an activity or resource" "dialogue"
Then "modules" "core_course > Activity chooser screen" should be visible
And "help" "core_course > Activity chooser screen" should not be visible
And "Back" "button" should not exist in the "modules" "core_course > Activity chooser screen"
And "Back" "button" in the "Add an activity or resource" "dialogue" should not be visible
And I should not see "The assignment activity module enables a teacher to communicate tasks, collect work and provide grades and feedback." in the "Add an activity or resource" "dialogue"
# Confirm hide summary also works for weekly format course
And I am on "C2" course homepage with editing mode on
And I click on "Add content" "button" in the "13 January - 19 January" "section"
And I click on "Activity or resource" "button" in the "13 January - 19 January" "section"
And I click on "Information about the Assignment activity" "button" in the "Add an activity or resource" "dialogue"
And I click on "Back" "button" in the "help" "core_course > Activity chooser screen"
And I click on "Back" "button" in the "Add an activity or resource" "dialogue"
And "modules" "core_course > Activity chooser screen" should be visible
And "help" "core_course > Activity chooser screen" should not be visible
And "Back" "button" should not exist in the "modules" "core_course > Activity chooser screen"
@@ -38,6 +38,7 @@ Feature: Use the activity chooser to insert activities anywhere in a section
And I press "Insert content before 'Test Forum'"
And I click on "Activity or resource" "button" in the ".dropdown-menu.show" "css_element"
When I click on "Add a new Assignment" "link" in the "Add an activity or resource" "dialogue"
And I click on "Add selected activity" "button" in the "Add an activity or resource" "dialogue"
And I set the following fields to these values:
| Assignment name | Test Assignment |
And I press "Save and return to course"
@@ -10,7 +10,7 @@ Feature: Embed videos without the media filter
And I turn editing mode on
@javascript
Scenario: Add a video in a URL resource. Make sure media filters work
Scenario: Make sure media filters work when adding a video in a URL resource
Given the following "activity" exists:
| activity | url |
| course | Acceptance test site |
@@ -23,7 +23,7 @@ Feature: Embed videos without the media filter
And I am on site homepage
@javascript
Scenario: Add a video as a File resource. Make sure media filters work
Scenario: Make sure media filters work when adding a video as a File resource
When I add a "File" to section "1" using the activity chooser
And I set the following fields to these values:
| Name | Video File |
@@ -33,7 +33,7 @@ Feature: Embed videos without the media filter
Then ".video-js" "css_element" should exist
@javascript
Scenario: Add a video as content to a lesson. Make sure media filters work
Scenario: Make sure media filters work when adding a video as content to a lesson
Given the following "activities" exist:
| activity | course | section | name |
| lesson | Acceptance test site | 1 | Lesson with video |
@@ -15,17 +15,13 @@ Feature: Assignments can have default grades and scales defined
| user | course | role |
| teacher1 | C1 | editingteacher |
@javascript
Scenario: When creating an assignment the default grade type and grade scale are set as default in the form
Given the following config values are set as admin:
| config | value | plugin |
| defaultgradetype | 2 | mod_assign |
| defaultgradescale | 2 | mod_assign |
When I am on the "Course 1" course page logged in as teacher1
And I wait until the page is ready
And I switch editing mode on
And I open the activity chooser
And I click on "Add a new Assignment" "link" in the "Add an activity or resource" "dialogue"
And I add an assign activity to course "Course 1" section "1"
And I set the following fields to these values:
| name | Test assignment |
Then the following fields match these values:
@@ -15,13 +15,9 @@ Feature: Teachers can enable comments only if comments are enabled at site level
| user | course | role |
| teacher1 | C1 | editingteacher |
When I log in as "teacher1"
And I am on "Course 1" course homepage
And I turn editing mode on
@javascript
Scenario: Teacher can enable comments if they are enabled at site level
Given I open the activity chooser
And I click on "Add a new Database" "link" in the "Add an activity or resource" "dialogue"
Given I add a data activity to course "Course 1" section "1"
When I expand all fieldsets
And "Allow comments on entries" "field" should exist
And I set the field "Name" to "Test Database name"
@@ -29,13 +25,11 @@ Feature: Teachers can enable comments only if comments are enabled at site level
And I press "Save and return to course"
And I should see "Test Database name"
@javascript
Scenario: Teacher cannot enable comments if they are disabled at site level
# Disable comments in site config.
Given the following config values are set as admin:
| usecomments | 0 |
And I open the activity chooser
And I click on "Add a new Database" "link" in the "Add an activity or resource" "dialogue"
And I add a data activity to course "Course 1" section "1"
When I expand all fieldsets
And I set the field "Name" to "Test Database name 2"
And "Allow comments on entries" "field" should not exist
@@ -18,9 +18,7 @@ Feature: Scorm activity default completion
@javascript
Scenario: Completion conditions when there is no default set at site or course level.
Given I log in as "teacher1"
And I am on "Course 1" course homepage with editing mode on
And I open the activity chooser
When I click on "Add a new SCORM" "link" in the "Add an activity or resource" "dialogue"
When I add a scorm activity to course "Course 1" section "1"
And I expand all fieldsets
Then the field "None" matches value "1"
And the field "Add requirements" matches value "0"
@@ -39,9 +37,7 @@ Feature: Scorm activity default completion
| completionstatusrequired_scorm[4] | 0 |
| completionstatusrequired_scorm[2] | 0 |
And I click on "Save changes" "button" in the "[data-region='activitycompletion-scorm']" "css_element"
And I am on "Course 1" course homepage with editing mode on
And I open the activity chooser
When I click on "Add a new SCORM" "link" in the "Add an activity or resource" "dialogue"
When I add a scorm activity to course "Course 1" section "1"
And I expand all fieldsets
Then the field "None" matches value "0"
And the field "Add requirements" matches value "1"
@@ -61,9 +57,7 @@ Feature: Scorm activity default completion
| completionstatusrequired_scorm[4] | 0 |
| completionstatusrequired_scorm[2] | 0 |
And I click on "Save changes" "button" in the "[data-region='activitycompletion-scorm']" "css_element"
And I am on "Course 1" course homepage with editing mode on
And I open the activity chooser
When I click on "Add a new SCORM" "link" in the "Add an activity or resource" "dialogue"
When I add a scorm activity to course "Course 1" section "1"
And I expand all fieldsets
Then the field "None" matches value "0"
And the field "Add requirements" matches value "1"
@@ -85,9 +79,7 @@ Feature: Scorm activity default completion
And the following "core_completion > Course defaults" exist:
| course | module | completion |
| C1 | scorm | 1 |
And I am on "Course 1" course homepage with editing mode on
And I open the activity chooser
When I click on "Add a new SCORM" "link" in the "Add an activity or resource" "dialogue"
When I add a scorm activity to course "Course 1" section "1"
And I expand all fieldsets
Then the field "None" matches value "0"
And the field "Students must manually mark the activity as done" matches value "1"
@@ -104,10 +96,7 @@ Feature: Scorm activity default completion
| completionstatusrequired_scorm[4] | 0 |
| completionstatusrequired_scorm[2] | 1 |
And I click on "Save changes" "button" in the "[data-region='activitycompletion-scorm']" "css_element"
And I am on "Course 1" course homepage with editing mode on
# When I add a "Teaching Tool 1" to section "1" using the activity chooser
And I open the activity chooser
When I click on "Add a new SCORM" "link" in the "Add an activity or resource" "dialogue"
When I add a scorm activity to course "Course 1" section "1"
And I expand all fieldsets
Then the field "None" matches value "0"
And the field "Add requirements" matches value "1"
@@ -42,6 +42,7 @@ Feature: Users view subsections on course page
And I hover "Insert an activity or resource before 'Page1 in Subsection1'" "button"
And I press "Insert an activity or resource before 'Page1 in Subsection1'"
And I click on "Add a new Assignment" "link" in the "Add an activity or resource" "dialogue"
And I click on "Add selected activity" "button" in the "Add an activity or resource" "dialogue"
And I set the following fields to these values:
| Assignment name | Assignment1 in Subsection1 |
And I press "Save and return to course"
@@ -59,6 +60,7 @@ Feature: Users view subsections on course page
And I press "Insert content before 'Subsection2'"
And I click on "Activity or resource" "button" in the ".dropdown-menu.show" "css_element"
And I click on "Add a new Assignment" "link" in the "Add an activity or resource" "dialogue"
And I click on "Add selected activity" "button" in the "Add an activity or resource" "dialogue"
And I set the following fields to these values:
| Assignment name | Assignment between subsections |
And I press "Save and return to course"
@@ -92,6 +94,7 @@ Feature: Users view subsections on course page
And I click on "Add content" "button" in the "General" "section"
And I click on "Activity or resource" "button" in the ".dropdown-menu.show" "css_element"
And I click on "Add a new Forum" "link" in the "Add an activity or resource" "dialogue"
And I click on "Add selected activity" "button" in the "Add an activity or resource" "dialogue"
And I set the field "Forum name" to "New forum"
And I press "Save and return to course"
Then I should see "New forum" in the "General" "section"
@@ -104,6 +107,7 @@ Feature: Users view subsections on course page
And I press "Insert content before 'New page'"
And I click on "Activity or resource" "button" in the ".dropdown-menu.show" "css_element"
And I click on "Add a new Forum" "link" in the "Add an activity or resource" "dialogue"
And I click on "Add selected activity" "button" in the "Add an activity or resource" "dialogue"
And I set the field "Forum name" to "New forum"
And I press "Save and return to course"
Then I should see "New forum" in the "Section 3" "section"
@@ -37,6 +37,7 @@ Feature: Teachers create and destroy subsections on section page
And I turn editing mode on
And I click on "Add an activity or resource" "button"
And I click on "Add a new Assignment" "link"
And I click on "Add selected activity" "button" in the "Add an activity or resource" "dialogue"
And I set the following fields to these values:
| Assignment name | Test assignment name |
| ID number | Test assignment name |
@@ -1,4 +1,4 @@
@mod @mod_url @javascript
@mod @mod_url
Feature: Manage URL variables
In order to maintain privacy for URLs
As a teacher
@@ -9,6 +9,7 @@ Feature: Manage URL variables
| fullname | shortname | category |
| Course 1 | C1 | 0 |
@javascript
Scenario: Disabling URL variables hides Role names as URL variables check box
Given the following config values are set as admin:
| allowvariables | 1 | url |
@@ -23,8 +24,7 @@ Feature: Manage URL variables
Given the following config values are set as admin:
| allowvariables | 0 | url |
When I log in as "admin"
And I am on "Course 1" course homepage with editing mode on
And I add a "URL" to section "1" using the activity chooser
And I add a url activity to course "Course 1" section "1"
Then I should not see "URL variables"
Scenario: Enable the use of URL variables without role names
@@ -32,10 +32,8 @@ Feature: Manage URL variables
| allowvariables | 1 | url |
| rolesinparams | 0 | url |
When I log in as "admin"
And I am on "Course 1" course homepage with editing mode on
And I add a "URL" to section "1" using the activity chooser
And I add a url activity to course "Course 1" section "1"
Then I should see "URL variables"
And I expand all fieldsets
And I should see "Full site name" in the "id_variable_0" "select"
But I should not see "Roles" in the "id_variable_0" "select"
@@ -44,9 +42,7 @@ Feature: Manage URL variables
| allowvariables | 1 | url |
| rolesinparams | 1 | url |
When I log in as "admin"
And I am on "Course 1" course homepage with editing mode on
And I add a "URL" to section "1" using the activity chooser
And I add a url activity to course "Course 1" section "1"
Then I should see "URL variables"
And I expand all fieldsets
And I should see "Full site name" in the "id_variable_0" "select"
And I should see "Your word for 'Student'" in the "id_variable_0" "select"