Proyectos de Subversion Moodle

Rev

| Ultima modificación | Ver Log |

Rev Autor Línea Nro. Línea
1 efrain 1
@core @core_course @core_customfield @javascript
2
Feature: The visibility of fields control where they are displayed
3
  In order to display custom fields on course listing
4
  As a manager
5
  I can change the visibility of the fields
6
 
7
  Background:
8
    Given the following "custom field categories" exist:
9
      | name              | component   | area   | itemid |
10
      | Category for test | core_course | course | 0      |
11
    Given the following "users" exist:
12
      | username | firstname | lastname | email                |
13
      | teacher1 | Teacher   | 1        | teacher1@example.com |
14
      | student1 | Student   | 1        | student@example.com  |
15
    And the following "courses" exist:
16
      | fullname | shortname | format |
17
      | Course 1 | C1        | topics |
18
    And the following "course enrolments" exist:
19
      | user     | course | role           |
20
      | teacher1 | C1     | editingteacher |
21
 
22
  Scenario: Display course custom fields on homepage
23
    When I log in as "admin"
24
    And I navigate to "Courses > Default settings > Course custom fields" in site administration
25
    And I click on "Add a new custom field" "link"
26
    And I click on "Short text" "link"
27
    And I set the following fields to these values:
28
      | Name       | Test field |
29
      | Short name | testfield  |
30
      | Visible to | Everyone   |
31
    And I click on "Save changes" "button" in the "Adding a new Short text" "dialogue"
32
    And I log out
33
    Then I log in as "teacher1"
34
    And I am on "Course 1" course homepage
35
    And I navigate to "Settings" in current page administration
36
    And I set the following fields to these values:
37
      | Test field | testcontent |
38
    And I press "Save and display"
39
    And I am on site homepage
40
    Then I should see "Test field: testcontent"
41
 
42
  Scenario: Do not display course custom fields on homepage
43
    When I log in as "admin"
44
    And I navigate to "Courses > Default settings > Course custom fields" in site administration
45
    And I click on "Add a new custom field" "link"
46
    And I click on "Short text" "link"
47
    And I set the following fields to these values:
48
      | Name       | Test field  |
49
      | Short name | testfield   |
50
      | Visible to | Nobody      |
51
    And I click on "Save changes" "button" in the "Adding a new Short text" "dialogue"
52
    And I log out
53
    When I log in as "teacher1"
54
    And I am on "Course 1" course homepage
55
    And I navigate to "Settings" in current page administration
56
    And I set the following fields to these values:
57
      | Test field | testcontent |
58
    And I press "Save and display"
59
    And I am on site homepage
60
    And I should not see "Test field: testcontent"
61
 
62
  Scenario: Display course custom fields on homepage only to course editors
63
    When I log in as "admin"
64
    And I navigate to "Courses > Default settings > Course custom fields" in site administration
65
    And I click on "Add a new custom field" "link"
66
    And I click on "Short text" "link"
67
    And I set the following fields to these values:
68
      | Name       | Test field     |
69
      | Short name | testfield      |
70
      | Visible to | Teachers       |
71
    And I click on "Save changes" "button" in the "Adding a new Short text" "dialogue"
72
    And I log out
73
    When I log in as "teacher1"
74
    And I am on "Course 1" course homepage
75
    And I navigate to "Settings" in current page administration
76
    And I set the following fields to these values:
77
      | Test field | testcontent |
78
    And I press "Save and display"
79
    When I am on site homepage
80
    And I should see "Test field: testcontent"
81
    And I log out
82
    When I log in as "student"
83
    When I am on site homepage
84
    And I should not see "Test field: testcontent"