source: moodle/trunk/fuentes/availability/condition/grouping/tests/behat/availability_grouping.feature @ 1331

Last change on this file since 1331 was 1331, checked in by jrpelegrina, 3 years ago

Updated to moodle 3.0.3

File size: 3.6 KB
Line 
1@availability @availability_grouping
2Feature: availability_grouping
3  In order to control student access to activities
4  As a teacher
5  I need to set grouping conditions which prevent student access
6
7  Background:
8    Given the following "courses" exist:
9      | fullname | shortname | format | enablecompletion |
10      | Course 1 | C1        | topics | 1                |
11    And the following "users" exist:
12      | username |
13      | teacher1 |
14      | student1 |
15    And the following "course enrolments" exist:
16      | user     | course | role           |
17      | teacher1 | C1     | editingteacher |
18      | student1 | C1     | student        |
19    And the following "groups" exist:
20      | name | course | idnumber |
21      | G1   | C1     | GI1      |
22    And the following "group members" exist:
23      | user     | group |
24      | student1 | GI1   |
25    And the following config values are set as admin:
26      | enableavailability  | 1 |
27
28  @javascript
29  Scenario: Test condition
30    # Basic setup.
31    Given I log in as "teacher1"
32    And I am on site homepage
33    And I follow "Course 1"
34    And I turn editing mode on
35
36    # Start to add a Page. If there aren't any groupings, there's no Grouping option.
37    And I add a "Page" to section "1"
38    And I expand all fieldsets
39    And I click on "Add restriction..." "button"
40    Then "Grouping" "button" should not exist in the "Add restriction..." "dialogue"
41    And I click on "Cancel" "button" in the "Add restriction..." "dialogue"
42
43    # Back to course page but add groups.
44    # This step used to be 'And I follow "C1"', but Chrome thinks the breadcrumb
45    # is not clickable, so we'll go via the home page instead.
46    And I am on site homepage
47    And I follow "Course 1"
48    And the following "groupings" exist:
49      | name | course | idnumber |
50      | GX1  | C1     | GXI1     |
51      | GX2  | C1     | GXI2     |
52    And I add a "Page" to section "1"
53    And I expand all fieldsets
54    And I click on "Add restriction..." "button"
55    Then "Grouping" "button" should exist in the "Add restriction..." "dialogue"
56
57    # Page P1 grouping GX1.
58    Given I click on "Grouping" "button"
59    And I set the field "Grouping" to "GX1"
60    And I click on ".availability-item .availability-eye img" "css_element"
61    And I set the following fields to these values:
62      | Name         | P1 |
63      | Description  | x  |
64      | Page content | x  |
65    And I click on "Save and return to course" "button"
66
67    # Page P2 with grouping GX2.
68    And I add a "Page" to section "2"
69    And I set the following fields to these values:
70      | Name         | P2 |
71      | Description  | x  |
72      | Page content | x  |
73    And I expand all fieldsets
74    And I click on "Add restriction..." "button"
75    And I click on "Grouping" "button"
76    And I set the field "Grouping" to "GX2"
77    And I click on ".availability-item .availability-eye img" "css_element"
78    And I click on "Save and return to course" "button"
79
80    # Log back in as student.
81    When I log out
82    And I log in as "student1"
83    And I follow "Course 1"
84
85    # No pages should appear yet.
86    Then I should not see "P1" in the "region-main" "region"
87    And I should not see "P2" in the "region-main" "region"
88
89    # Add group to grouping and log out/in again.
90    And I log out
91    And the following "grouping groups" exist:
92      | grouping | group  |
93      | GXI1     | GI1    |
94    And I log in as "student1"
95    And I am on site homepage
96    And I follow "Course 1"
97
98    # P1 should show but not B2.
99    Then I should see "P1" in the "region-main" "region"
100    And I should not see "P2" in the "region-main" "region"
Note: See TracBrowser for help on using the repository browser.