1441 |
ariadna |
1 |
@mod @mod_subsection
|
|
|
2 |
Feature: Teacher can only add subsection when certain conditions are met
|
|
|
3 |
In order to limit subsections
|
|
|
4 |
As an teacher
|
|
|
5 |
I need to create subsections only when possible
|
|
|
6 |
|
|
|
7 |
Background:
|
|
|
8 |
Given the following "users" exist:
|
|
|
9 |
| username | firstname | lastname | email |
|
|
|
10 |
| teacher1 | Teacher | 1 | teacher1@example.com |
|
|
|
11 |
And the following "courses" exist:
|
|
|
12 |
| fullname | shortname | category | numsections | initsections |
|
|
|
13 |
| Course 1 | C1 | 0 | 5 | 1 |
|
|
|
14 |
And the following "course enrolments" exist:
|
|
|
15 |
| user | course | role |
|
|
|
16 |
| teacher1 | C1 | editingteacher |
|
|
|
17 |
|
|
|
18 |
@javascript
|
|
|
19 |
Scenario: We cannot add subsections when maxsections is reached
|
|
|
20 |
Given the following config values are set as admin:
|
|
|
21 |
| maxsections | 10 | moodlecourse |
|
|
|
22 |
And I log in as "teacher1"
|
|
|
23 |
And I am on "Course 1" course homepage with editing mode on
|
|
|
24 |
And I click on "Add content" "button" in the "Section 1" "section"
|
|
|
25 |
And I click on "Subsection" "link" in the ".dropdown-menu.show" "css_element"
|
|
|
26 |
When the following config values are set as admin:
|
|
|
27 |
| maxsections | 4 | moodlecourse |
|
|
|
28 |
And I am on "Course 1" course homepage
|
|
|
29 |
And I should see "You have reached the maximum number of sections allowed for a course."
|