Proyectos de Subversion Moodle

Rev

| Ultima modificación | Ver Log |

Rev Autor Línea Nro. Línea
1 efrain 1
@core @core_my
2
Feature: Run tests over my courses.
3
 
4
  Background:
5
    Given the following "users" exist:
6
      | username | firstname | lastname | email             |
7
      | user1    | User      | 1        | user1@example.com |
8
    And the following "categories" exist:
9
      | name | category | idnumber |
10
      | CatA | 0        | cata     |
11
    And the following "roles" exist:
12
      | shortname | name   | archetype |
13
      | role1     | Role 1 |           |
14
    And the following "system role assigns" exist:
15
      | user  | role  | contextlevel | reference |
16
      | user1 | role1 | Category     | CatA      |
17
 
18
  Scenario: Admin can add new courses or manage them from my courses
19
    Given I am on the "My courses" page logged in as "admin"
20
    And I click on "Course management options" "link"
21
    And I click on "New course" "link"
22
    And I wait to be redirected
23
    Then I should see "Add a new course"
24
    And I am on the "My courses" page
25
    And I click on "Course management options" "link"
26
    And I click on "Manage courses" "link"
27
    And I should see "Manage course categories and courses"
28
 
29
  Scenario: User without creating a course and managing category permissions cannot see any link
30
    Given I am on the "My courses" page logged in as "user1"
31
    Then "Course management options" "link" should not exist
32
 
33
  Scenario: User without capability to browse courses cannot see any link
34
    Given the following "permission overrides" exist:
35
      | capability                     | permission | role | contextlevel | reference |
36
      | moodle/category:viewcourselist | Prevent    | user | System       |           |
37
    Given I am on the "My courses" page logged in as "user1"
38
    Then "Course management options" "link" should not exist
39
 
40
  @javascript
41
  Scenario: User with creating a course permission can see the Create course link only
42
    Given the following "permission overrides" exist:
43
      | capability           | permission | role  | contextlevel | reference |
44
      | moodle/course:create | Allow      | role1 | Category     | cata      |
45
    When I am on the "My courses" page logged in as "user1"
46
    Then "Course management options" "link" should exist
47
    And I click on "Course management options" "link"
48
    And I should see "New course"
49
    And I should not see "Manage courses"
50
    And I click on "New course" "link"
51
    And I wait to be redirected
52
    And I should see "Add a new course"
53
    And "CatA" "autocomplete_selection" should exist
54
 
55
  @javascript
56
  Scenario: User with managing a category permission can see the Manage course link only
57
    Given the following "permission overrides" exist:
58
      | capability             | permission | role  | contextlevel | reference |
59
      | moodle/category:manage | Allow      | role1 | Category     | cata      |
60
    When I am on the "My courses" page logged in as "user1"
61
    Then "Course management options" "link" should exist
62
    And I click on "Course management options" "link"
63
    And I should not see "New course"
64
    And I should see "Manage courses"
65
    And I click on "Manage courses" "link"
66
    And I wait to be redirected
67
    And I should see "Manage course categories and courses"
68
 
69
  @javascript
70
  Scenario: User with both creating a course and managing a category permission can see both links
71
    Given the following "permission overrides" exist:
72
      | capability             | permission | role  | contextlevel | reference |
73
      | moodle/course:create   | Allow      | role1 | Category     | cata      |
74
      | moodle/category:manage | Allow      | role1 | Category     | cata      |
75
    When I am on the "My courses" page logged in as "user1"
76
    Then "Course management options" "link" should exist
77
    And I click on "Course management options" "link"
78
    And I should see "New course"
79
    And I should see "Manage courses"
80
    And I click on "New course" "link"
81
    And I wait to be redirected
82
    And I should see "Add a new course"
83
    And "CatA" "autocomplete_selection" should exist
84
    And I am on the "My courses" page
85
    And I click on "Course management options" "link"
86
    And I click on "Manage courses" "link"
87
    And I wait to be redirected
88
    And I should see "Manage course categories and courses"
89
 
90
  @javascript
91
  Scenario: Admin can see relevant blocks but not add or move them
92
    Given I log in as "admin"
93
    And I am on site homepage
94
    And I turn editing mode on
95
    And I add the "Text" block to the default region with:
96
      | Text block title | Text on all pages                  |
97
      | Content          | This is visible on all pages       |
98
    And I configure the "Text on all pages" block
99
    And I set the following fields to these values:
100
      | Page contexts    | Display throughout the entire site |
101
      | Default region   | Right                              |
102
    And I click on "Save changes" "button" in the "Configure Text on all pages block" "dialogue"
103
    And I should see "This is visible on all pages"
104
    And "Move Text on all pages block" "menuitem" should exist in the "Text on all pages" "block"
105
    When I am on the "My courses" page
106
    # Check blocks visible but are "locked" in place.
107
    Then "Course overview" "text" should exist in the "region-main" "region"
108
    And I should not see "Add a block"
109
    And I should see "This is visible on all pages"
110
    And "Move Text on all pages block" "menuitem" should not exist in the "Text on all pages" "block"
111
    And "Move Course overview block" "menuitem" should not exist in the "Course overview" "block"
112
    And I click on "Actions menu" "icon" in the "Course overview" "block"
113
    And I should not see "Delete Course overview block"
114
 
115
  @javascript
116
  Scenario: User with creating a course permission can't see the Request course link
117
    Given the following "permission overrides" exist:
118
      | capability            | permission | role  | contextlevel | reference |
119
      | moodle/course:request | Allow      | user  | System       |           |
120
    When I am on the "My courses" page logged in as "admin"
121
    And I click on "Course management options" "link"
122
    And I should see "New course"
123
    Then I should not see "Request a course"
124
 
125
  @javascript
126
  Scenario: User without creating a course but with course request permission could see the Request course link
127
    Given the following "permission overrides" exist:
128
      | capability            | permission | role  | contextlevel | reference |
129
      | moodle/course:request | Allow      | user  | System       |           |
130
    When I am on the "My courses" page logged in as "user1"
131
    And I click on "Course management options" "link"
132
    And I should not see "New course"
133
    Then I should see "Request a course"
134
    And the following config values are set as admin:
135
      | enablecourserequests | 0 |
136
    And I am on the "My courses" page logged in as "user1"
137
    And "Course management options" "link" should not exist
138
 
139
  Scenario: User without creating nor course request permission shouldn't see any Request course link
140
    Given I am on the "My courses" page logged in as "user1"
141
    Then "Course management options" "link" should not exist