1 |
efrain |
1 |
@mod @mod_subcourse
|
|
|
2 |
Feature: Clicking the subcourse instance in the course outline may or may not redirect to the referenced course
|
|
|
3 |
In order to visit the referenced course
|
|
|
4 |
As a user
|
|
|
5 |
I need to visit the subcourse activity and either click a link or there is no need to do so
|
|
|
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 | category |
|
|
|
14 |
| MainCourse | M | 0 |
|
|
|
15 |
| RefCourse | R | 0 |
|
|
|
16 |
And the following "course enrolments" exist:
|
|
|
17 |
| user | course | role |
|
|
|
18 |
| teacher1 | M | editingteacher |
|
|
|
19 |
| student1 | M | student |
|
|
|
20 |
| teacher1 | R | editingteacher |
|
|
|
21 |
| student1 | R | student |
|
|
|
22 |
And I log in as "teacher1"
|
|
|
23 |
And I am on "MainCourse" course homepage
|
|
|
24 |
And I turn editing mode on
|
|
|
25 |
|
|
|
26 |
@javascript
|
|
|
27 |
Scenario: Student has to click the link to the referenced course manually
|
|
|
28 |
And I add a "Subcourse" to section "1" and I fill the form with:
|
|
|
29 |
| Subcourse name | Unit course 1 |
|
|
|
30 |
| Fetch grades from | RefCourse (R) |
|
|
|
31 |
| Redirect to the referenced course | 0 |
|
|
|
32 |
And I log out
|
|
|
33 |
When I log in as "student1"
|
|
|
34 |
And I am on "MainCourse" course homepage
|
|
|
35 |
And I follow "Unit course 1"
|
|
|
36 |
Then I should see "Go to RefCourse"
|
|
|
37 |
And I follow "RefCourse"
|
|
|
38 |
And I should see "RefCourse" in the "page-header" "region"
|
|
|
39 |
|
|
|
40 |
@javascript
|
|
|
41 |
Scenario: Student is instantly redirected to the referenced course
|
|
|
42 |
And I add a "Subcourse" to section "1" and I fill the form with:
|
|
|
43 |
| Subcourse name | Unit course 1 |
|
|
|
44 |
| Fetch grades from | RefCourse (R) |
|
|
|
45 |
| Redirect to the referenced course | 1 |
|
|
|
46 |
And I log out
|
|
|
47 |
When I log in as "student1"
|
|
|
48 |
And I am on "MainCourse" course homepage
|
|
|
49 |
And I follow "Unit course 1"
|
|
|
50 |
Then I should see "RefCourse" in the "page-header" "region"
|
|
|
51 |
|
|
|
52 |
@javascript
|
|
|
53 |
Scenario: Teacher is not redirected instantly even if that is enabled
|
|
|
54 |
And I add a "Subcourse" to section "1" and I fill the form with:
|
|
|
55 |
| Subcourse name | Unit course 1 |
|
|
|
56 |
| Fetch grades from | RefCourse (R) |
|
|
|
57 |
| Redirect to the referenced course | 1 |
|
|
|
58 |
And I am on the "Unit course 1" "subcourse activity" page logged in as teacher1
|
|
|
59 |
Then I should see "Go to RefCourse"
|
|
|
60 |
And I follow "RefCourse"
|
|
|
61 |
And I should see "RefCourse" in the "page-header" "region"
|
|
|
62 |
|
|
|
63 |
@javascript
|
|
|
64 |
Scenario: Teacher is redirected instantly if unable to fetch grades manually
|
|
|
65 |
And I add a "Subcourse" to section "1" and I fill the form with:
|
|
|
66 |
| Subcourse name | Unit course 1 |
|
|
|
67 |
| Fetch grades from | RefCourse (R) |
|
|
|
68 |
| Redirect to the referenced course | 1 |
|
|
|
69 |
| ID number | subcourse1 |
|
|
|
70 |
And the following "permission overrides" exist:
|
|
|
71 |
| capability | permission | role | contextlevel | reference |
|
|
|
72 |
| mod/subcourse:fetchgrades | Prevent | teacher | Activity module | subcourse1 |
|
|
|
73 |
| mod/subcourse:fetchgrades | Prevent | editingteacher | Activity module | subcourse1 |
|
|
|
74 |
And I am on "MainCourse" course homepage
|
|
|
75 |
And I am on the "Unit course 1" "subcourse activity" page logged in as teacher1
|
|
|
76 |
And I am on "RefCourse" course homepage
|
|
|
77 |
Then I should see "RefCourse" in the "page-header" "region"
|