Proyectos de Subversion Moodle

Rev

| Ultima modificación | Ver Log |

Rev Autor Línea Nro. Línea
1 efrain 1
@availability @availability_completion
2
Feature: availability_completion
3
  In order to control student access to activities
4
  As a teacher
5
  I need to set completion 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 "activities" exist:
20
      | activity | course | name   | completion |
21
      | page     | C1     | Page 1 | 1          |
22
      | page     | C1     | Page 2 |            |
23
      | page     | C1     | Page 3 | 1          |
24
      | page     | C1     | Page 4 |            |
25
 
26
  @javascript
27
  Scenario: Test condition
28
    # Basic setup.
29
    Given I am on the "Page 2" "page activity editing" page logged in as "teacher1"
30
    And I expand all fieldsets
31
    And I click on "Add restriction..." "button"
32
    And I click on "Activity completion" "button" in the "Add restriction..." "dialogue"
33
    And I click on ".availability-item .availability-eye img" "css_element"
34
    And I set the field "Activity or resource" to "Page 1"
35
    And I press "Save and return to course"
36
 
37
    # Log back in as student.
38
    When I am on the "Course 1" "course" page logged in as "student1"
39
 
40
    # Page 2 should not appear yet.
41
    Then I should not see "Page 2" in the "region-main" "region"
42
 
43
    # Mark page 1 complete
44
    When I toggle the manual completion state of "Page 1"
45
    Then I should see "Page 2" in the "region-main" "region"
46
 
47
  @javascript
48
  Scenario: Test completion and course cache rebuild
49
    Given the following "activities" exist:
50
      | activity | name    | course | idnumber | completion | completionview | completionpostsenabled | completionposts |
51
      | forum    | forum 1 | C1     | forum1   | 2          | 1              | 1                      | 2               |
52
    And the following "mod_forum > discussions" exist:
53
      | forum  | subject      | message          |
54
      | forum1 | Forum post 1 | This is the body |
55
    And I am on the "Page 2" "page activity editing" page logged in as "teacher1"
56
    And I expand all fieldsets
57
    And I press "Add restriction..."
58
    And I click on "Activity completion" "button" in the "Add restriction..." "dialogue"
59
    And I click on ".availability-item .availability-eye img" "css_element"
60
    And I set the following fields to these values:
61
      | Required completion status | must be marked complete |
62
      | cm                         | forum 1                 |
63
    And I press "Save and return to course"
64
    When I am on the "Course 1" "course" page logged in as "student1"
65
    # Page 2 should not appear yet.
66
    Then I should not see "Page 2" in the "region-main" "region"
67
    And I click on "forum 1" "link" in the "region-main" "region"
68
    # Page 2 should not appear yet.
69
    And I should not see "Page 2" in the "region-main" "region"
70
    And I am on the "forum 1" "forum activity editing" page logged in as "teacher1"
71
    And I expand all fieldsets
72
    And I set the following fields to these values:
73
      | completionpostsenabled | 0 |
74
    And I press "Save and display"
75
    And I am on the "Course 1" "course" page logged in as "student1"
76
    And I click on "forum 1" "link" in the "region-main" "region"
77
    And I am on "Course 1" course homepage
78
    And I should see "Page 2" in the "region-main" "region"
79
 
80
  @javascript
81
  Scenario Outline: Restrict access for activity completion should display correctly
82
    Given the following "question categories" exist:
83
      | contextlevel | reference | name           |
84
      | Course       | C1        | Test questions |
85
    And the following "questions" exist:
86
      | questioncategory | qtype     | name           | questiontext              |
87
      | Test questions   | truefalse | First question | Answer the first question |
88
    And the following "activities" exist:
89
      | activity   | name           | course | idnumber | gradepass | completion | completionpassgrade | completionusegrade |
90
      | quiz       | Test quiz name | C1     | quiz1    | 5.00      | 2          | 1                   | 1                  |
91
    And quiz "Test quiz name" contains the following questions:
92
      | question       | page |
93
      | First question | 1    |
94
    And I am on the "Page 2" "page activity editing" page logged in as "teacher1"
95
    And I expand all fieldsets
96
    And I press "Add restriction..."
97
    And I click on "Activity completion" "button" in the "Add restriction..." "dialogue"
98
    And I click on ".availability-item .availability-eye img" "css_element"
99
    And I set the following fields to these values:
100
      | Required completion status | <condition>   |
101
      | cm                         | quiz          |
102
    And I press "Save and return to course"
103
    And I am on the "Course 1" "course" page logged in as "student1"
104
    And I <shouldornot> see "Page 2" in the "region-main" "region"
105
    # Failed grade for quiz.
106
    When user "student1" has attempted "Test quiz name" with responses:
107
      | slot | response   |
108
      | 1    | <answer1>  |
109
    And I reload the page
110
    And I <shouldornotanswer1> see "Page 2" in the "region-main" "region"
111
    # Passing grade for quiz.
112
    But user "student1" has attempted "Test quiz name" with responses:
113
      | slot | response    |
114
      | 1    | <answer2>   |
115
    And I reload the page
116
    And I <shouldornotanswer2> see "Page 2" in the "region-main" "region"
117
 
118
    Examples:
119
      | condition                        | answer1 | answer2 | shouldornot | shouldornotanswer1 | shouldornotanswer2 |
120
      | must be marked complete          | False   | True    | should not  | should not         | should             |
121
      | must not be marked complete      | False   | True    | should      | should             | should not         |
122
      | must be complete with pass grade | False   | True    | should not  | should not         | should             |
123
      | must be complete with fail grade | False   | True    | should not  | should             | should not         |
124
 
125
  @javascript
126
  Scenario: Edit dependent activity name should also change the access restriction message
127
    Given I am on the "Page 2" "page activity editing" page logged in as "teacher1"
128
    And I expand all fieldsets
129
    And I click on "Add restriction..." "button"
130
    And I click on "Activity completion" "button" in the "Add restriction..." "dialogue"
131
    And I click on ".availability-item .availability-eye img" "css_element"
132
    And I set the field "Activity or resource" to "Page 1"
133
    And I press "Save and return to course"
134
    And I am on the "Page 4" "page activity editing" page
135
    And I expand all fieldsets
136
    And I click on "Add restriction..." "button"
137
    And I click on "Activity completion" "button" in the "Add restriction..." "dialogue"
138
    And I click on ".availability-item .availability-eye img" "css_element"
139
    And I set the field "Activity or resource" to "Page 3"
140
    And I press "Save and return to course"
141
    And I switch editing mode on
142
    And I set the field "Edit title" in the "Page 1" "activity" to "Page X"
143
    And I wait until the page is ready
144
    Then I should see "Not available unless: The activity Page X is marked complete" in the "Page 2" "activity"
145
    Then I should see "Not available unless: The activity Page 3 is marked complete" in the "Page 4" "activity"