Proyectos de Subversion Moodle

Rev

| Ultima modificación | Ver Log |

Rev Autor Línea Nro. Línea
1 efrain 1
@core @core_quiz @core_customfield @qbank_customfields @javascript
2
Feature: The visibility of question custom fields control where they are displayed
3
  In order to display custom fields in a quiz
4
 
5
  Background:
6
    Given the following "users" exist:
7
      | username | firstname | lastname | email                |
8
      | teacher1 | Terry1    | Teacher1 | teacher1@example.com |
9
    And the following "courses" exist:
10
      | fullname | shortname | format |
11
      | Course 1 | C1        | weeks  |
12
    And the following "course enrolments" exist:
13
      | user     | course | role           |
14
      | teacher1 | C1     | editingteacher |
15
    And the following "custom field categories" exist:
16
      | name              | component          | area     | itemid |
17
      | Category for test | qbank_customfields | question | 0      |
18
    And the following "custom fields" exist:
19
      | name    | category          | type | shortname | configdata                                    |
20
      | Field 1 | Category for test | text | f1        | {"visibility":"2"}                            |
21
      | Field 2 | Category for test | text | f2        | {"visibility":"2"}                            |
22
      | Field 3 | Category for test | text | f3        | {"visibility":"2","defaultvalue":"secret"}    |
23
    And the following "activity" exists:
24
      | activity | quiz                  |
25
      | course   | C1                    |
26
      | idnumber | 00001                 |
27
      | name     | Test quiz name        |
28
      | intro    | Test quiz description |
29
      | section  | 1                     |
30
      | grade    | 10                    |
31
    When I log in as "teacher1"
32
    And I am on "Course 1" course homepage with editing mode on
33
    And I add a "True/False" question to the "Test quiz name" quiz with:
34
      | Question name                      | First question                          |
35
      | Question text                      | Answer the first question               |
36
      | General feedback                   | Thank you, this is the general feedback |
37
      | Correct answer                     | False                                   |
38
      | Feedback for the response 'True'.  | So you think it is true                 |
39
      | Feedback for the response 'False'. | So you think it is false                |
40
 
41
  @javascript
42
  Scenario: Display custom question fields to teachers based on their visibility.
43
    When I am on the "First question" "core_question > edit" page
44
    Then I should see "Category for test"
45
    And I expand all fieldsets
46
    And I should see "Field 1"
47
    And I should see "Field 2"
48
    And I should see "Field 3"
49
    And I set the following fields to these values:
50
      | Field 1 | custom field text one|
51
      | Field 2 | custom field text two|
52
    And I press "id_submitbutton"
53
    And I should see "Field 1"
54
    And I should see "custom field text one"
55
    And I should see "Field 2"
56
    And I should see "custom field text two"
57
    And I should see "Field 3"
58
    And I should see "secret"
59
    And I choose "Preview" action for "First question" in the question bank
60
    And I should see "Field 1"
61
    And I should see "custom field text one"
62
    And I should see "Field 2"
63
    And I should see "custom field text two"
64
    And I should see "Field 3"
65
    And I should see "secret"