Proyectos de Subversion Moodle

Rev

| Ultima modificación | Ver Log |

Rev Autor Línea Nro. Línea
1 efrain 1
@core_reportbuilder @javascript
2
Feature: Manage card view settings in the report editor
3
  In order to manage a report card view settings
4
  As an admin
5
  I need to be able to edit and save the form
6
 
7
  Background:
8
    Given the following "core_reportbuilder > Reports" exist:
9
      | name      | source                                   | default |
10
      | My report | core_user\reportbuilder\datasource\users | 0       |
11
    And the following "core_reportbuilder > Columns" exist:
12
      | report    | uniqueidentifier |
13
      | My report | user:fullname    |
14
      | My report | user:email       |
15
      | My report | user:city        |
16
    And the following "users" exist:
17
      | username | firstname   | lastname | email              | city     |
18
      | l.smith  | Lionel      | Smith    | lionel@example.com | Bilbao   |
19
 
20
  Scenario: Edit card view settings form
21
    When I am on the "My report" "reportbuilder > Editor" page logged in as "admin"
22
    Then I change window size to "large"
23
    And I click on "Show/hide 'Card view'" "button"
24
    # Check default values.
25
    And the following fields match these values:
26
      | Columns visible       | 1     |
27
      | First column title    | No   |
28
    And I set the following fields to these values:
29
      | Columns visible       | 3     |
30
      | First column title    | Yes   |
31
    And I press "Save changes"
32
    And I should see "Card view settings saved"
33
    # Let's check that after switching to preview mode card view form gets rendered again.
34
    And I click on "Switch to preview mode" "button"
35
    And I click on "Switch to edit mode" "button"
36
    And I click on "Show/hide 'Card view'" "button"
37
    And the following fields match these values:
38
      | Columns visible       | 3     |
39
      | First column title    | Yes   |
40
    And I click on "Delete column 'Full name'" "button"
41
    And I click on "Delete" "button" in the "Delete column 'Full name'" "dialogue"
42
    # Check that 'Columns visible' select updates taking into account report maximum columns.
43
    And the field "visiblecolumns" matches value "2"
44
    And the "visiblecolumns" select box should not contain "3"
45
 
46
  Scenario: Show Card view
47
    When I am on the "My report" "reportbuilder > Editor" page logged in as "admin"
48
    And I change window size to "large"
49
    And I press "Switch to preview mode"
50
    And I change window size to "530x812"
51
    # Card view should just show user fullname while collapsed with default settings.
52
    And I should see "Lionel Smith" in the "reportbuilder-table" "table"
53
    And I should not see "lionel@example.com" in the "reportbuilder-table" "table"
54
    And I should not see "Bilbao" in the "reportbuilder-table" "table"
55
    And I click on "Show/hide 'Lionel Smith'" "button" in the "reportbuilder-table" "table"
56
    And I should see "Lionel Smith" in the "reportbuilder-table" "table"
57
    And I should see "lionel@example.com" in the "reportbuilder-table" "table"
58
    And I should see "Bilbao" in the "reportbuilder-table" "table"
59
    # Card view do not show first column title with default settings.
60
    And "[data-cardtitle=\"Full name\"]" "css_element" should not exist in the "reportbuilder-table" "table"
61
    And "[data-cardtitle=\"Email address\"]" "css_element" should exist in the "reportbuilder-table" "table"
62
    And "[data-cardtitle=\"City/town\"]" "css_element" should exist in the "reportbuilder-table" "table"
63
    # Change 'Columns visible' to 3 and 'First column title' to yes.
64
    And I change window size to "large"
65
    And I press "Switch to edit mode"
66
    And I click on "Show/hide 'Card view'" "button"
67
    And I set the following fields to these values:
68
      | Columns visible       | 3     |
69
      | First column title    | Yes   |
70
    And I press "Save changes"
71
    # Check now all the columns are shown in the card and there is no toggle button.
72
    And I press "Switch to preview mode"
73
    And I change window size to "530x812"
74
    And I should see "Lionel Smith" in the "reportbuilder-table" "table"
75
    And I should see "lionel@example.com" in the "reportbuilder-table" "table"
76
    And I should see "Bilbao" in the "reportbuilder-table" "table"
77
    And "[data-cardtitle=\"Full name\"]" "css_element" should exist in the "reportbuilder-table" "table"
78
    And "[data-cardtitle=\"Email address\"]" "css_element" should exist in the "reportbuilder-table" "table"
79
    And "[data-cardtitle=\"City/town\"]" "css_element" should exist in the "reportbuilder-table" "table"
80
    And "Show/hide 'Lionel Smith'" "button" should not exist
81
 
82
  Scenario Outline: Toggle card view according to content of first column
83
    Given the following "core_reportbuilder > Reports" exist:
84
      | name       | source                                   | default |
85
      | New report | core_user\reportbuilder\datasource\users | 0       |
86
    And the following "core_reportbuilder > Columns" exist:
87
      | report     | uniqueidentifier |
88
      | New report | <firstcolumn>    |
89
      | New report | user:email       |
90
    And the following "core_reportbuilder > Conditions" exist:
91
      | report     | uniqueidentifier |
92
      | New report | user:username    |
93
    When I am on the "New report" "reportbuilder > Editor" page logged in as "admin"
94
    And I click on "Show/hide 'Conditions'" "button"
95
    # Make sure we're only viewing our test user in the report.
96
    And I set the following fields in the "Username" "core_reportbuilder > Condition" to these values:
97
      | Username operator | Is equal to |
98
      | Username value    | l.smith     |
99
    And I click on "Apply" "button" in the "[data-region='settings-conditions']" "css_element"
100
    # Now use the card show/hide toggle.
101
    And I change window size to "530x812"
102
    And I press "Switch to preview mode"
103
    And I should not see "lionel@example.com" in the "reportbuilder-table" "table"
104
    And I click on "<togglebutton>" "button" in the "reportbuilder-table" "table"
105
    Then I should see "lionel@example.com" in the "reportbuilder-table" "table"
106
    Examples:
107
      | firstcolumn           | togglebutton             |
108
      | user:fullnamewithlink | Show/hide 'Lionel Smith' |
109
      | user:firstname        | Show/hide 'Lionel'       |
110
      | user:idnumber         | Show/hide card           |