From f66f6e86a9b4bea7baf78a9db28220746768139b Mon Sep 17 00:00:00 2001 From: Angelia Dela Cruz Date: Tue, 27 Aug 2024 18:22:19 +0800 Subject: [PATCH] MDL-82898 @enrol_self: Behat to test student enrolment using key --- enrol/self/tests/behat/self_enrolment.feature | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/enrol/self/tests/behat/self_enrolment.feature b/enrol/self/tests/behat/self_enrolment.feature index 64c8118fd2f31..8695389d00395 100644 --- a/enrol/self/tests/behat/self_enrolment.feature +++ b/enrol/self/tests/behat/self_enrolment.feature @@ -9,6 +9,7 @@ Feature: Users can auto-enrol themself in courses where self enrolment is allowe | username | firstname | lastname | email | | teacher1 | Teacher | 1 | teacher1@example.com | | student1 | Student | 1 | student1@example.com | + | student2 | Student | 2 | student2@example.com | And the following "courses" exist: | fullname | shortname | format | | Course 1 | C1 | topics | @@ -82,6 +83,16 @@ Feature: Users can auto-enrol themself in courses where self enrolment is allowe Then I should see "New section" And I should not see "Enrolment options" And I should not see "Enrol me in this course" + And I am on the "Course 1" course page logged in as student2 + And I set the following fields to these values: + | Enrolment key | moodle_rules | + And I press "Enrol me" + And I am on the "Course 1" course page logged in as teacher1 + And I navigate to course participants + And the following should exist in the "participants" table: + | First name | Email address | Roles | Groups | + | Student 1 | student1@example.com | Student | Group 1 | + | Student 2 | student2@example.com | Student | No groups | @javascript Scenario: Edit a self-enrolled user's enrolment from the course participants page