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: Uniqueness The course custom fields can be mandatory or not
3
  In order to make users required to fill a custom field
4
  As a manager
5
  I can change the uniqueness 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
    And the following "courses" exist:
15
      | fullname | shortname | format |
16
      | Course 1 | C1        | topics |
17
      | Course 2 | C2        | topics |
18
    And the following "course enrolments" exist:
19
      | user     | course | role           |
20
      | teacher1 | C1     | editingteacher |
21
      | teacher1 | C2     | editingteacher |
22
    When I log in as "admin"
23
    And I navigate to "Courses > Default settings > Course custom fields" in site administration
24
    And I click on "Add a new custom field" "link"
25
    And I click on "Short text" "link"
26
    And I set the following fields to these values:
27
      | Name        | Test field |
28
      | Short name  | testfield  |
29
      | Unique data | Yes        |
30
    And I click on "Save changes" "button" in the "Adding a new Short text" "dialogue"
31
    And I log out
32
 
33
  Scenario: A course custom field with unique data must not allow same data in same field in different courses
34
    When I log in as "teacher1"
35
    And I am on "Course 1" course homepage
36
    And I navigate to "Settings" in current page administration
37
    And I set the following fields to these values:
38
      | Test field | testcontent |
39
    And I press "Save and display"
40
    And I am on "Course 2" course homepage
41
    And I navigate to "Settings" in current page administration
42
    And I set the following fields to these values:
43
      | Test field | testcontent |
44
    And I press "Save and display"
45
    Then I should see "This value is already used"
46
 
47
  Scenario: A course custom field with unique data must not compare with itself
48
    When I log in as "teacher1"
49
    And I am on "Course 1" course homepage
50
    And I navigate to "Settings" in current page administration
51
    And I set the following fields to these values:
52
      | Test field | testcontent |
53
    And I press "Save and display"
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
    Then I should not see "This value is already used"
60
    And I should see "New section"
61
 
62
  Scenario: A course custom field with unique data must allow empty data
63
    When I log in as "teacher1"
64
    And I am on "Course 1" course homepage
65
    And I navigate to "Settings" in current page administration
66
    And I set the following fields to these values:
67
      | Test field |  |
68
    And I press "Save and display"
69
    And I am on "Course 2" course homepage
70
    And I navigate to "Settings" in current page administration
71
    And I set the following fields to these values:
72
      | Test field |  |
73
    And I press "Save and display"
74
    Then I should not see "This value is already used"