Skip to content

Commit 2058623

Browse files
authored
Merge pull request #4660 from dpalou/MOBILE-4842
MOBILE-4842 behat: Fix self enrol behats due to MDL-87251
2 parents b0ba5ab + 6c0617f commit 2058623

File tree

2 files changed

+59
-10
lines changed

2 files changed

+59
-10
lines changed
Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
@core_enrol @app @enrol @enrol_self @javascript @lms_upto5.1
2+
Feature: Users can auto-enrol themself in courses where self enrolment is allowed
3+
In order to participate in courses while using the mobile app
4+
As a user
5+
I need to auto enrol me in courses
6+
7+
Background:
8+
Given the Moodle site is compatible with this feature
9+
And the following "users" exist:
10+
| username | firstname | lastname | email |
11+
| teacher1 | Teacher | 1 | teacher1@example.com |
12+
| student1 | Student | 1 | student1@example.com |
13+
| student2 | Student | 2 | student2@example.com |
14+
And the following "courses" exist:
15+
| fullname | shortname | format | initsections |
16+
| Course 1 | C1 | topics | 1 |
17+
And the following "course enrolments" exist:
18+
| user | course | role |
19+
| teacher1 | C1 | editingteacher |
20+
21+
Scenario: Self-enrolment enabled with simultaneous guest access
22+
Given I log in as "teacher1"
23+
And I am on the "Course 1" "enrolment methods" page
24+
And I add "Self enrolment" enrolment method in "Course 1" with:
25+
| Custom instance name | Self enrolment (Student with password) |
26+
| Enrolment key | moodle_rules |
27+
And I click on "Enable" "link" in the "Self enrolment (Student)" "table_row"
28+
And I click on "Edit" "link" in the "Guest access" "table_row"
29+
And I set the following fields to these values:
30+
| Allow guest access | Yes |
31+
And I press "Save changes"
32+
33+
When I entered the app as "student1"
34+
And I press "Site home" in the app
35+
And I press "Available courses" in the app
36+
And I press "Course 1" in the app
37+
Then I should find "Course summary" in the app
38+
And I should find "Course" in the app
39+
And I should find "Enrol me" in the app
40+
And I should find "View course" in the app
41+
42+
When I press "Enrol me" in the app
43+
Then I should find "Self enrolment (Student)" in the app
44+
And I should find "Self enrolment (Student with password)" in the app
45+
46+
When I press "Self enrolment (Student)" in the app
47+
Then I should find "Self enrolment (Student)" in the app
48+
Then I should not find "Self enrolment (Student with password)" in the app

src/core/features/enrol/tests/behat/self_enrol.feature

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,12 @@
1-
@core_enrol @app @enrol @enrol_self @javascript
1+
@core_enrol @app @enrol @enrol_self @javascript @lms_from5.1
22
Feature: Users can auto-enrol themself in courses where self enrolment is allowed
33
In order to participate in courses while using the mobile app
44
As a user
55
I need to auto enrol me in courses
66

77
Background:
8-
Given the following "users" exist:
8+
Given the Moodle site is compatible with this feature
9+
And the following "users" exist:
910
| username | firstname | lastname | email |
1011
| teacher1 | Teacher | 1 | teacher1@example.com |
1112
| student1 | Student | 1 | student1@example.com |
@@ -124,9 +125,9 @@ Feature: Users can auto-enrol themself in courses where self enrolment is allowe
124125
Given I log in as "teacher1"
125126
And I am on the "Course 1" "enrolment methods" page
126127
And I add "Self enrolment" enrolment method in "Course 1" with:
127-
| Custom instance name | Self enrolment (Student with password) |
128-
| Enrolment key | moodle_rules |
129-
And I click on "Enable" "link" in the "Self enrolment (Student)" "table_row"
128+
| Custom instance name | Self enrolment as 'Student' with password |
129+
| Enrolment key | moodle_rules |
130+
And I click on "Enable" "link" in the "Self enrolment as 'Student'" "table_row"
130131
And I click on "Edit" "link" in the "Guest access" "table_row"
131132
And I set the following fields to these values:
132133
| Allow guest access | Yes |
@@ -142,9 +143,9 @@ Feature: Users can auto-enrol themself in courses where self enrolment is allowe
142143
And I should find "View course" in the app
143144

144145
When I press "Enrol me" in the app
145-
Then I should find "Self enrolment (Student)" in the app
146-
And I should find "Self enrolment (Student with password)" in the app
146+
Then I should find "Self enrolment as 'Student'" in the app
147+
And I should find "Self enrolment as 'Student' with password" in the app
147148

148-
When I press "Self enrolment (Student)" in the app
149-
Then I should find "Self enrolment (Student)" in the app
150-
Then I should not find "Self enrolment (Student with password)" in the app
149+
When I press "Self enrolment as 'Student'" in the app
150+
Then I should find "Self enrolment as 'Student'" in the app
151+
Then I should not find "Self enrolment as 'Student' with password" in the app

0 commit comments

Comments
 (0)