1 |
efrain |
1 |
@core @core_course
|
|
|
2 |
Feature: Activity navigation involving activities with access restrictions
|
|
|
3 |
In order to quickly switch to another activity that has access restrictions
|
|
|
4 |
As a student
|
|
|
5 |
I need to be able to use the activity navigation feature to access the activity after satisfying its access conditions
|
|
|
6 |
|
|
|
7 |
Background:
|
|
|
8 |
Given the following "users" exist:
|
|
|
9 |
| username | firstname | lastname | email |
|
|
|
10 |
| teacher1 | Teacher | 1 | teacher1@example.com |
|
|
|
11 |
| student1 | Student | 1 | student1@example.com |
|
|
|
12 |
And the following "courses" exist:
|
|
|
13 |
| fullname | shortname | format | enablecompletion |
|
|
|
14 |
| Course 1 | C1 | topics | 1 |
|
|
|
15 |
And the following "course enrolments" exist:
|
|
|
16 |
| user | course | role |
|
|
|
17 |
| student1 | C1 | student |
|
|
|
18 |
| teacher1 | C1 | editingteacher |
|
|
|
19 |
And the following "activities" exist:
|
|
|
20 |
| activity | name | intro | course | idnumber | section |
|
|
|
21 |
| page | Page 1 | Test page description 1 | C1 | page1 | 0 |
|
|
|
22 |
| page | Page 2 | Test page description 2 | C1 | page2 | 0 |
|
|
|
23 |
| page | Page 3 | Test page description 3 | C1 | page3 | 0 |
|
|
|
24 |
| page | Page 4 | Test page description 4 | C1 | page4 | 0 |
|
|
|
25 |
And I log in as "teacher1"
|
|
|
26 |
And I am on "Course 1" course homepage with editing mode on
|
|
|
27 |
# Set completion for Page 2.
|
|
|
28 |
And I open "Page 2" actions menu
|
|
|
29 |
And I click on "Edit settings" "link" in the "Page 2" activity
|
|
|
30 |
And I expand all fieldsets
|
|
|
31 |
And I set the field "Add requirements" to "1"
|
|
|
32 |
And I set the following fields to these values:
|
|
|
33 |
| Add requirements | 1 |
|
|
|
34 |
| View the activity | 1 |
|
|
|
35 |
And I press "Save and return to course"
|
|
|
36 |
# Require Page 2 to be completed first before Page 3 can be accessed.
|
|
|
37 |
And I open "Page 3" actions menu
|
|
|
38 |
And I click on "Edit settings" "link" in the "Page 3" activity
|
|
|
39 |
And I expand all fieldsets
|
|
|
40 |
And I click on "Add restriction..." "button"
|
|
|
41 |
And I click on "Activity completion" "button" in the "Add restriction..." "dialogue"
|
|
|
42 |
And I set the field "Activity or resource" to "Page 2"
|
|
|
43 |
And I press "Save and return to course"
|
|
|
44 |
And I log out
|
|
|
45 |
|
|
|
46 |
@javascript
|
|
|
47 |
Scenario: Activity navigation involving activities with access restrictions
|
|
|
48 |
Given I am on the "Page 1" "page activity" page logged in as student1
|
|
|
49 |
Then I should see "Page 2" in the "#next-activity-link" "css_element"
|
|
|
50 |
# Activity that has access restriction should not show up in the dropdown.
|
|
|
51 |
And the "Jump to..." select box should not contain "Page 3"
|
|
|
52 |
And I select "Page 4" from the "Jump to..." singleselect
|
|
|
53 |
# Page 2 should be shown in the previous link since Page 3 is not yet available.
|
|
|
54 |
And I should see "Page 2" in the "#prev-activity-link" "css_element"
|
|
|
55 |
And the "Jump to..." select box should not contain "Page 3"
|
|
|
56 |
# Navigate to Page 2.
|
|
|
57 |
And I click on "Page 2" "link" in the "page-content" "region"
|
|
|
58 |
# Since Page 2 has now been viewed and deemed completed, Page 3 can now be accessed.
|
|
|
59 |
And I should see "Page 3" in the "#next-activity-link" "css_element"
|
|
|
60 |
And the "Jump to..." select box should contain "Page 3"
|