Proyectos de Subversion Moodle

Rev

| Ultima modificación | Ver Log |

Rev Autor Línea Nro. Línea
1 efrain 1
@mod @mod_data @datapreset @data_preset_imagegallery
2
Feature: Users can use the Image gallery preset
3
  In order to create an Image gallery database
4
  As a user
5
  I need to apply and use the Image gallery preset
6
 
7
  Background:
8
    Given the following "users" exist:
9
      | username | firstname | lastname | email                |
10
      | student1 | Alice     | Student  | student1@example.com |
11
      | teacher1 | Pau       | Teacher  | teacher1@example.com |
12
    And the following "courses" exist:
13
      | fullname | shortname | category |
14
      | Course 1 | C1        | 0        |
15
    And the following "course enrolments" exist:
16
      | user     | course | role           |
17
      | teacher1 | C1     | editingteacher |
18
      | student1 | C1     | student        |
19
    And the following "activities" exist:
20
      | activity | name                | intro          | course | idnumber |
21
      | data     | Mountain landscapes | Database intro | C1     | data1    |
22
    And I am on the "Mountain landscapes" "data activity" page logged in as teacher1
23
    And I follow "Presets"
24
    And I click on "fullname" "radio" in the "Image gallery" "table_row"
25
    And I click on "Use this preset" "button"
26
    And the following "mod_data > entries" exist:
27
      | database | user      | title           | description                                  | image             |
28
      | data1    | student1  | First image     | This is the description text for image 1     | first.png         |
29
      | data1    | teacher1  | Second image    | And this is the description text for image 2 | second.png        |
30
 
31
  @javascript
32
  Scenario: Users view entries
33
    When I am on the "Mountain landscapes" "data activity" page logged in as student1
34
    Then I should see "First image"
35
    And I should not see "This is the description text for image 1"
36
    And I should not see "first.png"
37
    And I should not see "Alice Student" in the "#imagegallery-list" "css_element"
38
    And "//a/child::img[contains(@src, 'first.png')]" "xpath_element" should exist
39
    And "Actions" "icon" should exist in the "#imagegallery-list" "css_element"
40
    And I should see "Second image"
41
    And I should not see "And this is the description text for image 2"
42
    And I should not see "second.png"
43
    And I should not see "Pau Teacher"
44
    And "//a/child::img[contains(@src, 'second.png')]" "xpath_element" should exist
45
    # Single view.
46
    And I select "Single view" from the "jump" singleselect
47
    And I should see "First image"
48
    And I should see "Alice Student" in the ".imagegallery-single" "css_element"
49
    And I should see "This is the description text for image 1"
50
    And "//a/child::img[contains(@src, 'first.png')]" "xpath_element" should exist
51
    And "Actions" "icon" should exist in the ".imagegallery-single" "css_element"
52
    And I should not see "Second image"
53
    And I should not see "And this is the description text for image 2"
54
    And I should not see "Pau Teacher"
55
    And "//a/child::img[contains(@src, 'second.png')]" "xpath_element" should not exist
56
    And I follow "Next"
57
    And I should see "Second image"
58
    And I should see "Pau Teacher"
59
    And I should see "And this is the description text for image 2"
60
    And "//a/child::img[contains(@src, 'second.png')]" "xpath_element" should exist
61
    # This student can't edit or delete this entry, so the Actions menu shouldn't be displayed.
62
    And "Actions" "icon" should not exist in the ".imagegallery-single" "css_element"
63
    And I should not see "First image"
64
    And I should not see "Alice Student" in the ".imagegallery-single" "css_element"
65
    And I should not see "This is the description text for image 1"
66
    And "//a/child::img[contains(@src, 'first.png')]" "xpath_element" should not exist
67
 
68
  @javascript
69
  Scenario: Users can search entries
70
    Given I am on the "Mountain landscapes" "data activity" page logged in as student1
71
    And "First image" "text" should appear before "Second image" "text"
72
    When I click on "Advanced search" "checkbox"
73
    And I should see "First name"
74
    And I should see "Last name"
75
    And I set the field "title" to "First image"
76
    And I click on "Save settings" "button" in the "data_adv_form" "region"
77
    Then I should see "First image"
78
    And I should not see "Second image"
79
    But I set the field "title" to "image"
80
    And I set the field "Order" to "Descending"
81
    And I click on "Save settings" "button" in the "data_adv_form" "region"
82
    And "Second image" "text" should appear before "First image" "text"
83
 
84
  @javascript
85
  Scenario: Users can add entries
86
    Given I am on the "Mountain landscapes" "data activity" page logged in as student1
87
    When I press "Add entry"
88
    And I set the field "title" to "New image"
89
    And I set the field "description" to "This is the description for the new image."
90
    And I press "Save"
91
    Then I should see "New image"
92
    And I should see "This is the description for the new image."
93
 
94
  @javascript
95
  Scenario: Image gallery. Renaming a field should affect the template
96
    Given I am on the "Mountain landscapes" "data activity" page logged in as teacher1
97
    And I navigate to "Fields" in current page administration
98
    And I open the action menu in "title" "table_row"
99
    And I choose "Edit" in the open action menu
100
    And I set the field "Field name" to "Edited field name"
101
    And I press "Save"
102
    And I should see "Field updated"
103
    When I navigate to "Database" in current page administration
104
    Then I click on "Advanced search" "checkbox"
105
    And I should see "Edited field name"
106
    And I click on "Add entry" "button"
107
    And I should see "Edited field name"
108
 
109
  @javascript
110
  Scenario: Image gallery. Has otherfields tag
111
    Given the following "mod_data > fields" exist:
112
      | database | type | name        | description            |
113
      | data1    | text | Extra field | Test field description |
114
    And I am on the "Mountain landscapes" "data activity" page logged in as teacher1
115
    When I select "Single view" from the "jump" singleselect
116
    Then I should see "Extra field"
117
    And I click on "Add entry" "button"
118
    And I should see "Extra field"