From 4ccbf721470205a366495bf093b8c1e80f5d444f Mon Sep 17 00:00:00 2001 From: Rajesh Taneja Date: Fri, 25 Oct 2013 15:17:03 +0800 Subject: [PATCH] MDL-42536 enrol_self: Added behat to test group key self enrolment --- enrol/self/tests/behat/self_enrolment.feature | 24 +++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/enrol/self/tests/behat/self_enrolment.feature b/enrol/self/tests/behat/self_enrolment.feature index 978ce3a534b..7921ec7322d 100644 --- a/enrol/self/tests/behat/self_enrolment.feature +++ b/enrol/self/tests/behat/self_enrolment.feature @@ -51,3 +51,27 @@ Feature: Users can auto-enrol themself in courses where self enrolment is allowe Given I log in as "student1" When I follow "Course 1" Then I should see "You can not enrol yourself in this course" + + @javascript + Scenario: Self-enrolment enabled requiring a group enrolment key + Given I log in as "teacher1" + And I follow "Course 1" + When I add "Self enrolment" enrolment method with: + | Custom instance name | Test student enrolment | + | Enrolment key | moodle_rules | + | Use group enrolment keys | Yes | + And I follow "Groups" + And I press "Create group" + And I fill the moodle form with: + | Group name | Group 1 | + | Enrolment key | testgroupenrolkey | + And I press "Save changes" + And I log out + And I log in as "student1" + And I follow "Course 1" + And I fill the moodle form with: + | Enrolment key | testgroupenrolkey | + And I press "Enrol me" + Then I should see "Topic 1" + And I should not see "Enrolment options" + And I should not see "Enrol me in this course" \ No newline at end of file